This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate:
[perl5.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 Fri Mar  9 20:00:14 CET 2007 [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_signbit=''
704 d_sigprocmask=''
705 d_sigsetjmp=''
706 usesitecustomize=''
707 d_snprintf=''
708 d_vsnprintf=''
709 d_sockatmark=''
710 d_sockatmarkproto=''
711 d_msg_ctrunc=''
712 d_msg_dontroute=''
713 d_msg_oob=''
714 d_msg_peek=''
715 d_msg_proxy=''
716 d_oldsock=''
717 d_scm_rights=''
718 d_socket=''
719 d_sockpair=''
720 sockethdr=''
721 socketlib=''
722 d_socklen_t=''
723 d_socks5_init=''
724 d_sprintf_returns_strlen=''
725 d_sqrtl=''
726 d_srand48_r=''
727 srand48_r_proto=''
728 d_srandom_r=''
729 srandom_r_proto=''
730 d_sresgproto=''
731 d_sresuproto=''
732 d_statblks=''
733 d_statfs_f_flags=''
734 d_statfs_s=''
735 d_fstatvfs=''
736 d_statvfs=''
737 d_stdio_cnt_lval=''
738 d_stdio_ptr_lval=''
739 d_stdio_ptr_lval_nochange_cnt=''
740 d_stdio_ptr_lval_sets_cnt=''
741 d_stdiobase=''
742 d_stdstdio=''
743 stdio_base=''
744 stdio_bufsiz=''
745 stdio_cnt=''
746 stdio_filbuf=''
747 stdio_ptr=''
748 d_index=''
749 d_strchr=''
750 d_strcoll=''
751 d_strctcpy=''
752 d_strerrm=''
753 d_strerror=''
754 d_sysernlst=''
755 d_syserrlst=''
756 d_strerror_r=''
757 strerror_r_proto=''
758 d_strftime=''
759 d_strlcat=''
760 d_strlcpy=''
761 d_strtod=''
762 d_strtol=''
763 d_strtold=''
764 d_strtoll=''
765 d_strtoq=''
766 d_strtoul=''
767 d_strtoull=''
768 d_strtouq=''
769 d_strxfrm=''
770 d_symlink=''
771 d_syscall=''
772 d_syscallproto=''
773 d_sysconf=''
774 d_system=''
775 d_tcgetpgrp=''
776 d_tcsetpgrp=''
777 d_telldirproto=''
778 d_time=''
779 timetype=''
780 clocktype=''
781 d_times=''
782 d_tmpnam_r=''
783 tmpnam_r_proto=''
784 d_truncate=''
785 d_ttyname_r=''
786 ttyname_r_proto=''
787 d_tzname=''
788 d_u32align=''
789 d_ualarm=''
790 d_umask=''
791 d_semctl_semid_ds=''
792 d_semctl_semun=''
793 d_union_semun=''
794 d_unordered=''
795 d_unsetenv=''
796 d_usleep=''
797 d_usleepproto=''
798 d_ustat=''
799 d_pseudofork=''
800 d_vfork=''
801 usevfork=''
802 d_voidsig=''
803 signal_t=''
804 d_volatile=''
805 d_charvspr=''
806 d_vprintf=''
807 d_wait4=''
808 d_waitpid=''
809 d_wcstombs=''
810 d_wctomb=''
811 d_writev=''
812 dlext=''
813 cccdlflags=''
814 ccdlflags=''
815 dlsrc=''
816 ld=''
817 lddlflags=''
818 usedl=''
819 doublesize=''
820 ebcdic=''
821 fflushNULL=''
822 fflushall=''
823 fpossize=''
824 fpostype=''
825 gccansipedantic=''
826 gccosandvers=''
827 gccversion=''
828 gidformat=''
829 gidsign=''
830 gidsize=''
831 gidtype=''
832 groupstype=''
833 h_fcntl=''
834 h_sysfile=''
835 html1dir=''
836 html1direxp=''
837 installhtml1dir=''
838 html3dir=''
839 html3direxp=''
840 installhtml3dir=''
841 i_arpainet=''
842 i_crypt=''
843 db_hashtype=''
844 db_prefixtype=''
845 db_version_major=''
846 db_version_minor=''
847 db_version_patch=''
848 i_db=''
849 i_dbm=''
850 i_rpcsvcdbm=''
851 d_dirnamlen=''
852 direntrytype=''
853 i_dirent=''
854 i_dld=''
855 i_dlfcn=''
856 i_fcntl=''
857 i_float=''
858 i_fp=''
859 i_fp_class=''
860 i_gdbm=''
861 d_grpasswd=''
862 i_grp=''
863 i_ieeefp=''
864 i_inttypes=''
865 i_langinfo=''
866 i_libutil=''
867 i_limits=''
868 i_locale=''
869 i_machcthr=''
870 i_malloc=''
871 i_math=''
872 i_memory=''
873 i_mntent=''
874 i_ndbm=''
875 i_netdb=''
876 i_neterrno=''
877 i_netinettcp=''
878 i_niin=''
879 i_sysin=''
880 i_poll=''
881 i_prot=''
882 i_pthread=''
883 d_pwage=''
884 d_pwchange=''
885 d_pwclass=''
886 d_pwcomment=''
887 d_pwexpire=''
888 d_pwgecos=''
889 d_pwpasswd=''
890 d_pwquota=''
891 i_pwd=''
892 i_sfio=''
893 i_shadow=''
894 i_socks=''
895 i_stddef=''
896 i_stdlib=''
897 i_string=''
898 strings=''
899 i_sunmath=''
900 i_sysaccess=''
901 i_sysdir=''
902 i_sysfile=''
903 d_voidtty=''
904 i_bsdioctl=''
905 i_sysfilio=''
906 i_sysioctl=''
907 i_syssockio=''
908 i_syslog=''
909 i_sysmman=''
910 i_sysmode=''
911 i_sysmount=''
912 i_sysndir=''
913 i_sysparam=''
914 i_sysresrc=''
915 i_syssecrt=''
916 i_sysselct=''
917 i_sysstat=''
918 i_sysstatfs=''
919 i_sysstatvfs=''
920 i_systimes=''
921 i_systypes=''
922 i_sysuio=''
923 i_sysun=''
924 i_sysutsname=''
925 i_sysvfs=''
926 i_syswait=''
927 i_sgtty=''
928 i_termio=''
929 i_termios=''
930 d_tm_tm_gmtoff=''
931 d_tm_tm_zone=''
932 i_systime=''
933 i_systimek=''
934 i_time=''
935 timeincl=''
936 i_unistd=''
937 i_ustat=''
938 i_utime=''
939 i_values=''
940 i_stdarg=''
941 i_varargs=''
942 i_varhdr=''
943 i_vfork=''
944 d_inc_version_list=''
945 inc_version_list=''
946 inc_version_list_init=''
947 installprefix=''
948 installprefixexp=''
949 installstyle=''
950 installusrbinperl=''
951 intsize=''
952 longsize=''
953 shortsize=''
954 issymlink=''
955 libc=''
956 ldlibpthname=''
957 libperl=''
958 shrpenv=''
959 useshrplib=''
960 glibpth=''
961 libpth=''
962 loclibpth=''
963 plibpth=''
964 xlibpth=''
965 ignore_versioned_solibs=''
966 libs=''
967 libsdirs=''
968 libsfiles=''
969 libsfound=''
970 libspath=''
971 lns=''
972 d_PRIEUldbl=''
973 d_PRIFUldbl=''
974 d_PRIGUldbl=''
975 d_PRIeldbl=''
976 d_PRIfldbl=''
977 d_PRIgldbl=''
978 d_SCNfldbl=''
979 sPRIEUldbl=''
980 sPRIFUldbl=''
981 sPRIGUldbl=''
982 sPRIeldbl=''
983 sPRIfldbl=''
984 sPRIgldbl=''
985 sSCNfldbl=''
986 lseeksize=''
987 lseektype=''
988 mad=''
989 madlyh=''
990 madlyobj=''
991 madlysrc=''
992 make_set_make=''
993 d_mymalloc=''
994 freetype=''
995 mallocobj=''
996 mallocsrc=''
997 malloctype=''
998 usemallocwrap=''
999 usemymalloc=''
1000 installman1dir=''
1001 man1dir=''
1002 man1direxp=''
1003 man1ext=''
1004 installman3dir=''
1005 man3dir=''
1006 man3direxp=''
1007 man3ext=''
1008 modetype=''
1009 multiarch=''
1010 mydomain=''
1011 myhostname=''
1012 phostname=''
1013 c=''
1014 n=''
1015 d_eofnblk=''
1016 eagain=''
1017 o_nonblock=''
1018 rd_nodata=''
1019 need_va_copy=''
1020 netdb_hlen_type=''
1021 netdb_host_type=''
1022 netdb_name_type=''
1023 netdb_net_type=''
1024 groupcat=''
1025 hostcat=''
1026 passcat=''
1027 orderlib=''
1028 ranlib=''
1029 d_perl_otherlibdirs=''
1030 otherlibdirs=''
1031 package=''
1032 spackage=''
1033 pager=''
1034 api_revision=''
1035 api_subversion=''
1036 api_version=''
1037 api_versionstring=''
1038 patchlevel=''
1039 perl_patchlevel=''
1040 revision=''
1041 subversion=''
1042 version=''
1043 version_patchlevel_string=''
1044 perl5=''
1045 perladmin=''
1046 perlpath=''
1047 d_nv_preserves_uv=''
1048 d_nv_zero_is_allbits_zero=''
1049 i16size=''
1050 i16type=''
1051 i32size=''
1052 i32type=''
1053 i64size=''
1054 i64type=''
1055 i8size=''
1056 i8type=''
1057 ivsize=''
1058 ivtype=''
1059 nv_preserves_uv_bits=''
1060 nvsize=''
1061 nvtype=''
1062 u16size=''
1063 u16type=''
1064 u32size=''
1065 u32type=''
1066 u64size=''
1067 u64type=''
1068 u8size=''
1069 u8type=''
1070 uvsize=''
1071 uvtype=''
1072 ivdformat=''
1073 nvEUformat=''
1074 nvFUformat=''
1075 nvGUformat=''
1076 nveformat=''
1077 nvfformat=''
1078 nvgformat=''
1079 uvXUformat=''
1080 uvoformat=''
1081 uvuformat=''
1082 uvxformat=''
1083 pidtype=''
1084 prefix=''
1085 prefixexp=''
1086 installprivlib=''
1087 privlib=''
1088 privlibexp=''
1089 prototype=''
1090 ptrsize=''
1091 d_PRIXU64=''
1092 d_PRId64=''
1093 d_PRIi64=''
1094 d_PRIo64=''
1095 d_PRIu64=''
1096 d_PRIx64=''
1097 sPRIXU64=''
1098 sPRId64=''
1099 sPRIi64=''
1100 sPRIo64=''
1101 sPRIu64=''
1102 sPRIx64=''
1103 d_quad=''
1104 quadkind=''
1105 quadtype=''
1106 uquadtype=''
1107 drand01=''
1108 randbits=''
1109 randfunc=''
1110 randseedtype=''
1111 seedfunc=''
1112 installscript=''
1113 scriptdir=''
1114 scriptdirexp=''
1115 selectminbits=''
1116 selecttype=''
1117 sh=''
1118 sig_count=''
1119 sig_name=''
1120 sig_name_init=''
1121 sig_num=''
1122 sig_num_init=''
1123 sig_size=''
1124 d_sitearch=''
1125 installsitearch=''
1126 sitearch=''
1127 sitearchexp=''
1128 installsitebin=''
1129 sitebin=''
1130 sitebinexp=''
1131 installsitehtml1dir=''
1132 sitehtml1dir=''
1133 sitehtml1direxp=''
1134 installsitehtml3dir=''
1135 sitehtml3dir=''
1136 sitehtml3direxp=''
1137 installsitelib=''
1138 sitelib=''
1139 sitelib_stem=''
1140 sitelibexp=''
1141 installsiteman1dir=''
1142 siteman1dir=''
1143 siteman1direxp=''
1144 installsiteman3dir=''
1145 siteman3dir=''
1146 siteman3direxp=''
1147 siteprefix=''
1148 siteprefixexp=''
1149 installsitescript=''
1150 sitescript=''
1151 sitescriptexp=''
1152 sizesize=''
1153 sizetype=''
1154 so=''
1155 socksizetype=''
1156 sharpbang=''
1157 shsharp=''
1158 spitshell=''
1159 src=''
1160 ssizetype=''
1161 startperl=''
1162 startsh=''
1163 stdchar=''
1164 d_stdio_stream_array=''
1165 stdio_stream_array=''
1166 sysman=''
1167 trnl=''
1168 uidformat=''
1169 uidsign=''
1170 uidsize=''
1171 uidtype=''
1172 archname64=''
1173 use64bitall=''
1174 use64bitint=''
1175 usefaststdio=''
1176 ccflags_uselargefiles=''
1177 ldflags_uselargefiles=''
1178 libswanted_uselargefiles=''
1179 uselargefiles=''
1180 uselongdouble=''
1181 usemorebits=''
1182 usemultiplicity=''
1183 nm_opt=''
1184 nm_so_opt=''
1185 runnm=''
1186 usenm=''
1187 useperlio=''
1188 usesocks=''
1189 d_oldpthreads=''
1190 use5005threads=''
1191 useithreads=''
1192 usereentrant=''
1193 usethreads=''
1194 incpath=''
1195 mips_type=''
1196 usrinc=''
1197 d_vendorarch=''
1198 installvendorarch=''
1199 vendorarch=''
1200 vendorarchexp=''
1201 d_vendorbin=''
1202 installvendorbin=''
1203 vendorbin=''
1204 vendorbinexp=''
1205 installvendorhtml1dir=''
1206 vendorhtml1dir=''
1207 vendorhtml1direxp=''
1208 installvendorhtml3dir=''
1209 vendorhtml3dir=''
1210 vendorhtml3direxp=''
1211 d_vendorlib=''
1212 installvendorlib=''
1213 vendorlib=''
1214 vendorlib_stem=''
1215 vendorlibexp=''
1216 installvendorman1dir=''
1217 vendorman1dir=''
1218 vendorman1direxp=''
1219 installvendorman3dir=''
1220 vendorman3dir=''
1221 vendorman3direxp=''
1222 usevendorprefix=''
1223 vendorprefix=''
1224 vendorprefixexp=''
1225 d_vendorscript=''
1226 installvendorscript=''
1227 vendorscript=''
1228 vendorscriptexp=''
1229 versiononly=''
1230 defvoidused=''
1231 voidflags=''
1232 yacc=''
1233 yaccflags=''
1234 CONFIG=''
1235
1236 define='define'
1237 undef='undef'
1238 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1239 rmlist=''
1240
1241 : We must find out about Eunice early
1242 eunicefix=':'
1243 if test -f /etc/unixtovms; then
1244         eunicefix=/etc/unixtovms
1245 fi
1246 if test -f /etc/unixtovms.exe; then
1247         eunicefix=/etc/unixtovms.exe
1248 fi
1249
1250 : Set executable suffix now -- needed before hints available
1251 if test -f "/libs/version.library"; then
1252 : Amiga OS
1253     _exe=""
1254 elif test -f "/system/gnu_library/bin/ar.pm"; then
1255 : Stratus VOS
1256     _exe=".pm"
1257 elif test -n "$DJGPP"; then
1258 : DOS DJGPP
1259     _exe=".exe"
1260 elif test -d c:/. -o -n "$is_os2" ; then
1261 : OS/2 or cygwin
1262     _exe=".exe"
1263 fi
1264
1265 i_whoami=''
1266 : Trailing extension.  Override this in a hint file, if needed.
1267 : Extra object files, if any, needed on this platform.
1268 archobjs=''
1269 archname=''
1270 groupstype=''
1271 libnames=''
1272 : change the next line if compiling for Xenix/286 on Xenix/386
1273 xlibpth='/usr/lib/386 /lib/386'
1274 : Possible local library directories to search.
1275 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1276 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1277
1278 : general looking path for locating libraries
1279 glibpth="/lib /usr/lib $xlibpth"
1280 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1281 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1282 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1283 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1284
1285 : Private path used by Configure to find libraries.  Its value
1286 : is prepended to libpth. This variable takes care of special
1287 : machines, like the mips.  Usually, it should be empty.
1288 plibpth=''
1289
1290 : default library list
1291 libswanted=''
1292 : some systems want to use only the non-versioned libso:s
1293 ignore_versioned_solibs=''
1294 siteman1dir=''
1295 siteman3dir=''
1296 sitescript=''
1297 : set usethreads on the Configure command line to enable threads.
1298 usereentrant='undef'
1299 : full support for void wanted by default
1300 defvoidused=15
1301
1302 : Possible local include directories to search.
1303 : Set locincpth to "" in a hint file to defeat local include searches.
1304 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1305 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1306 :
1307 : no include file wanted by default
1308 inclwanted=''
1309
1310 : Enable -DEBUGGING and -DDEBUGGING from the command line
1311 EBUGGING=''
1312 DEBUGGING=old
1313
1314 ccname=''
1315 ccversion=''
1316 perllibs=''
1317 : set useposix=false in your hint file to disable the POSIX extension.
1318 useposix=true
1319 : set useopcode=false in your hint file to disable the Opcode extension.
1320 useopcode=true
1321 archname64=''
1322 ccflags_uselargefiles=''
1323 ldflags_uselargefiles=''
1324 libswanted_uselargefiles=''
1325 : set usemultiplicity on the Configure command line to enable multiplicity.
1326 : set usesocks on the Configure command line to enable socks.
1327 : List of libraries we want.
1328 : If anyone needs extra -lxxx, put those in a hint file.
1329 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1330 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1331 : We probably want to search /usr/shlib before most other libraries.
1332 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1333 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1334 glibpth="/usr/shlib $glibpth"
1335 : Do not use vfork unless overridden by a hint file.
1336 usevfork=false
1337
1338 : Find the basic shell for Bourne shell scripts
1339 case "$sh" in
1340 '')
1341         case "$SYSTYPE" in
1342         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1343         *) xxx='/bin/sh';;
1344         esac
1345         if test -f "$xxx"; then
1346                 sh="$xxx"
1347         else
1348                 : Build up a list and do a single loop so we can 'break' out.
1349                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1350                 for xxx in sh bash ksh pdksh ash; do
1351                         for p in $pth; do
1352                                 try="$try ${p}/${xxx}"
1353                         done
1354                 done
1355                 for xxx in $try; do
1356                         if test -f "$xxx"; then
1357                                 sh="$xxx";
1358                                 break
1359                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1360                                 sh="$xxx";
1361                                 break
1362                         elif test -f "$xxx.exe"; then
1363                                 sh="$xxx";
1364                                 break
1365                         fi
1366                 done
1367         fi
1368         ;;
1369 esac
1370
1371 case "$sh" in
1372 '')     cat >&2 <<EOM
1373 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1374
1375 Usually it's in /bin/sh.  How did you even get this far?
1376 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1377 we'll try to straighten this all out.
1378 EOM
1379         exit 1
1380         ;;
1381 esac
1382
1383 : see if sh knows # comments
1384 if `$sh -c '#' >/dev/null 2>&1`; then
1385         shsharp=true
1386         spitshell=cat
1387         xcat=/bin/cat
1388         test -f $xcat$_exe || xcat=/usr/bin/cat
1389         if test ! -f $xcat$_exe; then
1390                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1391                         if test -f $p/cat$_exe; then
1392                                 xcat=$p/cat
1393                                 break
1394                         fi
1395                 done
1396                 if test ! -f $xcat$_exe; then
1397                         echo "Can't find cat anywhere!"
1398                         exit 1
1399                 fi
1400         fi
1401         echo "#!$xcat" >sharp
1402         $eunicefix sharp
1403         chmod +x sharp
1404         ./sharp > today
1405         if test -s today; then
1406                 sharpbang='#!'
1407         else
1408                 echo "#! $xcat" > sharp
1409                 $eunicefix sharp
1410                 chmod +x sharp
1411                 ./sharp > today
1412                 if test -s today; then
1413                         sharpbang='#! '
1414                 else
1415                         sharpbang=': use '
1416                 fi
1417         fi
1418 else
1419         echo " "
1420         echo "Your $sh doesn't grok # comments--I will strip them later on."
1421         shsharp=false
1422         cd ..
1423         echo "exec grep -v '^[  ]*#'" >spitshell
1424         chmod +x spitshell
1425         $eunicefix spitshell
1426         spitshell=`pwd`/spitshell
1427         cd UU
1428         echo "I presume that if # doesn't work, #! won't work either!"
1429         sharpbang=': use '
1430 fi
1431 rm -f sharp today
1432
1433 : figure out how to guarantee sh startup
1434 case "$startsh" in
1435 '') startsh=${sharpbang}${sh} ;;
1436 *)
1437 esac
1438 cat >sharp <<EOSS
1439 $startsh
1440 set abc
1441 test "$?abc" != 1
1442 EOSS
1443
1444 chmod +x sharp
1445 $eunicefix sharp
1446 if ./sharp; then
1447         : echo "Yup, it does."
1448 else
1449         echo "Hmm... '$startsh' does not guarantee sh startup..."
1450         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1451 fi
1452 rm -f sharp
1453
1454
1455 : Save command line options in file UU/cmdline.opt for later use in
1456 : generating config.sh.
1457 cat > cmdline.opt <<EOSH
1458 # Configure command line arguments.
1459 config_arg0='$0'
1460 config_args='$*'
1461 config_argc=$#
1462 EOSH
1463 argn=1
1464 args_exp=''
1465 args_sep=''
1466 for arg in "$@"; do
1467         cat >>cmdline.opt <<EOSH
1468 config_arg$argn='$arg'
1469 EOSH
1470         # Extreme backslashitis: replace each ' by '"'"'
1471         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1472 $arg
1473 EOC
1474         arg_exp=`cat cmdl.opt`
1475         args_exp="$args_exp$args_sep'$arg_exp'"
1476         argn=`expr $argn + 1`
1477         args_sep=' '
1478 done
1479 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1480 # used by ./hints/os2.sh
1481 rm -f cmdl.opt
1482
1483 : produce awk script to parse command line options
1484 cat >options.awk <<'EOF'
1485 BEGIN {
1486         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1487
1488         len = length(optstr);
1489         for (i = 1; i <= len; i++) {
1490                 c = substr(optstr, i, 1);
1491                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1492                 if (a == ":") {
1493                         arg[c] = 1;
1494                         i++;
1495                 }
1496                 opt[c] = 1;
1497         }
1498 }
1499 {
1500         expect = 0;
1501         str = $0;
1502         if (substr(str, 1, 1) != "-") {
1503                 printf("'%s'\n", str);
1504                 next;
1505         }
1506         len = length($0);
1507         for (i = 2; i <= len; i++) {
1508                 c = substr(str, i, 1);
1509                 if (!opt[c]) {
1510                         printf("-%s\n", substr(str, i));
1511                         next;
1512                 }
1513                 printf("-%s\n", c);
1514                 if (arg[c]) {
1515                         if (i < len)
1516                                 printf("'%s'\n", substr(str, i + 1));
1517                         else
1518                                 expect = 1;
1519                         next;
1520                 }
1521         }
1522 }
1523 END {
1524         if (expect)
1525                 print "?";
1526 }
1527 EOF
1528
1529 : process the command line options
1530 set X `for arg in "$@"; do echo "X$arg"; done |
1531         sed -e s/X// | awk -f options.awk`
1532 eval "set $*"
1533 shift
1534 rm -f options.awk
1535
1536 : set up default values
1537 fastread=''
1538 reuseval=false
1539 config_sh=''
1540 alldone=''
1541 error=''
1542 silent=''
1543 extractsh=''
1544 override=''
1545 knowitall=''
1546 rm -f optdef.sh posthint.sh
1547 cat >optdef.sh <<EOS
1548 $startsh
1549 EOS
1550
1551
1552 : option parsing
1553 while test $# -gt 0; do
1554         case "$1" in
1555         -d) shift; fastread=yes;;
1556         -e) shift; alldone=cont;;
1557         -f)
1558                 shift
1559                 cd ..
1560                 if test -r "$1"; then
1561                         config_sh="$1"
1562                 else
1563                         echo "$me: cannot read config file $1." >&2
1564                         error=true
1565                 fi
1566                 cd UU
1567                 shift;;
1568         -h) shift; error=true;;
1569         -r) shift; reuseval=true;;
1570         -s) shift; silent=true; realsilent=true;;
1571         -E) shift; alldone=exit;;
1572         -K) shift; knowitall=true;;
1573         -O) shift; override=true;;
1574         -S) shift; silent=true; extractsh=true;;
1575         -D)
1576                 shift
1577                 case "$1" in
1578                 *=)
1579                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1580                         echo "$me: ignoring -D $1" >&2
1581                         ;;
1582                 *=*) echo "$1" | \
1583                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1584                 *) echo "$1='define'" >> optdef.sh;;
1585                 esac
1586                 shift
1587                 ;;
1588         -U)
1589                 shift
1590                 case "$1" in
1591                 *=) echo "$1" >> optdef.sh;;
1592                 *=*)
1593                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1594                         echo "$me: ignoring -U $1" >&2
1595                         ;;
1596                 *) echo "$1='undef'" >> optdef.sh;;
1597                 esac
1598                 shift
1599                 ;;
1600         -A)
1601             shift
1602             xxx=''
1603             yyy="$1"
1604             zzz=''
1605             uuu=undef
1606             case "$yyy" in
1607             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1608                  case "$zzz" in
1609                  *:*) zzz='' ;;
1610                  *)   xxx=append
1611                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1612                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1613                  esac
1614                  ;;
1615             esac
1616             case "$xxx" in
1617             '')  case "$yyy" in
1618                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1619                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1620                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1621                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1622                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1623                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1624                  esac
1625                  ;;       
1626             esac
1627             case "$xxx" in
1628             append)
1629                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1630             clear)
1631                 echo "$yyy=''"                  >> posthint.sh ;;
1632             define)
1633                 case "$zzz" in
1634                 '') zzz=define ;;
1635                 esac
1636                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1637             eval)
1638                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1639             prepend)
1640                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1641             undef)
1642                 case "$zzz" in
1643                 '') zzz="$uuu" ;;
1644                 esac
1645                 echo "$yyy=$zzz"                >> posthint.sh ;;
1646             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1647             esac
1648             shift
1649             ;;
1650         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1651             exit 0;;
1652         --) break;;
1653         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1654         *) break;;
1655         esac
1656 done
1657
1658 case "$error" in
1659 true)
1660         cat >&2 <<EOM
1661 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1662                  [-U symbol] [-U symbol=] [-A command:symbol...]
1663   -d : use defaults for all answers.
1664   -e : go on without questioning past the production of config.sh.
1665   -f : specify an alternate default configuration file.
1666   -h : print this help message and exit (with an error status).
1667   -r : reuse C symbols value if possible (skips costly nm extraction).
1668   -s : silent mode, only echoes questions and essential information.
1669   -D : define symbol to have some value:
1670          -D symbol         symbol gets the value 'define'
1671          -D symbol=value   symbol gets the value 'value'
1672   -E : stop at the end of questions, after having produced config.sh.
1673   -K : do not use unless you know what you are doing.
1674   -O : let -D and -U override definitions from loaded configuration file.
1675   -S : perform variable substitutions on all .SH files (can mix with -f)
1676   -U : undefine symbol:
1677          -U symbol    symbol gets the value 'undef'
1678          -U symbol=   symbol gets completely empty
1679   -A : manipulate symbol after the platform specific hints have been applied:
1680          -A symbol=value                append " "value to symbol
1681          -A append:symbol=value         append value to symbol
1682          -A define:symbol=value         define symbol to have value
1683          -A clear:symbol                define symbol to be ''
1684          -A define:symbol               define symbol to be 'define'
1685          -A eval:symbol=value           define symbol to be eval of value
1686          -A prepend:symbol=value        prepend value to symbol
1687          -A undef:symbol                define symbol to be 'undef'
1688          -A undef:symbol=               define symbol to be ''
1689   -V : print version number and exit (with a zero status).
1690 EOM
1691         exit 1
1692         ;;
1693 esac
1694
1695 : Sanity checks
1696 case "$fastread$alldone" in
1697 yescont|yesexit) ;;
1698 *)
1699         case "$extractsh" in
1700         true) ;;
1701         *)
1702                 if test ! -t 0; then
1703                         echo "Say 'sh Configure', not 'sh <Configure'"
1704                         exit 1
1705                 fi
1706                 ;;
1707         esac
1708         ;;
1709 esac
1710
1711 exec 4>&1
1712 case "$silent" in
1713 true) exec 1>/dev/null;;
1714 esac
1715
1716 : run the defines and the undefines, if any, but leave the file out there...
1717 touch optdef.sh
1718 . ./optdef.sh
1719 : create the posthint manipulation script and leave the file out there...
1720 touch posthint.sh
1721
1722 : set package name
1723 package=perl5
1724 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1725 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1726 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1727 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1728 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1729 esac
1730
1731 : Some greps do not return status, grrr.
1732 echo "grimblepritz" >grimble
1733 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1734         contains=contains
1735 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1736         contains=grep
1737 else
1738         contains=contains
1739 fi
1740 rm -f grimble
1741 : the following should work in any shell
1742 case "$contains" in
1743 contains*)
1744         echo " "
1745         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1746         cat >contains <<'EOSS'
1747 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1748 EOSS
1749 chmod +x contains
1750 esac
1751
1752 : Find the path to the source tree
1753 case "$src" in
1754 '') case "$0" in
1755     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1756          case "$src" in
1757          /*)    ;;
1758          .)     ;;
1759          *)     src=`cd ../$src && pwd` ;;
1760          esac
1761          ;;
1762     *)   src='.';;
1763     esac;;
1764 esac
1765 case "$src" in
1766 '')     src=/
1767         rsrc=/
1768         ;;
1769 /*) rsrc="$src";;
1770 *) rsrc="../$src";;
1771 esac
1772 if test -f $rsrc/Configure && \
1773         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1774 then
1775    : found it, so we are ok.
1776 else
1777         rsrc=''
1778         for src in . .. ../.. ../../.. ../../../..; do
1779                 if test -f ../$src/Configure && \
1780                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1781                 then
1782                         rsrc=../$src
1783                         break
1784                 fi
1785         done
1786 fi
1787 case "$rsrc" in
1788 '')
1789         cat <<EOM >&4
1790
1791 Sorry, I can't seem to locate the source dir for $package.  Please start
1792 Configure with an explicit path -- i.e. /some/path/Configure.
1793
1794 EOM
1795         exit 1
1796         ;;
1797 ../.)   rsrc='..';;
1798 *)
1799         echo " "
1800         echo "Sources for $package found in \"$src\"." >&4
1801         ;;
1802 esac
1803
1804 : script used to extract .SH files with variable substitutions
1805 cat >extract <<'EOS'
1806 PERL_CONFIG_SH=true
1807 echo "Doing variable substitutions on .SH files..."
1808 if test -f MANIFEST; then
1809         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1810 else
1811         echo "(Looking for .SH files under the source directory.)"
1812         set x `(cd "$src"; find . -name "*.SH" -print)`
1813 fi
1814 shift
1815 case $# in
1816 0) set x `(cd "$src"; echo *.SH)`; shift;;
1817 esac
1818 if test ! -f "$src/$1"; then
1819         shift
1820 fi
1821 mkdir_p='
1822 name=$1;
1823 create="";
1824 while test $name; do
1825         if test ! -d "$name"; then
1826                 create="$name $create";
1827                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1828                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1829         else
1830                 name="";
1831         fi;
1832 done;
1833 for file in $create; do
1834         mkdir $file;
1835 done
1836 '
1837 for file in $*; do
1838         case "$src" in
1839         ".")
1840                 case "$file" in
1841                 */*)
1842                         dir=`expr X$file : 'X\(.*\)/'`
1843                         file=`expr X$file : 'X.*/\(.*\)'`
1844                         (cd "$dir" && . ./$file)
1845                         ;;
1846                 *)
1847                         . ./$file
1848                         ;;
1849                 esac
1850                 ;;
1851         *)
1852                 case "$file" in
1853                 */*)
1854                         dir=`expr X$file : 'X\(.*\)/'`
1855                         file=`expr X$file : 'X.*/\(.*\)'`
1856                         (set x $dir; shift; eval $mkdir_p)
1857                         sh <"$src/$dir/$file"
1858                         ;;
1859                 *)
1860                         sh <"$src/$file"
1861                         ;;
1862                 esac
1863                 ;;
1864         esac
1865 done
1866 if test -f "$src/config_h.SH"; then
1867         if test ! -f config.h; then
1868         : oops, they left it out of MANIFEST, probably, so do it anyway.
1869         . "$src/config_h.SH"
1870         fi
1871 fi
1872 EOS
1873
1874 : extract files and exit if asked to do so
1875 case "$extractsh" in
1876 true)
1877         case "$realsilent" in
1878         true) ;;
1879         *) exec 1>&4;;
1880         esac
1881         case "$config_sh" in
1882         '') config_sh='config.sh';;
1883         esac
1884         echo " "
1885         echo "Fetching answers from $config_sh..."
1886         cd ..
1887         . $config_sh
1888         test "$override" && . ./optdef.sh
1889         echo " "
1890         . UU/extract
1891         rm -rf UU
1892         echo "Extraction done."
1893         exit 0
1894         ;;
1895 esac
1896
1897 : Eunice requires " " instead of "", can you believe it
1898 echo " "
1899 : Here we go...
1900 echo "Beginning of configuration questions for $package."
1901
1902 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1903
1904 : first determine how to suppress newline on echo command
1905 echo " "
1906 echo "Checking echo to see how to suppress newlines..."
1907 (echo "hi there\c" ; echo " ") >.echotmp
1908 if $contains c .echotmp >/dev/null 2>&1 ; then
1909         echo "...using -n."
1910         n='-n'
1911         c=''
1912 else
1913         cat <<'EOM'
1914 ...using \c
1915 EOM
1916         n=''
1917         c='\c'
1918 fi
1919 echo $n "The star should be here-->$c"
1920 echo '*'
1921 rm -f .echotmp
1922
1923 : Now test for existence of everything in MANIFEST
1924 echo " "
1925 if test -f "$rsrc/MANIFEST"; then
1926         echo "First let's make sure your kit is complete.  Checking..." >&4
1927         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1928         rm -f missing
1929         tmppwd=`pwd`
1930         for filelist in x??; do
1931                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1932         done
1933         if test -s missing; then
1934                 cat missing >&4
1935                 cat >&4 <<'EOM'
1936
1937 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1938
1939 You have the option of continuing the configuration process, despite the
1940 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1941 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1942 and contact the author (perlbug@perl.org).
1943
1944 EOM
1945                 echo $n "Continue? [n] $c" >&4
1946                 read ans
1947                 case "$ans" in
1948                 y*)
1949                         echo "Continuing..." >&4
1950                         rm -f missing
1951                         ;;
1952                 *)
1953                         echo "ABORTING..." >&4
1954                         kill $$
1955                         ;;
1956                 esac
1957         else
1958                 echo "Looks good..."
1959         fi
1960 else
1961         echo "There is no MANIFEST file.  I hope your kit is complete !"
1962 fi
1963 rm -f missing x??
1964
1965 echo " "
1966 : Find the appropriate value for a newline for tr
1967 if test -n "$DJGPP"; then
1968        trnl='\012'
1969 fi
1970 if test X"$trnl" = X; then
1971         case "`echo foo|tr '\n' x 2>/dev/null`" in
1972         foox) trnl='\n' ;;
1973         esac
1974 fi
1975 if test X"$trnl" = X; then
1976         case "`echo foo|tr '\012' x 2>/dev/null`" in
1977         foox) trnl='\012' ;;
1978         esac
1979 fi
1980 if test X"$trnl" = X; then
1981        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1982        fooxy) trnl='\n\r' ;;
1983        esac
1984 fi
1985 if test X"$trnl" = X; then
1986         cat <<EOM >&2
1987
1988 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1989
1990 EOM
1991         exit 1
1992 fi
1993
1994 : compute the number of columns on the terminal for proper question formatting
1995 case "$COLUMNS" in
1996 '') COLUMNS='80';;
1997 esac
1998
1999 : set up the echo used in my read
2000 myecho="case \"\$xxxm\" in
2001 '') echo $n \"\$rp $c\" >&4;;
2002 *) case \"\$rp\" in
2003         '') echo $n \"[\$xxxm] $c\";;
2004         *)
2005                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2006                         echo \"\$rp\" >&4
2007                         echo $n \"[\$xxxm] $c\" >&4
2008                 else
2009                         echo $n \"\$rp [\$xxxm] $c\" >&4
2010                 fi
2011                 ;;
2012         esac;;
2013 esac"
2014
2015 : now set up to do reads with possible shell escape and default assignment
2016 cat <<EOSC >myread
2017 $startsh
2018 xxxm=\$dflt
2019 $myecho
2020 ans='!'
2021 case "\$fastread" in
2022 yes) case "\$dflt" in
2023         '') ;;
2024         *) ans='';
2025                 case "\$silent-\$rp" in
2026                 true-) ;;
2027                 *) echo " " >&4;;
2028                 esac;;
2029         esac;;
2030 *) case "\$silent" in
2031         true) case "\$rp" in
2032                 '') ans='';;
2033                 esac;;
2034         esac;;
2035 esac
2036 while expr "X\$ans" : "X!" >/dev/null; do
2037         read answ
2038         set x \$xxxm
2039         shift
2040         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2041         case  "\$answ" in
2042         "!")
2043                 sh 1>&4
2044                 echo " "
2045                 $myecho
2046                 ;;
2047         !*)
2048                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2049                 shift
2050                 sh 1>&4 -c "\$*"
2051                 echo " "
2052                 $myecho
2053                 ;;
2054         "\$ans")
2055                 case "\$ans" in
2056                 \\&*)
2057                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2058                         shift
2059                         case "\$1" in
2060                         -d)
2061                                 fastread=yes
2062                                 echo "(OK, I'll run with -d after this question.)" >&4
2063                                 ;;
2064                         -*)
2065                                 echo "*** Sorry, \$1 not supported yet." >&4
2066                                 ;;
2067                         esac
2068                         $myecho
2069                         ans=!
2070                         ;;
2071                 esac;;
2072         *)
2073                 case "\$aok" in
2074                 y)
2075                         echo "*** Substitution done -- please confirm."
2076                         xxxm="\$ans"
2077                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2078                         xxxm="\$ans"
2079                         ans=!
2080                         ;;
2081                 *)
2082                         echo "*** Error -- try again."
2083                         ans=!
2084                         ;;
2085                 esac
2086                 $myecho
2087                 ;;
2088         esac
2089         case "\$ans\$xxxm\$nostick" in
2090         '')
2091                 ans=!
2092                 $myecho
2093                 ;;
2094         esac
2095 done
2096 case "\$ans" in
2097 '') ans="\$xxxm";;
2098 esac
2099 EOSC
2100
2101 : create .config dir to save info across Configure sessions
2102 test -d ../.config || mkdir ../.config
2103 cat >../.config/README <<EOF
2104 This directory created by Configure to save information that should
2105 persist across sessions for $package.
2106
2107 You may safely delete it if you wish.
2108 EOF
2109
2110 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2111 case "$usedevel" in
2112 $define|true|[yY]*) ;;
2113 *) case "$xversion" in
2114    *[13579])
2115         cat >&4 <<EOH
2116 *** WHOA THERE!!! ***
2117
2118     This is an UNSTABLE DEVELOPMENT release.
2119     The version of this $package distribution is $xversion, that is, odd,
2120     (as opposed to even) and that signifies a development release.
2121     If you want a maintenance release, you want an even-numbered version.
2122
2123     Do ***NOT*** install this into production use.
2124     Data corruption and crashes are possible.
2125
2126     It is most seriously suggested that you do not continue any further
2127     unless you want to help in developing and debugging Perl.
2128
2129     If you *still* want to build perl, you can answer 'y' now,
2130     or pass -Dusedevel to Configure.
2131
2132 EOH
2133         rp='Do you really want to continue?'
2134         dflt='n'
2135         . ./myread
2136         case "$ans" in
2137         [yY]) echo >&4 "Okay, continuing."
2138               usedevel="$define" ;;
2139         *) echo >&4 "Okay, bye."
2140            exit 1
2141            ;;
2142         esac
2143         ;;
2144     esac
2145     ;;
2146 esac
2147 case "$usedevel" in
2148 $define|true|[yY]*)
2149         case "$versiononly" in
2150         '') versiononly="$define" ;;
2151         esac
2152         case "$installusrbinperl" in
2153         '') installusrbinperl="$undef" ;;
2154         esac
2155         ;;
2156 esac
2157
2158 : general instructions
2159 needman=true
2160 firsttime=true
2161 user=`(logname) 2>/dev/null`
2162 case "$user" in
2163 '') user=`whoami 2>&1`;;
2164 esac
2165 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2166         firsttime=false
2167         echo " "
2168         rp='Would you like to see the instructions?'
2169         dflt=n
2170         . ./myread
2171         case "$ans" in
2172         [yY]*) ;;
2173         *) needman=false;;
2174         esac
2175 fi
2176 if $needman; then
2177         cat <<EOH
2178
2179 This installation shell script will examine your system and ask you questions
2180 to determine how the perl5 package should be installed. If you get
2181 stuck on a question, you may use a ! shell escape to start a subshell or
2182 execute a command.  Many of the questions will have default answers in square
2183 brackets; typing carriage return will give you the default.
2184
2185 On some of the questions which ask for file or directory names you are allowed
2186 to use the ~name construct to specify the login directory belonging to "name",
2187 even if you don't have a shell which knows about that.  Questions where this is
2188 allowed will be marked "(~name ok)".
2189
2190 EOH
2191         rp=''
2192         dflt='Type carriage return to continue'
2193         . ./myread
2194         cat <<'EOH'
2195
2196 The prompter used in this script allows you to use shell variables and
2197 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2198 in the default answer, as if the default line was a set of arguments given to a
2199 script shell.  This means you may also use $* to repeat the whole default line,
2200 so you do not have to re-type everything to add something to the default.
2201
2202 Everytime there is a substitution, you will have to confirm.  If there is an
2203 error (e.g. an unmatched backtick), the default answer will remain unchanged
2204 and you will be prompted again.
2205
2206 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2207 the questions and use the computed defaults (or the previous answers if there
2208 was already a config.sh file). Type 'Configure -h' for a list of options.
2209 You may also start interactively and then answer '& -d' at any prompt to turn
2210 on the non-interactive behaviour for the remainder of the execution.
2211
2212 EOH
2213         . ./myread
2214         cat <<EOH
2215
2216 Much effort has been expended to ensure that this shell script will run on any
2217 Unix system.  If despite that it blows up on yours, your best bet is to edit
2218 Configure and run it again.  If you can't run Configure for some reason,
2219 you'll have to generate a config.sh file by hand.  Whatever problems you
2220 have, let me (perlbug@perl.org) know how I blew it.
2221
2222 This installation script affects things in two ways:
2223
2224 1) it may do direct variable substitutions on some of the files included
2225    in this kit.
2226 2) it builds a config.h file for inclusion in C programs.  You may edit
2227    any of these files as the need arises after running this script.
2228
2229 If you make a mistake on a question, there is no easy way to back up to it
2230 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2231 files.  Configure will offer to let you do this before it runs the SH files.
2232
2233 EOH
2234         dflt='Type carriage return to continue'
2235         . ./myread
2236         case "$firsttime" in
2237         true) echo $user >>../.config/instruct;;
2238         esac
2239 fi
2240
2241 : find out where common programs are
2242 echo " "
2243 echo "Locating common programs..." >&4
2244 cat <<EOSC >loc
2245 $startsh
2246 case \$# in
2247 0) exit 1;;
2248 esac
2249 thing=\$1
2250 shift
2251 dflt=\$1
2252 shift
2253 for dir in \$*; do
2254         case "\$thing" in
2255         .)
2256         if test -d \$dir/\$thing; then
2257                 echo \$dir
2258                 exit 0
2259         fi
2260         ;;
2261         *)
2262         for thisthing in \$dir/\$thing; do
2263                 : just loop through to pick last item
2264         done
2265         if test -f \$thisthing; then
2266                 echo \$thisthing
2267                 exit 0
2268         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2269                 echo \$thisthing
2270                 exit 0
2271         elif test -f \$dir/\$thing.exe; then
2272                 if test -n "$DJGPP"; then
2273                         echo \$dir/\$thing.exe
2274                 elif test "$eunicefix" != ":"; then
2275                         : on Eunice apparently
2276                         echo \$dir/\$thing
2277                         exit 0
2278                 fi
2279                 exit 0
2280         fi
2281         ;;
2282         esac
2283 done
2284 echo \$dflt
2285 exit 1
2286 EOSC
2287 chmod +x loc
2288 $eunicefix loc
2289 loclist="
2290 awk
2291 cat
2292 chmod
2293 comm
2294 cp
2295 echo
2296 expr
2297 grep
2298 ls
2299 mkdir
2300 rm
2301 sed
2302 sort
2303 touch
2304 tr
2305 uniq
2306 "
2307 trylist="
2308 Mcc
2309 ar
2310 bison
2311 byacc
2312 cpp
2313 csh
2314 date
2315 egrep
2316 gmake
2317 gzip
2318 less
2319 ln
2320 make
2321 more
2322 nm
2323 nroff
2324 pg
2325 test
2326 uname
2327 zip
2328 "
2329 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2330 pth="$pth /lib /usr/lib"
2331 for file in $loclist; do
2332         eval xxx=\$$file
2333         case "$xxx" in
2334         /*|?:[\\/]*)
2335                 if test -f "$xxx"; then
2336                         : ok
2337                 else
2338                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2339                         xxx=`./loc $file $file $pth`
2340                 fi
2341                 ;;
2342         '') xxx=`./loc $file $file $pth`;;
2343         *) xxx=`./loc $xxx $xxx $pth`;;
2344         esac
2345         eval $file=$xxx$_exe
2346         eval _$file=$xxx
2347         case "$xxx" in
2348         /*)
2349                 echo $file is in $xxx.
2350                 ;;
2351         ?:[\\/]*)
2352                 echo $file is in $xxx.
2353                 ;;
2354         *)
2355                 echo "I don't know where '$file' is, and my life depends on it." >&4
2356                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2357                 exit 1
2358                 ;;
2359         esac
2360 done
2361 echo " "
2362 echo "Don't worry if any of the following aren't found..."
2363 say=offhand
2364 for file in $trylist; do
2365         eval xxx=\$$file
2366         case "$xxx" in
2367         /*|?:[\\/]*)
2368                 if test -f "$xxx"; then
2369                         : ok
2370                 else
2371                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2372                         xxx=`./loc $file $file $pth`
2373                 fi
2374                 ;;
2375         '') xxx=`./loc $file $file $pth`;;
2376         *) xxx=`./loc $xxx $xxx $pth`;;
2377         esac
2378         eval $file=$xxx$_exe
2379         eval _$file=$xxx
2380         case "$xxx" in
2381         /*)
2382                 echo $file is in $xxx.
2383                 ;;
2384         ?:[\\/]*)
2385                 echo $file is in $xxx.
2386                 ;;
2387         *)
2388                 echo "I don't see $file out there, $say."
2389                 say=either
2390                 ;;
2391         esac
2392 done
2393 case "$egrep" in
2394 egrep)
2395         echo "Substituting grep for egrep."
2396         egrep=$grep
2397         _egrep=$grep
2398         ;;
2399 esac
2400 case "$ln" in
2401 ln)
2402         echo "Substituting cp for ln."
2403         ln=$cp
2404         _ln=$cp
2405         ;;
2406 esac
2407 case "$make" in
2408 make)   
2409         case "$gmake" in
2410         gmake)
2411         echo "I can't find make or gmake, and my life depends on it." >&4
2412         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2413         exit 1
2414         ;;
2415         esac
2416         ;;
2417 esac    
2418 case "$gmake" in
2419 gmake)  ;;
2420 *)      # We can't have osname yet.
2421         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2422                 # Assume that gmake, if found, is definitely GNU make
2423                 # and prefer it over the system make.
2424                 echo "Substituting gmake for make."
2425                 make=$gmake
2426                 _make=$gmake
2427         fi
2428         ;;
2429 esac
2430 case "$test" in
2431 test)
2432         echo "Hopefully test is built into your sh."
2433         ;;
2434 *)
2435         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2436                 echo "Using the test built into your sh."
2437                 test=test
2438                 _test=test
2439         fi
2440         ;;
2441 esac
2442 case "$echo" in
2443 echo)
2444         echo "Hopefully echo is built into your sh."
2445         ;;
2446 '') ;;
2447 *)
2448         echo " "
2449 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2450         $echo $n "hi there$c" >foo1
2451         echo $n "hi there$c" >foo2
2452         if cmp foo1 foo2 >/dev/null 2>&1; then
2453                 echo "They are compatible.  In fact, they may be identical."
2454         else
2455                 case "$n" in
2456                 '-n') n='' c='\c';;
2457                 *) n='-n' c='';;
2458                 esac
2459                 cat <<FOO
2460 They are not compatible!  You are probably running ksh on a non-USG system.
2461 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2462 have echo built in and we may have to run some Bourne shell scripts.  That
2463 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2464
2465 FOO
2466                 $echo $n "The star should be here-->$c"
2467                 $echo "*"
2468         fi
2469         $rm -f foo1 foo2
2470         ;;
2471 esac
2472
2473 cat <<EOS >trygcc
2474 $startsh
2475 EOS
2476 cat <<'EOSC' >>trygcc
2477 case "$cc" in
2478 '') ;;
2479 *)  $rm -f try try.*
2480     $cat >try.c <<EOM
2481 int main(int argc, char *argv[]) {
2482   return 0;
2483 }
2484 EOM
2485     if $cc -o try $ccflags $ldflags try.c; then
2486        :
2487     else
2488         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2489         despair=yes
2490         trygcc=yes
2491         case "$cc" in
2492         *gcc*) trygcc=no ;;
2493         esac
2494         case "`$cc -v -c try.c 2>&1`" in
2495         *gcc*) trygcc=no ;;
2496         esac
2497         if $test X"$trygcc" = Xyes; then
2498             if gcc -o try -c try.c; then
2499                 echo " "
2500                 echo "You seem to have a working gcc, though." >&4
2501                 rp="Would you like to use it?"
2502                 dflt=y
2503                 if $test -f myread; then
2504                     . ./myread
2505                 else
2506                     if $test -f UU/myread; then
2507                         . ./UU/myread
2508                     else
2509                         echo "Cannot find myread, sorry.  Aborting." >&2
2510                         exit 1
2511                     fi
2512                 fi  
2513                 case "$ans" in
2514                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2515                        if $test -f usethreads.cbu; then
2516                            $cat >&4 <<EOM 
2517
2518 *** However, any setting of the C compiler flags (e.g. for thread support)
2519 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2520 *** (together with e.g. -Dusethreads).
2521
2522 EOM
2523                        fi;;
2524                 esac
2525             fi
2526         fi
2527     fi
2528     $rm -f try try.*
2529     ;;
2530 esac
2531 EOSC
2532
2533 cat <<EOS >checkcc
2534 $startsh
2535 EOS
2536 cat <<'EOSC' >>checkcc
2537 case "$cc" in        
2538 '') ;;
2539 *)  $rm -f try try.*              
2540     $cat >try.c <<EOM
2541 int main(int argc, char *argv[]) {
2542   return 0;
2543 }
2544 EOM
2545     if $cc -o try $ccflags $ldflags try.c; then
2546        :
2547     else
2548         if $test X"$despair" = Xyes; then
2549            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2550         fi
2551         $cat >&4 <<EOM         
2552 You need to find a working C compiler.
2553 Either (purchase and) install the C compiler supplied by your OS vendor,
2554 or for a free C compiler try http://gcc.gnu.org/
2555 I cannot continue any further, aborting.
2556 EOM
2557         exit 1
2558     fi
2559     $rm -f try try.*
2560     ;;
2561 esac
2562 EOSC
2563
2564 : determine whether symbolic links are supported
2565 echo " "
2566 $touch blurfl
2567 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2568         echo "Symbolic links are supported." >&4
2569         lns="$ln -s"
2570 else
2571         echo "Symbolic links are NOT supported." >&4
2572         lns="$ln"
2573 fi
2574 $rm -f blurfl sym
2575
2576 : determine whether symbolic links are supported
2577 echo " "
2578 case "$lns" in
2579 *"ln"*" -s")
2580         echo "Checking how to test for symbolic links..." >&4
2581         $lns blurfl sym
2582         if $test "X$issymlink" = X; then
2583                 case "$newsh" in
2584                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2585                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2586                 esac
2587                 if test $? = 0; then
2588                         issymlink="test -h"
2589                 else
2590                         echo "Your builtin 'test -h' may be broken." >&4
2591                         case "$test" in
2592                         /*)     ;;
2593                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2594                                 for p in $pth
2595                                 do
2596                                         if test -f "$p/$test"; then
2597                                                 test="$p/$test"
2598                                                 break
2599                                         fi
2600                                 done
2601                                 ;;
2602                         esac
2603                         case "$test" in
2604                         /*)
2605                                 echo "Trying external '$test -h'." >&4
2606                                 issymlink="$test -h"
2607                                 if $test ! -h sym >/dev/null 2>&1; then
2608                                         echo "External '$test -h' is broken, too." >&4
2609                                         issymlink=''
2610                                 fi
2611                                 ;;
2612                         *)      issymlink='' ;;
2613                         esac
2614                 fi              
2615         fi
2616         if $test "X$issymlink" = X; then
2617                 if $test -L sym 2>/dev/null; then
2618                         issymlink="$test -L"
2619                         echo "The builtin '$test -L' worked." >&4
2620                 fi
2621         fi
2622         if $test "X$issymlink" != X; then
2623                 echo "You can test for symbolic links with '$issymlink'." >&4
2624         else
2625                 echo "I do not know how you can test for symbolic links." >&4
2626         fi
2627         $rm -f blurfl sym
2628         ;;
2629 *)      echo "No symbolic links, so not testing for their testing..." >&4
2630         ;;
2631 esac
2632 echo " "
2633
2634
2635 case "$mksymlinks" in
2636 $define|true|[yY]*)
2637         case "$src" in
2638         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2639                 exit 1
2640                 ;;
2641         *)      case "$lns:$issymlink" in
2642                 *"ln"*" -s:"*"test -"?)
2643                         echo "Creating the symbolic links..." >&4
2644                         echo "(First creating the subdirectories...)" >&4
2645                         cd ..
2646                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2647                                 read directory
2648                                 test -z "$directory" && break
2649                                 mkdir -p $directory
2650                         done
2651                         # Sanity check 1.
2652                         if test ! -d t/base; then
2653                                 echo "Failed to create the subdirectories.  Aborting." >&4
2654                                 exit 1
2655                         fi
2656                         echo "(Then creating the symlinks...)" >&4
2657                         awk '{print $1}' $src/MANIFEST | while true; do
2658                                 read filename
2659                                 test -z "$filename" && break
2660                                 if test -f $filename; then
2661                                         if $issymlink $filename; then
2662                                                 rm -f $filename
2663                                         fi
2664                                 fi
2665                                 if test -f $filename; then
2666                                         echo "$filename already exists, not symlinking."
2667                                 else
2668                                         ln -s $src/$filename $filename
2669                                 fi
2670                         done
2671                         # Sanity check 2.
2672                         if test ! -f t/base/lex.t; then
2673                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2674                                 exit 1
2675                         fi
2676                         cd UU
2677                         ;;
2678                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2679                         ;;
2680                 esac
2681                 ;;
2682         esac
2683         ;;
2684 esac
2685
2686
2687 case "$usecrosscompile" in
2688 $define|true|[yY]*)
2689         $echo "Cross-compiling..."
2690         croak=''
2691         case "$cc" in
2692         *-*-gcc) # A cross-compiling gcc, probably.
2693             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2694             ar=$targetarch-ar
2695             # leave out ld, choosing it is more complex
2696             nm=$targetarch-nm
2697             ranlib=$targetarch-ranlib
2698             $echo 'extern int foo;' > try.c
2699             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2700             shift
2701             if $test $# -gt 0; then
2702                 incpth="$incpth $*"
2703                 incpth="`$echo $incpth|$sed 's/^ //'`"
2704                 echo "Guessing incpth '$incpth'." >&4
2705                 for i in $*; do
2706                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2707                     if $test -d $j; then
2708                         libpth="$libpth $j"
2709                     fi
2710                 done   
2711                 libpth="`$echo $libpth|$sed 's/^ //'`"
2712                 echo "Guessing libpth '$libpth'." >&4
2713             fi
2714             $rm -f try.c
2715             ;;
2716         esac
2717         case "$targetarch" in
2718         '') echo "Targetarch not defined." >&4; croak=y ;;
2719         *)  echo "Using targetarch $targetarch." >&4 ;;
2720         esac
2721         case "$incpth" in
2722         '') echo "Incpth not defined." >&4; croak=y ;;
2723         *)  echo "Using incpth '$incpth'." >&4 ;;
2724         esac
2725         case "$libpth" in
2726         '') echo "Libpth not defined." >&4; croak=y ;;
2727         *)  echo "Using libpth '$libpth'." >&4 ;;
2728         esac
2729         case "$usrinc" in
2730         '') for i in $incpth; do
2731                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2732                     usrinc=$i
2733                     echo "Guessing usrinc $usrinc." >&4
2734                     break
2735                 fi
2736             done
2737             case "$usrinc" in
2738             '') echo "Usrinc not defined." >&4; croak=y ;;
2739             esac
2740             ;;
2741         *)  echo "Using usrinc $usrinc." >&4 ;;
2742         esac
2743         case "$targethost" in
2744         '') echo "Targethost not defined." >&4; croak=y ;;
2745         *)  echo "Using targethost $targethost." >&4
2746         esac
2747         locincpth=' '
2748         loclibpth=' '
2749         case "$croak" in
2750         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2751         esac
2752         case "$src" in
2753         /*) run=$src/Cross/run
2754             targetmkdir=$src/Cross/mkdir
2755             to=$src/Cross/to
2756             from=$src/Cross/from
2757             ;;
2758         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2759             run=$pwd/Cross/run
2760             targetmkdir=$pwd/Cross/mkdir
2761             to=$pwd/Cross/to
2762             from=$pwd/Cross/from
2763             ;;
2764         esac
2765         case "$targetrun" in
2766         '') targetrun=ssh ;;
2767         esac
2768         case "$targetto" in
2769         '') targetto=scp ;;
2770         esac
2771         case "$targetfrom" in
2772         '') targetfrom=scp ;;
2773         esac
2774         run=$run-$targetrun
2775         to=$to-$targetto
2776         from=$from-$targetfrom
2777         case "$targetdir" in
2778         '')  targetdir=/tmp
2779              echo "Guessing targetdir $targetdir." >&4
2780              ;;
2781         esac
2782         case "$targetuser" in
2783         '')  targetuser=root
2784              echo "Guessing targetuser $targetuser." >&4
2785              ;;
2786         esac
2787         case "$targetfrom" in
2788         scp)    q=-q ;;
2789         *)      q='' ;;
2790         esac
2791         case "$targetrun" in
2792         ssh|rsh)
2793             cat >$run <<EOF
2794 #!/bin/sh
2795 case "\$1" in
2796 -cwd)
2797   shift
2798   cwd=\$1
2799   shift
2800   ;;
2801 esac
2802 case "\$cwd" in
2803 '') cwd=$targetdir ;;
2804 esac
2805 exe=\$1
2806 shift
2807 if $test ! -f \$exe.xok; then
2808   $to \$exe
2809   $touch \$exe.xok
2810 fi
2811 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2812 EOF
2813             ;;
2814         *)  echo "Unknown targetrun '$targetrun'" >&4
2815             exit 1
2816             ;;
2817         esac
2818         case "$targetmkdir" in
2819         */Cross/mkdir)
2820             cat >$targetmkdir <<EOF
2821 #!/bin/sh
2822 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2823 EOF
2824             $chmod a+rx $targetmkdir
2825             ;;
2826         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2827             exit 1
2828             ;;
2829         esac
2830         case "$targetto" in
2831         scp|rcp)
2832             cat >$to <<EOF
2833 #!/bin/sh
2834 for f in \$@
2835 do
2836   case "\$f" in
2837   /*)
2838     $targetmkdir \`dirname \$f\`
2839     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2840     ;;
2841   *)
2842     $targetmkdir $targetdir/\`dirname \$f\`
2843     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2844     ;;
2845   esac
2846 done
2847 exit 0
2848 EOF
2849             ;;
2850         cp) cat >$to <<EOF
2851 #!/bin/sh
2852 for f in \$@
2853 do
2854   case "\$f" in
2855   /*)
2856     $mkdir -p $targetdir/\`dirname \$f\`
2857     $cp \$f $targetdir/\$f || exit 1
2858     ;;
2859   *)
2860     $targetmkdir $targetdir/\`dirname \$f\`
2861     $cp \$f $targetdir/\$f || exit 1
2862     ;;
2863   esac
2864 done
2865 exit 0
2866 EOF
2867             ;;
2868         *)  echo "Unknown targetto '$targetto'" >&4
2869             exit 1
2870             ;;
2871         esac
2872         case "$targetfrom" in
2873         scp|rcp)
2874           cat >$from <<EOF
2875 #!/bin/sh
2876 for f in \$@
2877 do
2878   $rm -f \$f
2879   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2880 done
2881 exit 0
2882 EOF
2883             ;;
2884         cp) cat >$from <<EOF
2885 #!/bin/sh
2886 for f in \$@
2887 do
2888   $rm -f \$f
2889   cp $targetdir/\$f . || exit 1
2890 done
2891 exit 0
2892 EOF
2893             ;;
2894         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2895             exit 1
2896             ;;
2897         esac
2898         if $test ! -f $run; then
2899             echo "Target 'run' script '$run' not found." >&4
2900         else
2901             $chmod a+rx $run
2902         fi
2903         if $test ! -f $to; then
2904             echo "Target 'to' script '$to' not found." >&4
2905         else
2906             $chmod a+rx $to
2907         fi
2908         if $test ! -f $from; then
2909             echo "Target 'from' script '$from' not found." >&4
2910         else
2911             $chmod a+rx $from
2912         fi
2913         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2914             exit 1
2915         fi
2916         cat >&4 <<EOF
2917 Using '$run' for remote execution,
2918 and '$from' and '$to'
2919 for remote file transfer.
2920 EOF
2921         ;;
2922 *)      run=''
2923         to=:
2924         from=:
2925         usecrosscompile='undef'
2926         targetarch=''
2927         ;;
2928 esac
2929
2930 : see whether [:lower:] and [:upper:] are supported character classes
2931 echo " "
2932 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2933 ABYZ)
2934         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2935         up='[:upper:]'
2936         low='[:lower:]'
2937         ;;
2938 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2939         # (0xd9 and 0xe2), therefore that is a nice testing point.
2940         if test "X$up" = X -o "X$low" = X; then
2941             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2942             rs) up='[A-Z]'
2943                 low='[a-z]'
2944                 ;;
2945             esac
2946         fi
2947         if test "X$up" = X -o "X$low" = X; then
2948             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2949             rs) up='A-Z'
2950                 low='a-z'
2951                 ;;
2952             esac
2953         fi
2954         if test "X$up" = X -o "X$low" = X; then
2955             case "`echo RS | od -x 2>/dev/null`" in
2956             *D9E2*|*d9e2*)
2957                 echo "Hey, this might be EBCDIC." >&4
2958                 if test "X$up" = X -o "X$low" = X; then
2959                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2960                     rs) up='[A-IJ-RS-Z]'
2961                         low='[a-ij-rs-z]'
2962                         ;;
2963                     esac
2964                 fi
2965                 if test "X$up" = X -o "X$low" = X; then
2966                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2967                     rs) up='A-IJ-RS-Z'
2968                         low='a-ij-rs-z'
2969                         ;;
2970                     esac
2971                 fi
2972                 ;;
2973             esac
2974         fi
2975 esac
2976 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2977 rs)
2978     echo "Using $up and $low to convert case." >&4
2979     ;;
2980 *)
2981     echo "I don't know how to translate letters from upper to lower case." >&4
2982     echo "Your tr is not acting any way I know of." >&4
2983     exit 1
2984     ;;
2985 esac
2986 : set up the translation script tr, must be called with ./tr of course
2987 cat >tr <<EOSC
2988 $startsh
2989 case "\$1\$2" in
2990 '[A-Z][a-z]') exec $tr '$up' '$low';;
2991 '[a-z][A-Z]') exec $tr '$low' '$up';;
2992 esac
2993 exec $tr "\$@"
2994 EOSC
2995 chmod +x tr
2996 $eunicefix tr
2997
2998 : Try to determine whether config.sh was made on this system
2999 case "$config_sh" in
3000 '')
3001 myuname=`$uname -a 2>/dev/null`
3002 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3003 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3004 # because the A-Z/a-z are not consecutive.
3005 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3006         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3007 newmyuname="$myuname"
3008 dflt=n
3009 case "$knowitall" in
3010 '')
3011         if test -f ../config.sh; then
3012                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3013                         eval "`grep myuname= ../config.sh`"
3014                 fi
3015                 if test "X$myuname" = "X$newmyuname"; then
3016                         dflt=y
3017                 fi
3018         fi
3019         ;;
3020 *) dflt=y;;
3021 esac
3022
3023 : Get old answers from old config file if Configure was run on the
3024 : same system, otherwise use the hints.
3025 hint=default
3026 cd ..
3027 if test -f config.sh; then
3028         echo " "
3029         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3030         . UU/myread
3031         case "$ans" in
3032         n*|N*) echo "OK, I'll ignore it."
3033                 mv config.sh config.sh.old
3034                 myuname="$newmyuname"
3035                 ;;
3036         *)  echo "Fetching default answers from your old config.sh file..." >&4
3037                 tmp_n="$n"
3038                 tmp_c="$c"
3039                 tmp_sh="$sh"
3040                 . ./config.sh
3041                 cp config.sh UU
3042                 n="$tmp_n"
3043                 c="$tmp_c"
3044                 : Older versions did not always set $sh.  Catch re-use of such
3045                 : an old config.sh.
3046                 case "$sh" in
3047                 '') sh="$tmp_sh" ;;
3048                 esac
3049                 hint=previous
3050                 ;;
3051         esac
3052 fi
3053 . ./UU/checkcc
3054 if test ! -f config.sh; then
3055         $cat <<EOM
3056
3057 First time through, eh?  I have some defaults handy for some systems
3058 that need some extra help getting the Configure answers right:
3059
3060 EOM
3061         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3062         dflt=''
3063         : Half the following guesses are probably wrong... If you have better
3064         : tests or hints, please send them to perlbug@perl.org
3065         : The metaconfig authors would also appreciate a copy...
3066         $test -f /irix && osname=irix
3067         $test -f /xenix && osname=sco_xenix
3068         $test -f /dynix && osname=dynix
3069         $test -f /dnix && osname=dnix
3070         $test -f /lynx.os && osname=lynxos
3071         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3072         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3073         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3074         $test -f /bin/mips && /bin/mips && osname=mips
3075         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3076                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3077         $test -d /usr/apollo/bin && osname=apollo
3078         $test -f /etc/saf/_sactab && osname=svr4
3079         $test -d /usr/include/minix && osname=minix
3080         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3081         if $test -d /MachTen -o -d /MachTen_Folder; then
3082                 osname=machten
3083                 if $test -x /sbin/version; then
3084                         osvers=`/sbin/version | $awk '{print $2}' |
3085                         $sed -e 's/[A-Za-z]$//'`
3086                 elif $test -x /usr/etc/version; then
3087                         osvers=`/usr/etc/version | $awk '{print $2}' |
3088                         $sed -e 's/[A-Za-z]$//'`
3089                 else
3090                         osvers="$2.$3"
3091                 fi
3092         fi
3093
3094         $test -f /sys/posix.dll &&
3095                 $test -f /usr/bin/what &&
3096                 set X `/usr/bin/what /sys/posix.dll` &&
3097                 $test "$3" = UWIN &&
3098                 osname=uwin &&
3099                 osvers="$5"
3100
3101         if $test -f $uname; then
3102                 set X $myuname
3103                 shift
3104
3105                 case "$5" in
3106                 fps*) osname=fps ;;
3107                 mips*)
3108                         case "$4" in
3109                         umips) osname=umips ;;
3110                         *) osname=mips ;;
3111                         esac;;
3112                 [23]100) osname=mips ;;
3113                 next*) osname=next ;;
3114                 i386*)
3115                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3116                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3117                                 osname='sco'
3118                                 osvers=$tmp
3119                         elif $test -f /etc/kconfig; then
3120                                 osname=isc
3121                                 if test "$lns" = "$ln -s"; then
3122                                         osvers=4
3123                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3124                                         osvers=3
3125                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3126                                         osvers=2
3127                                 fi
3128                         fi
3129                         tmp=''
3130                         ;;
3131                 pc*)
3132                         if test -n "$DJGPP"; then
3133                                 osname=dos
3134                                 osvers=djgpp
3135                         fi
3136                         ;;
3137                 esac
3138
3139                 case "$1" in
3140                 aix) osname=aix
3141                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3142                         case "$tmp" in
3143                         # oslevel can fail with:
3144                         # oslevel: Unable to acquire lock.
3145                         *not\ found) osvers="$4"."$3" ;;
3146                         '<3240'|'<>3240') osvers=3.2.0 ;;
3147                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3148                         '=3250'|'>3250') osvers=3.2.5 ;;
3149                         *) osvers=$tmp;;
3150                         esac
3151                         ;;
3152                 bsd386) osname=bsd386
3153                         osvers=`$uname -r`
3154                         ;;
3155                 cygwin*) osname=cygwin
3156                         osvers="$3"
3157                         ;;
3158                 *dc.osx) osname=dcosx
3159                         osvers="$3"
3160                         ;;
3161                 dnix) osname=dnix
3162                         osvers="$3"
3163                         ;;
3164                 domainos) osname=apollo
3165                         osvers="$3"
3166                         ;;
3167                 dgux)   osname=dgux
3168                         osvers="$3"
3169                         ;;
3170                 dragonfly) osname=dragonfly
3171                         osvers="$3"
3172                         ;;
3173                 dynixptx*) osname=dynixptx
3174                         osvers=`echo "$4"|sed 's/^v//'`
3175                         ;;
3176                 freebsd) osname=freebsd
3177                         osvers="$3" ;;
3178                 genix)  osname=genix ;;
3179                 gnu)    osname=gnu
3180                         osvers="$3" ;;
3181                 hp*)    osname=hpux
3182                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3183                         ;;
3184                 irix*)  osname=irix
3185                         case "$3" in
3186                         4*) osvers=4 ;;
3187                         5*) osvers=5 ;;
3188                         *)      osvers="$3" ;;
3189                         esac
3190                         ;;
3191                 linux)  osname=linux
3192                         case "$3" in
3193                         *)      osvers="$3" ;;
3194                         esac
3195                         ;;
3196                 MiNT)   osname=mint
3197                         ;;
3198                 netbsd*) osname=netbsd
3199                         osvers="$3"
3200                         ;;
3201                 news-os) osvers="$3"
3202                         case "$3" in
3203                         4*) osname=newsos4 ;;
3204                         *) osname=newsos ;;
3205                         esac
3206                         ;;
3207                 next*) osname=next ;;
3208                 nonstop-ux) osname=nonstopux ;;
3209                 openbsd) osname=openbsd
3210                         osvers="$3"
3211                         ;;
3212                 os2)    osname=os2
3213                         osvers="$4"
3214                         ;;
3215                 POSIX-BC | posix-bc ) osname=posix-bc
3216                         osvers="$3"
3217                         ;;
3218                 powerux | power_ux | powermax_os | powermaxos | \
3219                 powerunix | power_unix) osname=powerux
3220                         osvers="$3"
3221                         ;;
3222                 qnx) osname=qnx
3223                         osvers="$4"
3224                         ;;
3225                 solaris) osname=solaris
3226                         case "$3" in
3227                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3228                         *)      osvers="$3" ;;
3229                         esac
3230                         ;;
3231                 sunos) osname=sunos
3232                         case "$3" in
3233                         5*) osname=solaris
3234                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3235                         *)      osvers="$3" ;;
3236                         esac
3237                         ;;
3238                 titanos) osname=titanos
3239                         case "$3" in
3240                         1*) osvers=1 ;;
3241                         2*) osvers=2 ;;
3242                         3*) osvers=3 ;;
3243                         4*) osvers=4 ;;
3244                         *)      osvers="$3" ;;
3245                         esac
3246                         ;;
3247                 ultrix) osname=ultrix
3248                         osvers="$3"
3249                         ;;
3250                 osf1|mls+)      case "$5" in
3251                                 alpha)
3252                                         osname=dec_osf
3253                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3254                                         case "$osvers" in
3255                                         [1-9].[0-9]*) ;;
3256                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3257                                         esac
3258                                         ;;
3259                         hp*)    osname=hp_osf1  ;;
3260                         mips)   osname=mips_osf1 ;;
3261                         esac
3262                         ;;
3263                 # UnixWare 7.1.2 is known as Open UNIX 8
3264                 openunix|unixware) osname=svr5
3265                         osvers="$4"
3266                         ;;
3267                 uts)    osname=uts
3268                         osvers="$3"
3269                         ;;
3270                 vos) osvers="$3"
3271                         ;;
3272                 $2) case "$osname" in
3273                         *isc*) ;;
3274                         *freebsd*) ;;
3275                         svr*)
3276                                 : svr4.x or possibly later
3277                                 case "svr$3" in
3278                                 ${osname}*)
3279                                         osname=svr$3
3280                                         osvers=$4
3281                                         ;;
3282                                 esac
3283                                 case "$osname" in
3284                                 svr4.0)
3285                                         : Check for ESIX
3286                                         if test -f /stand/boot ; then
3287                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3288                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3289                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3290                                                         if test -n "$isesix"; then
3291                                                                 osname=esix4
3292                                                         fi
3293                                                 fi
3294                                         fi
3295                                         ;;
3296                                 esac
3297                                 ;;
3298                         *)      if test -f /etc/systemid; then
3299                                         osname=sco
3300                                         set `echo $3 | $sed 's/\./ /g'` $4
3301                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3302                                                 osvers=$1.$2.$3
3303                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3304                                                 osvers=$1.$2
3305                                         elif $test -f $src/hints/sco_$1.sh; then
3306                                                 osvers=$1
3307                                         fi
3308                                 else
3309                                         case "$osname" in
3310                                         '') : Still unknown.  Probably a generic Sys V.
3311                                                 osname="sysv"
3312                                                 osvers="$3"
3313                                                 ;;
3314                                         esac
3315                                 fi
3316                                 ;;
3317                         esac
3318                         ;;
3319                 *)      case "$osname" in
3320                         '') : Still unknown.  Probably a generic BSD.
3321                                 osname="$1"
3322                                 osvers="$3"
3323                                 ;;
3324                         esac
3325                         ;;
3326                 esac
3327         else
3328                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3329                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3330                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3331                                 osname=news_os
3332                         fi
3333                         $rm -f UU/kernel.what
3334                 elif test -d c:/. -o -n "$is_os2" ; then
3335                         set X $myuname
3336                         osname=os2
3337                         osvers="$5"
3338                 fi
3339         fi
3340
3341         case "$targetarch" in
3342         '') ;;
3343         *)  hostarch=$osname
3344             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3345             osvers=''
3346             ;;
3347         esac
3348
3349         : Now look for a hint file osname_osvers, unless one has been
3350         : specified already.
3351         case "$hintfile" in
3352         ''|' ')
3353                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3354                 : Also try without trailing minor version numbers.
3355                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3356                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3357                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3358                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3359                 case "$file" in
3360                 '') dflt=none ;;
3361                 *)  case "$osvers" in
3362                         '') dflt=$file
3363                                 ;;
3364                         *)  if $test -f $src/hints/$file.sh ; then
3365                                         dflt=$file
3366                                 elif $test -f $src/hints/$xfile.sh ; then
3367                                         dflt=$xfile
3368                                 elif $test -f $src/hints/$xxfile.sh ; then
3369                                         dflt=$xxfile
3370                                 elif $test -f $src/hints/$xxxfile.sh ; then
3371                                         dflt=$xxxfile
3372                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3373                                         dflt=$xxxxfile
3374                                 elif $test -f "$src/hints/${osname}.sh" ; then
3375                                         dflt="${osname}"
3376                                 else
3377                                         dflt=none
3378                                 fi
3379                                 ;;
3380                         esac
3381                         ;;
3382                 esac
3383                 if $test -f Policy.sh ; then
3384                         case "$dflt" in
3385                         *Policy*) ;;
3386                         none) dflt="Policy" ;;
3387                         *) dflt="Policy $dflt" ;;
3388                         esac
3389                 fi
3390                 ;;
3391         *)
3392                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3393                 ;;
3394         esac
3395
3396         if $test -f Policy.sh ; then
3397                 $cat <<EOM
3398
3399 There's also a Policy hint file available, which should make the
3400 site-specific (policy) questions easier to answer.
3401 EOM
3402
3403         fi
3404
3405         $cat <<EOM
3406
3407 You may give one or more space-separated answers, or "none" if appropriate.
3408 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3409 previous run of Configure, you may specify it as well as or instead of
3410 OS-specific hints.  If hints are provided for your OS, you should use them:
3411 although Perl can probably be built without hints on many platforms, using
3412 hints often improve performance and may enable features that Configure can't
3413 set up on its own. If there are no hints that match your OS, specify "none";
3414 DO NOT give a wrong version or a wrong OS.
3415
3416 EOM
3417
3418         rp="Which of these apply, if any?"
3419         . UU/myread
3420         tans=$ans
3421         for file in $tans; do
3422                 if $test X$file = XPolicy -a -f Policy.sh; then
3423                         . Policy.sh
3424                         $cat Policy.sh >> UU/config.sh
3425                 elif $test -f $src/hints/$file.sh; then
3426                         . $src/hints/$file.sh
3427                         $cat $src/hints/$file.sh >> UU/config.sh
3428                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3429                         : nothing
3430                 else
3431                         : Give one chance to correct a possible typo.
3432                         echo "$file.sh does not exist"
3433                         dflt=$file
3434                         rp="hint to use instead?"
3435                         . UU/myread
3436                         for file in $ans; do
3437                                 if $test -f "$src/hints/$file.sh"; then
3438                                         . $src/hints/$file.sh
3439                                         $cat $src/hints/$file.sh >> UU/config.sh
3440                                 elif $test X$ans = X -o X$ans = Xnone ; then
3441                                         : nothing
3442                                 else
3443                                         echo "$file.sh does not exist -- ignored."
3444                                 fi
3445                         done
3446                 fi
3447         done
3448
3449         hint=recommended
3450         : Remember our hint file for later.
3451         if $test -f "$src/hints/$file.sh" ; then
3452                 hintfile="$file"
3453         else
3454                 hintfile=''
3455         fi
3456 fi
3457 cd UU
3458 ;;
3459 *)
3460         echo " "
3461         echo "Fetching default answers from $config_sh..." >&4
3462         tmp_n="$n"
3463         tmp_c="$c"
3464         cd ..
3465         cp $config_sh config.sh 2>/dev/null
3466         chmod +w config.sh
3467         . ./config.sh
3468         cd UU
3469         cp ../config.sh .
3470         n="$tmp_n"
3471         c="$tmp_c"
3472         hint=previous
3473         ;;
3474 esac
3475 test "$override" && . ./optdef.sh
3476
3477 : Restore computed paths
3478 for file in $loclist $trylist; do
3479         eval $file="\$_$file"
3480 done
3481
3482 cat << EOM
3483
3484 Configure uses the operating system name and version to set some defaults.
3485 The default value is probably right if the name rings a bell. Otherwise,
3486 since spelling matters for me, either accept the default or answer "none"
3487 to leave it blank.
3488
3489 EOM
3490 case "$osname" in
3491         ''|' ')
3492                 case "$hintfile" in
3493                 ''|' '|none) dflt=none ;;
3494                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3495                 esac
3496                 ;;
3497         *) dflt="$osname" ;;
3498 esac
3499 rp="Operating system name?"
3500 . ./myread
3501 case "$ans" in
3502 none)  osname='' ;;
3503 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3504 esac
3505 echo " "
3506 case "$osvers" in
3507         ''|' ')
3508                 case "$hintfile" in
3509                 ''|' '|none) dflt=none ;;
3510                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3511                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3512                         case "$dflt" in
3513                         ''|' ') dflt=none ;;
3514                         esac
3515                         ;;
3516                 esac
3517                 ;;
3518         *) dflt="$osvers" ;;
3519 esac
3520 rp="Operating system version?"
3521 . ./myread
3522 case "$ans" in
3523 none)  osvers='' ;;
3524 *) osvers="$ans" ;;
3525 esac
3526
3527
3528 . ./posthint.sh
3529
3530 : who configured the system
3531 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3532 case "$cf_by" in
3533 "")
3534         cf_by=`(logname) 2>/dev/null`
3535         case "$cf_by" in
3536         "")
3537                 cf_by=`(whoami) 2>/dev/null`
3538                 case "$cf_by" in
3539                 "") cf_by=unknown ;;
3540                 esac ;;
3541         esac ;;
3542 esac
3543
3544 : decide how portable to be.  Allow command line overrides.
3545 case "$d_portable" in
3546 "$undef") ;;
3547 *)      d_portable="$define" ;;
3548 esac
3549
3550 : set up shell script to do ~ expansion
3551 cat >filexp <<EOSS
3552 $startsh
3553 : expand filename
3554 case "\$1" in
3555  ~/*|~)
3556         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3557         ;;
3558  ~*)
3559         if $test -f /bin/csh; then
3560                 /bin/csh -f -c "glob \$1"
3561                 failed=\$?
3562                 echo ""
3563                 exit \$failed
3564         else
3565                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3566                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3567                 if $test ! -d "\$dir"; then
3568                         me=\`basename \$0\`
3569                         echo "\$me: can't locate home directory for: \$name" >&2
3570                         exit 1
3571                 fi
3572                 case "\$1" in
3573                 */*)
3574                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3575                         ;;
3576                 *)
3577                         echo \$dir
3578                         ;;
3579                 esac
3580         fi
3581         ;;
3582 *)
3583         echo \$1
3584         ;;
3585 esac
3586 EOSS
3587 chmod +x filexp
3588 $eunicefix filexp
3589
3590 : now set up to get a file name
3591 cat <<EOS >getfile
3592 $startsh
3593 EOS
3594 cat <<'EOSC' >>getfile
3595 tilde=''
3596 fullpath=''
3597 already=''
3598 skip=''
3599 none_ok=''
3600 exp_file=''
3601 nopath_ok=''
3602 orig_rp="$rp"
3603 orig_dflt="$dflt"
3604 case "$gfpth" in
3605 '') gfpth='.' ;;
3606 esac
3607
3608 case "$fn" in
3609 *\(*)
3610         : getfile will accept an answer from the comma-separated list
3611         : enclosed in parentheses even if it does not meet other criteria.
3612         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3613         fn=`echo $fn | sed 's/(.*)//'`
3614         ;;
3615 esac
3616
3617 case "$fn" in
3618 *:*)
3619         loc_file=`expr $fn : '.*:\(.*\)'`
3620         fn=`expr $fn : '\(.*\):.*'`
3621         ;;
3622 esac
3623
3624 case "$fn" in
3625 *~*) tilde=true;;
3626 esac
3627 case "$fn" in
3628 */*) fullpath=true;;
3629 esac
3630 case "$fn" in
3631 *+*) skip=true;;
3632 esac
3633 case "$fn" in
3634 *n*) none_ok=true;;
3635 esac
3636 case "$fn" in
3637 *e*) exp_file=true;;
3638 esac
3639 case "$fn" in
3640 *p*) nopath_ok=true;;
3641 esac
3642
3643 case "$fn" in
3644 *f*) type='File';;
3645 *d*) type='Directory';;
3646 *l*) type='Locate';;
3647 esac
3648
3649 what="$type"
3650 case "$what" in
3651 Locate) what='File';;
3652 esac
3653
3654 case "$exp_file" in
3655 '')
3656         case "$d_portable" in
3657         "$define") ;;
3658         *) exp_file=true;;
3659         esac
3660         ;;
3661 esac
3662
3663 cd ..
3664 while test "$type"; do
3665         redo=''
3666         rp="$orig_rp"
3667         dflt="$orig_dflt"
3668         case "$tilde" in
3669         true) rp="$rp (~name ok)";;
3670         esac
3671         . UU/myread
3672         if test -f UU/getfile.ok && \
3673                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3674         then
3675                 value="$ans"
3676                 ansexp="$ans"
3677                 break
3678         fi
3679         case "$ans" in
3680         none)
3681                 value=''
3682                 ansexp=''
3683                 case "$none_ok" in
3684                 true) type='';;
3685                 esac
3686                 ;;
3687         *)
3688                 case "$tilde" in
3689                 '') value="$ans"
3690                         ansexp="$ans";;
3691                 *)
3692                         value=`UU/filexp $ans`
3693                         case $? in
3694                         0)
3695                                 if test "$ans" != "$value"; then
3696                                         echo "(That expands to $value on this system.)"
3697                                 fi
3698                                 ;;
3699                         *) value="$ans";;
3700                         esac
3701                         ansexp="$value"
3702                         case "$exp_file" in
3703                         '') value="$ans";;
3704                         esac
3705                         ;;
3706                 esac
3707                 case "$fullpath" in
3708                 true)
3709                         case "$ansexp" in
3710                         /*) value="$ansexp" ;;
3711                         [a-zA-Z]:/*) value="$ansexp" ;;
3712                         *)
3713                                 redo=true
3714                                 case "$already" in
3715                                 true)
3716                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3717                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3718                                         ;;
3719                                 *)
3720                                 echo "Please give a full path name, starting with slash." >&4
3721                                         case "$tilde" in
3722                                         true)
3723                                 echo "Note that using ~name is ok provided it expands well." >&4
3724                                                 already=true
3725                                                 ;;
3726                                         esac
3727                                 esac
3728                                 ;;
3729                         esac
3730                         ;;
3731                 esac
3732                 case "$redo" in
3733                 '')
3734                         case "$type" in
3735                         File)
3736                                 for fp in $gfpth; do
3737                                         if test "X$fp" = X.; then
3738                                             pf="$ansexp"
3739                                         else    
3740                                             pf="$fp/$ansexp"
3741                                         fi
3742                                         if test -f "$pf"; then
3743                                                 type=''
3744                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3745                                         then
3746                                                 echo "($value is not a plain file, but that's ok.)"
3747                                                 type=''
3748                                         fi
3749                                         if test X"$type" = X; then
3750                                             value="$pf"
3751                                             break
3752                                         fi
3753                                 done
3754                                 ;;
3755                         Directory)
3756                                 for fp in $gfpth; do
3757                                         if test "X$fp" = X.; then
3758                                             dir="$ans"
3759                                             direxp="$ansexp"
3760                                         else    
3761                                             dir="$fp/$ansexp"
3762                                             direxp="$fp/$ansexp"
3763                                         fi
3764                                         if test -d "$direxp"; then
3765                                                 type=''
3766                                                 value="$dir"
3767                                                 break
3768                                         fi
3769                                 done
3770                                 ;;
3771                         Locate)
3772                                 if test -d "$ansexp"; then
3773                                         echo "(Looking for $loc_file in directory $value.)"
3774                                         value="$value/$loc_file"
3775                                         ansexp="$ansexp/$loc_file"
3776                                 fi
3777                                 if test -f "$ansexp"; then
3778                                         type=''
3779                                 fi
3780                                 case "$nopath_ok" in
3781                                 true)   case "$value" in
3782                                         */*) ;;
3783                                         *)      echo "Assuming $value will be in people's path."
3784                                                 type=''
3785                                                 ;;
3786                                         esac
3787                                         ;;
3788                                 esac
3789                                 ;;
3790                         esac
3791
3792                         case "$skip" in
3793                         true) type='';
3794                         esac
3795
3796                         case "$type" in
3797                         '') ;;
3798                         *)
3799                                 if test "$fastread" = yes; then
3800                                         dflt=y
3801                                 else
3802                                         dflt=n
3803                                 fi
3804                                 rp="$what $value doesn't exist.  Use that name anyway?"
3805                                 . UU/myread
3806                                 dflt=''
3807                                 case "$ans" in
3808                                 y*) type='';;
3809                                 *) echo " ";;
3810                                 esac
3811                                 ;;
3812                         esac
3813                         ;;
3814                 esac
3815                 ;;
3816         esac
3817 done
3818 cd UU
3819 ans="$value"
3820 rp="$orig_rp"
3821 dflt="$orig_dflt"
3822 rm -f getfile.ok
3823 test "X$gfpthkeep" != Xy && gfpth=""
3824 EOSC
3825
3826 : determine root of directory hierarchy where package will be installed.
3827 case "$prefix" in
3828 '')
3829         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3830         ;;
3831 *?/)
3832         dflt=`echo "$prefix" | sed 's/.$//'`
3833         ;;
3834 *)
3835         dflt="$prefix"
3836         ;;
3837 esac
3838 $cat <<EOM
3839
3840 By default, $package will be installed in $dflt/bin, manual pages
3841 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3842 installation directories. Typically this is something like /usr/local.
3843 If you wish to have binaries under /usr/bin but other parts of the
3844 installation under /usr/local, that's ok: you will be prompted
3845 separately for each of the installation directories, the prefix being
3846 only used to set the defaults.
3847
3848 EOM
3849 fn=d~
3850 rp='Installation prefix to use?'
3851 . ./getfile
3852 oldprefix=''
3853 case "$prefix" in
3854 '') ;;
3855 *)
3856         case "$ans" in
3857         "$prefix") ;;
3858         *) oldprefix="$prefix";;
3859         esac
3860         ;;
3861 esac
3862 prefix="$ans"
3863 prefixexp="$ansexp"
3864
3865 case "$afsroot" in
3866 '')     afsroot=/afs ;;
3867 *)      afsroot=$afsroot ;;
3868 esac
3869
3870 : is AFS running?
3871 echo " "
3872 case "$afs" in
3873 $define|true)   afs=true ;;
3874 $undef|false)   afs=false ;;
3875 *)      if test -d $afsroot; then
3876                 afs=true
3877         else
3878                 afs=false
3879         fi
3880         ;;
3881 esac
3882 if $afs; then
3883         echo "AFS may be running... I'll be extra cautious then..." >&4
3884 else
3885         echo "AFS does not seem to be running..." >&4
3886 fi
3887
3888 : determine installation prefix for where package is to be installed.
3889 if $afs; then 
3890 $cat <<EOM
3891
3892 Since you are running AFS, I need to distinguish the directory in which
3893 files will reside from the directory in which they are installed (and from
3894 which they are presumably copied to the former directory by occult means).
3895
3896 EOM
3897         case "$installprefix" in
3898         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3899         *) dflt="$installprefix";;
3900         esac
3901 else
3902 $cat <<EOM
3903
3904 In some special cases, particularly when building $package for distribution,
3905 it is convenient to distinguish the directory in which files should be
3906 installed from the directory ($prefix) in which they will
3907 eventually reside.  For most users, these two directories are the same.
3908
3909 EOM
3910         case "$installprefix" in
3911         '') dflt=$prefix ;;
3912         *) dflt=$installprefix;;
3913         esac
3914 fi
3915 fn=d~
3916 rp='What installation prefix should I use for installing files?'
3917 . ./getfile
3918 installprefix="$ans"
3919 installprefixexp="$ansexp"
3920
3921 : Perform the prefixexp/installprefixexp correction if necessary
3922 cat <<EOS >installprefix
3923 $startsh
3924 EOS
3925 cat <<'EOSC' >>installprefix
3926 : Change installation prefix, if necessary.
3927 if $test X"$prefix" != X"$installprefix"; then
3928     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3929 else
3930     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3931 fi
3932 EOSC
3933 chmod +x installprefix
3934 $eunicefix installprefix
3935
3936 : Set variables such as privlib and privlibexp from the output of ./getfile
3937 : performing the prefixexp/installprefixexp correction if necessary.
3938 cat <<EOS >setprefixvar
3939 $startsh
3940 EOS
3941 cat <<'EOSC' >>setprefixvar
3942 eval "${prefixvar}=\"\$ans\""
3943 eval "${prefixvar}exp=\"\$ansexp\""
3944 . ./installprefix
3945 EOSC
3946 chmod +x setprefixvar
3947 $eunicefix setprefixvar
3948
3949 : set up the script used to warn in case of inconsistency
3950 cat <<EOS >whoa
3951 $startsh
3952 EOS
3953 cat <<'EOSC' >>whoa
3954 dflt=y
3955 case "$hint" in
3956     recommended)
3957         case "$hintfile" in
3958         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3959                 ;;
3960         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
3961                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
3962                 ;;
3963         esac
3964         ;;
3965     *)  echo " "
3966         echo "*** WHOA THERE!!! ***" >&4
3967         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3968         ;;
3969 esac
3970 rp="    Keep the $hint value?"
3971 . ./myread
3972 case "$ans" in
3973 y) td=$was; tu=$was;;
3974 esac
3975 EOSC
3976
3977 : function used to set $1 to $val
3978 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3979 case "$val$was" in
3980 $define$undef) . ./whoa; eval "$var=\$td";;
3981 $undef$define) . ./whoa; eval "$var=\$tu";;
3982 *) eval "$var=$val";;
3983 esac'
3984
3985 case "$usesocks" in
3986 $define|true|[yY]*)     dflt='y';;
3987 *) dflt='n';;
3988 esac
3989 cat <<EOM
3990
3991 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3992 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3993 to use the PerlIO abstraction layer, this will be implicitly selected.
3994
3995 If this doesn't make any sense to you, just accept the default '$dflt'.
3996 EOM
3997 rp='Build Perl for SOCKS?'
3998 . ./myread
3999 case "$ans" in
4000 y|Y)    val="$define" ;;     
4001 *)      val="$undef" ;;
4002 esac
4003 set usesocks
4004 eval $setvar
4005
4006 case "$usesocks" in
4007 $define|true|[yY]*) useperlio="$define";;
4008 esac
4009
4010 case "$useperlio" in
4011 $define|true|[yY]*|'')  dflt='y';;
4012 *) dflt='n';;
4013 esac
4014 cat <<EOM
4015
4016 Previous version of $package used the standard IO mechanisms as
4017 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4018 alternate IO mechanisms via the PerlIO abstraction layer, but the
4019 stdio mechanism is still available if needed.  The abstraction layer
4020 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4021 Using PerlIO with sfio may cause problems with some extension modules.
4022
4023 If this doesn't make any sense to you, just accept the default '$dflt'.
4024 EOM
4025 rp='Use the PerlIO abstraction layer?'
4026 . ./myread
4027 case "$ans" in
4028 y|Y) 
4029         val="$define"
4030         ;;
4031 *)      
4032         echo "Ok, doing things the stdio way."
4033         val="$undef"
4034         ;;
4035 esac
4036 set useperlio
4037 eval $setvar 
4038
4039 case "$usesocks" in
4040 $define|true|[yY]*)
4041         case "$useperlio" in
4042         $define|true|[yY]*) ;;
4043         *)      cat >&4 <<EOM
4044
4045 You are using the SOCKS proxy protocol library which means that you
4046 should also use the PerlIO layer.  You may be headed for trouble.
4047
4048 EOM
4049                 ;;
4050         esac
4051         ;;
4052 esac
4053
4054         
4055 : get the patchlevel
4056 echo " "
4057 echo "Getting the current patchlevel..." >&4
4058 if $test -r $rsrc/patchlevel.h;then
4059         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4060         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4061         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4062         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4063         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4064         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4065         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
4066 else
4067         revision=0
4068         patchlevel=0
4069         subversion=0
4070         api_revision=0
4071         api_version=0
4072         api_subversion=0
4073         perl_patchlevel=0
4074         $echo "(You do not have patchlevel.h.  Eek.)"
4075 fi
4076 if $test -r $rsrc/.patch ; then
4077         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4078                 perl_patchlevel=`cat $rsrc/.patch`
4079         fi
4080 fi
4081 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4082 version_patchlevel_string="version $patchlevel subversion $subversion"
4083 case "$perl_patchlevel" in
4084 0|'') ;;
4085 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4086 esac
4087
4088 $echo "(You have $package $version_patchlevel_string.)"
4089
4090 case "$osname" in
4091 dos|vms)
4092         : XXX Should be a Configure test for double-dots in filenames.
4093         version=`echo $revision $patchlevel $subversion | \
4094                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4095         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4096                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4097         ;;
4098 *)
4099         version=`echo $revision $patchlevel $subversion | \
4100                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4101         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4102                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4103         ;;
4104 esac
4105 : Special case the 5.005_xx maintenance series, which used 5.005
4106 : without any subversion label as a subdirectory in $sitelib
4107 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4108         api_versionstring='5.005'
4109 fi
4110
4111 case "$usethreads" in
4112 $define|true|[yY]*)     dflt='y';;
4113 *)     # Catch case where user specified ithreads or 5005threads but
4114        # forgot -Dusethreads (A.D. 4/2002)
4115        case "$useithreads$use5005threads" in
4116        *$define*)      
4117                 case "$useperlio" in
4118                 "$define")      dflt='y' ;;
4119                 *)              dflt='n' ;;
4120                 esac
4121                 ;;
4122        *)       dflt='n';;
4123        esac
4124        ;;
4125 esac
4126 cat <<EOM
4127
4128 Perl can be built to take advantage of threads on some systems.
4129 To do so, Configure can be run with -Dusethreads.
4130
4131 Note that Perl built with threading support runs slightly slower
4132 and uses more memory than plain Perl. The current implementation
4133 is believed to be stable, but it is fairly new, and so should be
4134 treated with caution.
4135
4136 If this doesn't make any sense to you, just accept the default '$dflt'.
4137 EOM
4138 rp='Build a threading Perl?'
4139 . ./myread
4140 case "$ans" in
4141 y|Y)    val="$define" ;;
4142 *)      val="$undef" ;;
4143 esac
4144 set usethreads
4145 eval $setvar
4146
4147 if $test $patchlevel -lt 9; then
4148     case "$usethreads" in
4149     $define)
4150         $cat <<EOM
4151
4152 Since release 5.6, Perl has had two different threading implementations,
4153 the newer interpreter-based version (ithreads) with one interpreter per
4154 thread, and the older 5.005 version (5005threads).
4155 The 5005threads version is effectively unmaintained and will probably be
4156 removed in Perl 5.10, so there should be no need to build a Perl using it
4157 unless needed for backwards compatibility with some existing 5.005threads
4158 code.
4159
4160 EOM
4161         : Default to ithreads unless overridden on command line or with
4162         : old config.sh
4163         dflt='y'
4164         case "$use5005threads" in
4165                 $define|true|[yY]*) dflt='n';;
4166         esac
4167         case "$useithreads" in
4168                 $undef|false|[nN]*) dflt='n';;
4169         esac
4170         rp='Use the newer interpreter-based ithreads?'
4171         . ./myread
4172         case "$ans" in
4173         y|Y)    val="$define" ;;
4174         *)      val="$undef" ;;
4175         esac
4176         set useithreads
4177         eval $setvar
4178         : Now set use5005threads to the opposite value.
4179         case "$useithreads" in
4180         $define) val="$undef" ;;
4181         *) val="$define" ;;
4182         esac
4183         set use5005threads
4184         eval $setvar
4185         ;;
4186     *)
4187         useithreads="$undef"
4188         use5005threads="$undef"
4189         ;;
4190     esac
4191
4192     case "$useithreads$use5005threads" in
4193     "$define$define")
4194         $cat >&4 <<EOM
4195
4196 You cannot have both the ithreads and the 5.005 threads enabled
4197 at the same time.  Disabling the 5.005 threads since they are
4198 much less stable than the ithreads.
4199
4200 EOM
4201         use5005threads="$undef"
4202         ;;
4203     esac
4204
4205 else
4206 : perl-5.9.x and later
4207
4208     use5005threads="$undef"
4209     case "$usethreads" in
4210     $define)
4211         : Default to ithreads unless overridden on command line or with
4212         : old config.sh
4213         dflt='y'
4214         case "$useithreads" in
4215                 $undef|false|[nN]*) dflt='n';;
4216         esac
4217         rp='Use the newer interpreter-based ithreads?'
4218         . ./myread
4219         case "$ans" in
4220         y|Y)    val="$define" ;;
4221         *)      val="$undef" ;;
4222         esac
4223         set useithreads
4224         eval $setvar
4225         ;;
4226     *)
4227         useithreads="$undef"
4228         ;;
4229     esac
4230
4231 fi
4232
4233 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4234         cat >&4 <<EOF
4235 ***
4236 *** To build with ithreads you must also use the PerlIO layer.
4237 *** Cannot continue, aborting.
4238 ***
4239 EOF
4240         exit 1
4241 fi
4242
4243 case "$d_oldpthreads" in
4244 '')     : Configure tests would be welcome here.  For now, assume undef.
4245         val="$undef" ;;
4246 *)      val="$d_oldpthreads" ;;
4247 esac
4248 set d_oldpthreads
4249 eval $setvar
4250
4251
4252 : Look for a hint-file generated 'call-back-unit'.  If the
4253 : user has specified that a threading perl is to be built,
4254 : we may need to set or change some other defaults.
4255 if $test -f usethreads.cbu; then
4256     echo "Your platform has some specific hints regarding threaded builds, using them..."
4257     . ./usethreads.cbu
4258 else
4259     case "$usethreads" in
4260         "$define"|true|[yY]*)
4261                 $cat <<EOM
4262 (Your platform does not have any specific hints for threaded builds.
4263  Assuming POSIX threads, then.)
4264 EOM
4265         ;;
4266     esac
4267 fi
4268
4269 cat <<EOM
4270
4271 Perl can be built so that multiple Perl interpreters can coexist
4272 within the same Perl executable.
4273 EOM
4274
4275 case "$useithreads" in
4276 $define)
4277         cat <<EOM
4278 This multiple interpreter support is required for interpreter-based threads.
4279 EOM
4280         val="$define"
4281         ;;
4282 *)      case "$usemultiplicity" in
4283         $define|true|[yY]*)     dflt='y';;
4284         *) dflt='n';;
4285         esac
4286         echo " "
4287         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4288         rp='Build Perl for multiplicity?'
4289         . ./myread
4290         case "$ans" in
4291         y|Y)    val="$define" ;;
4292         *)      val="$undef" ;;
4293         esac
4294         ;;
4295 esac
4296 set usemultiplicity
4297 eval $setvar
4298
4299
4300 case "$usemorebits" in
4301 "$define"|true|[yY]*)
4302         use64bitint="$define"
4303         uselongdouble="$define"
4304         usemorebits="$define"
4305         ;;
4306 *)      usemorebits="$undef"
4307         ;;
4308 esac
4309
4310 : make some quick guesses about what we are up against
4311 echo " "
4312 $echo $n "Hmm...  $c"
4313 echo exit 1 >bsd
4314 echo exit 1 >usg
4315 echo exit 1 >v7
4316 echo exit 1 >osf1
4317 echo exit 1 >eunice
4318 echo exit 1 >xenix
4319 echo exit 1 >venix
4320 echo exit 1 >os2
4321 d_bsd="$undef"
4322 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4323 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4324 then
4325         echo "Looks kind of like an OSF/1 system, but we'll see..."
4326         echo exit 0 >osf1
4327 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4328         xxx=`./loc addbib blurfl $pth`
4329         if $test -f $xxx; then
4330         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4331                 echo exit 0 >bsd
4332                 echo exit 0 >usg
4333         else
4334                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4335                         echo "Looks kind of like an extended USG system, but we'll see..."
4336                 else
4337                         echo "Looks kind of like a USG system, but we'll see..."
4338                 fi
4339                 echo exit 0 >usg
4340         fi
4341 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4342         echo "Looks kind of like a BSD system, but we'll see..."
4343         d_bsd="$define"
4344         echo exit 0 >bsd
4345 else
4346         echo "Looks kind of like a Version 7 system, but we'll see..."
4347         echo exit 0 >v7
4348 fi
4349 case "$eunicefix" in
4350 *unixtovms*)
4351         $cat <<'EOI'
4352 There is, however, a strange, musty smell in the air that reminds me of
4353 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4354 EOI
4355         echo exit 0 >eunice
4356         d_eunice="$define"
4357 : it so happens the Eunice I know will not run shell scripts in Unix format
4358         ;;
4359 *)
4360         echo " "
4361         echo "Congratulations.  You aren't running Eunice."
4362         d_eunice="$undef"
4363         ;;
4364 esac
4365 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4366 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4367 : semicolon as a patch separator
4368 case "$p_" in
4369 :) ;;
4370 *)
4371         $cat <<'EOI'
4372 I have the feeling something is not exactly right, however...don't tell me...
4373 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4374 (Or you may be running DOS with DJGPP.)
4375 EOI
4376         echo exit 0 >os2
4377         ;;
4378 esac
4379 if test -f /xenix; then
4380         echo "Actually, this looks more like a XENIX system..."
4381         echo exit 0 >xenix
4382         d_xenix="$define"
4383 else
4384         echo " "
4385         echo "It's not Xenix..."
4386         d_xenix="$undef"
4387 fi
4388 chmod +x xenix
4389 $eunicefix xenix
4390 if test -f /venix; then
4391         echo "Actually, this looks more like a VENIX system..."
4392         echo exit 0 >venix
4393 else
4394         echo " "
4395         if ./xenix; then
4396                 : null
4397         else
4398                 echo "Nor is it Venix..."
4399         fi
4400 fi
4401 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4402 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4403 $rm -f foo
4404
4405 case "$cc" in
4406 '') dflt=cc;;
4407 *) dflt="$cc";;
4408 esac
4409 rp="Use which C compiler?"
4410 . ./myread
4411 cc="$ans"
4412
4413 : See if they have not cc but they do have gcc
4414 . ./trygcc
4415 : Look for a hint-file generated 'call-back-unit'.  Now that the
4416 : user has specified the compiler, we may need to set or change some
4417 : other defaults.
4418 if $test -f cc.cbu; then
4419     . ./cc.cbu
4420 fi
4421 . ./checkcc
4422
4423 echo " "
4424 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4425 $cat >try.c <<EOM
4426 #include <stdio.h>
4427 int main() {
4428 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4429 #ifdef __VERSION__
4430         printf("%s\n", __VERSION__);
4431 #else
4432         printf("%s\n", "1");
4433 #endif
4434 #endif
4435         return(0);
4436 }
4437 EOM
4438 if $cc -o try $ccflags $ldflags try.c; then
4439         gccversion=`$run ./try`
4440         case "$gccversion" in
4441         '') echo "You are not using GNU cc." ;;
4442         *)  echo "You are using GNU cc $gccversion."
4443             ccname=gcc
4444             ;;
4445         esac
4446 else
4447         echo " "
4448         echo "*** WHOA THERE!!! ***" >&4
4449         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4450         case "$knowitall" in
4451         '')
4452         echo "    You'd better start hunting for one and let me know about it." >&4
4453                 exit 1
4454                 ;;
4455         esac
4456 fi
4457 $rm -f try try.*
4458 case "$gccversion" in
4459 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4460 esac
4461 case "$gccversion" in
4462 '') gccosandvers='' ;;
4463 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4464    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4465    gccshortvers=''
4466    case "$gccosandvers" in
4467    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4468    $osname$osvers) ;; # looking good
4469    $osname*) cat <<EOM >&4
4470
4471 *** WHOA THERE!!! ***
4472
4473     Your gcc has not been compiled for the exact release of
4474     your operating system ($gccosandvers versus $osname$osvers).
4475
4476     In general it is a good idea to keep gcc synchronized with
4477     the operating system because otherwise serious problems
4478     may ensue when trying to compile software, like Perl.
4479
4480     I'm trying to be optimistic here, though, and will continue.
4481     If later during the configuration and build icky compilation
4482     problems appear (headerfile conflicts being the most common
4483     manifestation), I suggest reinstalling the gcc to match
4484     your operating system release.
4485
4486 EOM
4487       ;;
4488    *) gccosandvers='' ;; # failed to parse, better be silent
4489    esac
4490    ;;
4491 esac
4492 case "$ccname" in
4493 '') ccname="$cc" ;;
4494 esac
4495
4496 # gcc 3.* complain about adding -Idirectories that they already know about,
4497 # so we will take those off from locincpth.
4498 case "$gccversion" in
4499 3*)
4500     echo "main(){}">try.c
4501     for incdir in $locincpth; do
4502        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4503              grep '^c[cp]p*[01]: warning: changing search order '`
4504        if test "X$warn" != X; then
4505            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4506        fi
4507     done
4508     $rm -f try try.*
4509 esac
4510
4511 : What should the include directory be ?
4512 echo " "
4513 $echo $n "Hmm...  $c"
4514 dflt='/usr/include'
4515 incpath=''
4516 mips_type=''
4517 if $test -f /bin/mips && /bin/mips; then
4518         echo "Looks like a MIPS system..."
4519         $cat >usr.c <<'EOCP'
4520 #ifdef SYSTYPE_BSD43
4521 /bsd43
4522 #endif
4523 EOCP
4524         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4525                 dflt='/bsd43/usr/include'
4526                 incpath='/bsd43'
4527                 mips_type='BSD 4.3'
4528         else
4529                 mips_type='System V'
4530         fi
4531         $rm -f usr.c usr.out
4532         echo "and you're compiling with the $mips_type compiler and libraries."
4533         xxx_prompt=y
4534         echo "exit 0" >mips
4535 else
4536         echo "Doesn't look like a MIPS system."
4537         xxx_prompt=n
4538         echo "exit 1" >mips
4539 fi
4540 chmod +x mips
4541 $eunicefix mips
4542 case "$usrinc" in
4543 '') ;;
4544 *) dflt="$usrinc";;
4545 esac
4546 case "$xxx_prompt" in
4547 y)      fn=d/
4548         echo " "
4549         rp='Where are the include files you want to use?'
4550         . ./getfile
4551         usrinc="$ans"
4552         ;;
4553 *)      usrinc="$dflt"
4554         ;;
4555 esac
4556
4557 : see how we invoke the C preprocessor
4558 echo " "
4559 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4560 cat <<'EOT' >testcpp.c
4561 #define ABC abc
4562 #define XYZ xyz
4563 ABC.XYZ
4564 EOT
4565 cd ..
4566 if test ! -f cppstdin; then
4567         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4568                 # AIX cc -E doesn't show the absolute headerfile
4569                 # locations but we'll cheat by using the -M flag.
4570                 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
4571         else
4572                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4573         fi
4574 else
4575         echo "Keeping your $hint cppstdin wrapper."
4576 fi
4577 chmod 755 cppstdin
4578 wrapper=`pwd`/cppstdin
4579 ok='false'
4580 cd UU
4581
4582 if $test "X$cppstdin" != "X" && \
4583         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4584         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4585 then
4586         echo "You used to use $cppstdin $cppminus so we'll use that again."
4587         case "$cpprun" in
4588         '') echo "But let's see if we can live without a wrapper..." ;;
4589         *)
4590                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4591                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4592                 then
4593                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4594                         ok='true'
4595                 else
4596                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4597                 fi
4598                 ;;
4599         esac
4600 else
4601         case "$cppstdin" in
4602         '') ;;
4603         *)
4604                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4605                 ;;
4606         esac
4607 fi
4608
4609 if $ok; then
4610         : nothing
4611 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4612         $cc -E <testcpp.c >testcpp.out 2>&1; \
4613         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4614         echo "Yup, it does."
4615         x_cpp="$cc -E"
4616         x_minus='';
4617 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4618         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4619         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4620         echo "Yup, it does."
4621         x_cpp="$cc -E"
4622         x_minus='-';
4623 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4624         $cc -P <testcpp.c >testcpp.out 2>&1; \
4625         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4626         echo "Yipee, that works!"
4627         x_cpp="$cc -P"
4628         x_minus='';
4629 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4630         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4631         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4632         echo "At long last!"
4633         x_cpp="$cc -P"
4634         x_minus='-';
4635 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4636         $cpp <testcpp.c >testcpp.out 2>&1; \
4637         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4638         echo "It works!"
4639         x_cpp="$cpp"
4640         x_minus='';
4641 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4642         $cpp - <testcpp.c >testcpp.out 2>&1; \
4643         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4644         echo "Hooray, it works!  I was beginning to wonder."
4645         x_cpp="$cpp"
4646         x_minus='-';
4647 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4648         $wrapper <testcpp.c >testcpp.out 2>&1; \
4649         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4650         x_cpp="$wrapper"
4651         x_minus=''
4652         echo "Eureka!"
4653 else
4654         dflt=''
4655         rp="No dice.  I can't find a C preprocessor.  Name one:"
4656         . ./myread
4657         x_cpp="$ans"
4658         x_minus=''
4659         $x_cpp <testcpp.c >testcpp.out 2>&1
4660         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4661                 echo "OK, that will do." >&4
4662         else
4663 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4664                 exit 1
4665         fi
4666 fi
4667
4668 case "$ok" in
4669 false)
4670         cppstdin="$x_cpp"
4671         cppminus="$x_minus"
4672         cpprun="$x_cpp"
4673         cpplast="$x_minus"
4674         set X $x_cpp
4675         shift
4676         case "$1" in
4677         "$cpp")
4678                 echo "Perhaps can we force $cc -E using a wrapper..."
4679                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4680                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4681                 then
4682                         echo "Yup, we can."
4683                         cppstdin="$wrapper"
4684                         cppminus='';
4685                 else
4686                         echo "Nope, we'll have to live without it..."
4687                 fi
4688                 ;;
4689         esac
4690         case "$cpprun" in
4691         "$wrapper")
4692                 cpprun=''
4693                 cpplast=''
4694                 ;;
4695         esac
4696         ;;
4697 esac
4698
4699 case "$cppstdin" in
4700 "$wrapper"|'cppstdin') ;;
4701 *) $rm -f $wrapper;;
4702 esac
4703 $rm -f testcpp.c testcpp.out
4704
4705 : Set private lib path
4706 case "$plibpth" in
4707 '') if ./mips; then
4708                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4709         fi;;
4710 esac
4711 case "$libpth" in
4712 ' ') dlist='';;
4713 '') dlist="$loclibpth $plibpth $glibpth";;
4714 *) dlist="$libpth";;
4715 esac
4716
4717 : Now check and see which directories actually exist, avoiding duplicates
4718 libpth=''
4719 for xxx in $dlist
4720 do
4721     if $test -d $xxx; then
4722                 case " $libpth " in
4723                 *" $xxx "*) ;;
4724                 *) libpth="$libpth $xxx";;
4725                 esac
4726     fi
4727 done
4728 $cat <<'EOM'
4729
4730 Some systems have incompatible or broken versions of libraries.  Among
4731 the directories listed in the question below, please remove any you
4732 know not to be holding relevant libraries, and add any that are needed.
4733 Say "none" for none.
4734
4735 EOM
4736 case "$libpth" in
4737 '') dflt='none';;
4738 *)
4739         set X $libpth
4740         shift
4741         dflt=${1+"$@"}
4742         ;;
4743 esac
4744 rp="Directories to use for library searches?"
4745 . ./myread
4746 case "$ans" in
4747 none) libpth=' ';;
4748 *) libpth="$ans";;
4749 esac
4750
4751 : compute shared library extension
4752 case "$so" in
4753 '')
4754         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4755                 dflt='sl'
4756         else
4757                 dflt='so'
4758         fi
4759         ;;
4760 *) dflt="$so";;
4761 esac
4762 $cat <<EOM
4763
4764 On some systems, shared libraries may be available.  Answer 'none' if
4765 you want to suppress searching of shared libraries for the remainder
4766 of this configuration.
4767
4768 EOM
4769 rp='What is the file extension used for shared libraries?'
4770 . ./myread
4771 so="$ans"
4772
4773 : Define several unixisms.
4774 : Hints files or command line option can be used to override them.
4775 : The convoluted testing is in case hints files set either the old
4776 : or the new name.
4777 case "$_exe" in
4778 '')     case "$exe_ext" in
4779         '')     ;;
4780         *)      _exe="$exe_ext" ;;
4781         esac
4782         ;;
4783 esac
4784 case "$_a" in
4785 '')     case "$lib_ext" in
4786     '') _a='.a';;
4787         *)      _a="$lib_ext" ;;
4788         esac
4789         ;;
4790 esac
4791 case "$_o" in
4792 '') case "$obj_ext" in
4793         '')     _o='.o';;
4794         *)      _o="$obj_ext";;
4795         esac
4796         ;;
4797 esac
4798 case "$p_" in
4799 '') case "$path_sep" in
4800         '')     p_=':';;
4801         *)      p_="$path_sep";;
4802         esac
4803         ;;
4804 esac
4805 exe_ext=$_exe
4806 lib_ext=$_a
4807 obj_ext=$_o
4808 path_sep=$p_
4809
4810 : Which makefile gets called first.  This is used by make depend.
4811 case "$firstmakefile" in
4812 '') firstmakefile='makefile';;
4813 esac
4814
4815 case "$ccflags" in
4816 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4817 esac
4818
4819 case "$uselongdouble" in
4820 $define|true|[yY]*)     dflt='y';;
4821 *) dflt='n';;
4822 esac
4823 cat <<EOM
4824
4825 Perl can be built to take advantage of long doubles which
4826 (if available) may give more accuracy and range for floating point numbers.
4827
4828 If this doesn't make any sense to you, just accept the default '$dflt'.
4829 EOM
4830 rp='Try to use long doubles if available?'
4831 . ./myread
4832 case "$ans" in
4833 y|Y)    val="$define"   ;;
4834 *)      val="$undef"    ;;
4835 esac
4836 set uselongdouble
4837 eval $setvar
4838
4839 case "$uselongdouble" in
4840 true|[yY]*) uselongdouble="$define" ;;
4841 esac
4842
4843 : Look for a hint-file generated 'call-back-unit'.  If the
4844 : user has specified that long doubles should be used,
4845 : we may need to set or change some other defaults.
4846 if $test -f uselongdouble.cbu; then
4847     echo "Your platform has some specific hints regarding long doubles, using them..."
4848     . ./uselongdouble.cbu
4849 else
4850     case "$uselongdouble" in
4851         $define)
4852                 $cat <<EOM
4853 (Your platform does not have any specific hints for long doubles.)
4854 EOM
4855         ;;
4856     esac
4857 fi
4858
4859 : Looking for optional libraries
4860 echo " "
4861 echo "Checking for optional libraries..." >&4
4862 case "$libs" in
4863 ' '|'') dflt='';;
4864 *) dflt="$libs";;
4865 esac
4866 case "$libswanted" in
4867 '') libswanted='c_s';;
4868 esac
4869 case "$usesocks" in
4870 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4871 esac
4872 libsfound=''
4873 libsfiles=''
4874 libsdirs=''
4875 libspath=''
4876 for thisdir in $libpth $xlibpth; do
4877   test -d $thisdir && libspath="$libspath $thisdir"
4878 done
4879 for thislib in $libswanted; do
4880         for thisdir in $libspath; do
4881             xxx=''
4882             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4883                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4884                 $test -f "$xxx" && eval $libscheck
4885                 $test -f "$xxx" && libstyle=shared
4886             fi
4887             if test ! -f "$xxx"; then
4888                 xxx=$thisdir/lib$thislib.$so
4889                 $test -f "$xxx" && eval $libscheck
4890                 $test -f "$xxx" && libstyle=shared
4891             fi  
4892             if test ! -f "$xxx"; then
4893                 xxx=$thisdir/lib$thislib$_a
4894                 $test -f "$xxx" && eval $libscheck
4895                 $test -f "$xxx" && libstyle=static
4896             fi
4897             if test ! -f "$xxx"; then
4898                 xxx=$thisdir/$thislib$_a
4899                 $test -f "$xxx" && eval $libscheck
4900                 $test -f "$xxx" && libstyle=static
4901             fi
4902             if test ! -f "$xxx"; then
4903                 xxx=$thisdir/lib${thislib}_s$_a
4904                 $test -f "$xxx" && eval $libscheck
4905                 $test -f "$xxx" && libstyle=static
4906                 $test -f "$xxx" && thislib=${thislib}_s
4907             fi
4908             if test ! -f "$xxx"; then
4909                 xxx=$thisdir/Slib$thislib$_a
4910                 $test -f "$xxx" && eval $libscheck
4911                 $test -f "$xxx" && libstyle=static
4912             fi
4913             if $test -f "$xxx"; then
4914                 case "$libstyle" in
4915                 shared) echo "Found -l$thislib (shared)." ;;
4916                 static) echo "Found -l$thislib." ;;
4917                 *)      echo "Found -l$thislib ($libstyle)." ;;
4918                 esac
4919                 case " $dflt " in
4920                 *"-l$thislib "*);;
4921                 *) dflt="$dflt -l$thislib"
4922                    libsfound="$libsfound $xxx"
4923                    yyy=`basename $xxx`
4924                    libsfiles="$libsfiles $yyy"
4925                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4926                    case " $libsdirs " in
4927                    *" $yyy "*) ;;
4928                    *) libsdirs="$libsdirs $yyy" ;;
4929                    esac
4930                    ;;
4931                 esac
4932                 break
4933             fi  
4934         done
4935         if $test ! -f "$xxx"; then
4936             echo "No -l$thislib."
4937         fi
4938 done
4939 set X $dflt
4940 shift
4941 dflt="$*"
4942 case "$libs" in
4943 '') dflt="$dflt";;
4944 *) dflt="$libs";;
4945 esac
4946 case "$dflt" in
4947 ' '|'') dflt='none';;
4948 esac
4949
4950 $cat <<EOM
4951
4952 In order to compile $package on your machine, a number of libraries
4953 are usually needed.  Include any other special libraries here as well.
4954 Say "none" for none.  The default list is almost always right.
4955 EOM
4956
4957 echo " "
4958 rp="What libraries to use?"
4959 . ./myread
4960 case "$ans" in
4961 none) libs=' ';;
4962 *) libs="$ans";;
4963 esac
4964
4965 : determine optimization, if desired, or use for debug flag also
4966 case "$optimize" in
4967 ' '|$undef) dflt='none';;
4968 '') dflt='-O';;
4969 *) dflt="$optimize";;
4970 esac
4971 $cat <<EOH
4972
4973 By default, $package compiles with the -O flag to use the optimizer.
4974 Alternately, you might want to use the symbolic debugger, which uses
4975 the -g flag (on traditional Unix systems).  Either flag can be
4976 specified here.  To use neither flag, specify the word "none".
4977
4978 EOH
4979 rp="What optimizer/debugger flag should be used?"
4980 . ./myread
4981 optimize="$ans"
4982 case "$optimize" in
4983 'none') optimize=" ";;
4984 esac
4985
4986 : Check what DEBUGGING is required from the command line
4987 : -DEBUGGING      or -DDEBUGGING or
4988 : -DEBUGGING=both                       = -g + -DDEBUGGING
4989 : -DEBUGGING=-g   or -Doptimize=-g      = -g
4990 : -DEBUGGING=none or -UDEBUGGING        =
4991 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
4992 case "$EBUGGING" in
4993 '')     ;;
4994 *)      DEBUGGING=$EBUGGING ;;
4995 esac
4996
4997 case "$DEBUGGING" in
4998 -g|both|$define)
4999     case "$optimize" in
5000         *-g*) ;;
5001         *)    optimize="$optimize -g" ;;
5002     esac ;;
5003 none|$undef)
5004     case "$optimize" in
5005         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5006                 shift
5007                 optimize="$*"
5008                 ;;
5009     esac ;;
5010 esac
5011
5012 dflt=''
5013 case "$DEBUGGING" in
5014 both|$define) dflt='-DDEBUGGING'
5015 esac
5016
5017 : We will not override a previous value, but we might want to
5018 : augment a hint file
5019 case "$hint" in
5020 default|recommended)
5021         case "$gccversion" in
5022         1*) dflt="$dflt -fpcc-struct-return" ;;
5023         esac
5024         case "$optimize:$DEBUGGING" in
5025         *-g*:old) dflt="$dflt -DDEBUGGING";;
5026         esac
5027         case "$gccversion" in
5028         2*) if test -d /etc/conf/kconfig.d &&
5029                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5030                 then
5031                         # Interactive Systems (ISC) POSIX mode.
5032                         dflt="$dflt -posix"
5033                 fi
5034                 ;;
5035         esac
5036         case "$gccversion" in
5037         1*) ;;
5038         2.[0-8]*) ;;
5039         ?*)     echo " "
5040                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
5041                 echo 'int main(void) { return 0; }' > gcctest.c
5042                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
5043                         echo "Yes, it does." 2>&1
5044                         case "$ccflags" in
5045                         *strict-aliasing*)
5046                                 echo "Leaving current flags $ccflags alone." 2>&1
5047                                 ;;
5048                         *) dflt="$dflt -fno-strict-aliasing" ;;
5049                         esac
5050                 else
5051                         echo "Nope, it doesn't, but that's ok." 2>&1
5052                 fi
5053                 ;;
5054         esac
5055         # For gcc, adding -pipe speeds up compilations for some, but apparently
5056         # some assemblers can't read from stdin.  (It also slows down compilations
5057         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5058         case "$gccversion" in
5059         ?*)     echo " "
5060                 echo "Checking if your compiler accepts -pipe" 2>&1
5061                 echo 'int main(void) { return 0; }' > gcctest.c
5062                 if $cc -pipe -o gcctest gcctest.c; then
5063                         echo "Yes, it does." 2>&1
5064                         case "$ccflags" in
5065                         *-pipe*)
5066                                 echo "Leaving current flags $ccflags alone." 2>&1
5067                                 ;;
5068                         *) dflt="$dflt -pipe" ;;
5069                         esac
5070                 else
5071                         echo "Nope, it doesn't, but that's ok." 2>&1
5072                 fi
5073                 ;;
5074         esac
5075         ;;
5076 esac
5077
5078 case "$mips_type" in
5079 *BSD*|'') inclwanted="$locincpth $usrinc";;
5080 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5081 esac
5082 for thisincl in $inclwanted; do
5083         if $test -d $thisincl; then
5084                 if $test x$thisincl != x$usrinc; then
5085                         case "$dflt" in
5086                         *" -I$thisincl "*);;
5087                         *) dflt="$dflt -I$thisincl ";;
5088                         esac
5089                 fi
5090         fi
5091 done
5092
5093 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5094         xxx=true;
5095 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5096         xxx=true;
5097 else
5098         xxx=false;
5099 fi;
5100 if $xxx; then
5101         case "$dflt" in
5102         *$2*);;
5103         *) dflt="$dflt -D$2";;
5104         esac;
5105 fi'
5106
5107 set signal.h LANGUAGE_C; eval $inctest
5108
5109 case "$usesocks" in
5110 $define)
5111         ccflags="$ccflags -DSOCKS"
5112         ;;
5113 esac
5114
5115 case "$hint" in
5116 default|recommended) dflt="$ccflags $dflt" ;;
5117 *) dflt="$ccflags";;
5118 esac
5119
5120 case "$dflt" in
5121 ''|' ') dflt=none;;
5122 esac
5123
5124 $cat <<EOH
5125
5126 Your C compiler may want other flags.  For this question you should include
5127 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5128 but you should NOT include libraries or ld flags like -lwhatever.  If you
5129 want $package to honor its debug switch, you should include -DDEBUGGING here.
5130 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5131
5132 To use no flags, specify the word "none".
5133
5134 EOH
5135 set X $dflt
5136 shift
5137 dflt=${1+"$@"}
5138 rp="Any additional cc flags?"
5139 . ./myread
5140 case "$ans" in
5141 none) ccflags='';;
5142 *) ccflags="$ans";;
5143 esac
5144
5145 : the following weeds options from ccflags that are of no interest to cpp
5146 case "$cppflags" in
5147 '') cppflags="$ccflags" ;;
5148 *)  cppflags="$cppflags $ccflags" ;;
5149 esac
5150 case "$gccversion" in
5151 1*) cppflags="$cppflags -D__GNUC__"
5152 esac
5153 case "$mips_type" in
5154 '');;
5155 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5156 esac
5157 case "$cppflags" in
5158 '');;
5159 *)
5160         echo " "
5161         echo "Let me guess what the preprocessor flags are..." >&4
5162         set X $cppflags
5163         shift
5164         cppflags=''
5165         $cat >cpp.c <<'EOM'
5166 #define BLURFL foo
5167
5168 BLURFL xx LFRULB
5169 EOM
5170         previous=''
5171         for flag in $*
5172         do
5173                 case "$flag" in
5174                 -*) ftry="$flag";;
5175                 *) ftry="$previous $flag";;
5176                 esac
5177                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5178                         >cpp1.out 2>/dev/null && \
5179                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5180                         >cpp2.out 2>/dev/null && \
5181                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5182                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5183                 then
5184                         cppflags="$cppflags $ftry"
5185                         previous=''
5186                 else
5187                         previous="$flag"
5188                 fi
5189         done
5190         set X $cppflags
5191         shift
5192         cppflags=${1+"$@"}
5193         case "$cppflags" in
5194         *-*)  echo "They appear to be: $cppflags";;
5195         esac
5196         $rm -f cpp.c cpp?.out
5197         ;;
5198 esac
5199
5200 : flags used in final linking phase
5201 case "$ldflags" in
5202 '') if ./venix; then
5203                 dflt='-i -z'
5204         else
5205                 dflt=''
5206         fi
5207         case "$ccflags" in
5208         *-posix*) dflt="$dflt -posix" ;;
5209         esac
5210         ;;
5211 *) dflt="$ldflags";;
5212 esac
5213
5214 : Try to guess additional flags to pick up local libraries.
5215 for thislibdir in $libpth; do
5216         case " $loclibpth " in
5217         *" $thislibdir "*)
5218                 case "$dflt " in
5219                 *"-L$thislibdir "*) ;;
5220                 *)  dflt="$dflt -L$thislibdir" ;;
5221                 esac
5222                 ;;
5223         esac
5224 done
5225
5226 case "$dflt" in
5227 '') dflt='none' ;;
5228 esac
5229
5230 $cat <<EOH
5231
5232 Your C linker may need flags.  For this question you should
5233 include -L/whatever and any other flags used by the C linker, but you
5234 should NOT include libraries like -lwhatever.
5235
5236 Make sure you include the appropriate -L/path flags if your C linker
5237 does not normally search all of the directories you specified above,
5238 namely
5239         $libpth
5240 To use no flags, specify the word "none".
5241
5242 EOH
5243
5244 rp="Any additional ld flags (NOT including libraries)?"
5245 . ./myread
5246 case "$ans" in
5247 none) ldflags='';;
5248 *) ldflags="$ans";;
5249 esac
5250 rmlist="$rmlist pdp11"
5251
5252 : coherency check
5253 echo " "
5254 echo "Checking your choice of C compiler and flags for coherency..." >&4
5255 $cat > try.c <<'EOF'
5256 #include <stdio.h>
5257 int main() { printf("Ok\n"); return(0); }
5258 EOF
5259 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5260 shift
5261 $cat >try.msg <<'EOM'
5262 I've tried to compile and run the following simple program:
5263
5264 EOM
5265 $cat try.c >> try.msg
5266
5267 $cat >> try.msg <<EOM
5268
5269 I used the command:
5270
5271         $*
5272         $run ./try
5273
5274 and I got the following output:
5275
5276 EOM
5277 dflt=y
5278 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5279         if $sh -c "$run ./try" >>try.msg 2>&1; then
5280                 xxx=`$run ./try`
5281                 case "$xxx" in
5282                 "Ok") dflt=n ;;
5283                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5284                         case " $libs " in
5285                         *" -lsfio "*)
5286                                 cat >> try.msg <<'EOQS'
5287 If $libs contains -lsfio, and sfio is mis-configured, then it
5288 sometimes (apparently) runs and exits with a 0 status, but with no
5289 output!  It may have to do with sfio's use of _exit vs. exit.
5290
5291 EOQS
5292                                 rp="You have a big problem.  Shall I abort Configure"
5293                                 dflt=y
5294                                 ;;
5295                         esac
5296                         ;;
5297                 esac
5298         else
5299                 echo "The program compiled OK, but exited with status $?." >>try.msg
5300                 rp="You have a problem.  Shall I abort Configure"
5301                 dflt=y
5302         fi
5303 else
5304         echo "I can't compile the test program." >>try.msg
5305         rp="You have a BIG problem.  Shall I abort Configure"
5306         dflt=y
5307 fi
5308 case "$dflt" in
5309 y)
5310         $cat try.msg >&4
5311         case "$knowitall" in
5312         '')
5313                 echo "(The supplied flags or libraries might be incorrect.)"
5314                 ;;
5315         *) dflt=n;;
5316         esac
5317         echo " "
5318         . ./myread
5319         case "$ans" in
5320         n*|N*) ;;
5321         *)      echo "Ok.  Stopping Configure." >&4
5322                 exit 1
5323                 ;;
5324         esac
5325         ;;
5326 n) echo "OK, that should do.";;
5327 esac
5328 $rm -f try try.* core
5329
5330 : define a shorthand compile call
5331 compile='
5332 mc_file=$1;
5333 shift;
5334 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5335 : define a shorthand compile call for compilations that should be ok.
5336 compile_ok='
5337 mc_file=$1;
5338 shift;
5339 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5340
5341 : determine filename position in cpp output
5342 echo " "
5343 echo "Computing filename position in cpp output for #include directives..." >&4
5344 case "$osname" in
5345 vos) testaccess=-e ;;
5346 *)   testaccess=-r ;;
5347 esac
5348 echo '#include <stdio.h>' > foo.c
5349 $cat >fieldn <<EOF
5350 $startsh
5351 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5352 $grep '^[       ]*#.*stdio\.h' | \
5353 while read cline; do
5354         pos=1
5355         set \$cline
5356         while $test \$# -gt 0; do
5357                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5358                         echo "\$pos"
5359                         exit 0
5360                 fi
5361                 shift
5362                 pos=\`expr \$pos + 1\`
5363         done
5364 done
5365 EOF
5366 chmod +x fieldn
5367 fieldn=`./fieldn`
5368 $rm -f foo.c fieldn
5369 case $fieldn in
5370 '') pos='???';;
5371 1) pos=first;;
5372 2) pos=second;;
5373 3) pos=third;;
5374 *) pos="${fieldn}th";;
5375 esac
5376 echo "Your cpp writes the filename in the $pos field of the line."
5377
5378 case "$osname" in
5379 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5380 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5381 *)   cppfilter='' ;;
5382 esac
5383 : locate header file
5384 $cat >findhdr <<EOF
5385 $startsh
5386 wanted=\$1
5387 name=''
5388 for usrincdir in $usrinc
5389 do
5390         if test -f \$usrincdir/\$wanted; then
5391                 echo "\$usrincdir/\$wanted"
5392                 exit 0
5393         fi
5394 done
5395 awkprg='{ print \$$fieldn }'
5396 echo "#include <\$wanted>" > foo\$\$.c
5397 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5398 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5399 while read cline; do
5400         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5401         case "\$name" in
5402         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5403         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5404         *) exit 2;;
5405         esac;
5406 done;
5407 #
5408 # status = 0: grep returned 0 lines, case statement not executed
5409 # status = 1: headerfile found
5410 # status = 2: while loop executed, no headerfile found
5411 #
5412 status=\$?
5413 $rm -f foo\$\$.c;
5414 if test \$status -eq 1; then
5415         exit 0;
5416 fi
5417 exit 1
5418 EOF
5419 chmod +x findhdr
5420
5421 : define an alternate in-header-list? function
5422 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5423 cont=true; xxf="echo \"<\$1> found.\" >&4";
5424 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5425 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5426 esac;
5427 case $# in 4) instead=instead;; *) instead="at last";; esac;
5428 while $test "$cont"; do
5429         xxx=`./findhdr $1`
5430         var=$2; eval "was=\$$2";
5431         if $test "$xxx" && $test -r "$xxx";
5432         then eval $xxf;
5433         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5434                 cont="";
5435         else eval $xxnf;
5436         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5437         set $yyy; shift; shift; yyy=$@;
5438         case $# in 0) cont="";;
5439         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5440                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5441         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5442                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5443         esac;
5444 done;
5445 while $test "$yyy";
5446 do set $yyy; var=$2; eval "was=\$$2";
5447         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5448         set $yyy; shift; shift; yyy=$@;
5449 done'
5450
5451 : see if stdlib is available
5452 set stdlib.h i_stdlib
5453 eval $inhdr
5454
5455 : check for lengths of integral types
5456 echo " "
5457 case "$intsize" in
5458 '')
5459         echo "Checking to see how big your integers are..." >&4
5460         $cat >try.c <<EOCP
5461 #include <stdio.h>
5462 #$i_stdlib I_STDLIB
5463 #ifdef I_STDLIB
5464 #include <stdlib.h>
5465 #endif
5466 int main()
5467 {
5468         printf("intsize=%d;\n", (int)sizeof(int));
5469         printf("longsize=%d;\n", (int)sizeof(long));
5470         printf("shortsize=%d;\n", (int)sizeof(short));
5471         exit(0);
5472 }
5473 EOCP
5474         set try
5475         if eval $compile_ok && $run ./try > /dev/null; then
5476                 eval `$run ./try`
5477                 echo "Your integers are $intsize bytes long."
5478                 echo "Your long integers are $longsize bytes long."
5479                 echo "Your short integers are $shortsize bytes long."
5480         else
5481                 $cat >&4 <<EOM
5482 !
5483 Help! I can't compile and run the intsize test program: please enlighten me!
5484 (This is probably a misconfiguration in your system or libraries, and
5485 you really ought to fix it.  Still, I'll try anyway.)
5486 !
5487 EOM
5488                 dflt=4
5489                 rp="What is the size of an integer (in bytes)?"
5490                 . ./myread
5491                 intsize="$ans"
5492                 dflt=$intsize
5493                 rp="What is the size of a long integer (in bytes)?"
5494                 . ./myread
5495                 longsize="$ans"
5496                 dflt=2
5497                 rp="What is the size of a short integer (in bytes)?"
5498                 . ./myread
5499                 shortsize="$ans"
5500         fi
5501         ;;
5502 esac
5503 $rm -f try try.*
5504
5505 : check for long long
5506 echo " "
5507 echo "Checking to see if you have long long..." >&4
5508 echo 'int main() { long long x = 7; return 0; }' > try.c
5509 set try
5510 if eval $compile; then
5511         val="$define"
5512         echo "You have long long."
5513 else
5514         val="$undef"
5515         echo "You do not have long long."
5516 fi
5517 $rm try.*
5518 set d_longlong
5519 eval $setvar
5520
5521 : check for length of long long
5522 case "${d_longlong}${longlongsize}" in
5523 $define)
5524         echo " "
5525         echo "Checking to see how big your long longs are..." >&4
5526         $cat >try.c <<'EOCP'
5527 #include <stdio.h>
5528 int main()
5529 {
5530     printf("%d\n", (int)sizeof(long long));
5531     return(0);
5532 }
5533 EOCP
5534         set try
5535         if eval $compile_ok; then
5536                 longlongsize=`$run ./try`
5537                 echo "Your long longs are $longlongsize bytes long."
5538         else
5539                 dflt='8'
5540                 echo " "
5541                 echo "(I can't seem to compile the test program.  Guessing...)"
5542                 rp="What is the size of a long long (in bytes)?"
5543                 . ./myread
5544                 longlongsize="$ans"
5545         fi
5546         if $test "X$longsize" = "X$longlongsize"; then
5547                 echo "(That isn't any different from an ordinary long.)"
5548         fi      
5549         ;;
5550 esac
5551 $rm -f try.* try
5552
5553 : see if inttypes.h is available
5554 : we want a real compile instead of Inhdr because some systems
5555 : have an inttypes.h which includes non-existent headers
5556 echo " "
5557 $cat >try.c <<EOCP
5558 #include <inttypes.h>
5559 int main() {
5560         static int32_t foo32 = 0x12345678;
5561 }
5562 EOCP
5563 set try
5564 if eval $compile; then
5565         echo "<inttypes.h> found." >&4
5566         val="$define"
5567 else
5568         echo "<inttypes.h> NOT found." >&4
5569         val="$undef"
5570 fi
5571 $rm -f try.c try
5572 set i_inttypes
5573 eval $setvar
5574
5575 : check for int64_t
5576 echo " "
5577 echo "Checking to see if you have int64_t..." >&4
5578 $cat >try.c <<EOCP
5579 #include <sys/types.h>
5580 #$i_inttypes I_INTTYPES
5581 #ifdef I_INTTYPES
5582 #include <inttypes.h>
5583 #endif
5584 int main() { int64_t x = 7; }
5585 EOCP
5586 set try
5587 if eval $compile; then
5588         val="$define"
5589         echo "You have int64_t."
5590 else
5591         val="$undef"
5592         echo "You do not have int64_t."
5593 fi
5594 $rm -f try try.*
5595 set d_int64_t
5596 eval $setvar
5597
5598
5599 echo " "
5600 echo "Checking which 64-bit integer type we could use..." >&4
5601
5602 case "$intsize" in
5603 8) val=int
5604    set quadtype
5605    eval $setvar
5606    val='"unsigned int"'
5607    set uquadtype
5608    eval $setvar
5609    quadkind=1
5610    ;;
5611 *) case "$longsize" in
5612    8) val=long
5613       set quadtype
5614       eval $setvar
5615       val='"unsigned long"'
5616       set uquadtype
5617       eval $setvar
5618       quadkind=2
5619       ;;
5620    *) case "$d_longlong:$longlongsize" in
5621       define:8)
5622         val='"long long"'
5623         set quadtype
5624         eval $setvar
5625         val='"unsigned long long"'
5626         set uquadtype
5627         eval $setvar
5628         quadkind=3
5629         ;;
5630       *) case "$d_int64_t" in
5631          define)
5632            val=int64_t
5633            set quadtype
5634            eval $setvar
5635            val=uint64_t
5636            set uquadtype
5637            eval $setvar
5638            quadkind=4
5639            ;;
5640          esac
5641          ;;
5642       esac
5643       ;;
5644    esac
5645    ;;
5646 esac
5647
5648 case "$quadtype" in
5649 '')     echo "Alas, no 64-bit integer types in sight." >&4
5650         d_quad="$undef"
5651         ;;
5652 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5653         d_quad="$define"
5654         ;;
5655 esac
5656
5657
5658 case "$uselonglong" in
5659 "$define"|true|[yY]*)
5660         cat <<EOM >&4
5661
5662 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5663 EOM
5664         use64bitint="$define"
5665         ;;
5666 esac                          
5667 case "$use64bits" in
5668 "$define"|true|[yY]*)
5669         cat <<EOM >&4
5670
5671 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5672 EOM
5673         use64bitint="$define"
5674         ;;
5675 esac                          
5676 case "$use64bitints" in
5677 "$define"|true|[yY]*)
5678         cat <<EOM >&4
5679
5680 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5681 EOM
5682         use64bitint="$define"
5683         ;;
5684 esac                          
5685 case "$use64bitsint" in
5686 "$define"|true|[yY]*)
5687         cat <<EOM >&4
5688
5689 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5690 EOM
5691         use64bitint="$define"
5692         ;;
5693 esac                          
5694 case "$uselonglongs" in
5695 "$define"|true|[yY]*)
5696         cat <<EOM >&4
5697
5698 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5699 EOM
5700         use64bitint="$define"
5701         ;;
5702 esac                          
5703 case "$use64bitsall" in
5704 "$define"|true|[yY]*)
5705         cat <<EOM >&4
5706
5707 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5708 EOM
5709         use64bitall="$define"
5710         ;;
5711 esac                          
5712
5713 case "$ccflags" in
5714 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5715 esac
5716 case "$use64bitall" in
5717 "$define"|true|[yY]*) use64bitint="$define" ;;
5718 esac
5719
5720 case "$longsize" in
5721 8) cat <<EOM
5722
5723 You have natively 64-bit long integers.
5724 EOM
5725    val="$define"
5726    ;;
5727 *) case "$use64bitint" in
5728    "$define"|true|[yY]*) dflt='y';;
5729    *) dflt='n';;
5730    esac
5731    case "$d_quad" in
5732    "$define") ;;
5733    *) dflt='n' ;;
5734    esac
5735    cat <<EOM
5736
5737 Perl can be built to take advantage of 64-bit integer types
5738 on some systems.  To do so, Configure can be run with -Duse64bitint.
5739 Choosing this option will most probably introduce binary incompatibilities.
5740
5741 If this doesn't make any sense to you, just accept the default '$dflt'.
5742 (The default has been chosen based on your configuration.)
5743 EOM
5744    rp='Try to use 64-bit integers, if available?'
5745    . ./myread
5746    case "$ans" in
5747    [yY]*) val="$define" ;;
5748    *)     val="$undef"  ;;
5749    esac
5750    ;;
5751 esac
5752 set use64bitint
5753 eval $setvar
5754
5755 case "$use64bitall" in
5756 "$define"|true|[yY]*) dflt='y' ;;
5757 *) case "$longsize" in
5758    8) dflt='y' ;;
5759    *) dflt='n' ;;
5760    esac
5761    ;;
5762 esac    
5763 cat <<EOM
5764
5765 You may also choose to try maximal 64-bitness.  It means using as much
5766 64-bitness as possible on the platform.  This in turn means even more
5767 binary incompatibilities.  On the other hand, your platform may not
5768 have any more 64-bitness available than what you already have chosen.
5769
5770 If this doesn't make any sense to you, just accept the default '$dflt'.
5771 (The default has been chosen based on your configuration.)
5772 EOM
5773 rp='Try to use maximal 64-bit support, if available?'
5774 . ./myread
5775 case "$ans" in
5776 [yY]*) val="$define" ;;
5777 *)     val="$undef"  ;;
5778 esac
5779 set use64bitall
5780 eval $setvar
5781 case "$use64bitall" in
5782 "$define")
5783         case "$use64bitint" in
5784         "$undef")
5785                 cat <<EOM
5786
5787 Since you have chosen a maximally 64-bit build, I'm also turning on
5788 the use of 64-bit integers.
5789 EOM
5790                 use64bitint="$define" ;;
5791         esac
5792         ;;
5793 esac
5794
5795 : Look for a hint-file generated 'call-back-unit'.  If the
5796 : user has specified that a 64-bit perl is to be built,
5797 : we may need to set or change some other defaults.
5798 if $test -f use64bitint.cbu; then
5799         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5800         . ./use64bitint.cbu
5801 fi
5802 case "$use64bitint" in
5803 "$define"|true|[yY]*)
5804         case "$longsize" in
5805         4) case "$archname64" in
5806            '') archname64=64int ;;
5807            esac
5808            ;;
5809         esac
5810         ;;
5811 esac
5812
5813 : Look for a hint-file generated 'call-back-unit'.  If the
5814 : user has specified that a maximally 64-bit perl is to be built,
5815 : we may need to set or change some other defaults.
5816 if $test -f use64bitall.cbu; then
5817         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5818         . ./use64bitall.cbu
5819 fi
5820 case "$use64bitall" in
5821 "$define"|true|[yY]*)
5822         case "$longsize" in
5823         4) case "$archname64" in
5824            ''|64int) archname64=64all ;;
5825            esac
5826            ;;
5827         esac
5828         ;;
5829 esac
5830
5831 case "$d_quad:$use64bitint" in
5832 $undef:$define)
5833         cat >&4 <<EOF
5834
5835 *** You have chosen to use 64-bit integers,
5836 *** but none can be found.
5837 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5838 *** Cannot continue, aborting.
5839
5840 EOF
5841         exit 1
5842         ;;
5843 esac
5844
5845 : check for length of double
5846 echo " "
5847 case "$doublesize" in
5848 '')
5849         echo "Checking to see how big your double precision numbers are..." >&4
5850         $cat >try.c <<EOCP
5851 #include <stdio.h>
5852 #$i_stdlib I_STDLIB
5853 #ifdef I_STDLIB
5854 #include <stdlib.h>
5855 #endif
5856 int main()
5857 {
5858     printf("%d\n", (int)sizeof(double));
5859     exit(0);
5860 }
5861 EOCP
5862         set try
5863         if eval $compile_ok; then
5864                 doublesize=`$run ./try`
5865                 echo "Your double is $doublesize bytes long."
5866         else
5867                 dflt='8'
5868                 echo "(I can't seem to compile the test program.  Guessing...)"
5869                 rp="What is the size of a double precision number (in bytes)?"
5870                 . ./myread
5871                 doublesize="$ans"
5872         fi
5873         ;;
5874 esac
5875 $rm -f try.c try
5876
5877 : check for long doubles
5878 echo " "
5879 echo "Checking to see if you have long double..." >&4
5880 echo 'int main() { long double x = 7.0; }' > try.c
5881 set try
5882 if eval $compile; then
5883         val="$define"
5884         echo "You have long double."
5885 else
5886         val="$undef"
5887         echo "You do not have long double."
5888 fi
5889 $rm try.*
5890 set d_longdbl
5891 eval $setvar
5892
5893 : check for length of long double
5894 case "${d_longdbl}${longdblsize}" in
5895 $define)
5896         echo " "
5897         echo "Checking to see how big your long doubles are..." >&4
5898         $cat >try.c <<'EOCP'
5899 #include <stdio.h>
5900 int main()
5901 {
5902         printf("%d\n", sizeof(long double));
5903 }
5904 EOCP
5905         set try
5906         set try
5907         if eval $compile; then
5908                 longdblsize=`$run ./try`
5909                 echo "Your long doubles are $longdblsize bytes long."
5910         else
5911                 dflt='8'
5912                 echo " "
5913                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5914                 rp="What is the size of a long double (in bytes)?"
5915                 . ./myread
5916                 longdblsize="$ans"
5917         fi
5918         if $test "X$doublesize" = "X$longdblsize"; then
5919                 echo "That isn't any different from an ordinary double."
5920                 echo "I'll keep your setting anyway, but you may see some"
5921                 echo "harmless compilation warnings."
5922         fi      
5923         ;;
5924 esac
5925 $rm -f try.* try
5926
5927 : determine the architecture name
5928 echo " "
5929 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5930         tarch=`arch`"-$osname"
5931 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5932         if uname -m > tmparch 2>&1 ; then
5933                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5934                         -e 's/$/'"-$osname/" tmparch`
5935         else
5936                 tarch="$osname"
5937         fi
5938         $rm -f tmparch
5939 else
5940         tarch="$osname"
5941 fi
5942 case "$myarchname" in
5943 ''|"$tarch") ;;
5944 *)
5945         echo "(Your architecture name used to be $myarchname.)"
5946         archname=''
5947         ;;
5948 esac
5949 case "$targetarch" in
5950 '') ;;
5951 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5952 esac
5953 myarchname="$tarch"
5954 case "$archname" in
5955 '') dflt="$tarch";;
5956 *) dflt="$archname";;
5957 esac
5958 rp='What is your architecture name'
5959 . ./myread
5960 archname="$ans"
5961 case "$usethreads" in
5962 $define)
5963         echo "Threads selected." >&4
5964         case "$archname" in
5965         *-thread*) echo "...and architecture name already has -thread." >&4
5966                 ;;
5967         *)      archname="$archname-thread"
5968                 echo "...setting architecture name to $archname." >&4
5969                 ;;
5970         esac
5971         ;;
5972 esac
5973 case "$usemultiplicity" in
5974 $define)
5975         echo "Multiplicity selected." >&4
5976         case "$archname" in
5977         *-multi*) echo "...and architecture name already has -multi." >&4
5978                 ;;
5979         *)      archname="$archname-multi"
5980                 echo "...setting architecture name to $archname." >&4
5981                 ;;
5982         esac
5983         ;;
5984 esac
5985 case "$use64bitint$use64bitall" in
5986 *"$define"*)
5987         case "$archname64" in
5988         '')
5989                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5990                 ;;
5991         *)
5992                 case "$use64bitint" in
5993                 "$define") echo "64 bit integers selected." >&4 ;;
5994                 esac
5995                 case "$use64bitall" in
5996                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5997                 esac
5998                 case "$archname" in
5999                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6000                         ;;
6001                 *)      archname="$archname-$archname64"
6002                         echo "...setting architecture name to $archname." >&4
6003                         ;;
6004                 esac
6005                 ;;
6006         esac
6007 esac
6008 case "$uselongdouble" in
6009 $define)
6010         echo "Long doubles selected." >&4
6011         case "$longdblsize" in
6012         $doublesize)
6013                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6014                 ;;
6015         *)
6016                 case "$archname" in
6017                 *-ld*) echo "...and architecture name already has -ld." >&4
6018                         ;;
6019                 *)      archname="$archname-ld"
6020                         echo "...setting architecture name to $archname." >&4
6021                         ;;
6022                 esac
6023                 ;;
6024         esac
6025         ;;
6026 esac
6027 case "$useperlio" in
6028 $define)
6029         echo "Perlio selected." >&4
6030         ;;
6031 *)
6032         echo "Perlio not selected, using stdio." >&4
6033         case "$archname" in
6034         *-stdio*) echo "...and architecture name already has -stdio." >&4
6035                 ;;
6036         *)      archname="$archname-stdio"
6037                 echo "...setting architecture name to $archname." >&4
6038                 ;;
6039         esac
6040         ;;
6041 esac
6042 if $test -f archname.cbu; then
6043         echo "Your platform has some specific hints for architecture name, using them..."
6044         . ./archname.cbu
6045 fi
6046
6047 : set the prefixit variable, to compute a suitable default value
6048 prefixit='case "$3" in
6049 ""|none)
6050         case "$oldprefix" in
6051         "") eval "$1=\"\$$2\"";;
6052         *)
6053                 case "$3" in
6054                 "") eval "$1=";;
6055                 none)
6056                         eval "tp=\"\$$2\"";
6057                         case "$tp" in
6058                         ""|" ") eval "$1=\"\$$2\"";;
6059                         *) eval "$1=";;
6060                         esac;;
6061                 esac;;
6062         esac;;
6063 *)
6064         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6065         case "$tp" in
6066         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6067         /*-$oldprefix/*|\~*-$oldprefix/*)
6068                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6069         *) eval "$1=\"\$$2\"";;
6070         esac;;
6071 esac'
6072
6073 : determine installation style
6074 : For now, try to deduce it from prefix unless it is already set.
6075 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6076 case "$installstyle" in
6077 '')     case "$prefix" in
6078                 *perl*) dflt='lib';;
6079                 *) dflt='lib/perl5' ;;
6080         esac
6081         ;;
6082 *)      dflt="$installstyle" ;;
6083 esac
6084 : Probably not worth prompting for this since we prompt for all
6085 : the directories individually, and the prompt would be too long and
6086 : confusing anyway.
6087 installstyle=$dflt
6088
6089 : determine where public executables go
6090 echo " "
6091 set dflt bin bin
6092 eval $prefixit
6093 fn=d~
6094 rp='Pathname where the public executables will reside?'
6095 . ./getfile
6096 if $test "X$ansexp" != "X$binexp"; then
6097         installbin=''
6098 fi
6099 prefixvar=bin
6100 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6101 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6102 :     this via initialinstalllocation
6103 . ./setprefixvar
6104
6105 case "$userelocatableinc" in
6106 $define|true|[yY]*)     dflt='y' ;;
6107 *)                      dflt='n' ;;
6108 esac
6109 cat <<EOM
6110
6111 Would you like to build Perl so that the installation is relocatable, so that
6112 library paths in @INC are determined relative to the path of the perl binary?
6113 This is not advised for system Perl installs, or if you need to run setid
6114 scripts or scripts under taint mode.
6115
6116 If this doesn't make any sense to you, just accept the default '$dflt'.
6117 EOM
6118 rp='Use relocatable @INC?'
6119 . ./myread
6120 case "$ans" in
6121 y|Y)    val="$define" ;;
6122 *)      val="$undef"  ;;
6123 esac
6124 set userelocatableinc
6125 eval $setvar
6126
6127 initialinstalllocation="$binexp"
6128 : Default prefix is now "up one level from where the binaries are"
6129 case "$userelocatableinc" in
6130 $define|true|[yY]*)
6131     bin=".../"
6132     binexp=".../"
6133     prefix=".../.."
6134     prefixexp=".../.."
6135     installprefixexp=".../.."
6136     ;;
6137 esac
6138
6139 : determine where private library files go
6140 : Usual default is /usr/local/lib/perl5/$version.
6141 : Also allow things like /opt/perl/lib/$version, since
6142 : /opt/perl/lib/perl5... would be redundant.
6143 : The default "style" setting is made in installstyle.U
6144 case "$installstyle" in
6145 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6146 *)       set dflt privlib lib/$version ;;
6147 esac
6148 eval $prefixit
6149 $cat <<EOM
6150
6151 There are some auxiliary files for $package that need to be put into a
6152 private library directory that is accessible by everyone.
6153
6154 EOM
6155 fn=$binexp
6156 fn=d~+
6157 rp='Pathname where the private library files will reside?'
6158 . ./getfile
6159 prefixvar=privlib
6160 . ./setprefixvar
6161
6162 : set the prefixup variable, to restore leading tilda escape
6163 prefixup='case "$prefixexp" in
6164 "$prefix") ;;
6165 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6166 esac'
6167
6168 : determine where public architecture dependent libraries go
6169 set archlib archlib
6170 eval $prefixit
6171 : privlib default is /usr/local/lib/$package/$version
6172 : archlib default is /usr/local/lib/$package/$version/$archname
6173 : privlib may have an optional trailing /share.
6174 tdflt=`echo $privlib | $sed 's,/share$,,'`
6175 tdflt=$tdflt/$archname
6176 case "$archlib" in
6177 '')     dflt=$tdflt
6178         ;;
6179 *)      dflt="$archlib"
6180     ;;
6181 esac
6182 $cat <<EOM
6183
6184 $spackage contains architecture-dependent library files.  If you are
6185 sharing libraries in a heterogeneous environment, you might store
6186 these files in a separate location.  Otherwise, you can just include
6187 them with the rest of the public library files.
6188
6189 EOM
6190 fn=$binexp
6191 fn=d+~
6192 rp='Where do you want to put the public architecture-dependent libraries?'
6193 . ./getfile
6194 prefixvar=archlib
6195 . ./setprefixvar
6196 if $test X"$archlib" = X"$privlib"; then
6197         d_archlib="$undef"
6198 else
6199         d_archlib="$define"
6200 fi
6201
6202 : see if setuid scripts can be secure
6203 $cat <<EOM
6204
6205 Some kernels have a bug that prevents setuid #! scripts from being
6206 secure.  Some sites have disabled setuid #! scripts because of this.
6207
6208 First let's decide if your kernel supports secure setuid #! scripts.
6209 (If setuid #! scripts would be secure but have been disabled anyway,
6210 don't say that they are secure if asked.)
6211
6212 EOM
6213
6214 val="$undef"
6215 if $test -d /dev/fd; then
6216         echo "#!$ls" >reflect
6217         chmod +x,u+s reflect
6218         ./reflect >flect 2>&1
6219         if $contains "/dev/fd" flect >/dev/null; then
6220                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6221                 val="$define"
6222         else
6223                 $cat <<EOM
6224 If you are not sure if they are secure, I can check but I'll need a
6225 username and password different from the one you are using right now.
6226 If you don't have such a username or don't want me to test, simply
6227 enter 'none'.
6228
6229 EOM
6230                 rp='Other username to test security of setuid scripts with?'
6231                 dflt='none'
6232                 . ./myread
6233                 case "$ans" in
6234                 n|none)
6235                         case "$d_suidsafe" in
6236                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6237                                 dflt=n;;
6238                         "$undef")
6239                                 echo "Well, the $hint value is *not* secure." >&4
6240                                 dflt=n;;
6241                         *)      echo "Well, the $hint value *is* secure." >&4
6242                                 dflt=y;;
6243                         esac
6244                         ;;
6245                 *)
6246                         $rm -f reflect flect
6247                         echo "#!$ls" >reflect
6248                         chmod +x,u+s reflect
6249                         echo >flect
6250                         chmod a+w flect
6251                         echo '"su" will (probably) prompt you for '"$ans's password."
6252                         su $ans -c './reflect >flect'
6253                         if $contains "/dev/fd" flect >/dev/null; then
6254                                 echo "Okay, it looks like setuid scripts are secure." >&4
6255                                 dflt=y
6256                         else
6257                                 echo "I don't think setuid scripts are secure." >&4
6258                                 dflt=n
6259                         fi
6260                         ;;
6261                 esac
6262                 rp='Does your kernel have *secure* setuid scripts?'
6263                 . ./myread
6264                 case "$ans" in
6265                 [yY]*)  val="$define";;
6266                 *)      val="$undef";;
6267                 esac
6268         fi
6269 else
6270         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6271         echo "(That's for file descriptors, not floppy disks.)"
6272         val="$undef"
6273 fi
6274 set d_suidsafe
6275 eval $setvar
6276
6277 $rm -f reflect flect
6278
6279 : now see if they want to do setuid emulation
6280 echo " "
6281 val="$undef"
6282 case "$d_suidsafe" in
6283 "$define")
6284         val="$undef"
6285         echo "No need to emulate SUID scripts since they are secure here." >&4
6286         ;;
6287 *)
6288         $cat <<EOM
6289 Some systems have disabled setuid scripts, especially systems where
6290 setuid scripts cannot be secure.  On systems where setuid scripts have
6291 been disabled, the setuid/setgid bits on scripts are currently
6292 useless.  It is possible for $package to detect those bits and emulate
6293 setuid/setgid in a secure fashion.  This emulation will only work if
6294 setuid scripts have been disabled in your kernel.
6295
6296 EOM
6297         case "$d_dosuid" in
6298         "$define") dflt=y ;;
6299         *) dflt=n ;;
6300         esac
6301         rp="Do you want to do setuid/setgid emulation?"
6302         . ./myread
6303         case "$ans" in
6304         [yY]*)  val="$define";;
6305         *)      val="$undef";;
6306         esac
6307         ;;
6308 esac
6309 set d_dosuid
6310 eval $setvar
6311
6312 : Find perl5.005 or later.
6313 echo "Looking for a previously installed perl5.005 or later... "
6314 case "$perl5" in
6315 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6316                 : Check if this perl is recent and can load a simple module
6317                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6318                         perl5=$tdir/perl
6319                         break;
6320                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6321                         perl5=$tdir/perl5
6322                         break;
6323                 fi
6324         done
6325         ;;
6326 *)      perl5="$perl5"
6327         ;;
6328 esac
6329 case "$perl5" in
6330 '')     echo "None found.  That's ok.";;
6331 *)      echo "Using $perl5." ;;
6332 esac
6333
6334 $cat <<EOM
6335
6336 After $package is installed, you may wish to install various
6337 add-on modules and utilities.  Typically, these add-ons will
6338 be installed under $prefix with the rest
6339 of this package.  However, you may wish to install such add-ons
6340 elsewhere under a different prefix.
6341
6342 If you do not wish to put everything under a single prefix, that's
6343 ok.  You will be prompted for the individual locations; this siteprefix
6344 is only used to suggest the defaults.
6345
6346 The default should be fine for most people.
6347
6348 EOM
6349 fn=d~+
6350 rp='Installation prefix to use for add-on modules and utilities?'
6351 : XXX Here might be another good place for an installstyle setting.
6352 case "$siteprefix" in
6353 '') dflt=$prefix ;;
6354 *)  dflt=$siteprefix ;;
6355 esac
6356 . ./getfile
6357 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6358 oldsiteprefix=''
6359 case "$siteprefix" in
6360 '') ;;
6361 *)      case "$ans" in
6362         "$prefix") ;;
6363         *) oldsiteprefix="$prefix";;
6364         esac
6365         ;;
6366 esac
6367 siteprefix="$ans"
6368 siteprefixexp="$ansexp"
6369
6370 : determine where site specific libraries go.
6371 : Usual default is /usr/local/lib/perl5/site_perl/$version
6372 : The default "style" setting is made in installstyle.U
6373 : XXX No longer works with Prefixit stuff.
6374 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6375 case "$sitelib" in
6376 '') case "$installstyle" in
6377         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6378         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6379         esac
6380         ;;
6381 *)      dflt="$sitelib"
6382         ;;
6383 esac
6384 $cat <<EOM
6385
6386 The installation process will create a directory for
6387 site-specific extensions and modules.  Most users find it convenient
6388 to place all site-specific files in this directory rather than in the
6389 main distribution directory.
6390
6391 EOM
6392 fn=d~+
6393 rp='Pathname for the site-specific library files?'
6394 . ./getfile
6395 prefixvar=sitelib
6396 . ./setprefixvar
6397 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6398
6399 : Determine list of previous versions to include in @INC
6400 $cat > getverlist <<EOPL
6401 #!$perl5 -w
6402 use File::Basename;
6403 \$api_versionstring = "$api_versionstring";
6404 \$version = "$version";
6405 \$stem = "$sitelib_stem";
6406 \$archname = "$archname";
6407 EOPL
6408         $cat >> getverlist <<'EOPL'
6409 # The list found is store twice for each entry: the original name, and
6410 # the binary broken down version as pack "sss", so sorting is easy and
6411 # unambiguous. This will work for all versions that have a maximum of
6412 # three digit groups, separate by '.'s or '_'s. Names are extended with
6413 # ".0.0" to ensure at least three elements for the pack.
6414 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6415
6416 # Can't have leading @ because metaconfig interprets it as a command!
6417 ;@inc_version_list=();
6418 # XXX Redo to do opendir/readdir?
6419 if (-d $stem) {
6420     chdir($stem);
6421     ;@candidates = map {
6422         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6423 }
6424 else {
6425     ;@candidates = ();
6426 }
6427
6428 ($pversion, $aversion, $vsn5005) = map {
6429     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6430 foreach $d (@candidates) {
6431     if ($d->[1] lt $pversion) {
6432         if ($d->[1] ge $aversion) {
6433             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6434         }
6435         elsif ($d->[1] ge $vsn5005) {
6436             unshift(@inc_version_list, grep { -d } $d->[0]);
6437         }
6438     }
6439     else {
6440         # Skip newer version.  I.e. don't look in
6441         # 5.7.0 if we're installing 5.6.1.
6442     }
6443 }
6444
6445 if (@inc_version_list) {
6446     print join(' ', @inc_version_list);
6447 }
6448 else {
6449     # Blank space to preserve value for next Configure run.
6450     print " ";
6451 }
6452 EOPL
6453 chmod +x getverlist
6454 case "$inc_version_list" in
6455 '')     if test -x "$perl5$exe_ext"; then
6456                 dflt=`$perl5 getverlist`
6457         else
6458                 dflt='none'
6459         fi
6460         ;;
6461 $undef) dflt='none' ;;
6462 *)  eval dflt=\"$inc_version_list\" ;;
6463 esac
6464 case "$dflt" in
6465 ''|' ') dflt=none ;;
6466 esac
6467 case "$dflt" in
6468 5.005) dflt=none ;;
6469 esac
6470 $cat <<EOM
6471
6472 In order to ease the process of upgrading, this version of perl
6473 can be configured to use modules built and installed with earlier
6474 versions of perl that were installed under $prefix.  Specify here
6475 the list of earlier versions that this version of perl should check.
6476 If Configure detected no earlier versions of perl installed under
6477 $prefix, then the list will be empty.  Answer 'none' to tell perl
6478 to not search earlier versions.
6479
6480 The default should almost always be sensible, so if you're not sure,
6481 just accept the default.
6482 EOM
6483
6484 rp='List of earlier versions to include in @INC?'
6485 . ./myread
6486 case "$ans" in
6487 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6488 *) inc_version_list="$ans" ;;
6489 esac
6490 case "$inc_version_list" in
6491 ''|' ')
6492         inc_version_list_init='0'
6493         d_inc_version_list="$undef"
6494         ;;
6495 *)      inc_version_list_init=`echo $inc_version_list |
6496                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6497         d_inc_version_list="$define"
6498         ;;
6499 esac
6500 $rm -f getverlist
6501
6502 : see if this is a malloc.h system
6503 : we want a real compile instead of Inhdr because some systems have a
6504 : malloc.h that just gives a compile error saying to use stdlib.h instead
6505 echo " "
6506 $cat >try.c <<EOCP
6507 #include <stdlib.h>
6508 #include <malloc.h>
6509 int main () { return 0; }
6510 EOCP
6511 set try
6512 if eval $compile; then
6513     echo "<malloc.h> found." >&4
6514     val="$define"
6515 else
6516     echo "<malloc.h> NOT found." >&4
6517     val="$undef"
6518 fi
6519 $rm -f try.c try
6520 set i_malloc
6521 eval $setvar
6522
6523 : check for void type
6524 echo " "
6525 echo "Checking to see how well your C compiler groks the void type..." >&4
6526 case "$voidflags" in
6527 '')
6528         $cat >try.c <<EOCP
6529 #$i_stdlib I_STDLIB
6530 #ifdef I_STDLIB
6531 #include <stdlib.h>
6532 #endif
6533 #if TRY & 1
6534 void sub() {
6535 #else
6536 sub() {
6537 #endif
6538         extern void moo();      /* function returning void */
6539         void (*goo)();          /* ptr to func returning void */
6540 #if TRY & 8
6541         void *hue;              /* generic ptr */
6542 #endif
6543 #if TRY & 2
6544         void (*foo[10])();
6545 #endif
6546
6547 #if TRY & 4
6548         if(goo == moo) {
6549                 exit(0);
6550         }
6551 #endif
6552         exit(0);
6553 }
6554 int main() { sub(); }
6555 EOCP
6556         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6557                 voidflags=$defvoidused
6558         echo "Good.  It appears to support void to the level $package wants.">&4
6559                 if $contains warning .out >/dev/null 2>&1; then
6560                         echo "However, you might get some warnings that look like this:"
6561                         $cat .out
6562                 fi
6563         else
6564 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6565                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6566                         echo "It supports 1..."
6567                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6568                                 echo "It also supports 2..."
6569                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6570                                         voidflags=7
6571                                         echo "And it supports 4 but not 8 definitely."
6572                                 else
6573                                         echo "It doesn't support 4..."
6574                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6575                                                 voidflags=11
6576                                                 echo "But it supports 8."
6577                                         else
6578                                                 voidflags=3
6579                                                 echo "Neither does it support 8."
6580                                         fi
6581                                 fi
6582                         else
6583                                 echo "It does not support 2..."
6584                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6585                                         voidflags=13
6586                                         echo "But it supports 4 and 8."
6587                                 else
6588                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6589                                                 voidflags=5
6590                                                 echo "And it supports 4 but has not heard about 8."
6591                                         else
6592                                                 echo "However it supports 8 but not 4."
6593                                         fi
6594                                 fi
6595                         fi
6596                 else
6597                         echo "There is no support at all for void."
6598                         voidflags=0
6599                 fi
6600         fi
6601 esac
6602 case "$voidflags" in
6603 "$defvoidused") ;;
6604 *)      $cat >&4 <<'EOM'
6605   Support flag bits are:
6606     1: basic void declarations.
6607     2: arrays of pointers to functions returning void.
6608     4: operations between pointers to and addresses of void functions.
6609     8: generic void pointers.
6610 EOM
6611         dflt="$voidflags";
6612         rp="Your void support flags add up to what?"
6613         . ./myread
6614         voidflags="$ans"
6615         ;;
6616 esac
6617 $rm -f try try.* .out
6618
6619 : check for length of pointer
6620 echo " "
6621 case "$ptrsize" in
6622 '')
6623         echo "Checking to see how big your pointers are..." >&4
6624         if test "$voidflags" -gt 7; then
6625                 echo '#define VOID_PTR char *' > try.c
6626         else
6627                 echo '#define VOID_PTR void *' > try.c
6628         fi
6629         $cat >>try.c <<EOCP
6630 #include <stdio.h>
6631 #$i_stdlib I_STDLIB
6632 #ifdef I_STDLIB
6633 #include <stdlib.h>
6634 #endif
6635 int main()
6636 {
6637     printf("%d\n", (int)sizeof(VOID_PTR));
6638     exit(0);
6639 }
6640 EOCP
6641         set try
6642         if eval $compile_ok; then
6643                 ptrsize=`$run ./try`
6644                 echo "Your pointers are $ptrsize bytes long."
6645         else
6646                 dflt='4'
6647                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6648                 rp="What is the size of a pointer (in bytes)?"
6649                 . ./myread
6650                 ptrsize="$ans"
6651         fi
6652         ;;
6653 esac
6654 $rm -f try.c try
6655 case "$use64bitall" in
6656 "$define"|true|[yY]*)
6657         case "$ptrsize" in
6658         4)      cat <<EOM >&4
6659
6660 *** You have chosen a maximally 64-bit build,
6661 *** but your pointers are only 4 bytes wide.
6662 *** Please rerun Configure without -Duse64bitall.
6663 EOM
6664                 case "$d_quad" in
6665                 define)
6666                         cat <<EOM >&4
6667 *** Since you have quads, you could possibly try with -Duse64bitint.
6668 EOM
6669                         ;;
6670                 esac
6671                 cat <<EOM >&4
6672 *** Cannot continue, aborting.
6673
6674 EOM
6675
6676                 exit 1
6677                 ;;
6678         esac
6679         ;;
6680 esac
6681
6682
6683 : determine whether to use malloc wrapping
6684 echo " "
6685 case "$usemallocwrap" in
6686 [yY]*|true|$define)     dflt='y' ;;
6687 [nN]*|false|$undef)     dflt='n' ;;
6688 *)      case "$usedevel" in
6689         [yY]*|true|$define)     dflt='y' ;;
6690         *) dflt='n' ;;
6691         esac
6692         ;;
6693 esac
6694 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6695 . ./myread
6696 usemallocwrap="$ans"
6697 case "$ans" in
6698 y*|true)
6699         usemallocwrap="$define" ;;
6700 *)
6701         usemallocwrap="$undef" ;;
6702 esac
6703
6704 : determine which malloc to compile in
6705 echo " "
6706 case "$usemymalloc" in
6707 [yY]*|true|$define)     dflt='y' ;;
6708 [nN]*|false|$undef)     dflt='n' ;;
6709 *)      case "$ptrsize" in
6710         4) dflt='y' ;;
6711         *) dflt='n' ;;
6712         esac
6713         ;;
6714 esac
6715 rp="Do you wish to attempt to use the malloc that comes with $package?"
6716 . ./myread
6717 usemymalloc="$ans"
6718 case "$ans" in
6719 y*|true)
6720         usemymalloc='y'
6721         mallocsrc='malloc.c'
6722         mallocobj="malloc$_o"
6723         d_mymalloc="$define"
6724         case "$libs" in
6725         *-lmalloc*)
6726                 : Remove malloc from list of libraries to use
6727                 echo "Removing unneeded -lmalloc from library list" >&4
6728                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6729                 shift
6730                 libs="$*"
6731                 echo "libs = $libs" >&4
6732                 ;;
6733         esac
6734         ;;
6735 *)
6736         usemymalloc='n'
6737         mallocsrc=''
6738         mallocobj=''
6739         d_mymalloc="$undef"
6740         ;;
6741 esac
6742
6743 : compute the return types of malloc and free
6744 echo " "
6745 $cat >malloc.c <<END
6746 #$i_malloc I_MALLOC
6747 #$i_stdlib I_STDLIB
6748 #include <stdio.h>
6749 #include <sys/types.h>
6750 #ifdef I_MALLOC
6751 #include <malloc.h>
6752 #endif
6753 #ifdef I_STDLIB
6754 #include <stdlib.h>
6755 #endif
6756 #ifdef TRY_MALLOC
6757 void *malloc();
6758 #endif
6759 #ifdef TRY_FREE
6760 void free();
6761 #endif
6762 END
6763 case "$malloctype" in
6764 '')
6765         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6766                 malloctype='void *'
6767         else
6768                 malloctype='char *'
6769         fi
6770         ;;
6771 esac
6772 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6773
6774 case "$freetype" in
6775 '')
6776         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6777                 freetype='void'
6778         else
6779                 freetype='int'
6780         fi
6781         ;;
6782 esac
6783 echo "Your system uses $freetype free(), it would seem." >&4
6784 $rm -f malloc.[co]
6785 : determine where site specific architecture-dependent libraries go.
6786 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6787 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6788 : sitelib may have an optional trailing /share.
6789 case "$sitearch" in
6790 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6791         dflt="$dflt/$archname"
6792         ;;
6793 *)      dflt="$sitearch"
6794         ;;
6795 esac
6796 set sitearch sitearch none
6797 eval $prefixit
6798 $cat <<EOM
6799
6800 The installation process will also create a directory for
6801 architecture-dependent site-specific extensions and modules.
6802
6803 EOM
6804 fn=d~+
6805 rp='Pathname for the site-specific architecture-dependent library files?'
6806 . ./getfile
6807 prefixvar=sitearch
6808 . ./setprefixvar
6809 if $test X"$sitearch" = X"$sitelib"; then
6810         d_sitearch="$undef"
6811 else
6812         d_sitearch="$define"
6813 fi
6814
6815 $cat <<EOM
6816
6817 The installation process will also create a directory for
6818 vendor-supplied add-ons.  Vendors who supply perl with their system
6819 may find it convenient to place all vendor-supplied files in this
6820 directory rather than in the main distribution directory.  This will
6821 ease upgrades between binary-compatible maintenance versions of perl.
6822
6823 Of course you may also use these directories in whatever way you see
6824 fit.  For example, you might use them to access modules shared over a
6825 company-wide network.
6826
6827 The default answer should be fine for most people.
6828 This causes further questions about vendor add-ons to be skipped
6829 and no vendor-specific directories will be configured for perl.
6830
6831 EOM
6832 rp='Do you want to configure vendor-specific add-on directories?'
6833 case "$usevendorprefix" in
6834 define|true|[yY]*) dflt=y ;;
6835 *)      : User may have set vendorprefix directly on Configure command line.
6836         case "$vendorprefix" in
6837         ''|' ') dflt=n ;;
6838         *)      dflt=y ;;
6839         esac
6840         ;;
6841 esac
6842 . ./myread
6843 case "$ans" in
6844 [yY]*)  fn=d~+
6845         rp='Installation prefix to use for vendor-supplied add-ons?'
6846         case "$vendorprefix" in
6847         '') dflt='' ;;
6848         *)  dflt=$vendorprefix ;;
6849         esac
6850         . ./getfile
6851         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6852         oldvendorprefix=''
6853         case "$vendorprefix" in
6854         '') ;;
6855         *)      case "$ans" in
6856                 "$prefix") ;;
6857                 *) oldvendorprefix="$prefix";;
6858                 esac
6859                 ;;
6860         esac
6861         usevendorprefix="$define"
6862         vendorprefix="$ans"
6863         vendorprefixexp="$ansexp"
6864         ;;
6865 *)      usevendorprefix="$undef"
6866         vendorprefix=''
6867         vendorprefixexp=''
6868         ;;
6869 esac
6870
6871 case "$vendorprefix" in
6872 '')     d_vendorlib="$undef"
6873         vendorlib=''
6874         vendorlibexp=''
6875         ;;
6876 *)      d_vendorlib="$define"
6877         : determine where vendor-supplied modules go.
6878         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6879         case "$vendorlib" in
6880         '')
6881                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6882                 case "$installstyle" in
6883                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6884                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6885                 esac
6886                 ;;
6887         *)      dflt="$vendorlib"
6888                 ;;
6889         esac
6890         fn=d~+
6891         rp='Pathname for the vendor-supplied library files?'
6892         . ./getfile
6893         vendorlib="$ans"
6894         vendorlibexp="$ansexp"
6895         ;;
6896 esac
6897 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6898 prefixvar=vendorlib
6899 . ./installprefix
6900
6901 case "$vendorprefix" in
6902 '')     d_vendorarch="$undef"
6903         vendorarch=''
6904         vendorarchexp=''
6905         ;;
6906 *)      d_vendorarch="$define"
6907         : determine where vendor-supplied architecture-dependent libraries go.
6908         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6909         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6910         : vendorlib may have an optional trailing /share.
6911         case "$vendorarch" in
6912         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6913                 dflt="$dflt/$archname"
6914                 ;;
6915         *)      dflt="$vendorarch" ;;
6916         esac
6917         fn=d~+
6918         rp='Pathname for vendor-supplied architecture-dependent files?'
6919         . ./getfile
6920         vendorarch="$ans"
6921         vendorarchexp="$ansexp"
6922         ;;
6923 esac
6924 prefixvar=vendorarch
6925 . ./installprefix
6926
6927 : Final catch-all directories to search
6928 $cat <<EOM
6929
6930 Lastly, you can have perl look in other directories for extensions and
6931 modules in addition to those already specified.
6932 These directories will be searched after 
6933         $sitearch 
6934         $sitelib 
6935 EOM
6936 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6937 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6938 echo ' '
6939 case "$otherlibdirs" in
6940 ''|' ') dflt='none' ;;
6941 *)      dflt="$otherlibdirs" ;;
6942 esac
6943 $cat <<EOM
6944 Enter a colon-separated set of extra paths to include in perl's @INC
6945 search path, or enter 'none' for no extra paths.
6946
6947 EOM
6948
6949 rp='Colon-separated list of additional directories for perl to search?'
6950 . ./myread
6951 case "$ans" in
6952 ' '|''|none)    otherlibdirs=' ' ;;     
6953 *)      otherlibdirs="$ans" ;;
6954 esac
6955 case "$otherlibdirs" in
6956 ' ') val=$undef ;;
6957 *)      val=$define ;;
6958 esac
6959 set d_perl_otherlibdirs
6960 eval $setvar
6961
6962 : Cruising for prototypes
6963 echo " "
6964 echo "Checking out function prototypes..." >&4
6965 $cat >prototype.c <<EOCP
6966 #$i_stdlib I_STDLIB
6967 #ifdef I_STDLIB
6968 #include <stdlib.h>
6969 #endif
6970 int main(int argc, char *argv[]) {
6971         exit(0);}
6972 EOCP
6973 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6974         echo "Your C compiler appears to support function prototypes."
6975         val="$define"
6976 else
6977         echo "Your C compiler doesn't seem to understand function prototypes."
6978         val="$undef"
6979 fi
6980 set prototype
6981 eval $setvar
6982 $rm -f prototype*
6983
6984 case "$prototype" in
6985 "$define") ;;
6986 *)      ansi2knr='ansi2knr'
6987         echo " "
6988         cat <<EOM >&4
6989
6990 $me:  FATAL ERROR:
6991 This version of $package can only be compiled by a compiler that 
6992 understands function prototypes.  Unfortunately, your C compiler 
6993         $cc $ccflags
6994 doesn't seem to understand them.  Sorry about that.
6995
6996 If GNU cc is available for your system, perhaps you could try that instead.  
6997
6998 Eventually, we hope to support building Perl with pre-ANSI compilers.
6999 If you would like to help in that effort, please contact <perlbug@perl.org>.
7000
7001 Aborting Configure now.
7002 EOM
7003         exit 2
7004         ;;
7005 esac
7006
7007 echo " "
7008 case "$extras" in
7009 '') dflt='n';;
7010 *) dflt='y';;
7011 esac
7012 cat <<EOM
7013 Perl can be built with extra modules or bundles of modules which
7014 will be fetched from the CPAN and installed alongside Perl.
7015
7016 Notice that you will need access to the CPAN; either via the Internet,
7017 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7018 be asked later to configure the CPAN.pm module which will in turn do
7019 the installation of the rest of the extra modules or bundles.)
7020
7021 Notice also that if the modules require any external software such as
7022 libraries and headers (the libz library and the zlib.h header for the
7023 Compress::Zlib module, for example) you MUST have any such software
7024 already installed, this configuration process will NOT install such
7025 things for you.
7026
7027 If this doesn't make any sense to you, just accept the default '$dflt'.
7028 EOM
7029 rp='Install any extra modules (y or n)?'
7030 . ./myread
7031 case "$ans" in
7032 y|Y)
7033         cat <<EOM
7034
7035 Please list any extra modules or bundles to be installed from CPAN,
7036 with spaces between the names.  The names can be in any format the
7037 'install' command of CPAN.pm will understand.  (Answer 'none',
7038 without the quotes, to install no extra modules or bundles.)
7039 EOM
7040         rp='Extras?'
7041         dflt="$extras"
7042         . ./myread
7043         extras="$ans"
7044 esac
7045 case "$extras" in
7046 ''|'none')
7047         val=''
7048         $rm -f ../extras.lst
7049         ;;
7050 *)      echo "(Saving the list of extras for later...)"
7051         echo "$extras" > ../extras.lst
7052         val="'$extras'"
7053         ;;
7054 esac
7055 set extras
7056 eval $setvar
7057 echo " "
7058
7059 : determine where html pages for programs go
7060 set html1dir html1dir none
7061 eval $prefixit
7062 $cat <<EOM
7063
7064 If you wish to install html files for programs in $spackage, indicate
7065 the appropriate directory here.  To skip installing html files,
7066 answer "none".
7067 EOM
7068 case "$html1dir" in
7069 ''|none|$undef|' ') dflt=none ;;
7070 *) dflt=$html1dir ;;
7071 esac
7072 fn=dn+~
7073 rp="Directory for the main $spackage html pages?"
7074 . ./getfile
7075 prefixvar=html1dir
7076 . ./setprefixvar
7077 : Use ' ' for none so value is preserved next time through Configure
7078 $test X"$html1dir" = "X" && html1dir=' '
7079
7080 : determine where html pages for libraries and modules go
7081 set html3dir html3dir none
7082 eval $prefixit
7083 $cat <<EOM
7084
7085 If you wish to install html files for modules associated with $spackage,
7086 indicate the appropriate directory here.  To skip installing html files,
7087 answer "none".
7088 EOM
7089 : There is no obvious default.  If they have specified html1dir, then
7090 : try to key off that, possibly changing .../html1 into .../html3.
7091 case "$html3dir" in
7092 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7093 *) dflt=$html3dir ;;
7094 esac
7095 fn=dn+~
7096 rp="Directory for the $spackage module html pages?"
7097 . ./getfile
7098 prefixvar=html3dir
7099 . ./setprefixvar
7100 : Use ' ' for none so value is preserved next time through Configure
7101 $test X"$html3dir" = "X" && html3dir=' '
7102
7103 : determine whether to install perl also as /usr/bin/perl
7104
7105 echo " "
7106 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7107         $cat <<EOM
7108 Many scripts expect perl to be installed as /usr/bin/perl.
7109
7110 If you want to, I can install the perl you are about to compile
7111 as /usr/bin/perl (in addition to $bin/perl).
7112 EOM
7113         if test -f /usr/bin/perl; then
7114             $cat <<EOM
7115
7116 However, please note that because you already have a /usr/bin/perl,
7117 overwriting that with a new Perl would very probably cause problems.
7118 Therefore I'm assuming you don't want to do that (unless you insist).
7119
7120 EOM
7121             case "$installusrbinperl" in
7122             "$define"|[yY]*)    dflt='y';;
7123             *)                  dflt='n';;
7124             esac
7125         else
7126             $cat <<EOM
7127
7128 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7129
7130 EOM
7131             case "$installusrbinperl" in
7132             "$undef"|[nN]*)     dflt='n';;
7133             *)                  dflt='y';;
7134             esac
7135         fi
7136         rp="Do you want to install perl as /usr/bin/perl?"
7137         . ./myread
7138         case "$ans" in
7139         [yY]*)  val="$define";;
7140         *)      val="$undef" ;;
7141         esac
7142 else
7143         val="$undef"
7144 fi
7145 set installusrbinperl
7146 eval $setvar
7147
7148 echo " "
7149 echo "Checking for GNU C Library..." >&4
7150 cat >try.c <<'EOCP'
7151 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7152    alone are insufficient to distinguish different versions, such as
7153    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7154    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7155 */
7156 #include <stdio.h>
7157 int main(void)
7158 {
7159 #ifdef __GLIBC__
7160 #   ifdef __GLIBC_MINOR__
7161 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7162 #           include <gnu/libc-version.h>
7163             printf("%s\n",  gnu_get_libc_version());
7164 #       else
7165             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7166 #       endif
7167 #   else
7168         printf("%d\n",  __GLIBC__);
7169 #   endif
7170     return 0;
7171 #else
7172     return 1;
7173 #endif
7174 }
7175 EOCP
7176 set try
7177 if eval $compile_ok && $run ./try > glibc.ver; then
7178         val="$define"
7179         gnulibc_version=`$cat glibc.ver`
7180         echo "You are using the GNU C Library version $gnulibc_version"
7181 else
7182         val="$undef"
7183         gnulibc_version=''
7184         echo "You are not using the GNU C Library"
7185 fi
7186 $rm -f try try.* glibc.ver
7187 set d_gnulibc
7188 eval $setvar
7189
7190 : see if nm is to be used to determine whether a symbol is defined or not
7191 case "$usenm" in
7192 '')
7193         dflt=''
7194         case "$d_gnulibc" in
7195         "$define")
7196                 echo " "
7197                 echo "nm probably won't work on the GNU C Library." >&4
7198                 dflt=n
7199                 ;;
7200         esac
7201         case "$dflt" in
7202         '') 
7203                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7204                         echo " "
7205                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7206                         echo "'nm' won't be sufficient on this sytem." >&4
7207                         dflt=n
7208                 fi
7209                 ;;
7210         esac
7211         case "$dflt" in
7212         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7213                 if $test $dflt -gt 20; then
7214                         dflt=y
7215                 else
7216                         dflt=n
7217                 fi
7218                 ;;
7219         esac
7220         ;;
7221 *)
7222         case "$usenm" in
7223         true|$define) dflt=y;;
7224         *) dflt=n;;
7225         esac
7226         ;;
7227 esac
7228 $cat <<EOM
7229
7230 I can use $nm to extract the symbols from your C libraries. This
7231 is a time consuming task which may generate huge output on the disk (up
7232 to 3 megabytes) but that should make the symbols extraction faster. The
7233 alternative is to skip the 'nm' extraction part and to compile a small
7234 test program instead to determine whether each symbol is present. If
7235 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7236 this may be the best solution.
7237
7238 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7239
7240 EOM
7241 rp="Shall I use $nm to extract C symbols from the libraries?"
7242 . ./myread
7243 case "$ans" in
7244 [Nn]*) usenm=false;;
7245 *) usenm=true;;
7246 esac
7247
7248 runnm=$usenm
7249 case "$reuseval" in
7250 true) runnm=false;;
7251 esac
7252
7253 : nm options which may be necessary
7254 case "$nm_opt" in
7255 '') if $test -f /mach_boot; then
7256                 nm_opt=''       # Mach
7257         elif $test -d /usr/ccs/lib; then
7258                 nm_opt='-p'     # Solaris (and SunOS?)
7259         elif $test -f /dgux; then
7260                 nm_opt='-p'     # DG-UX
7261         elif $test -f /lib64/rld; then
7262                 nm_opt='-p'     # 64-bit Irix
7263         else
7264                 nm_opt=''
7265         fi;;
7266 esac
7267
7268 : nm options which may be necessary for shared libraries but illegal
7269 : for archive libraries.  Thank you, Linux.
7270 case "$nm_so_opt" in
7271 '')     case "$myuname" in
7272         *linux*|gnu*)
7273                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7274                         nm_so_opt='--dynamic'
7275                 fi
7276                 ;;
7277         esac
7278         ;;
7279 esac
7280
7281 case "$runnm" in
7282 true)
7283 : get list of predefined functions in a handy place
7284 echo " "
7285 case "$libc" in
7286 '') libc=unknown
7287         case "$libs" in
7288         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7289         esac
7290         ;;
7291 esac
7292 case "$libs" in
7293 '') ;;
7294 *)  for thislib in $libs; do
7295         case "$thislib" in
7296         -lc|-lc_s)
7297                 : Handle C library specially below.
7298                 ;;
7299         -l*)
7300                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7301                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7302                         :
7303                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7304                         :
7305                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7306                         :
7307                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7308                         :
7309                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7310                         :
7311                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7312                         :
7313                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7314                         :
7315                 else
7316                         try=''
7317                 fi
7318                 libnames="$libnames $try"
7319                 ;;
7320         *) libnames="$libnames $thislib" ;;
7321         esac
7322         done
7323         ;;
7324 esac
7325 xxx=normal
7326 case "$libc" in
7327 unknown)
7328         set /lib/libc.$so
7329         for xxx in $libpth; do
7330                 $test -r $1 || set $xxx/libc.$so
7331                 : The messy sed command sorts on library version numbers.
7332                 $test -r $1 || \
7333                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7334                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7335                                 h
7336                                 s/[0-9][0-9]*/0000&/g
7337                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7338                                 G
7339                                 s/\n/ /' | \
7340                          $sort | $sed -e 's/^.* //'`
7341                 eval set \$$#
7342         done
7343         $test -r $1 || set /usr/ccs/lib/libc.$so
7344         $test -r $1 || set /lib/libsys_s$_a
7345         ;;
7346 *)
7347         set blurfl
7348         ;;
7349 esac
7350 if $test -r "$1"; then
7351         echo "Your (shared) C library seems to be in $1."
7352         libc="$1"
7353 elif $test -r /lib/libc && $test -r /lib/clib; then
7354         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7355         xxx=apollo
7356         libc='/lib/clib /lib/libc'
7357         if $test -r /lib/syslib; then
7358                 echo "(Your math library is in /lib/syslib.)"
7359                 libc="$libc /lib/syslib"
7360         fi
7361 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7362         echo "Your C library seems to be in $libc, as you said before."
7363 elif $test -r $incpath/usr/lib/libc$_a; then
7364         libc=$incpath/usr/lib/libc$_a;
7365         echo "Your C library seems to be in $libc.  That's fine."
7366 elif $test -r /lib/libc$_a; then
7367         libc=/lib/libc$_a;
7368         echo "Your C library seems to be in $libc.  You're normal."
7369 else
7370         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7371                 :
7372         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7373                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7374         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7375                 :
7376         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7377                 :
7378         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7379                 :
7380         else
7381                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7382         fi
7383         if $test -r "$tans"; then
7384                 echo "Your C library seems to be in $tans, of all places."
7385                 libc=$tans
7386         else
7387                 libc='blurfl'
7388         fi
7389 fi
7390 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7391         dflt="$libc"
7392         cat <<EOM
7393
7394 If the guess above is wrong (which it might be if you're using a strange
7395 compiler, or your machine supports multiple models), you can override it here.
7396
7397 EOM
7398 else
7399         dflt=''
7400         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7401         cat >&4 <<EOM
7402 I can't seem to find your C library.  I've looked in the following places:
7403
7404 EOM
7405         $sed 's/^/      /' libpath
7406         cat <<EOM
7407
7408 None of these seems to contain your C library. I need to get its name...
7409
7410 EOM
7411 fi
7412 fn=f
7413 rp='Where is your C library?'
7414 . ./getfile
7415 libc="$ans"
7416
7417 echo " "
7418 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7419 set X `cat libnames`
7420 shift
7421 xxx=files
7422 case $# in 1) xxx=file; esac
7423 echo "Extracting names from the following $xxx for later perusal:" >&4
7424 echo " "
7425 $sed 's/^/      /' libnames >&4
7426 echo " "
7427 $echo $n "This may take a while...$c" >&4
7428
7429 for file in $*; do
7430         case $file in
7431         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7432         *) $nm $nm_opt $file 2>/dev/null;;
7433         esac
7434 done >libc.tmp
7435
7436 $echo $n ".$c"
7437 $grep fprintf libc.tmp > libc.ptf
7438 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7439 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7440 xxx='[ADTSIW]'
7441 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7442         eval $xscan;\
7443         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7444                 eval $xrun
7445 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7446         eval $xscan;\
7447         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7448                 eval $xrun
7449 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7450         eval $xscan;\
7451         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7452                 eval $xrun
7453 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7454         eval $xscan;\
7455         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7456                 eval $xrun
7457 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7458         eval $xscan;\
7459         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7460                 eval $xrun
7461 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7462         eval $xscan;\
7463         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7464                 eval $xrun
7465 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7466                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7467         eval $xscan;\
7468         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7469                 eval $xrun
7470 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7471         eval $xscan;\
7472         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7473                 eval $xrun
7474 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7475         eval $xscan;\
7476         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7477                 eval $xrun
7478 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7479         eval $xscan;\
7480         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7481                 eval $xrun
7482 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7483         eval $xscan;\
7484         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7485                 eval $xrun
7486 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7487         eval $xscan;\
7488         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7489                 eval $xrun
7490 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7491         eval $xscan;\
7492         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7493                 eval $xrun
7494 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7495         eval $xscan;\
7496         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7497                 eval $xrun
7498 else
7499         $nm -p $* 2>/dev/null >libc.tmp
7500         $grep fprintf libc.tmp > libc.ptf
7501         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7502                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7503         then
7504                 nm_opt='-p'
7505                 eval $xrun
7506         else
7507                 echo " "
7508                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7509                 com=''
7510                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7511                         for thisname in $libnames $libc; do
7512                                 $ar t $thisname >>libc.tmp
7513                         done
7514                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7515                         echo "Ok." >&4
7516                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7517                         # Repeat libc to extract forwarders to DLL entries too
7518                         for thisname in $libnames $libc; do
7519                                 $ar tv $thisname >>libc.tmp
7520                                 # Revision 50 of EMX has bug in $ar.
7521                                 # it will not extract forwarders to DLL entries
7522                                 # Use emximp which will extract exactly them.
7523                                 emximp -o tmp.imp $thisname \
7524                                     2>/dev/null && \
7525                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7526                                     < tmp.imp >>libc.tmp
7527                                 $rm tmp.imp
7528                         done
7529                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7530                         echo "Ok." >&4
7531                 else
7532                         echo "$ar didn't seem to work right." >&4
7533                         echo "Maybe this is a Cray...trying bld instead..." >&4
7534                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7535                         then
7536                                 for thisname in $libnames; do
7537                                         bld t $libnames | \
7538                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7539                                         $ar t $thisname >>libc.tmp
7540                                 done
7541                                 echo "Ok." >&4
7542                         else
7543                                 echo "That didn't work either.  Giving up." >&4
7544                                 exit 1
7545                         fi
7546                 fi
7547         fi
7548 fi
7549 nm_extract="$com"
7550 case "$PASE" in
7551 define)
7552     echo " "
7553     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7554     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7555     ;;
7556 *)  if $test -f /lib/syscalls.exp; then
7557         echo " "
7558         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7559         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7560     fi
7561     ;;
7562 esac
7563 ;;
7564 esac
7565 $rm -f libnames libpath
7566
7567 : see if dld is available
7568 set dld.h i_dld
7569 eval $inhdr
7570
7571 : is a C symbol defined?
7572 csym='tlook=$1;
7573 case "$3" in
7574 -v) tf=libc.tmp; tdc="";;
7575 -a) tf=libc.tmp; tdc="[]";;
7576 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7577 esac;
7578 tx=yes;
7579 case "$reuseval-$4" in
7580 true-) ;;
7581 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7582 esac;
7583 case "$tx" in
7584 yes)
7585         case "$d_cplusplus" in
7586                 $define) extern_C=\"C\";;
7587         esac;
7588         tval=false;
7589         if $test "$runnm" = true; then
7590                 if $contains $tlook $tf >/dev/null 2>&1; then
7591                         tval=true;
7592                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7593                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7594                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7595                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7596                         $rm -f try$_exe try.c core core.* try.core;
7597                 fi;
7598         else
7599                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7600                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7601                 $rm -f try$_exe try.c;
7602         fi;
7603         ;;
7604 *)
7605         case "$tval" in
7606         $define) tval=true;;
7607         *) tval=false;;
7608         esac;
7609         ;;
7610 esac;
7611 eval "$2=$tval"'
7612
7613 : define an is-in-libc? function
7614 inlibc='echo " "; td=$define; tu=$undef;
7615 sym=$1; var=$2; eval "was=\$$2";
7616 tx=yes;
7617 case "$reuseval$was" in
7618 true) ;;
7619 true*) tx=no;;
7620 esac;
7621 case "$tx" in
7622 yes)
7623         set $sym tres -f;
7624         eval $csym;
7625         case "$tres" in
7626         true)
7627                 echo "$sym() found." >&4;
7628                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7629         *)
7630                 echo "$sym() NOT found." >&4;
7631                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7632         esac;;
7633 *)
7634         case "$was" in
7635         $define) echo "$sym() found." >&4;;
7636         *) echo "$sym() NOT found." >&4;;
7637         esac;;
7638 esac'
7639
7640
7641 echo " "
7642 echo "Checking for C++..." >&4
7643 cat >try.c <<'EOCP'
7644 #include <stdio.h>
7645 int main(void)
7646 {
7647 #ifdef __cplusplus
7648     printf("define\n");
7649 #else
7650     printf("undef\n");
7651 #endif
7652     return 0;
7653 }
7654 EOCP
7655 set try
7656 if eval $compile_ok && $run ./try >cplusplus$$; then
7657         val=`$cat cplusplus$$`
7658         echo "You are using a C++ compiler."
7659 else
7660         val="$undef"
7661         echo "You are not using a C++ compiler."
7662 fi
7663 $rm -f try try.* cplusplus$$
7664 set d_cplusplus
7665 eval $setvar
7666
7667 : see if dlopen exists
7668 xxx_runnm="$runnm"
7669 xxx_ccflags="$ccflags"
7670 runnm=false
7671 : with g++ one needs -shared to get is-in-libc to work for dlopen
7672 case "$gccversion" in
7673 '')     ;;
7674 *)      case "$d_cplusplus" in
7675         "$define") ccflags="$ccflags -shared" ;;
7676         esac
7677         ;;
7678 esac
7679 set dlopen d_dlopen
7680 eval $inlibc
7681 runnm="$xxx_runnm"
7682 ccflags="$xxx_ccflags"
7683
7684 : see if this is a unistd.h system
7685 set unistd.h i_unistd
7686 eval $inhdr
7687
7688 : determine which dynamic loading, if any, to compile in
7689 echo " "
7690 dldir="ext/DynaLoader"
7691 case "$usedl" in
7692 $define|y|true)
7693         dflt='y'
7694         usedl="$define"
7695         ;;
7696 $undef|n|false)
7697         dflt='n'
7698         usedl="$undef"
7699         ;;
7700 *) 
7701         dflt='n'
7702         case "$d_dlopen" in
7703             $define) dflt='y' ;;
7704         esac
7705         case "$i_dld" in
7706             $define) dflt='y' ;;
7707         esac
7708         : Does a dl_xxx.xs file exist for this operating system
7709         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7710         ;;
7711 esac
7712 rp="Do you wish to use dynamic loading?"
7713 . ./myread
7714 usedl="$ans"
7715 case "$ans" in
7716 y*) usedl="$define"
7717         case "$dlsrc" in
7718         '')
7719                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7720                         dflt="$dldir/dl_${osname}.xs"
7721                 elif $test "$d_dlopen" = "$define" ; then
7722                         dflt="$dldir/dl_dlopen.xs"
7723                 elif $test "$i_dld" = "$define" ; then
7724                         dflt="$dldir/dl_dld.xs"
7725                 else
7726                         dflt=''
7727                 fi
7728                 ;;
7729         *)      dflt="$dldir/$dlsrc"
7730                 ;;
7731         esac
7732     echo "The following dynamic loading files are available:"
7733         : Can not go over to $dldir because getfile has path hard-coded in.
7734         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7735         rp="Source file to use for dynamic loading"
7736         fn="fne"
7737         gfpth="$src"
7738         . ./getfile
7739         usedl="$define"
7740         : emulate basename
7741         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7742
7743         $cat << EOM
7744
7745 Some systems may require passing special flags to $cc -c to
7746 compile modules that will be used to create a shared library.
7747 To use no flags, say "none".
7748
7749 EOM
7750     case "$cccdlflags" in
7751     '') case "$gccversion" in
7752                 '') case "$osname" in
7753                         hpux)   dflt='+z' ;;
7754                         next)   dflt='none' ;;
7755                         irix*)  dflt='-KPIC' ;;
7756                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7757                         sunos)  dflt='-pic' ;;
7758                         *)      dflt='none' ;;
7759                     esac
7760                         ;;
7761                 *)  case "$osname" in
7762                         darwin) dflt='none' ;;
7763                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7764                         *)      dflt='-fpic' ;;
7765                     esac ;;
7766             esac ;;
7767         ' ') dflt='none' ;;
7768     *)  dflt="$cccdlflags" ;;
7769     esac
7770     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7771     . ./myread
7772     case "$ans" in
7773     none) cccdlflags=' ' ;;
7774     *) cccdlflags="$ans" ;;
7775     esac
7776
7777     cat << EOM
7778
7779 Some systems use ld to create libraries that can be dynamically loaded,
7780 while other systems (such as those using ELF) use $cc.
7781
7782 EOM
7783         case "$ld" in
7784         '')     $cat >try.c <<EOM
7785 /* Test for whether ELF binaries are produced */
7786 #include <fcntl.h>
7787 #$i_stdlib I_STDLIB
7788 #ifdef I_STDLIB
7789 #include <stdlib.h>
7790 #endif
7791 #$i_unistd I_UNISTD
7792 #ifdef I_UNISTD
7793 #include <unistd.h>
7794 #endif
7795 int main() {
7796         char b[4];
7797         int i = open("a.out",O_RDONLY);
7798         if(i == -1) 
7799                 exit(1); /* fail */
7800         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7801                 exit(0); /* succeed (yes, it's ELF) */
7802         else
7803                 exit(1); /* fail */
7804 }
7805 EOM
7806                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7807                         cat <<EOM
7808 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7809 EOM
7810                         dflt="$cc"
7811                 else
7812                         echo "I'll use ld to build dynamic libraries."
7813                         dflt='ld'
7814                 fi
7815                 rm -f try.c a.out
7816                 ;;
7817         *)      dflt="$ld"
7818                 ;;
7819         esac
7820
7821     rp="What command should be used to create dynamic libraries?"
7822     . ./myread
7823         ld="$ans"
7824
7825     cat << EOM
7826
7827 Some systems may require passing special flags to $ld to create a
7828 library that can be dynamically loaded.  If your ld flags include
7829 -L/other/path options to locate libraries outside your loader's normal
7830 search path, you may need to specify those -L options here as well.  To
7831 use no flags, say "none".
7832
7833 EOM
7834     case "$lddlflags" in
7835     '') case "$osname" in
7836                         beos) dflt='-nostart' ;;
7837                         hpux) dflt='-b';
7838                               case "$gccversion" in
7839                               '') dflt="$dflt +vnocompatwarnings" ;;
7840                               esac
7841                               ;;        
7842                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7843                         next)  dflt='none' ;;
7844                         solaris) dflt='-G' ;;
7845                         sunos) dflt='-assert nodefinitions' ;;
7846                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7847                 *)     dflt='none' ;;
7848                         esac
7849                         ;;
7850     *) dflt="$lddlflags" ;;
7851     esac
7852
7853         : Try to guess additional flags to pick up local libraries.
7854         : Be careful not to append to a plain 'none'
7855         case "$dflt" in
7856         none) dflt='' ;;
7857         esac
7858         for thisflag in $ldflags; do
7859                 case "$thisflag" in
7860                 -L*|-R*|-Wl,-R*)
7861                         case " $dflt " in
7862                         *" $thisflag "*) ;;
7863                         *) dflt="$dflt $thisflag" ;;
7864                         esac
7865                         ;;
7866                 esac
7867         done
7868
7869         case "$dflt" in
7870         ''|' ') dflt='none' ;;
7871         esac
7872
7873     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7874     . ./myread
7875     case "$ans" in
7876     none) lddlflags=' ' ;;
7877     *) lddlflags="$ans" ;;
7878     esac
7879
7880         cat <<EOM
7881
7882 Some systems may require passing special flags to $cc to indicate that
7883 the resulting executable will use dynamic linking.  To use no flags,
7884 say "none".
7885
7886 EOM
7887     case "$ccdlflags" in
7888     '') case "$osname" in
7889             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7890             next|sunos) dflt='none' ;;
7891             *)          dflt='none' ;;
7892             esac ;;
7893     ' ')  dflt='none' ;;
7894     *)  dflt="$ccdlflags" ;;
7895     esac
7896     rp="Any special flags to pass to $cc to use dynamic linking?"
7897     . ./myread
7898     case "$ans" in
7899     none) ccdlflags=' ' ;;
7900     *) ccdlflags="$ans" ;;
7901     esac
7902     ;;
7903 *)  usedl="$undef"
7904         ld='ld'
7905     dlsrc='dl_none.xs'
7906     lddlflags=''
7907     ccdlflags=''
7908     ;;
7909 esac
7910
7911 also=''
7912 case "$usedl" in
7913 $undef)
7914         # No dynamic loading being used, so don't bother even to prompt.
7915         useshrplib='false'
7916         ;;
7917 *)      case "$useshrplib" in
7918         '')     case "$osname" in
7919                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7920                         dflt=y
7921                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7922                         ;;
7923                 next*)
7924                         case "$osvers" in
7925                         4*)     dflt=y
7926                                 also='Building a shared libperl is needed for MAB support.'
7927                                 ;;
7928                         *)      dflt=n
7929                                 ;;
7930                         esac
7931                         ;;
7932                 *)      dflt=n
7933                         ;;
7934                 esac
7935                 ;;
7936         $define|true|[Yy]*)
7937                 dflt=y
7938                 ;;
7939         *)      dflt=n
7940                 ;;
7941         esac
7942         $cat << EOM
7943
7944 The perl executable is normally obtained by linking perlmain.c with
7945 libperl${_a}, any static extensions (usually just DynaLoader), and
7946 any other libraries needed on this system (such as -lm, etc.).  Since
7947 your system supports dynamic loading, it is probably possible to build
7948 a shared libperl.$so.  If you will have more than one executable linked
7949 to libperl.$so, this will significantly reduce the size of each
7950 executable, but it may have a noticeable effect on performance.  The
7951 default is probably sensible for your system.
7952 $also
7953
7954 EOM
7955         rp="Build a shared libperl.$so (y/n)"
7956         . ./myread
7957         case "$ans" in
7958         true|$define|[Yy]*)
7959                 useshrplib='true'  ;;
7960         *)      useshrplib='false' ;;
7961         esac
7962         ;;
7963 esac
7964
7965 case "$useshrplib" in
7966 true)
7967         case "$libperl" in
7968         '')
7969                 # Figure out a good name for libperl.so.  Since it gets stored in
7970                 # a version-specific architecture-dependent library, the version
7971                 # number isn't really that important, except for making cc/ld happy.
7972                 #
7973                 # A name such as libperl.so.3.1
7974                 majmin="libperl.$so.$patchlevel.$subversion"
7975                 # A name such as libperl.so.301
7976                 majonly=`echo $patchlevel $subversion |
7977                         $awk '{printf "%d%02d", $1, $2}'`
7978                 majonly=libperl.$so.$majonly
7979                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7980                 # rely on figuring it out from the naming of libc.
7981                 case "${osname}${osvers}" in
7982                 next4*)
7983                         dflt=libperl.5.$so
7984                         # XXX How handle the --version stuff for MAB?
7985                         ;;
7986                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7987                         dflt=libperl.$so
7988                         ;;
7989                 cygwin*) # ld links against an importlib
7990                         dflt=libperl$lib_ext
7991                         ;;
7992                 *)      # Try to guess based on whether libc has major.minor.
7993                         case "$libc" in
7994                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7995                         *libc.$so.[0-9]*) dflt=$majonly ;;
7996                         *)      dflt=libperl.$so ;;
7997                         esac
7998                         ;;
7999                 esac
8000                 ;;
8001         *)      dflt=$libperl
8002                 ;;
8003         esac
8004         cat << EOM
8005
8006 I need to select a good name for the shared libperl.  If your system uses
8007 library names with major and minor numbers, then you might want something
8008 like $majmin.  Alternatively, if your system uses a single version
8009 number for shared libraries, then you might want to use $majonly.
8010 Or, your system might be quite happy with a simple libperl.$so.
8011
8012 Since the shared libperl will get installed into a version-specific
8013 architecture-dependent directory, the version number of the shared perl
8014 library probably isn't important, so the default should be o.k.
8015
8016 EOM
8017         rp='What name do you want to give to the shared libperl?'
8018         . ./myread
8019         libperl=$ans
8020         echo "Ok, I'll use $libperl"
8021         ;;
8022 *)
8023         libperl="libperl${_a}"
8024         ;;
8025 esac
8026
8027 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8028 case "$shrpdir" in
8029 '') ;;
8030 *)      $cat >&4 <<EOM
8031 WARNING:  Use of the shrpdir variable for the installation location of
8032 the shared $libperl is not supported.  It was never documented and
8033 will not work in this version.  Let me (perlbug@perl.org)
8034 know of any problems this may cause.
8035
8036 EOM
8037         case "$shrpdir" in
8038         "$archlibexp/CORE")
8039                 $cat >&4 <<EOM
8040 But your current setting of $shrpdir is
8041 the default anyway, so it's harmless.
8042 EOM
8043                 ;;
8044         *)
8045                 $cat >&4 <<EOM
8046 Further, your current attempted setting of $shrpdir
8047 conflicts with the value of $archlibexp/CORE
8048 that installperl will use.
8049 EOM
8050                 ;;
8051         esac
8052         ;;
8053 esac
8054
8055 # How will the perl executable find the installed shared $libperl?
8056 # Add $xxx to ccdlflags.
8057 # If we can't figure out a command-line option, use $shrpenv to
8058 # set env LD_RUN_PATH.  The main perl makefile uses this.
8059 shrpdir=$archlibexp/CORE
8060 xxx=''
8061 tmp_shrpenv=''
8062 if "$useshrplib"; then
8063     case "$osname" in 
8064         aix)
8065                 # We'll set it in Makefile.SH...
8066                 ;;
8067         solaris)
8068                 xxx="-R $shrpdir"
8069                 ;;
8070         freebsd|netbsd|openbsd|interix|dragonfly)
8071                 xxx="-Wl,-R$shrpdir"
8072                 ;;
8073         bsdos|linux|irix*|dec_osf|gnu*)
8074                 xxx="-Wl,-rpath,$shrpdir"
8075                 ;;
8076         next)
8077                 # next doesn't like the default...
8078                 ;;
8079         beos)
8080                 # beos doesn't like the default, either.
8081                 ;;
8082         hpux*)
8083                 # hpux doesn't like the default, either.
8084                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8085                 ;;
8086         *)
8087                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8088                 ;;
8089         esac
8090         case "$xxx" in
8091         '') ;;
8092         *)      
8093                 # Only add $xxx if it isn't already in ccdlflags.
8094                 case " $ccdlflags " in
8095                 *" $xxx "*)     ;;
8096                 *)      ccdlflags="$ccdlflags $xxx"
8097                         cat <<EOM >&4
8098
8099 Adding $xxx to the flags
8100 passed to $ld so that the perl executable will find the 
8101 installed shared $libperl.
8102
8103 EOM
8104                         ;;
8105                 esac
8106                 ;;
8107         esac
8108 fi
8109 # Fix ccdlflags in AIX for building external extensions.
8110 # (For building Perl itself bare -bE:perl.exp is needed,
8111 #  Makefile.SH takes care of this.)
8112 case "$osname" in
8113 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8114 esac
8115 # Respect a hint or command-line value.
8116 case "$shrpenv" in
8117 '') shrpenv="$tmp_shrpenv" ;;
8118 esac
8119 case "$ldlibpthname" in
8120 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8121 none)   ldlibpthname='' ;;
8122 esac
8123
8124 : determine where manual pages are on this system
8125 echo " "
8126 case "$sysman" in
8127 '') 
8128         syspath='/usr/share/man/man1 /usr/man/man1'
8129         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8130         syspath="$syspath /usr/man/u_man/man1"
8131         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8132         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8133         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8134         sysman=`./loc . /usr/man/man1 $syspath`
8135         ;;
8136 esac
8137 if $test -d "$sysman"; then
8138         echo "System manual is in $sysman." >&4
8139 else
8140         echo "Could not find manual pages in source form." >&4
8141 fi
8142
8143 : determine where manual pages go
8144 set man1dir man1dir none
8145 eval $prefixit
8146 $cat <<EOM
8147
8148 $spackage has manual pages available in source form.
8149 EOM
8150 case "$nroff" in
8151 nroff)
8152         echo "However, you don't have nroff, so they're probably useless to you."
8153         case "$man1dir" in
8154         '') man1dir="none";;
8155         esac;;
8156 esac
8157 echo "If you don't want the manual sources installed, answer 'none'."
8158 case "$man1dir" in
8159 ' ') dflt=none
8160         ;;
8161 '')
8162         lookpath="$prefixexp/share/man/man1"
8163         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8164         lookpath="$lookpath $prefixexp/man/p_man/man1"
8165         lookpath="$lookpath $prefixexp/man/u_man/man1"
8166         lookpath="$lookpath $prefixexp/man/man.1"
8167         case "$sysman" in
8168         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8169         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8170         esac
8171         set dflt
8172         eval $prefixup
8173         ;;
8174 *)  dflt="$man1dir"
8175         ;;
8176 esac
8177 echo " "
8178 fn=dn+~
8179 rp="Where do the main $spackage manual pages (source) go?"
8180 . ./getfile
8181 if $test "X$man1direxp" != "X$ansexp"; then
8182         installman1dir=''
8183 fi
8184 prefixvar=man1dir
8185 . ./setprefixvar
8186
8187 case "$man1dir" in
8188 '')     man1dir=' '
8189         installman1dir='';;
8190 esac
8191
8192 : What suffix to use on installed man pages
8193
8194 case "$man1dir" in
8195 ' ')
8196         man1ext='0'
8197         ;;
8198 *)
8199         rp="What suffix should be used for the main $spackage man pages?"
8200         case "$man1ext" in
8201         '')     case "$man1dir" in
8202                 *1)  dflt=1 ;;
8203                 *1p) dflt=1p ;;
8204                 *1pm) dflt=1pm ;;
8205                 *l) dflt=l;;
8206                 *n) dflt=n;;
8207                 *o) dflt=o;;
8208                 *p) dflt=p;;
8209                 *C) dflt=C;;
8210                 *L) dflt=L;;
8211                 *L1) dflt=L1;;
8212                 *) dflt=1;;
8213                 esac
8214                 ;;
8215         *)      dflt="$man1ext";;
8216         esac
8217         . ./myread
8218         man1ext="$ans"
8219         ;;
8220 esac
8221
8222 : see if we can have long filenames
8223 echo " "
8224 first=123456789abcdef
8225 $rm -f $first
8226 if (echo hi >$first) 2>/dev/null; then
8227         if $test -f 123456789abcde; then
8228                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8229                 val="$undef"
8230         else
8231                 echo 'You can have filenames longer than 14 characters.'>&4
8232                 val="$define"
8233         fi
8234 else
8235         $cat <<'EOM'
8236 You can't have filenames longer than 14 chars.
8237 You can't even think about them!
8238 EOM
8239         val="$undef"
8240 fi 
8241 set d_flexfnam
8242 eval $setvar
8243 $rm -rf 123456789abcde*
8244
8245 : determine where library module manual pages go
8246 set man3dir man3dir none
8247 eval $prefixit
8248 $cat <<EOM
8249
8250 $spackage has manual pages for many of the library modules.
8251 EOM
8252
8253 case "$nroff" in
8254 nroff)
8255         $cat <<'EOM'
8256 However, you don't have nroff, so they're probably useless to you.
8257 EOM
8258         case "$man3dir" in
8259         '') man3dir="none";;
8260         esac;;
8261 esac
8262
8263 case "$d_flexfnam" in
8264 undef)
8265         $cat <<'EOM'
8266 However, your system can't handle the long file names like File::Basename.3.
8267 EOM
8268         case "$man3dir" in
8269         '') man3dir="none";;
8270         esac;;
8271 esac
8272
8273 echo "If you don't want the manual sources installed, answer 'none'."
8274 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8275 case "$man3dir" in
8276 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8277         if $test -d "$privlib/man/man3"; then
8278                 cat <<EOM >&4
8279
8280 WARNING:  Previous versions of perl installed man3 pages into
8281 $privlib/man/man3.  This version will suggest a
8282 new default of $dflt.
8283 EOM
8284                 tdflt=$dflt
8285                 dflt='n'
8286                 rp='Do you wish to preserve the old behavior?(y/n)'
8287                 . ./myread
8288                 case "$ans" in
8289                 y*) dflt="$privlib/man/man3" ;;
8290                 *)  dflt=$tdflt ;;
8291                 esac
8292     fi
8293         ;;
8294 *)      dflt="$man3dir" ;;
8295 esac
8296 case "$dflt" in
8297 ' ') dflt=none ;;
8298 esac
8299 echo " "
8300 fn=dn+~
8301 rp="Where do the $package library man pages (source) go?"
8302 . ./getfile
8303 prefixvar=man3dir
8304 . ./setprefixvar
8305
8306 case "$man3dir" in
8307 '')     man3dir=' '
8308         installman3dir='';;
8309 esac
8310
8311 : What suffix to use on installed man pages
8312 case "$man3dir" in
8313 ' ')
8314         man3ext='0'
8315         ;;
8316 *)
8317         rp="What suffix should be used for the $package library man pages?"
8318         case "$man3ext" in
8319         '')     case "$man3dir" in
8320                 *3)  dflt=3 ;;
8321                 *3p) dflt=3p ;;
8322                 *3pm) dflt=3pm ;;
8323                 *l) dflt=l;;
8324                 *n) dflt=n;;
8325                 *o) dflt=o;;
8326                 *p) dflt=p;;
8327                 *C) dflt=C;;
8328                 *L) dflt=L;;
8329                 *L3) dflt=L3;;
8330                 *) dflt=3;;
8331                 esac
8332                 ;;
8333         *)      dflt="$man3ext";;
8334         esac
8335         . ./myread
8336         man3ext="$ans"
8337         ;;
8338 esac
8339
8340 : see if we have to deal with yellow pages, now NIS.
8341 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8342         if $test -f /usr/etc/nibindd; then
8343                 echo " "
8344                 echo "I'm fairly confident you're on a NeXT."
8345                 echo " "
8346                 rp='Do you get the hosts file via NetInfo?'
8347                 dflt=y
8348                 case "$hostcat" in
8349                 nidump*) ;;
8350                 '') ;;
8351                 *) dflt=n;;
8352                 esac
8353                 . ./myread
8354                 case "$ans" in
8355                 y*) hostcat='nidump hosts .';;
8356                 *)      case "$hostcat" in
8357                         nidump*) hostcat='';;
8358                         esac
8359                         ;;
8360                 esac
8361         fi
8362         case "$hostcat" in
8363         nidump*) ;;
8364         *)
8365                 case "$hostcat" in
8366                 *ypcat*) dflt=y;;
8367                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8368                                 dflt=y
8369                         else
8370                                 dflt=n
8371                         fi;;
8372                 *) dflt=n;;
8373                 esac
8374                 echo " "
8375                 rp='Are you getting the hosts file via yellow pages?'
8376                 . ./myread
8377                 case "$ans" in
8378                 y*) hostcat='ypcat hosts';;
8379                 *) hostcat='cat /etc/hosts';;
8380                 esac
8381                 ;;
8382         esac
8383 fi
8384 case "$hostcat" in
8385 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8386 esac
8387 case "$groupcat" in
8388 '') test -f /etc/group && groupcat='cat /etc/group';;
8389 esac
8390 case "$passcat" in
8391 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8392 esac
8393
8394 : now get the host name
8395 echo " "
8396 echo "Figuring out host name..." >&4
8397 case "$myhostname" in
8398 '') cont=true
8399         echo 'Maybe "hostname" will work...'
8400         if tans=`sh -c hostname 2>&1` ; then
8401                 myhostname=$tans
8402                 phostname=hostname
8403                 cont=''
8404         fi
8405         ;;
8406 *) cont='';;
8407 esac
8408 if $test "$cont"; then
8409         if ./xenix; then
8410                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8411                 if tans=`cat /etc/systemid 2>&1` ; then
8412                         myhostname=$tans
8413                         phostname='cat /etc/systemid'
8414                         echo "Whadyaknow.  Xenix always was a bit strange..."
8415                         cont=''
8416                 fi
8417         elif $test -r /etc/systemid; then
8418                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8419         fi
8420 fi
8421 if $test "$cont"; then
8422         echo 'No, maybe "uuname -l" will work...'
8423         if tans=`sh -c 'uuname -l' 2>&1` ; then
8424                 myhostname=$tans
8425                 phostname='uuname -l'
8426         else
8427                 echo 'Strange.  Maybe "uname -n" will work...'
8428                 if tans=`sh -c 'uname -n' 2>&1` ; then
8429                         myhostname=$tans
8430                         phostname='uname -n'
8431                 else
8432                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8433                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8434                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8435                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8436                         else
8437                                 case "$myhostname" in
8438                                 '') echo "Does this machine have an identity crisis or something?"
8439                                         phostname='';;
8440                                 *)
8441                                         echo "Well, you said $myhostname before..."
8442                                         phostname='echo $myhostname';;
8443                                 esac
8444                         fi
8445                 fi
8446         fi
8447 fi
8448 case "$myhostname" in
8449 '') myhostname=noname ;;
8450 esac
8451 : you do not want to know about this
8452 set $myhostname
8453 myhostname=$1
8454
8455 : verify guess
8456 if $test "$myhostname" ; then
8457         dflt=y
8458         rp='Your host name appears to be "'$myhostname'".'" Right?"
8459         . ./myread
8460         case "$ans" in
8461         y*) ;;
8462         *) myhostname='';;
8463         esac
8464 fi
8465
8466 : bad guess or no guess
8467 while $test "X$myhostname" = X ; do
8468         dflt=''
8469         rp="Please type the (one word) name of your host:"
8470         . ./myread
8471         myhostname="$ans"
8472 done
8473
8474 : translate upper to lower if necessary
8475 case "$myhostname" in
8476 *[A-Z]*)
8477         echo "(Normalizing case in your host name)"
8478         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8479         ;;
8480 esac
8481
8482 case "$myhostname" in
8483 *.*)
8484         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8485         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8486         echo "(Trimming domain name from host name--host name is now $myhostname)"
8487         ;;
8488 *) case "$mydomain" in
8489         '')
8490                 {
8491                         test "X$hostcat" = "Xypcat hosts" &&
8492                         ypmatch "$myhostname" hosts 2>/dev/null |\
8493                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8494                         $test -s hosts
8495                 } || {
8496                         test "X$hostcat" != "X" &&
8497                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8498                                         /[       ]$myhostname[  . ]/p" > hosts
8499                 }
8500                 tmp_re="[       . ]"
8501                 if $test -f hosts; then
8502                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8503                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8504                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8505                                 hosts | $sort | $uniq | \
8506                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8507                         case `$echo X$dflt` in
8508                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8509                                 dflt=.
8510                                 ;;
8511                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8512                                 ;;
8513                         esac
8514                 else
8515                         echo "(I cannot locate a hosts database anywhere)"
8516                         dflt=.
8517                 fi
8518                 case "$dflt" in
8519                 .)
8520                         tans=`./loc resolv.conf X /etc /usr/etc`
8521                         if $test -f "$tans"; then
8522                                 echo "(Attempting domain name extraction from $tans)"
8523                                 dflt=.`$sed -n -e 's/   / /g' \
8524                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8525                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8526                                 case "$dflt" in
8527                                 .) dflt=.`$sed -n -e 's/        / /g' \
8528                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8529                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8530                                         ;;
8531                                 esac
8532                         fi
8533                         ;;
8534                 esac
8535                 case "$dflt" in
8536                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8537                         dflt=.`sh -c domainname 2>/dev/null`
8538                         case "$dflt" in
8539                         '') dflt='.';;
8540                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8541                         esac
8542                         ;;
8543                 esac
8544                 case "$dflt$osname" in
8545                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8546                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8547                         ;;
8548                 esac
8549                 case "$dflt" in
8550                 .) echo "(Lost all hope -- silly guess then)"
8551                         dflt='.nonet'
8552                         ;;
8553                 esac
8554                 $rm -f hosts
8555                 ;;
8556         *) dflt="$mydomain";;
8557         esac;;
8558 esac
8559 echo " "
8560 rp="What is your domain name?"
8561 . ./myread
8562 tans="$ans"
8563 case "$ans" in
8564 '') ;;
8565 .*) ;;
8566 *) tans=".$tans";;
8567 esac
8568 mydomain="$tans"
8569
8570 : translate upper to lower if necessary
8571 case "$mydomain" in
8572 *[A-Z]*)
8573         echo "(Normalizing case in your domain name)"
8574         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8575         ;;
8576 esac
8577
8578 : a little sanity check here
8579 case "$phostname" in
8580 '') ;;
8581 *)
8582         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8583         $myhostname$mydomain|$myhostname) ;;
8584         *)
8585                 case "$phostname" in
8586                 sed*)
8587                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8588                         ;;
8589                 *)
8590                         echo "(That doesn't agree with your $phostname command, by the way.)"
8591                         ;;
8592                 esac
8593         ;;
8594         esac
8595         ;;
8596 esac
8597
8598 $cat <<EOM
8599
8600 I need to get your e-mail address in Internet format if possible, i.e.
8601 something like user@host.domain. Please answer accurately since I have
8602 no easy means to double check it. The default value provided below
8603 is most probably close to reality but may not be valid from outside
8604 your organization...
8605
8606 EOM
8607 cont=x
8608 while test "$cont"; do
8609         case "$cf_email" in
8610         '') dflt="$cf_by@$myhostname$mydomain";;
8611         *) dflt="$cf_email";;
8612         esac
8613         rp='What is your e-mail address?'
8614         . ./myread
8615         cf_email="$ans"
8616         case "$cf_email" in
8617         *@*.*) cont='' ;;
8618         *)
8619                 rp='Address does not look like an Internet one.  Use it anyway?'
8620                 case "$fastread" in
8621                 yes) dflt=y ;;
8622                 *) dflt=n ;;
8623                 esac
8624                 . ./myread
8625                 case "$ans" in
8626                 y*) cont='' ;;
8627                 *) echo " " ;;
8628                 esac
8629                 ;;
8630         esac
8631 done
8632
8633 $cat <<EOM
8634
8635 If you or somebody else will be maintaining perl at your site, please
8636 fill in the correct e-mail address here so that they may be contacted
8637 if necessary. Currently, the "perlbug" program included with perl
8638 will send mail to this address in addition to perlbug@perl.org. You may
8639 enter "none" for no administrator.
8640
8641 EOM
8642 case "$perladmin" in
8643 '') dflt="$cf_email";;
8644 *) dflt="$perladmin";;
8645 esac
8646 rp='Perl administrator e-mail address'
8647 . ./myread
8648 perladmin="$ans"
8649
8650 : determine whether to only install version-specific parts.
8651 echo " "
8652 $cat <<EOM
8653 Do you want to install only the version-specific parts of the perl
8654 distribution?  Usually you do *not* want to do this.
8655 EOM
8656 case "$versiononly" in
8657 "$define"|[Yy]*|true) dflt='y' ;;
8658 *) dflt='n';
8659 esac
8660 rp="Do you want to install only the version-specific parts of perl?"
8661 . ./myread
8662 case "$ans" in
8663 [yY]*)  val="$define";;
8664 *)      val="$undef" ;;
8665 esac
8666 set versiononly
8667 eval $setvar
8668
8669 case "$versiononly" in
8670 "$define") inc_version_list=''
8671            inc_version_list_init=0
8672            ;;
8673 esac
8674
8675 : figure out how to guarantee perl startup
8676 : XXX Note that this currently takes advantage of the bug that binexp ignores
8677 :     the Configure -Dinstallprefix setting, which in turn means that under
8678 :     relocatable @INC, initialinstalllocation is what binexp started as.
8679 case "$startperl" in
8680 '')
8681         case "$sharpbang" in
8682         *!)
8683                 $cat <<EOH
8684
8685 I can use the #! construct to start perl on your system. This will
8686 make startup of perl scripts faster, but may cause problems if you
8687 want to share those scripts and perl is not in a standard place
8688 ($initialinstalllocation/perl) on all your platforms. The alternative
8689 is to force a shell by starting the script with a single ':' character.
8690
8691 EOH
8692                 case "$versiononly" in
8693                 "$define")      dflt="$initialinstalllocation/perl$version";;
8694                 *)              dflt="$initialinstalllocation/perl";;
8695                 esac
8696                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8697                 . ./myread
8698                 case "$ans" in
8699                 none)   startperl=": # use perl";;
8700                 *)      startperl="#!$ans"
8701                         if $test 30 -lt `echo "$ans" | wc -c`; then
8702                                 $cat >&4 <<EOM
8703
8704 WARNING:  Some systems limit the #! command to 32 characters.
8705 If you experience difficulty running Perl scripts with #!, try
8706 installing Perl in a directory with a shorter pathname.
8707
8708 EOM
8709                         fi ;;
8710                 esac
8711                 ;;
8712         *) startperl=": # use perl"
8713                 ;;
8714         esac
8715         ;;
8716 esac
8717 echo "I'll use $startperl to start perl scripts."
8718
8719 : figure best path for perl in scripts
8720 case "$perlpath" in
8721 '')
8722         case "$versiononly" in
8723         "$define")      perlpath="$initialinstalllocation/perl$version";;
8724         *)              perlpath="$initialinstalllocation/perl";;
8725         esac
8726         case "$startperl" in
8727         *!*) ;;
8728         *)
8729                 $cat <<EOH
8730
8731 I will use the "eval 'exec'" idiom to start Perl on your system.
8732 I can use the full path of your Perl binary for this purpose, but
8733 doing so may cause problems if you want to share those scripts and
8734 Perl is not always in a standard place ($initialinstalllocation/perl).
8735
8736 EOH
8737                 dflt="$initialinstalllocation/perl"
8738                 rp="What path shall I use in \"eval 'exec'\"?"
8739                 . ./myread
8740                 perlpath="$ans"
8741                 ;;
8742         esac
8743         ;;
8744 esac
8745 case "$startperl" in
8746 *!*)    ;;
8747 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8748 esac
8749
8750 : determine where public executable scripts go
8751 set scriptdir scriptdir
8752 eval $prefixit
8753 case "$scriptdir" in
8754 '')
8755         dflt="$bin"
8756         : guess some guesses
8757         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8758         $test -d /usr/share/bin     && dflt=/usr/share/bin
8759         $test -d /usr/local/script  && dflt=/usr/local/script
8760         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8761         $test -d $prefixexp/script  && dflt=$prefixexp/script
8762         set dflt
8763         eval $prefixup
8764         ;;
8765 *)  dflt="$scriptdir"
8766         ;;
8767 esac
8768 $cat <<EOM
8769
8770 Some installations have a separate directory just for executable scripts so
8771 that they can mount it across multiple architectures but keep the scripts in
8772 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8773 Or you might just lump your scripts in with all your other executables.
8774
8775 EOM
8776 fn=d~
8777 rp='Where do you keep publicly executable scripts?'
8778 . ./getfile
8779 if $test "X$ansexp" != "X$scriptdirexp"; then
8780         installscript=''
8781 fi
8782 installscriptdir=''
8783 prefixvar=scriptdir
8784 . ./setprefixvar
8785 : A little fix up for an irregularly named variable.
8786 installscript="$installscriptdir"
8787
8788 : determine where add-on public executables go
8789 case "$sitebin" in
8790 '')     dflt=$siteprefix/bin ;;
8791 *)      dflt=$sitebin ;;
8792 esac
8793 fn=d~
8794 rp='Pathname where the add-on public executables should be installed?'
8795 . ./getfile
8796 prefixvar=sitebin
8797 . ./setprefixvar
8798
8799 : determine where add-on html pages go
8800 : There is no standard location, so try to copy the previously-selected
8801 : directory structure for the core html pages.
8802 case "$sitehtml1dir" in
8803 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8804 *)     dflt=$sitehtml1dir ;;
8805 esac
8806 case "$dflt" in
8807 ''|' ') dflt=none ;;
8808 esac
8809 fn=dn+~
8810 rp='Pathname where the site-specific html pages should be installed?'
8811 . ./getfile
8812 prefixvar=sitehtml1dir
8813 . ./setprefixvar
8814
8815 : determine where add-on library html pages go
8816 : There is no standard location, so try to copy the previously-selected
8817 : directory structure for the core html pages.
8818 case "$sitehtml3dir" in
8819 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8820 *)     dflt=$sitehtml3dir ;;
8821 esac
8822 case "$dflt" in
8823 ''|' ') dflt=none ;;
8824 esac
8825 fn=dn+~
8826 rp='Pathname where the site-specific library html pages should be installed?'
8827 . ./getfile
8828 prefixvar=sitehtml3dir
8829 . ./setprefixvar
8830
8831 : determine where add-on manual pages go
8832 case "$siteman1dir" in
8833 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8834 *)      dflt=$siteman1dir ;;
8835 esac
8836 case "$dflt" in
8837 ''|' ') dflt=none ;;
8838 esac
8839 fn=dn+~
8840 rp='Pathname where the site-specific manual pages should be installed?'
8841 . ./getfile
8842 prefixvar=siteman1dir
8843 . ./setprefixvar
8844
8845 : determine where add-on library man pages go
8846 case "$siteman3dir" in
8847 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8848 *)      dflt=$siteman3dir ;;
8849 esac
8850 case "$dflt" in
8851 ''|' ') dflt=none ;;
8852 esac
8853 fn=dn+~
8854 rp='Pathname where the site-specific library manual pages should be installed?'
8855 . ./getfile
8856 prefixvar=siteman3dir
8857 . ./setprefixvar
8858
8859 : determine where add-on public executable scripts go
8860 case "$sitescript" in
8861 '')     dflt=$siteprefix/script
8862         $test -d $dflt || dflt=$sitebin ;;
8863 *)  dflt="$sitescript" ;;
8864 esac
8865 fn=d~+
8866 rp='Pathname where add-on public executable scripts should be installed?'
8867 . ./getfile
8868 prefixvar=sitescript
8869 . ./setprefixvar
8870
8871 case "$usefaststdio" in
8872 $define|true|[yY]*|'')
8873         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8874         case "$xversion" in
8875         [68])   dflt='y' ;;
8876         *)      dflt='n' ;;
8877         esac
8878         ;;
8879 *) dflt='n';;
8880 esac
8881 cat <<EOM
8882
8883 Perl can be built to use 'fast stdio', which means using the stdio
8884 library but also directly manipulating the stdio buffers to enable
8885 faster I/O.  Using stdio is better for backward compatibility (especially
8886 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8887 interface has been preferred instead of stdio.
8888
8889 If this doesn't make any sense to you, just accept the default '$dflt'.
8890 EOM
8891 rp='Use the "fast stdio" if available?'
8892 . ./myread
8893 case "$ans" in
8894 y|Y)    val="$define" ;;     
8895 *)      val="$undef" ;;
8896 esac
8897 set usefaststdio
8898 eval $setvar
8899
8900
8901 : define an is-a-typedef? function
8902 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8903 case "$inclist" in
8904 "") inclist="sys/types.h";;
8905 esac;
8906 eval "varval=\$$var";
8907 case "$varval" in
8908 "")
8909         $rm -f temp.c;
8910         for inc in $inclist; do
8911                 echo "#include <$inc>" >>temp.c;
8912         done;
8913         echo "#ifdef $type" >> temp.c;
8914         echo "printf(\"We have $type\");" >> temp.c;
8915         echo "#endif" >> temp.c;
8916         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8917         if $contains $type temp.E >/dev/null 2>&1; then
8918                 eval "$var=\$type";
8919         else
8920                 eval "$var=\$def";
8921         fi;
8922         $rm -f temp.?;;
8923 *) eval "$var=\$varval";;
8924 esac'
8925
8926 : define an is-a-typedef? function that prompts if the type is not available.
8927 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8928 case "$inclist" in
8929 "") inclist="sys/types.h";;
8930 esac;
8931 eval "varval=\$$var";
8932 case "$varval" in
8933 "")
8934         $rm -f temp.c;
8935         for inc in $inclist; do
8936                 echo "#include <$inc>" >>temp.c;
8937         done;
8938         echo "#ifdef $type" >> temp.c;
8939         echo "printf(\"We have $type\");" >> temp.c;
8940         echo "#endif" >> temp.c;
8941         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8942         echo " " ;
8943         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8944         if $contains $type temp.E >/dev/null 2>&1; then
8945                 echo "$type found." >&4;
8946                 eval "$var=\$type";
8947         else
8948                 echo "$type NOT found." >&4;
8949                 dflt="$def";
8950                 . ./myread ;
8951                 eval "$var=\$ans";
8952         fi;
8953         $rm -f temp.?;;
8954 *) eval "$var=\$varval";;
8955 esac'
8956
8957 : see what type lseek is declared as in the kernel
8958 rp="What is the type used for lseek's offset on this system?"
8959 set off_t lseektype long stdio.h sys/types.h
8960 eval $typedef_ask
8961
8962 echo " "
8963 echo "Checking to see how big your file offsets are..." >&4
8964 $cat >try.c <<EOCP
8965 #include <sys/types.h>
8966 #include <stdio.h>
8967 int main()
8968 {
8969     printf("%d\n", (int)sizeof($lseektype));
8970     return(0); 
8971 }
8972 EOCP
8973 set try
8974 if eval $compile_ok; then
8975         lseeksize=`$run ./try`
8976         echo "Your file offsets are $lseeksize bytes long."
8977 else
8978         dflt=$longsize
8979         echo " "
8980         echo "(I can't seem to compile the test program.  Guessing...)"
8981         rp="What is the size of your file offsets (in bytes)?"
8982         . ./myread
8983         lseeksize="$ans"
8984 fi
8985 $rm -f try.c try
8986
8987 : see what type file positions are declared as in the library
8988 rp="What is the type for file position used by fsetpos()?"
8989 set fpos_t fpostype long stdio.h sys/types.h
8990 eval $typedef_ask
8991
8992 echo " "
8993 case "$fpostype" in
8994 *_t) zzz="$fpostype"    ;;
8995 *)   zzz="fpos_t"       ;;
8996 esac
8997 echo "Checking the size of $zzz..." >&4 
8998 cat > try.c <<EOCP
8999 #include <sys/types.h>
9000 #include <stdio.h>
9001 #$i_stdlib I_STDLIB
9002 #ifdef I_STDLIB
9003 #include <stdlib.h>
9004 #endif
9005 int main() {
9006     printf("%d\n", (int)sizeof($fpostype));
9007     exit(0);
9008 }
9009 EOCP
9010 set try
9011 if eval $compile_ok; then
9012         yyy=`$run ./try`
9013         case "$yyy" in
9014         '')     fpossize=4
9015                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9016                 ;;
9017         *)      fpossize=$yyy
9018                 echo "Your $zzz is $fpossize bytes long."
9019                 ;;
9020         esac
9021 else
9022         dflt="$longsize"
9023         echo " " >&4
9024         echo "(I can't compile the test program.  Guessing...)" >&4
9025         rp="What is the size of your file positions (in bytes)?"
9026         . ./myread
9027         fpossize="$ans"
9028 fi
9029
9030 # Backward compatibility (uselfs is deprecated).
9031 case "$uselfs" in
9032 "$define"|true|[yY]*)
9033         cat <<EOM >&4
9034
9035 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9036 EOM
9037         uselargefiles="$define"
9038         ;;
9039 esac                          
9040
9041 case "$lseeksize:$fpossize" in
9042 8:8) cat <<EOM
9043
9044 You can have files larger than 2 gigabytes.
9045 EOM
9046    val="$define" ;;
9047 *)    case "$uselargefiles" in
9048    "$undef"|false|[nN]*) dflt='n' ;;
9049    *)   dflt='y' ;;
9050    esac
9051    cat <<EOM
9052
9053 Perl can be built to understand large files (files larger than 2 gigabytes)
9054 on some systems.  To do so, Configure can be run with -Duselargefiles.
9055
9056 If this doesn't make any sense to you, just accept the default '$dflt'.
9057 EOM
9058    rp='Try to understand large files, if available?'
9059    . ./myread
9060    case "$ans" in
9061    y|Y)         val="$define" ;;
9062    *)           val="$undef"  ;;
9063    esac
9064    ;;
9065 esac
9066 set uselargefiles
9067 eval $setvar
9068 : Look for a hint-file generated 'call-back-unit'.  If the
9069 : user has specified that a large files perl is to be built,
9070 : we may need to set or change some other defaults.
9071 if $test -f uselargefiles.cbu; then
9072         echo "Your platform has some specific hints regarding large file builds, using them..."
9073         . ./uselargefiles.cbu
9074 fi
9075 case "$uselargefiles" in
9076 "$define")
9077         if $test -f uselargefiles.cbu; then
9078                 echo " "
9079                 echo "Rechecking to see how big your file offsets are..." >&4
9080                 $cat >try.c <<EOCP
9081 #include <sys/types.h>
9082 #include <stdio.h>
9083 int main()
9084 {
9085     printf("%d\n", (int)sizeof($lseektype));
9086     return(0); 
9087 }
9088 EOCP
9089                 set try
9090                 if eval $compile_ok; then
9091                         lseeksize=`$run ./try`
9092                         $echo "Your file offsets are now $lseeksize bytes long."
9093                 else
9094                         dflt="$lseeksize"
9095                         echo " "
9096                         echo "(I can't seem to compile the test program.  Guessing...)"
9097                         rp="What is the size of your file offsets (in bytes)?"
9098                         . ./myread
9099                         lseeksize="$ans"
9100                 fi
9101                 case "$fpostype" in
9102                 *_t) zzz="$fpostype"    ;;
9103                 *)   zzz="fpos_t"       ;;
9104                 esac
9105                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9106                 $cat > try.c <<EOCP
9107 #include <sys/types.h>
9108 #include <stdio.h>
9109 #$i_stdlib I_STDLIB
9110 #ifdef I_STDLIB
9111 #include <stdlib.h>
9112 #endif
9113 int main() {
9114     printf("%d\n", (int)sizeof($fpostype));
9115     return(0);
9116 }
9117 EOCP
9118                 set try
9119                 if eval $compile_ok; then
9120                         yyy=`$run ./try`
9121                         dflt="$lseeksize"
9122                         case "$yyy" in
9123                         '')     echo " "
9124                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9125                                 ;;
9126                         *)      fpossize=$yyy
9127                                 echo " $fpossize bytes." >&4
9128                                 ;;
9129                         esac
9130                 else
9131                         dflt="$fpossize"
9132                         echo " "
9133                         echo "(I can't compile the test program.  Guessing...)" >&4
9134                         rp="What is the size of your file positions (in bytes)?"
9135                         . ./myread
9136                         fpossize="$ans"
9137                 fi
9138                 $rm -f try.c try
9139         fi
9140         ;;
9141 esac
9142
9143 case "$vendorprefix" in
9144 '')     d_vendorbin="$undef"
9145         vendorbin=''
9146         vendorbinexp=''
9147         ;;
9148 *)      d_vendorbin="$define"
9149         : determine where vendor-supplied executables go.
9150         case "$vendorbin" in
9151         '') dflt=$vendorprefix/bin ;;
9152         *)      dflt="$vendorbin" ;;
9153         esac
9154         fn=d~+
9155         rp='Pathname for the vendor-supplied executables directory?'
9156         . ./getfile
9157         vendorbin="$ans"
9158         vendorbinexp="$ansexp"
9159         ;;
9160 esac
9161 prefixvar=vendorbin
9162 . ./installprefix
9163
9164 case "$vendorprefix" in
9165 '')     vendorhtml1dir=''
9166         vendorhtml1direxp=''
9167         ;;
9168 *)      : determine where vendor-supplied html pages go.
9169         : There is no standard location, so try to copy the previously-selected
9170         : directory structure for the core html pages.
9171         : XXX Better default suggestions would be welcome.
9172         case "$vendorhtml1dir" in
9173         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9174         *)      dflt=$vendorhtml1dir ;;
9175         esac
9176         case "$dflt" in
9177         ''|' ') dflt=none ;;
9178         esac
9179         fn=dn+~
9180         rp='Pathname for the vendor-supplied html pages?'
9181         . ./getfile
9182         vendorhtml1dir="$ans"
9183         vendorhtml1direxp="$ansexp"
9184         ;;
9185 esac
9186 : Use ' ' for none so value is preserved next time through Configure
9187 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9188 prefixvar=vendorhtml1dir
9189 . ./installprefix
9190
9191 case "$vendorprefix" in
9192 '')     vendorhtml3dir=''
9193         vendorhtml3direxp=''
9194         ;;
9195 *)      : determine where vendor-supplied module html pages go.
9196         : There is no standard location, so try to copy the previously-selected
9197         : directory structure for the core html pages.
9198         : XXX Better default suggestions would be welcome.
9199         case "$vendorhtml3dir" in
9200         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9201         *)      dflt=$vendorhtml3dir ;;
9202         esac
9203         case "$dflt" in
9204         ''|' ') dflt=none ;;
9205         esac
9206         fn=dn+~
9207         rp='Pathname for the vendor-supplied html pages?'
9208         . ./getfile
9209         vendorhtml3dir="$ans"
9210         vendorhtml3direxp="$ansexp"
9211         ;;
9212 esac
9213 : Use ' ' for none so value is preserved next time through Configure
9214 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9215 prefixvar=vendorhtml3dir
9216 . ./installprefix
9217
9218 case "$vendorprefix" in
9219 '')     vendorman1dir=''
9220         vendorman1direxp=''
9221         ;;
9222 *)      : determine where vendor-supplied manual pages go.
9223         case "$vendorman1dir" in
9224         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9225         *)      dflt=$vendorman1dir ;;
9226         esac
9227         case "$dflt" in
9228         ''|' ') dflt=none ;;
9229         esac
9230         fn=nd~+
9231         rp='Pathname for the vendor-supplied manual section 1 pages?'
9232         . ./getfile
9233         vendorman1dir="$ans"
9234         vendorman1direxp="$ansexp"
9235         ;;
9236 esac
9237 : Use ' ' for none so value is preserved next time through Configure
9238 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9239 prefixvar=vendorman1dir
9240 . ./installprefix
9241
9242 case "$vendorprefix" in
9243 '')     vendorman3dir=''
9244         vendorman3direxp=''
9245         ;;
9246 *)      : determine where vendor-supplied module manual pages go.
9247         case "$vendorman3dir" in
9248         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9249         *)      dflt=$vendorman3dir ;;
9250         esac
9251         case "$dflt" in
9252         ''|' ') dflt=none ;;
9253         esac
9254         fn=nd~+
9255         rp='Pathname for the vendor-supplied manual section 3 pages?'
9256         . ./getfile
9257         vendorman3dir="$ans"
9258         vendorman3direxp="$ansexp"
9259         ;;
9260 esac
9261 : Use ' ' for none so value is preserved next time through Configure
9262 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9263 prefixvar=vendorman3dir
9264 . ./installprefix
9265
9266 case "$vendorprefix" in
9267 '')     d_vendorscript="$undef"
9268         vendorscript=''
9269         vendorscriptexp=''
9270         ;;
9271 *)      d_vendorscript="$define"
9272         : determine where vendor-supplied scripts go.
9273         case "$vendorscript" in
9274         '')     dflt=$vendorprefix/script
9275                 $test -d $dflt || dflt=$vendorbin ;;
9276         *)  dflt="$vendorscript" ;;
9277         esac
9278         $cat <<EOM
9279
9280 The installation process will create a directory for
9281 vendor-supplied scripts.
9282
9283 EOM
9284         fn=d~+
9285         rp='Pathname for the vendor-supplied scripts directory?'
9286         . ./getfile
9287         vendorscript="$ans"
9288         vendorscriptexp="$ansexp"
9289         ;;
9290 esac
9291 prefixvar=vendorscript
9292 . ./installprefix
9293
9294 : see if qgcvt exists
9295 set qgcvt d_qgcvt
9296 eval $inlibc
9297
9298 echo " "
9299
9300 if $test X"$d_longdbl" = X"$define"; then
9301
9302 echo "Checking how to print long doubles..." >&4
9303
9304 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9305         $cat >try.c <<'EOCP'
9306 #include <sys/types.h>
9307 #include <stdio.h>
9308 int main() {
9309   double d = 123.456;
9310   printf("%.3f\n", d);
9311 }
9312 EOCP
9313         set try
9314         if eval $compile; then
9315                 yyy=`$run ./try`
9316                 case "$yyy" in
9317                 123.456)
9318                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9319                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9320                         echo "We will use %f."
9321                         ;;
9322                 esac
9323         fi
9324 fi
9325
9326 if $test X"$sPRIfldbl" = X; then
9327         $cat >try.c <<'EOCP'
9328 #include <sys/types.h>
9329 #include <stdio.h>
9330 int main() {
9331   long double d = 123.456;
9332   printf("%.3Lf\n", d);
9333 }
9334 EOCP
9335         set try
9336         if eval $compile; then
9337                 yyy=`$run ./try`
9338                 case "$yyy" in
9339                 123.456)
9340                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9341                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9342                         echo "We will use %Lf."
9343                         ;;
9344                 esac
9345         fi
9346 fi
9347
9348 if $test X"$sPRIfldbl" = X; then
9349         $cat >try.c <<'EOCP'
9350 #include <sys/types.h>
9351 #include <stdio.h>
9352 int main() {
9353   long double d = 123.456;
9354   printf("%.3llf\n", d);
9355 }
9356 EOCP
9357         set try
9358         if eval $compile; then
9359                 yyy=`$run ./try`
9360                 case "$yyy" in
9361                 123.456)
9362                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9363                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9364                         echo "We will use %llf."
9365                         ;;
9366                 esac
9367         fi
9368 fi
9369
9370 if $test X"$sPRIfldbl" = X; then
9371         $cat >try.c <<'EOCP'
9372 #include <sys/types.h>
9373 #include <stdio.h>
9374 int main() {
9375   long double d = 123.456;
9376   printf("%.3lf\n", d);
9377 }
9378 EOCP
9379         set try
9380         if eval $compile; then
9381                 yyy=`$run ./try`
9382                 case "$yyy" in
9383                 123.456)
9384                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9385                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9386                         echo "We will use %lf."
9387                         ;;
9388                 esac
9389         fi
9390 fi
9391
9392 if $test X"$sPRIfldbl" = X; then
9393         echo "Cannot figure out how to print long doubles." >&4
9394 else
9395         sSCNfldbl=$sPRIfldbl    # expect consistency
9396 fi
9397
9398 $rm -f try try.*
9399
9400 fi # d_longdbl
9401
9402 case "$sPRIfldbl" in
9403 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9404         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9405         d_SCNfldbl="$undef";
9406         ;;
9407 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9408         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9409         d_SCNfldbl="$define";
9410         ;;
9411 esac
9412
9413 : Check how to convert floats to strings.
9414
9415 if test "X$d_Gconvert" = X; then
9416
9417 echo " "
9418 echo "Checking for an efficient way to convert floats to strings."
9419 echo " " > try.c
9420 case "$uselongdouble" in
9421 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9422 esac
9423 case "$d_longdbl" in
9424 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9425 esac
9426 case "$d_PRIgldbl" in
9427 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9428 esac
9429 $cat >>try.c <<EOP
9430 #ifdef TRY_gconvert
9431 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9432 char *myname = "gconvert";
9433 #endif
9434 #ifdef TRY_gcvt
9435 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9436 char *myname = "gcvt";
9437 #endif
9438 #ifdef TRY_qgcvt
9439 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9440 char *myname = "qgcvt";
9441 #define DOUBLETYPE long double
9442 #endif
9443 #ifdef TRY_sprintf
9444 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9445 #ifdef HAS_PRIgldbl
9446 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9447 #else
9448 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9449 #endif
9450 #else
9451 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9452 #endif
9453 char *myname = "sprintf";
9454 #endif
9455
9456 #ifndef DOUBLETYPE
9457 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9458 #define DOUBLETYPE long double
9459 #else
9460 #define DOUBLETYPE double
9461 #endif
9462 #endif
9463
9464 #include <stdio.h>
9465
9466 #define I_STDLIB $i_stdlib
9467 #ifdef I_STDLIB
9468 #include <stdlib.h>
9469 #endif
9470
9471 int
9472 checkit(expect, got)
9473 char *expect;
9474 char *got;
9475 {
9476     if (strcmp(expect, got)) {
9477                 printf("%s oddity:  Expected %s, got %s\n",
9478                         myname, expect, got);
9479                 exit(1);
9480         }
9481 }
9482
9483 int main()
9484
9485         char buf[64]; 
9486         buf[63] = '\0';
9487
9488         /* This must be 1st test on (which?) platform */
9489         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9490         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9491         checkit("0.1", buf);
9492
9493         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9494         checkit("0.01", buf);
9495
9496         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9497         checkit("0.001", buf);
9498
9499         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9500         checkit("0.0001", buf);
9501
9502         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9503         if (strlen(buf) > 5)
9504             checkit("9e-005", buf); /* for Microsoft ?? */
9505         else
9506             checkit("9e-05", buf);
9507
9508         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9509         checkit("1", buf);
9510
9511         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9512         checkit("1.1", buf);
9513
9514         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9515         checkit("1.01", buf);
9516
9517         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9518         checkit("1.001", buf);
9519
9520         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9521         checkit("1.0001", buf);
9522
9523         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9524         checkit("1.00001", buf);
9525
9526         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9527         checkit("1.000001", buf);
9528
9529         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9530         checkit("0", buf);
9531
9532         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9533         checkit("-1", buf);
9534
9535         /* Some Linux gcvt's give 1.e+5 here. */
9536         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9537         checkit("100000", buf);
9538         
9539         /* Some Linux gcvt's give -1.e+5 here. */
9540         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9541         checkit("-100000", buf);
9542
9543         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9544         checkit("123.456", buf);
9545
9546         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9547         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9548         /* 34 should be enough to scare even long double
9549          * places into using the e notation. */
9550         if (strlen(buf) > 5)
9551             checkit("1e+034", buf); /* for Microsoft */
9552         else
9553             checkit("1e+34", buf);
9554
9555         /* For Perl, if you add additional tests here, also add them to
9556          * t/base/num.t for benefit of platforms not using Configure or
9557          * overriding d_Gconvert */
9558
9559         exit(0);
9560 }
9561 EOP
9562 : first add preferred functions to our list
9563 xxx_list=""
9564 for xxx_convert in $gconvert_preference; do
9565     case $xxx_convert in
9566     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9567     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9568     esac 
9569 done
9570 : then add any others
9571 for xxx_convert in gconvert gcvt sprintf; do
9572     case "$xxx_list" in
9573     *$xxx_convert*) ;;
9574     *) xxx_list="$xxx_list $xxx_convert" ;;
9575     esac 
9576 done
9577
9578 case "$d_longdbl$uselongdouble" in
9579 "$define$define")
9580     : again, add prefered functions to our list first
9581     xxx_ld_list=""
9582     for xxx_convert in $gconvert_ld_preference; do
9583         case $xxx_convert in
9584         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9585         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9586         esac
9587     done
9588     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9589     for xxx_convert in qgcvt sprintf $xxx_list; do
9590         case "$xxx_ld_list" in
9591         $xxx_convert*|*" $xxx_convert"*) ;;
9592         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9593         esac
9594     done
9595     : if sprintf cannot do long doubles, move it to the end
9596     if test "$d_PRIgldbl" != "$define"; then
9597         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9598     fi
9599     : if no qgcvt, remove it
9600     if test "$d_qgcvt" != "$define"; then
9601         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9602     fi
9603     : use the ld_list
9604     xxx_list="$xxx_ld_list"
9605     ;;
9606 esac
9607
9608 for xxx_convert in $xxx_list; do
9609         echo "Trying $xxx_convert..."
9610         $rm -f try try$_o
9611         set try -DTRY_$xxx_convert
9612         if eval $compile; then
9613                 echo "$xxx_convert() found." >&4
9614                 if $run ./try; then
9615                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9616                         break;
9617                 else
9618                         echo "...But $xxx_convert didn't work as I expected."
9619                         xxx_convert=''
9620                 fi
9621         else
9622                 echo "$xxx_convert NOT found." >&4
9623         fi
9624 done
9625
9626 if test X$xxx_convert = X; then
9627     echo "*** WHOA THERE!!! ***" >&4
9628     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9629     xxx_convert=sprintf
9630 fi
9631
9632 case "$xxx_convert" in
9633 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9634 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9635 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9636 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9637    "$define$define$define")
9638       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9639    "$define$define$undef")
9640       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9641    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9642    esac
9643    ;;  
9644 esac
9645
9646 fi
9647
9648 : see if _fwalk exists
9649 set fwalk d__fwalk
9650 eval $inlibc
9651
9652 : Initialize h_fcntl
9653 h_fcntl=false
9654
9655 : Initialize h_sysfile
9656 h_sysfile=false
9657
9658 : access call always available on UNIX
9659 set access d_access
9660 eval $inlibc
9661
9662 : locate the flags for 'access()'
9663 case "$d_access" in
9664 "$define")
9665         echo " "
9666         $cat >access.c <<EOCP
9667 #include <sys/types.h>
9668 #ifdef I_FCNTL
9669 #include <fcntl.h>
9670 #endif
9671 #ifdef I_SYS_FILE
9672 #include <sys/file.h>
9673 #endif
9674 #ifdef I_UNISTD
9675 #include <unistd.h>
9676 #endif
9677 #$i_stdlib I_STDLIB
9678 #ifdef I_STDLIB
9679 #include <stdlib.h>
9680 #endif
9681 int main() {
9682         exit(R_OK);
9683 }
9684 EOCP
9685         : check sys/file.h first, no particular reason here
9686         if $test `./findhdr sys/file.h` && \
9687                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9688                 h_sysfile=true;
9689                 echo "<sys/file.h> defines the *_OK access constants." >&4
9690         elif $test `./findhdr fcntl.h` && \
9691                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9692                 h_fcntl=true;
9693                 echo "<fcntl.h> defines the *_OK access constants." >&4
9694         elif $test `./findhdr unistd.h` && \
9695                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9696                 echo "<unistd.h> defines the *_OK access constants." >&4
9697         else
9698                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9699         fi
9700         ;;
9701 esac
9702 $rm -f access*
9703
9704 : see if accessx exists
9705 set accessx d_accessx
9706 eval $inlibc
9707
9708 : see if aintl exists
9709 set aintl d_aintl
9710 eval $inlibc
9711
9712 : see if alarm exists
9713 set alarm d_alarm
9714 eval $inlibc
9715
9716 : see if POSIX threads are available
9717 set pthread.h i_pthread
9718 eval $inhdr
9719
9720 : define a fucntion to check prototypes
9721 $cat > protochk <<EOSH
9722 $startsh
9723 cc="$cc"
9724 optimize="$optimize"
9725 ccflags="$ccflags"
9726 prototype="$prototype"
9727 define="$define"
9728 rm=$rm
9729 usethreads=$usethreads
9730 i_pthread=$i_pthread
9731 pthread_h_first=$pthread_h_first
9732 EOSH
9733
9734 $cat >> protochk <<'EOSH'
9735
9736 $rm -f try.c
9737 foo="$1"
9738 shift
9739 while test $# -ge 2; do
9740         case "$1" in
9741                 $define) echo "#include <$2>" >> try.c ;;
9742                 literal) echo "$2" >> try.c ;;
9743         esac
9744     # Extra magic for the benefit of systems that need pthread.h
9745     # to be included early to correctly detect threadsafe functions.
9746     # Such functions must guarantee themselves, though, that the usethreads
9747     # and i_pthread have been defined, before calling protochk.
9748     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9749         echo "#include <pthread.h>" >> try.c
9750         pthread_h_done=yes
9751     fi
9752     shift 2
9753 done
9754 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9755 cat >> try.c <<'EOCP'
9756 #ifdef CAN_PROTOTYPE
9757 #define _(args) args
9758 #else
9759 #define _(args) ()
9760 #endif
9761 EOCP
9762 echo "$foo" >> try.c
9763 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9764 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9765 status=$?
9766 $rm -f try.[co]
9767 exit $status
9768 EOSH
9769 chmod +x protochk
9770 $eunicefix protochk
9771
9772 hasproto='varname=$1; func=$2; shift; shift;
9773 while $test $# -ge 2; do
9774         case "$1" in
9775         $define) echo "#include <$2>";;
9776         esac ;
9777     shift 2;
9778 done > try.c;
9779 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9780 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9781         echo "$func() prototype found.";
9782         val="$define";
9783 else
9784         echo "$func() prototype NOT found.";
9785         val="$undef";
9786 fi;
9787 set $varname;
9788 eval $setvar;
9789 $rm -f try.c tryout.c'
9790
9791 : see if sys/types.h has to be included
9792 set sys/types.h i_systypes
9793 eval $inhdr
9794
9795 : see if sys/select.h has to be included
9796 set sys/select.h i_sysselct
9797 eval $inhdr
9798
9799 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9800 while $test $# -ge 2; do
9801         case "$1" in
9802         $define) echo "#include <$2>";;
9803         esac ;
9804     shift 2;
9805 done > try.c;
9806 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9807 set try;
9808 if eval $compile; then
9809         val="$define";
9810 else
9811         val="$undef";
9812 fi;
9813 set $varname;
9814 eval $setvar;
9815 $rm -f try try.c try.o'
9816
9817 : see if we should include time.h, sys/time.h, or both
9818 echo " "
9819 if test "X$timeincl" = X; then
9820         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9821         $echo $n "I'm now running the test program...$c"
9822         $cat >try.c <<EOCP
9823 #include <sys/types.h>
9824 #ifdef I_TIME
9825 #include <time.h>
9826 #endif
9827 #ifdef I_SYSTIME
9828 #ifdef SYSTIMEKERNEL
9829 #define KERNEL
9830 #endif
9831 #include <sys/time.h>
9832 #endif
9833 #ifdef I_SYSSELECT
9834 #include <sys/select.h>
9835 #endif
9836 #$i_stdlib I_STDLIB
9837 #ifdef I_STDLIB
9838 #include <stdlib.h>
9839 #endif
9840 int main()
9841 {
9842         struct tm foo;
9843 #ifdef S_TIMEVAL
9844         struct timeval bar;
9845 #endif
9846 #ifdef S_TIMEZONE
9847         struct timezone tzp;
9848 #endif
9849         if (foo.tm_sec == foo.tm_sec)
9850                 exit(0);
9851 #ifdef S_TIMEVAL
9852         if (bar.tv_sec == bar.tv_sec)
9853                 exit(0);
9854 #endif
9855         exit(1);
9856 }
9857 EOCP
9858         flags=''
9859         for s_timezone in '-DS_TIMEZONE' ''; do
9860         sysselect=''
9861         for s_timeval in '-DS_TIMEVAL' ''; do
9862         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9863         for i_time in '' '-DI_TIME'; do
9864         for i_systime in '-DI_SYSTIME' ''; do
9865                 case "$flags" in
9866                 '') $echo $n ".$c"
9867                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9868                         if eval $compile; then
9869                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9870                                 shift
9871                                 flags="$*"
9872                                 echo " "
9873                                 $echo $n "Succeeded with $flags$c"
9874                         fi
9875                         ;;
9876                 esac
9877         done
9878         done
9879         done
9880         done
9881         done
9882         timeincl=''
9883         echo " "
9884         case "$flags" in
9885         *SYSTIMEKERNEL*) i_systimek="$define"
9886                 timeincl=`./findhdr sys/time.h`
9887                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9888         *) i_systimek="$undef";;
9889         esac
9890         case "$flags" in
9891         *I_TIME*) i_time="$define"
9892                 timeincl=`./findhdr time.h`" $timeincl"
9893                 echo "We'll include <time.h>." >&4;;
9894         *) i_time="$undef";;
9895         esac
9896         case "$flags" in
9897         *I_SYSTIME*) i_systime="$define"
9898                 timeincl=`./findhdr sys/time.h`" $timeincl"
9899                 echo "We'll include <sys/time.h>." >&4;;
9900         *) i_systime="$undef";;
9901         esac
9902         $rm -f try.c try
9903 fi
9904 : see if struct tm knows about tm_zone
9905 case "$i_systime$i_time" in
9906 *$define*) 
9907         echo " "
9908         echo "Checking to see if your struct tm has tm_zone field..." >&4
9909         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9910         eval $hasfield
9911         ;;
9912 *)      val="$undef"
9913         set d_tm_tm_zone
9914         eval $setvar
9915         ;;
9916 esac
9917 case "$d_tm_tm_zone" in
9918 "$define")      echo "Yes, it does."   ;;
9919 *)              echo "No, it doesn't." ;;
9920 esac
9921 : see if struct tm knows about tm_gmtoff
9922 case "$i_systime$i_time" in
9923 *$define*) 
9924         echo " "
9925         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9926         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9927         eval $hasfield
9928         ;;
9929 *)      val="$undef"
9930         set d_tm_tm_gmtoff
9931         eval $setvar
9932         ;;
9933 esac
9934 case "$d_tm_tm_gmtoff" in
9935 "$define")      echo "Yes, it does."   ;;
9936 *)              echo "No, it doesn't." ;;
9937 esac
9938
9939 : see if asctime_r exists
9940 set asctime_r d_asctime_r
9941 eval $inlibc
9942 case "$d_asctime_r" in
9943 "$define")
9944         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9945         case "$d_asctime_r_proto:$usethreads" in
9946         ":define")      d_asctime_r_proto=define
9947                 set d_asctime_r_proto asctime_r $hdrs
9948                 eval $hasproto ;;
9949         *)      ;;
9950         esac
9951         case "$d_asctime_r_proto" in
9952         define)
9953         case "$asctime_r_proto" in
9954         ''|0) try='char* asctime_r(const struct tm*, char*);'
9955         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9956         esac
9957         case "$asctime_r_proto" in
9958         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9959         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9960         esac
9961         case "$asctime_r_proto" in
9962         ''|0) try='int asctime_r(const struct tm*, char*);'
9963         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9964         esac
9965         case "$asctime_r_proto" in
9966         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9967         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9968         esac
9969         case "$asctime_r_proto" in
9970         ''|0)   d_asctime_r=undef
9971                 asctime_r_proto=0
9972                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9973         * )     case "$asctime_r_proto" in
9974                 REENTRANT_PROTO*) ;;
9975                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9976                 esac
9977                 echo "Prototype: $try" ;;
9978         esac
9979         ;;
9980         *)      case "$usethreads" in
9981                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9982                 esac
9983                 d_asctime_r=undef
9984                 asctime_r_proto=0
9985                 ;;
9986         esac
9987         ;;
9988 *)      asctime_r_proto=0
9989         ;;
9990 esac
9991
9992 : see if atolf exists
9993 set atolf d_atolf
9994 eval $inlibc
9995
9996 : see if atoll exists
9997 set atoll d_atoll
9998 eval $inlibc
9999
10000 : Look for GCC-style attribute format
10001 case "$d_attribute_format" in
10002 '')
10003 echo " "
10004 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10005 $cat >attrib.c <<'EOCP'
10006 #include <stdio.h>
10007 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10008 EOCP
10009 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10010         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10011                 echo "Your C compiler doesn't support __attribute__((format))."
10012                 val="$undef"
10013         else
10014                 echo "Your C compiler supports __attribute__((format))."
10015                 val="$define"
10016         fi
10017 else
10018         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10019         val="$undef"
10020 fi
10021 ;;
10022 *) val="$d_attribute_format" ;;
10023 esac
10024 set d_attribute_format
10025 eval $setvar
10026 $rm -f attrib*
10027
10028 : Look for GCC-style attribute format with null format allowed
10029 case "$d_printf_format_null" in
10030 '') case "$d_attribute_format" in
10031     $define)
10032         echo " "
10033         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10034 $cat >attrib.c <<EOCP
10035 #include <stdio.h>
10036 #$i_stdlib I_STDLIB
10037 #ifdef I_STDLIB
10038 #include <stdlib.h>
10039 #endif
10040 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10041 int null_printf (char* pat,...) { return (int)pat; }
10042 int main () { exit(null_printf(NULL)); }
10043 EOCP
10044         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10045             : run the executable in case it produces a run-time warning
10046             if $run ./attrib >>attrib.out 2>&1; then
10047                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10048                     echo "Your C compiler doesn't allow __printf__ format to be null."
10049                     val="$undef"
10050                 else
10051                     echo "Your C compiler allows __printf__ format to be null."
10052                     val="$define"
10053                 fi
10054             else
10055             echo "Your C compiler executable failed with __printf__ format null."
10056             val="$undef"
10057         fi
10058     else
10059         echo "Your C compiler fails with __printf__ format null."
10060         val="$undef"
10061     fi
10062     ;;
10063     *)  val="$undef" ;;
10064     esac
10065 ;;
10066 *)  val="$d_printf_format_null" ;;
10067 esac
10068 set d_printf_format_null
10069 eval $setvar
10070 $rm -f attrib*
10071
10072 : Look for GCC-style attribute malloc
10073 case "$d_attribute_malloc" in
10074 '')
10075 echo " "
10076 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10077 $cat >attrib.c <<'EOCP'
10078 #include <stdio.h>
10079 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10080 EOCP
10081 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10082         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10083                 echo "Your C compiler doesn't support __attribute__((malloc))."
10084                 val="$undef"
10085         else
10086                 echo "Your C compiler supports __attribute__((malloc))."
10087                 val="$define"
10088         fi
10089 else
10090         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10091         val="$undef"
10092 fi
10093 ;;
10094 *) val="$d_attribute_malloc" ;;
10095 esac
10096 set d_attribute_malloc
10097 eval $setvar
10098 $rm -f attrib*
10099
10100 : Look for GCC-style attribute nonnull
10101 case "$d_attribute_nonnull" in
10102 '')
10103 echo " "
10104 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10105 $cat >attrib.c <<'EOCP'
10106 #include <stdio.h>
10107 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10108 EOCP
10109 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10110         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10111                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10112                 val="$undef"
10113         else
10114                 echo "Your C compiler supports __attribute__((nonnull))."
10115                 val="$define"
10116         fi
10117 else
10118         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10119         val="$undef"
10120 fi
10121 ;;
10122 *) val="$d_attribute_nonnull" ;;
10123 esac
10124 set d_attribute_nonnull
10125 eval $setvar
10126 $rm -f attrib*
10127
10128 : Look for GCC-style attribute noreturn
10129 case "$d_attribute_noreturn" in
10130 '')
10131 echo " "
10132 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10133 $cat >attrib.c <<'EOCP'
10134 #include <stdio.h>
10135 void fall_over_dead( void ) __attribute__((noreturn));
10136 EOCP
10137 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10138         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10139                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10140                 val="$undef"
10141         else
10142                 echo "Your C compiler supports __attribute__((noreturn))."
10143                 val="$define"
10144         fi
10145 else
10146         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10147         val="$undef"
10148 fi
10149 ;;
10150 *) val="$d_attribute_noreturn" ;;
10151 esac
10152 set d_attribute_noreturn
10153 eval $setvar
10154 $rm -f attrib*
10155
10156 : Look for GCC-style attribute pure
10157 case "$d_attribute_pure" in
10158 '')
10159 echo " "
10160 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10161 $cat >attrib.c <<'EOCP'
10162 #include <stdio.h>
10163 int square( int n ) __attribute__((pure));
10164 EOCP
10165 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10166         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10167                 echo "Your C compiler doesn't support __attribute__((pure))."
10168                 val="$undef"
10169         else
10170                 echo "Your C compiler supports __attribute__((pure))."
10171                 val="$define"
10172         fi
10173 else
10174         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10175         val="$undef"
10176 fi
10177 ;;
10178 *) val="$d_attribute_pure" ;;
10179 esac
10180 set d_attribute_pure
10181 eval $setvar
10182 $rm -f attrib*
10183
10184 : Look for GCC-style attribute unused
10185 case "$d_attribute_unused" in
10186 '')
10187 echo " "
10188 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10189 $cat >attrib.c <<'EOCP'
10190 #include <stdio.h>
10191 int do_something( int dummy __attribute__((unused)), int n );
10192 EOCP
10193 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10194         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10195                 echo "Your C compiler doesn't support __attribute__((unused))."
10196                 val="$undef"
10197         else
10198                 echo "Your C compiler supports __attribute__((unused))."
10199                 val="$define"
10200         fi
10201 else
10202         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10203         val="$undef"
10204 fi
10205 ;;
10206 *) val="$d_attribute_unused" ;;
10207 esac
10208 set d_attribute_unused
10209 eval $setvar
10210 $rm -f attrib*
10211
10212 : Look for GCC-style attribute warn_unused_result
10213 case "$d_attribute_warn_unused_result" in
10214 '')
10215 echo " "
10216 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10217 $cat >attrib.c <<'EOCP'
10218 #include <stdio.h>
10219 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10220 EOCP
10221 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10222         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10223                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10224                 val="$undef"
10225         else
10226                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10227                 val="$define"
10228         fi
10229 else
10230         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10231         val="$undef"
10232 fi
10233 ;;
10234 *) val="$d_attribute_warn_unused_result" ;;
10235 esac
10236 set d_attribute_warn_unused_result
10237 eval $setvar
10238 $rm -f attrib*
10239
10240 : see if bcmp exists
10241 set bcmp d_bcmp
10242 eval $inlibc
10243
10244 : see if bcopy exists
10245 set bcopy d_bcopy
10246 eval $inlibc
10247
10248 : see if getpgrp exists
10249 set getpgrp d_getpgrp
10250 eval $inlibc
10251
10252 case "$d_getpgrp" in
10253 "$define")
10254         echo " "
10255         echo "Checking to see which flavor of getpgrp is in use..."
10256         $cat >try.c <<EOP
10257 #$i_unistd I_UNISTD
10258 #include <sys/types.h>
10259 #ifdef I_UNISTD
10260 #  include <unistd.h>
10261 #endif
10262 #$i_stdlib I_STDLIB
10263 #ifdef I_STDLIB
10264 #include <stdlib.h>
10265 #endif
10266 int main()
10267 {
10268         if (getuid() == 0) {
10269                 printf("(I see you are running Configure as super-user...)\n");
10270                 setuid(1);
10271         }
10272 #ifdef TRY_BSD_PGRP
10273         if (getpgrp(1) == 0)
10274                 exit(0);
10275 #else
10276         if (getpgrp() > 0)
10277                 exit(0);
10278 #endif
10279         exit(1);
10280 }
10281 EOP
10282         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10283                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10284                 val="$define"
10285         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10286                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10287                 val="$undef"
10288         else
10289                 echo "I can't seem to compile and run the test program."
10290                 if ./usg; then
10291                         xxx="a USG one, i.e. you use getpgrp()."
10292                 else
10293                         # SVR4 systems can appear rather BSD-ish.
10294                         case "$i_unistd" in
10295                         $undef)
10296                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10297                                 val="$define"
10298                                 ;;
10299                         $define)
10300                                 xxx="probably a USG one, i.e. you use getpgrp()."
10301                                 val="$undef"
10302                                 ;;
10303                         esac
10304                 fi
10305                 echo "Assuming your getpgrp is $xxx" >&4
10306         fi
10307         ;;
10308 *) val="$undef";;
10309 esac
10310 set d_bsdgetpgrp
10311 eval $setvar
10312 $rm -f try try.*
10313
10314 : see if setpgrp exists
10315 set setpgrp d_setpgrp
10316 eval $inlibc
10317
10318 case "$d_setpgrp" in
10319 "$define")
10320         echo " "
10321         echo "Checking to see which flavor of setpgrp is in use..."
10322         $cat >try.c <<EOP
10323 #$i_unistd I_UNISTD
10324 #include <sys/types.h>
10325 #ifdef I_UNISTD
10326 #  include <unistd.h>
10327 #endif
10328 #$i_stdlib I_STDLIB
10329 #ifdef I_STDLIB
10330 #include <stdlib.h>
10331 #endif
10332 int main()
10333 {
10334         if (getuid() == 0) {
10335                 printf("(I see you are running Configure as super-user...)\n");
10336                 setuid(1);
10337         }
10338 #ifdef TRY_BSD_PGRP
10339         if (-1 == setpgrp(1, 1))
10340                 exit(0);
10341 #else
10342         if (setpgrp() != -1)
10343                 exit(0);
10344 #endif
10345         exit(1);
10346 }
10347 EOP
10348         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10349                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10350                 val="$define"
10351         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10352                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10353                 val="$undef"
10354         else
10355                 echo "(I can't seem to compile and run the test program.)"
10356                 if ./usg; then
10357                         xxx="a USG one, i.e. you use setpgrp()."
10358                 else
10359                         # SVR4 systems can appear rather BSD-ish.
10360                         case "$i_unistd" in
10361                         $undef)
10362                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10363                                 val="$define"
10364                                 ;;
10365                         $define)
10366                                 xxx="probably a USG one, i.e. you use setpgrp()."
10367                                 val="$undef"
10368                                 ;;
10369                         esac
10370                 fi
10371                 echo "Assuming your setpgrp is $xxx" >&4
10372         fi
10373         ;;
10374 *) val="$undef";;
10375 esac
10376 set d_bsdsetpgrp
10377 eval $setvar
10378 $rm -f try try.*
10379 : Look for GCC-style __builtin_choose_expr
10380 case "$d_builtin_choose_expr" in
10381 '')
10382     echo " "
10383     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10384     $cat >try.c <<'EOCP'
10385 #include <assert.h>
10386 #include <stdlib.h>
10387 #include <stdio.h>
10388
10389 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10390
10391 int main(void) {
10392     assert( SYRINX(1) == 2112 );
10393     assert( SYRINX(1) != 5150 );
10394     assert( SYRINX(0) == 5150 );
10395     assert( SYRINX(0) != 2112 );
10396     puts( "All good!" );
10397     exit(0);
10398 }
10399
10400 EOCP
10401     set try
10402     if eval $compile; then
10403         echo "Your C compiler supports __builtin_choose_expr."
10404         val="$define"
10405     else
10406         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10407         val="$undef"
10408     fi
10409 ;;
10410 *) val="$d_builtin_choose_expr" ;;
10411 esac
10412
10413 set d_builtin_choose_expr
10414 eval $setvar
10415 $rm -f try.* try core core.try.*
10416
10417 : Look for GCC-style __builtin_expect
10418 case "$d_builtin_expect" in
10419 '')
10420     echo " "
10421     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10422     $cat >builtin.c <<'EOCP'
10423 int main(void) {
10424     int n = 50;
10425     if ( __builtin_expect(n, 0) ) n = 1;
10426 }
10427 EOCP
10428     set try
10429     if eval $compile; then
10430         echo "Your C compiler supports __builtin_choose_expr."
10431         val="$define"
10432     else
10433         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10434         val="$undef"
10435     fi
10436     ;;
10437 *) val="$d_builtin_expect" ;;
10438 esac
10439
10440 set d_builtin_expect
10441 eval $setvar
10442 $rm -f try.* try core core.try.*
10443
10444 : see if bzero exists
10445 set bzero d_bzero
10446 eval $inlibc
10447
10448 : see if stdarg is available
10449 echo " "
10450 if $test `./findhdr stdarg.h`; then
10451         echo "<stdarg.h> found." >&4
10452         valstd="$define"
10453 else
10454         echo "<stdarg.h> NOT found." >&4
10455         valstd="$undef"
10456 fi
10457
10458 : see if varags is available
10459 echo " "
10460 if $test `./findhdr varargs.h`; then
10461         echo "<varargs.h> found." >&4
10462 else
10463         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10464 fi
10465
10466 : set up the varargs testing programs
10467 $cat > varargs.c <<EOP
10468 #ifdef I_STDARG
10469 #include <stdarg.h>
10470 #endif
10471 #ifdef I_VARARGS
10472 #include <varargs.h>
10473 #endif
10474
10475 #ifdef I_STDARG
10476 int f(char *p, ...)
10477 #else
10478 int f(va_alist)
10479 va_dcl
10480 #endif
10481 {
10482         va_list ap;
10483 #ifndef I_STDARG
10484         char *p;
10485 #endif
10486 #ifdef I_STDARG
10487         va_start(ap,p);
10488 #else
10489         va_start(ap);
10490         p = va_arg(ap, char *);
10491 #endif
10492         va_end(ap);
10493         return 0;
10494 }
10495 EOP
10496 $cat > varargs <<EOP
10497 $startsh
10498 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10499         echo "true"
10500 else
10501         echo "false"
10502 fi
10503 $rm -f varargs$_o
10504 EOP
10505 chmod +x varargs
10506
10507 : now check which varargs header should be included
10508 echo " "
10509 i_varhdr=''
10510 case "$valstd" in
10511 "$define")
10512         if `./varargs I_STDARG`; then
10513                 val='stdarg.h'
10514         elif `./varargs I_VARARGS`; then
10515                 val='varargs.h'
10516         fi
10517         ;;
10518 *)
10519         if `./varargs I_VARARGS`; then
10520                 val='varargs.h'
10521         fi
10522         ;;
10523 esac
10524 case "$val" in
10525 '')
10526 echo "I could not find the definition for va_dcl... You have problems..." >&4
10527         val="$undef"; set i_stdarg; eval $setvar
10528         val="$undef"; set i_varargs; eval $setvar
10529         ;;
10530 *) 
10531         set i_varhdr
10532         eval $setvar
10533         case "$i_varhdr" in
10534         stdarg.h)
10535                 val="$define"; set i_stdarg; eval $setvar
10536                 val="$undef"; set i_varargs; eval $setvar
10537                 ;;
10538         varargs.h)
10539                 val="$undef"; set i_stdarg; eval $setvar
10540                 val="$define"; set i_varargs; eval $setvar
10541                 ;;
10542         esac
10543         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10544 esac
10545 $rm -f varargs*
10546
10547 : see if the Compiler supports C99 variadic macros
10548 case "$i_stdarg$i_stdlib" in
10549     "$define$define")
10550     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10551     $cat >try.c <<EOCP
10552 #include <stdio.h>
10553 #include <stdarg.h>
10554
10555 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10556
10557 int main() {
10558   char buf[20];
10559   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10560   puts(buf);
10561   return 0;
10562 }
10563 EOCP
10564     set try
10565     if eval $compile && $run ./try 2>&1 >/dev/null; then
10566         case "`$run ./try`" in
10567             "123 456 789")
10568             echo "You have C99 variadic macros." >&4
10569             d_c99_variadic_macros="$define"
10570             ;;
10571             *)
10572             echo "You don't have functional C99 variadic macros." >&4
10573             d_c99_variadic_macros="$undef"
10574             ;;
10575         esac
10576     else
10577         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10578         d_c99_variadic_macros="$undef"
10579     fi
10580     $rm -f try.* try core core.try.*
10581     ;;
10582     *)
10583     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10584     d_c99_variadic_macros="$undef"
10585     ;;
10586 esac
10587
10588 : see if signal is declared as pointer to function returning int or void
10589 echo " "
10590 xxx=`./findhdr signal.h`
10591 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10592 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10593         echo "You have int (*signal())() instead of void." >&4
10594         val="$undef"
10595 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10596         echo "You have void (*signal())()." >&4
10597         val="$define"
10598 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10599         echo "You have int (*signal())() instead of void." >&4
10600         val="$undef"
10601 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10602         echo "You have void (*signal())()." >&4
10603         val="$define"
10604 else
10605         case "$d_voidsig" in
10606         '')
10607         echo "I can't determine whether signal handler returns void or int..." >&4
10608                 dflt=void
10609                 rp="What type does your signal handler return?"
10610                 . ./myread
10611                 case "$ans" in
10612                 v*) val="$define";;
10613                 *) val="$undef";;
10614                 esac;;
10615         "$define")
10616                 echo "As you already told me, signal handler returns void." >&4
10617                 val="$define"
10618                 ;;
10619         *)      echo "As you already told me, signal handler returns int." >&4
10620                 val="$undef"
10621                 ;;
10622         esac
10623 fi
10624 set d_voidsig
10625 eval $setvar
10626 case "$d_voidsig" in
10627 "$define") signal_t="void";;
10628 *) signal_t="int";;
10629 esac
10630 $rm -f $$.tmp
10631
10632 : check for ability to cast large floats to 32-bit ints.
10633 echo " "
10634 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10635 if $test "$intsize" -ge 4; then
10636         xxx=int
10637 else
10638         xxx=long
10639 fi
10640 $cat >try.c <<EOCP
10641 #include <stdio.h>
10642 #$i_stdlib I_STDLIB
10643 #ifdef I_STDLIB
10644 #include <stdlib.h>
10645 #endif
10646 #include <sys/types.h>
10647 #include <signal.h>
10648 $signal_t blech(int s) { exit(3); }
10649 int main()
10650 {
10651         $xxx i32;
10652         double f, g;
10653         int result = 0;
10654         char str[16];
10655         signal(SIGFPE, blech);
10656
10657         /* Don't let compiler optimize the test away.  Store the number 
10658            in a writable string for gcc to pass to sscanf under HP/UX.
10659         */
10660         sprintf(str, "2147483647");
10661         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10662         g = 10 * f;
10663         i32  = ($xxx) g;
10664
10665         /* x86 processors will probably give 0x8000 0000, which is a
10666            sign change.  We don't want that.  We want to mimic SPARC
10667            behavior here, which is to preserve the sign and give
10668            back 0x7fff ffff.
10669         */
10670         if (i32 != ($xxx) f)
10671                 result |= 1;
10672         exit(result);
10673 }
10674 EOCP
10675 set try
10676 if eval $compile_ok; then
10677         $run ./try
10678         yyy=$?
10679 else
10680         echo "(I can't seem to compile the test program--assuming it can't)"
10681         yyy=1
10682 fi
10683 case "$yyy" in
10684 0)      val="$define"
10685         echo "Yup, it can."
10686         ;;
10687 *)      val="$undef"
10688         echo "Nope, it can't."
10689         ;;
10690 esac
10691 set d_casti32
10692 eval $setvar
10693 $rm -f try try.*
10694
10695 : check for ability to cast negative floats to unsigned
10696 echo " "
10697 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10698 $cat >try.c <<EOCP
10699 #include <stdio.h>
10700 #$i_stdlib I_STDLIB
10701 #ifdef I_STDLIB
10702 #include <stdlib.h>
10703 #endif
10704 #include <sys/types.h>
10705 #include <signal.h>
10706 $signal_t blech(int s) { exit(7); }
10707 $signal_t blech_in_list(int s) { exit(4); }
10708 unsigned long dummy_long(unsigned long p) { return p; }
10709 unsigned int dummy_int(unsigned int p) { return p; }
10710 unsigned short dummy_short(unsigned short p) { return p; }
10711 int main()
10712 {
10713         double f;
10714         unsigned long along;
10715         unsigned int aint;
10716         unsigned short ashort;
10717         int result = 0;
10718         char str[16];
10719         
10720         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10721            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10722            optimized the whole file away
10723         */
10724         /* Store the number in a writable string for gcc to pass to 
10725            sscanf under HP/UX.
10726         */
10727         sprintf(str, "-123");
10728         sscanf(str, "%lf", &f);  /* f = -123.; */
10729
10730         signal(SIGFPE, blech);
10731         along = (unsigned long)f;
10732         aint = (unsigned int)f;
10733         ashort = (unsigned short)f;
10734         if (along != (unsigned long)-123)
10735                 result |= 1;
10736         if (aint != (unsigned int)-123)
10737                 result |= 1;
10738         if (ashort != (unsigned short)-123)
10739                 result |= 1;
10740         sprintf(str, "1073741824.");
10741         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10742         f = f + f;
10743         along = 0;
10744         along = (unsigned long)f;
10745         if (along != 0x80000000)
10746                 result |= 2;
10747         f -= 1.;
10748         along = 0;
10749         along = (unsigned long)f;
10750         if (along != 0x7fffffff)
10751                 result |= 1;
10752         f += 2.;
10753         along = 0;
10754         along = (unsigned long)f;
10755         if (along != 0x80000001)
10756                 result |= 2;
10757         if (result)
10758                 exit(result);
10759         signal(SIGFPE, blech_in_list);
10760         sprintf(str, "123.");
10761         sscanf(str, "%lf", &f);  /* f = 123.; */
10762         along = dummy_long((unsigned long)f);
10763         aint = dummy_int((unsigned int)f);
10764         ashort = dummy_short((unsigned short)f);
10765         if (along != (unsigned long)123)
10766                 result |= 4;
10767         if (aint != (unsigned int)123)
10768                 result |= 4;
10769         if (ashort != (unsigned short)123)
10770                 result |= 4;
10771         exit(result);
10772
10773 }
10774 EOCP
10775 set try
10776 if eval $compile_ok; then
10777         $run ./try
10778         castflags=$?
10779 else
10780         echo "(I can't seem to compile the test program--assuming it can't)"
10781         castflags=7
10782 fi
10783 case "$castflags" in
10784 0)      val="$define"
10785         echo "Yup, it can."
10786         ;;
10787 *)      val="$undef"
10788         echo "Nope, it can't."
10789         ;;
10790 esac
10791 set d_castneg
10792 eval $setvar
10793 $rm -f try try.*
10794
10795 : see if vprintf exists
10796 echo " "
10797 if set vprintf val -f d_vprintf; eval $csym; $val; then
10798         echo 'vprintf() found.' >&4
10799         val="$define"
10800         $cat >try.c <<EOF
10801 #include <varargs.h>
10802 #$i_stdlib I_STDLIB
10803 #ifdef I_STDLIB
10804 #include <stdlib.h>
10805 #endif
10806
10807 int main() { xxx("foo"); }
10808
10809 xxx(va_alist)
10810 va_dcl
10811 {
10812         va_list args;
10813         char buf[10];
10814
10815         va_start(args);
10816         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10817 }
10818 EOF
10819         set try
10820         if eval $compile && $run ./try; then
10821                 echo "Your vsprintf() returns (int)." >&4
10822                 val2="$undef"
10823         else
10824                 echo "Your vsprintf() returns (char*)." >&4
10825                 val2="$define"
10826         fi
10827 else
10828         echo 'vprintf() NOT found.' >&4
10829                 val="$undef"
10830                 val2="$undef"
10831 fi
10832 $rm -f try try.*
10833 set d_vprintf
10834 eval $setvar
10835 val=$val2
10836 set d_charvspr
10837 eval $setvar
10838
10839 : see if chown exists
10840 set chown d_chown
10841 eval $inlibc
10842
10843 : see if chroot exists
10844 set chroot d_chroot
10845 eval $inlibc
10846
10847 : see if chsize exists
10848 set chsize d_chsize
10849 eval $inlibc
10850
10851 : see if class exists
10852 set class d_class
10853 eval $inlibc
10854
10855 : see if clearenv exists
10856 set clearenv d_clearenv
10857 eval $inlibc
10858
10859 hasstruct='varname=$1; struct=$2; shift; shift;
10860 while $test $# -ge 2; do
10861         case "$1" in
10862         $define) echo "#include <$2>";;
10863         esac ;
10864     shift 2;
10865 done > try.c;
10866 echo "int main () { struct $struct foo; }" >> try.c;
10867 set try;
10868 if eval $compile; then
10869         val="$define";
10870 else
10871         val="$undef";
10872 fi;
10873 set $varname;
10874 eval $setvar;
10875 $rm -f try try.c try.o'
10876
10877 socketlib=''
10878 sockethdr=''
10879 : see whether socket exists
10880 echo " "
10881 $echo $n "Hmm... $c" >&4
10882 if set socket val -f d_socket; eval $csym; $val; then
10883         echo "Looks like you have Berkeley networking support." >&4
10884         d_socket="$define"
10885         if set setsockopt val -f; eval $csym; $val; then
10886                 d_oldsock="$undef"
10887         else
10888                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10889                 d_oldsock="$define"
10890         fi
10891 else
10892         if $contains socklib libc.list >/dev/null 2>&1; then
10893                 echo "Looks like you have Berkeley networking support." >&4
10894                 d_socket="$define"
10895                 : we will have to assume that it supports the 4.2 BSD interface
10896                 d_oldsock="$undef"
10897         else
10898                 echo "You don't have Berkeley networking in libc$_a..." >&4
10899                 if test "X$d_socket" = "X$define"; then
10900                    echo "...but you seem to believe that you have sockets." >&4
10901                 else
10902                         for net in net socket
10903                         do
10904                                 if test -f /usr/lib/lib$net$_a; then
10905                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10906                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10907                                         if $contains socket libc.list >/dev/null 2>&1; then
10908                                                 d_socket="$define"
10909                                                 socketlib="-l$net"
10910                                                 case "$net" in
10911                                                 net)
10912                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10913                                                         sockethdr="-I/usr/netinclude"
10914                                                         ;;
10915                                                 esac
10916                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10917                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10918                                                         d_oldsock="$undef"
10919                                                 else
10920                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10921                                                         d_oldsock="$define"
10922                                                 fi
10923                                                 break
10924                                         fi
10925                                 fi
10926                         done
10927                         if test "X$d_socket" != "X$define"; then
10928                            echo "or anywhere else I see." >&4
10929                            d_socket="$undef"
10930                            d_oldsock="$undef"
10931                         fi
10932                 fi
10933         fi
10934 fi
10935
10936 : see if socketpair exists
10937 set socketpair d_sockpair
10938 eval $inlibc
10939
10940
10941 echo " "
10942 echo "Checking the availability of certain socket constants..." >&4
10943 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10944         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10945         $cat >try.c <<EOF
10946 #include <sys/types.h>
10947 #include <sys/socket.h>
10948 int main() {
10949     int i = $ENUM;
10950 }
10951 EOF
10952         val="$undef"
10953         set try; if eval $compile; then
10954                 val="$define"
10955         fi
10956         set d_${enum}; eval $setvar
10957         $rm -f try.c try
10958 done
10959
10960 : see if this is a sys/uio.h system
10961 set sys/uio.h i_sysuio
10962 eval $inhdr
10963
10964
10965 echo " "
10966 echo "Checking to see if your system supports struct cmsghdr..." >&4
10967 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10968 eval $hasstruct
10969 case "$d_cmsghdr_s" in
10970 "$define")      echo "Yes, it does."   ;;
10971 *)              echo "No, it doesn't." ;;
10972 esac
10973
10974
10975 : check for const keyword
10976 echo " "
10977 echo 'Checking to see if your C compiler knows about "const"...' >&4
10978 $cat >const.c <<'EOCP'
10979 typedef struct spug { int drokk; } spug;
10980 int main()
10981 {
10982         const char *foo;
10983         const spug y = { 0 };
10984 }
10985 EOCP
10986 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10987         val="$define"
10988         echo "Yup, it does."
10989 else
10990         val="$undef"
10991         echo "Nope, it doesn't."
10992 fi
10993 set d_const
10994 eval $setvar
10995
10996 : see if copysignl exists
10997 set copysignl d_copysignl
10998 eval $inlibc
10999
11000 : see if crypt exists
11001 echo " "
11002 set crypt d_crypt
11003 eval $inlibc
11004 case "$d_crypt" in
11005 $define) cryptlib='' ;;
11006 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11007                 echo 'crypt() found.' >&4
11008                 val="$define"
11009                 cryptlib=''
11010         else
11011                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11012                 if $test -z "$cryptlib"; then
11013                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11014                 else
11015                         cryptlib=-lcrypt
11016                 fi
11017                 if $test -z "$cryptlib"; then
11018                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11019                 else
11020                         cryptlib=-lcrypt
11021                 fi
11022                 if $test -z "$cryptlib"; then
11023                         cryptlib=`./loc libcrypt$_a "" $libpth`
11024                 else
11025                         cryptlib=-lcrypt
11026                 fi
11027                 if $test -z "$cryptlib"; then
11028                         echo 'crypt() NOT found.' >&4
11029                         val="$undef"
11030                 else
11031                         val="$define"
11032                 fi
11033         fi
11034         set d_crypt
11035         eval $setvar
11036         ;;
11037 esac
11038
11039 : see if this is a crypt.h system
11040 set crypt.h i_crypt
11041 eval $inhdr
11042
11043 : see if crypt_r exists
11044 set crypt_r d_crypt_r
11045 eval $inlibc
11046 case "$d_crypt_r" in
11047 "$define")
11048         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11049         case "$d_crypt_r_proto:$usethreads" in
11050         ":define")      d_crypt_r_proto=define
11051                 set d_crypt_r_proto crypt_r $hdrs
11052                 eval $hasproto ;;
11053         *)      ;;
11054         esac
11055         case "$d_crypt_r_proto" in
11056         define)
11057         case "$crypt_r_proto" in
11058         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11059         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11060         esac
11061         case "$crypt_r_proto" in
11062         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11063         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11064         esac
11065         case "$crypt_r_proto" in
11066         ''|0)   d_crypt_r=undef
11067                 crypt_r_proto=0
11068                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11069         * )     case "$crypt_r_proto" in
11070                 REENTRANT_PROTO*) ;;
11071                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11072                 esac
11073                 echo "Prototype: $try" ;;
11074         esac
11075         ;;
11076         *)      case "$usethreads" in
11077                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11078                 esac
11079                 d_crypt_r=undef
11080                 crypt_r_proto=0
11081                 ;;
11082         esac
11083         ;;
11084 *)      crypt_r_proto=0
11085         ;;
11086 esac
11087
11088 : get csh whereabouts
11089 case "$csh" in
11090 'csh') val="$undef" ;;
11091 *) val="$define" ;;
11092 esac
11093 set d_csh
11094 eval $setvar
11095 : Respect a hint or command line value for full_csh.
11096 case "$full_csh" in
11097 '') full_csh=$csh ;;
11098 esac
11099
11100 : see if ctermid exists
11101 set ctermid d_ctermid
11102 eval $inlibc
11103
11104 : see if ctermid_r exists
11105 set ctermid_r d_ctermid_r
11106 eval $inlibc
11107 case "$d_ctermid_r" in
11108 "$define")
11109         hdrs="$i_systypes sys/types.h define stdio.h "
11110         case "$d_ctermid_r_proto:$usethreads" in
11111         ":define")      d_ctermid_r_proto=define
11112                 set d_ctermid_r_proto ctermid_r $hdrs
11113                 eval $hasproto ;;
11114         *)      ;;
11115         esac
11116         case "$d_ctermid_r_proto" in
11117         define)
11118         case "$ctermid_r_proto" in
11119         ''|0) try='char* ctermid_r(char*);'
11120         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11121         esac
11122         case "$ctermid_r_proto" in
11123         ''|0)   d_ctermid_r=undef
11124                 ctermid_r_proto=0
11125                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11126         * )     case "$ctermid_r_proto" in
11127                 REENTRANT_PROTO*) ;;
11128                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11129                 esac
11130                 echo "Prototype: $try" ;;
11131         esac
11132         ;;
11133         *)      case "$usethreads" in
11134                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11135                 esac
11136                 d_ctermid_r=undef
11137                 ctermid_r_proto=0
11138                 ;;
11139         esac
11140         ;;
11141 *)      ctermid_r_proto=0
11142         ;;
11143 esac
11144
11145 : see if ctime_r exists
11146 set ctime_r d_ctime_r
11147 eval $inlibc
11148 case "$d_ctime_r" in
11149 "$define")
11150         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11151         case "$d_ctime_r_proto:$usethreads" in
11152         ":define")      d_ctime_r_proto=define
11153                 set d_ctime_r_proto ctime_r $hdrs
11154                 eval $hasproto ;;
11155         *)      ;;
11156         esac
11157         case "$d_ctime_r_proto" in
11158         define)
11159         case "$ctime_r_proto" in
11160         ''|0) try='char* ctime_r(const time_t*, char*);'
11161         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11162         esac
11163         case "$ctime_r_proto" in
11164         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11165         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11166         esac
11167         case "$ctime_r_proto" in
11168         ''|0) try='int ctime_r(const time_t*, char*);'
11169         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11170         esac
11171         case "$ctime_r_proto" in
11172         ''|0) try='int ctime_r(const time_t*, char*, int);'
11173         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11174         esac
11175         case "$ctime_r_proto" in
11176         ''|0)   d_ctime_r=undef
11177                 ctime_r_proto=0
11178                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11179         * )     case "$ctime_r_proto" in
11180                 REENTRANT_PROTO*) ;;
11181                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11182                 esac
11183                 echo "Prototype: $try" ;;
11184         esac
11185         ;;
11186         *)      case "$usethreads" in
11187                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11188                 esac
11189                 d_ctime_r=undef
11190                 ctime_r_proto=0
11191                 ;;
11192         esac
11193         ;;
11194 *)      ctime_r_proto=0
11195         ;;
11196 esac
11197
11198 : see if cuserid exists
11199 set cuserid d_cuserid
11200 eval $inlibc
11201
11202 : see if this is a limits.h system
11203 set limits.h i_limits
11204 eval $inhdr
11205
11206 : see if this is a float.h system
11207 set float.h i_float
11208 eval $inhdr
11209
11210 : See if number of significant digits in a double precision number is known
11211 echo " "
11212 $cat >dbl_dig.c <<EOM
11213 #$i_limits I_LIMITS
11214 #$i_float I_FLOAT
11215 #ifdef I_LIMITS
11216 #include <limits.h>
11217 #endif
11218 #ifdef I_FLOAT
11219 #include <float.h>
11220 #endif
11221 #ifdef DBL_DIG
11222 printf("Contains DBL_DIG");
11223 #endif
11224 EOM
11225 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11226 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11227         echo "DBL_DIG found." >&4
11228         val="$define"
11229 else
11230         echo "DBL_DIG NOT found." >&4
11231         val="$undef"
11232 fi
11233 $rm -f dbl_dig.?
11234 set d_dbl_dig
11235 eval $setvar
11236
11237 : see if dbm.h is available
11238 : see if dbmclose exists
11239 set dbmclose d_dbmclose
11240 eval $inlibc
11241
11242 case "$d_dbmclose" in
11243 $define)
11244         set dbm.h i_dbm
11245         eval $inhdr
11246         case "$i_dbm" in
11247         $define)
11248                 val="$undef"
11249                 set i_rpcsvcdbm
11250                 eval $setvar
11251                 ;;
11252         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11253                 eval $inhdr
11254                 ;;
11255         esac
11256         ;;
11257 *)      echo "We won't be including <dbm.h>"
11258         val="$undef"
11259         set i_dbm
11260         eval $setvar
11261         val="$undef"
11262         set i_rpcsvcdbm
11263         eval $setvar
11264         ;;
11265 esac
11266
11267 : see if prototype for dbminit is available
11268 echo " "
11269 set d_dbminitproto dbminit $i_dbm dbm.h
11270 eval $hasproto
11271
11272 : see if difftime exists
11273 set difftime d_difftime
11274 eval $inlibc
11275
11276 : see if this is a dirent system
11277 echo " "
11278 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11279         val="$define"
11280         echo "<dirent.h> found." >&4
11281 else
11282         val="$undef"
11283         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11284                 echo "<sys/dir.h> found." >&4
11285                 echo " "
11286         else
11287                 xinc=`./findhdr sys/ndir.h`
11288         fi
11289         echo "<dirent.h> NOT found." >&4
11290 fi
11291 set i_dirent
11292 eval $setvar
11293
11294 : Look for type of directory structure.
11295 echo " "
11296 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11297
11298 case "$direntrytype" in
11299 ''|' ')
11300         case "$i_dirent" in
11301         $define) guess1='struct dirent' ;;
11302         *) guess1='struct direct'  ;;
11303         esac
11304         ;;
11305 *)      guess1="$direntrytype"
11306         ;;
11307 esac
11308
11309 case "$guess1" in
11310 'struct dirent') guess2='struct direct' ;;
11311 *) guess2='struct dirent' ;;
11312 esac
11313                 
11314 if $contains "$guess1" try.c >/dev/null 2>&1; then
11315         direntrytype="$guess1"
11316         echo "Your directory entries are $direntrytype." >&4
11317 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11318         direntrytype="$guess2"
11319         echo "Your directory entries seem to be $direntrytype." >&4
11320 else
11321         echo "I don't recognize your system's directory entries." >&4
11322         rp="What type is used for directory entries on this system?"
11323         dflt="$guess1"
11324         . ./myread
11325         direntrytype="$ans"
11326 fi
11327 $rm -f try try.c
11328
11329
11330 : see if the directory entry stores field length
11331 echo " "
11332 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11333 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11334         echo "Good, your directory entry keeps length information in d_namlen." >&4
11335         val="$define"
11336 else
11337         echo "Your directory entry does not know about the d_namlen field." >&4
11338         val="$undef"
11339 fi
11340 set d_dirnamlen
11341 eval $setvar
11342 $rm -f try try.c
11343
11344 : Look for DIR.dd_fd
11345 case "$i_dirent" in
11346 "$define")
11347     echo "Checking to see if DIR has a dd_fd member variable" >&4
11348     $cat >try.c <<EOCP
11349 #$i_stdlib I_STDLIB
11350 #ifdef I_STDLIB
11351 #include <stdlib.h>
11352 #endif
11353 #include <dirent.h>
11354
11355 int main() {
11356     DIR dir;
11357     dir.dd_fd = 1;
11358     return 0;
11359 }
11360 EOCP
11361     val=$undef
11362     set try
11363     if eval $compile; then
11364         echo "Yes, it does."
11365         val="$define"
11366     else
11367         echo "No, it does not."
11368         val="$undef"
11369     fi
11370     ;;
11371 *)
11372     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11373     val="$undef"
11374     ;;
11375 esac
11376 set d_dir_dd_fd
11377 eval $setvar
11378 $rm -f try try.*
11379
11380 : see if this is an sysdir system
11381 set sys/dir.h i_sysdir
11382 eval $inhdr
11383
11384 : see if this is an sysndir system
11385 set sys/ndir.h i_sysndir
11386 eval $inhdr
11387
11388 : Look for dirfd
11389 echo " "
11390 $cat >dirfd.c <<EOM
11391 #include <stdio.h>
11392 #$i_stdlib I_STDLIB
11393 #ifdef I_STDLIB
11394 #include <stdlib.h>
11395 #endif
11396 #$i_dirent I_DIRENT             /**/
11397 #$i_sysdir I_SYS_DIR            /**/
11398 #$i_sysndir I_SYS_NDIR          /**/
11399 #$i_systypes I_SYS_TYPES        /**/
11400 #if defined(I_SYS_TYPES)
11401 #include <sys/types.h>
11402 #endif
11403 #if defined(I_DIRENT)
11404 #include <dirent.h>
11405 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11406 #include <sys/dir.h>
11407 #endif
11408 #else
11409 #ifdef I_SYS_NDIR
11410 #include <sys/ndir.h>
11411 #else
11412 #ifdef I_SYS_DIR
11413 #ifdef hp9000s500
11414 #include <ndir.h>       /* may be wrong in the future */
11415 #else
11416 #include <sys/dir.h>
11417 #endif
11418 #endif
11419 #endif
11420 #endif 
11421 int main() {
11422         DIR *dirp = opendir(".");
11423         if (dirfd(dirp) >= 0)
11424                 exit(0);
11425         else
11426                 exit(1);
11427 }
11428 EOM
11429 val=$undef
11430 set dirfd
11431 if eval $compile; then
11432         val="$define"
11433 fi
11434 case "$val" in
11435 $define)        echo "dirfd() found." >&4       ;;
11436 *)              echo "dirfd() NOT found." >&4   ;;
11437 esac
11438 set d_dirfd
11439 eval $setvar
11440 $rm -f dirfd*
11441
11442 : see if dlerror exists
11443 xxx_runnm="$runnm"
11444 runnm=false
11445 set dlerror d_dlerror
11446 eval $inlibc
11447 runnm="$xxx_runnm"
11448
11449 : see if dlfcn is available
11450 set dlfcn.h i_dlfcn
11451 eval $inhdr
11452
11453 case "$usedl" in
11454 $define|y|true)
11455         $cat << EOM
11456
11457 On a few systems, the dynamically loaded modules that perl generates and uses
11458 will need a different extension than shared libs. The default will probably
11459 be appropriate.
11460
11461 EOM
11462         case "$dlext" in
11463         '')     dflt="$so" ;;
11464         *)      dflt="$dlext" ;;
11465         esac
11466         rp='What is the extension of dynamically loaded modules'
11467         . ./myread
11468         dlext="$ans"
11469         ;;
11470 *)
11471         dlext="none"
11472         ;;
11473 esac
11474
11475 : Check if dlsym need a leading underscore
11476 echo " "
11477 val="$undef"
11478
11479 case "$dlsrc" in
11480 dl_dlopen.xs)
11481         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11482         $cat >dyna.c <<'EOM'
11483 fred () { }
11484 EOM
11485
11486 $cat >fred.c<<EOM
11487
11488 #include <stdio.h>
11489 #$i_stdlib I_STDLIB
11490 #ifdef I_STDLIB
11491 #include <stdlib.h>
11492 #endif
11493 #$i_dlfcn I_DLFCN
11494 #ifdef I_DLFCN
11495 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11496 #else
11497 #include <sys/types.h>
11498 #include <nlist.h>
11499 #include <link.h>
11500 #endif
11501
11502 extern int fred() ;
11503
11504 int main()
11505 {
11506     void * handle ;
11507     void * symbol ;
11508 #ifndef RTLD_LAZY
11509     int mode = 1 ;
11510 #else
11511     int mode = RTLD_LAZY ;
11512 #endif
11513     handle = dlopen("./dyna.$dlext", mode) ;
11514     if (handle == NULL) {
11515         printf ("1\n") ;
11516         fflush (stdout) ;
11517         exit(0);
11518     }
11519     symbol = dlsym(handle, "fred") ;
11520     if (symbol == NULL) {
11521         /* try putting a leading underscore */
11522         symbol = dlsym(handle, "_fred") ;
11523         if (symbol == NULL) {
11524             printf ("2\n") ;
11525             fflush (stdout) ;
11526             exit(0);
11527         }
11528         printf ("3\n") ;
11529     }
11530     else
11531         printf ("4\n") ;
11532     fflush (stdout) ;
11533     exit(0);
11534 }
11535 EOM
11536         : Call the object file tmp-dyna.o in case dlext=o.
11537         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11538                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11539                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11540                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11541                 xxx=`$run ./fred`
11542                 case $xxx in
11543                 1)      echo "Test program failed using dlopen." >&4
11544                         echo "Perhaps you should not use dynamic loading." >&4;;
11545                 2)      echo "Test program failed using dlsym." >&4
11546                         echo "Perhaps you should not use dynamic loading." >&4;;
11547                 3)      echo "dlsym needs a leading underscore" >&4
11548                         val="$define" ;;
11549                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11550                 esac
11551         else
11552                 echo "I can't compile and run the test program." >&4
11553                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11554         fi
11555         ;;
11556 esac
11557                 
11558 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11559
11560 set d_dlsymun
11561 eval $setvar
11562
11563 : see if drand48_r exists
11564 set drand48_r d_drand48_r
11565 eval $inlibc
11566 case "$d_drand48_r" in
11567 "$define")
11568         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11569         case "$d_drand48_r_proto:$usethreads" in
11570         ":define")      d_drand48_r_proto=define
11571                 set d_drand48_r_proto drand48_r $hdrs
11572                 eval $hasproto ;;
11573         *)      ;;
11574         esac
11575         case "$d_drand48_r_proto" in
11576         define)
11577         case "$drand48_r_proto" in
11578         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11579         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11580         esac
11581         case "$drand48_r_proto" in
11582         ''|0)   d_drand48_r=undef
11583                 drand48_r_proto=0
11584                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11585         * )     case "$drand48_r_proto" in
11586                 REENTRANT_PROTO*) ;;
11587                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11588                 esac
11589                 echo "Prototype: $try" ;;
11590         esac
11591         ;;
11592         *)      case "$usethreads" in
11593                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11594                 esac
11595                 d_drand48_r=undef
11596                 drand48_r_proto=0
11597                 ;;
11598         esac
11599         ;;
11600 *)      drand48_r_proto=0
11601         ;;
11602 esac
11603
11604 : see if prototype for drand48 is available
11605 echo " "
11606 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11607 eval $hasproto
11608
11609 : see if dup2 exists
11610 set dup2 d_dup2
11611 eval $inlibc
11612
11613 : see if eaccess exists
11614 set eaccess d_eaccess
11615 eval $inlibc
11616
11617 : see if endgrent exists
11618 set endgrent d_endgrent
11619 eval $inlibc
11620
11621 : see if this is an grp system
11622 set grp.h i_grp
11623 eval $inhdr
11624
11625 case "$i_grp" in
11626 $define)
11627         xxx=`./findhdr grp.h`
11628         $cppstdin $cppflags $cppminus < $xxx >$$.h
11629
11630         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11631                 val="$define"
11632         else
11633                 val="$undef"
11634         fi
11635         set d_grpasswd
11636         eval $setvar
11637
11638         $rm -f $$.h
11639         ;;
11640 *)
11641         val="$undef";
11642         set d_grpasswd; eval $setvar
11643         ;;
11644 esac
11645
11646 : see if endgrent_r exists
11647 set endgrent_r d_endgrent_r
11648 eval $inlibc
11649 case "$d_endgrent_r" in
11650 "$define")
11651         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11652         case "$d_endgrent_r_proto:$usethreads" in
11653         ":define")      d_endgrent_r_proto=define
11654                 set d_endgrent_r_proto endgrent_r $hdrs
11655                 eval $hasproto ;;
11656         *)      ;;
11657         esac
11658         case "$d_endgrent_r_proto" in
11659         define)
11660         case "$endgrent_r_proto" in
11661         ''|0) try='int endgrent_r(FILE**);'
11662         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11663         esac
11664         case "$endgrent_r_proto" in
11665         ''|0) try='void endgrent_r(FILE**);'
11666         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11667         esac
11668         case "$endgrent_r_proto" in
11669         ''|0)   d_endgrent_r=undef
11670                 endgrent_r_proto=0
11671                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11672         * )     case "$endgrent_r_proto" in
11673                 REENTRANT_PROTO*) ;;
11674                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11675                 esac
11676                 echo "Prototype: $try" ;;
11677         esac
11678         ;;
11679         *)      case "$usethreads" in
11680                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11681                 esac
11682                 d_endgrent_r=undef
11683                 endgrent_r_proto=0
11684                 ;;
11685         esac
11686         ;;
11687 *)      endgrent_r_proto=0
11688         ;;
11689 esac
11690
11691 : see if endhostent exists
11692 set endhostent d_endhent
11693 eval $inlibc
11694
11695 : see if this is a netdb.h system
11696 set netdb.h i_netdb
11697 eval $inhdr
11698
11699 : see if endhostent_r exists
11700 set endhostent_r d_endhostent_r
11701 eval $inlibc
11702 case "$d_endhostent_r" in
11703 "$define")
11704         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11705         case "$d_endhostent_r_proto:$usethreads" in
11706         ":define")      d_endhostent_r_proto=define
11707                 set d_endhostent_r_proto endhostent_r $hdrs
11708                 eval $hasproto ;;
11709         *)      ;;
11710         esac
11711         case "$d_endhostent_r_proto" in
11712         define)
11713         case "$endhostent_r_proto" in
11714         ''|0) try='int endhostent_r(struct hostent_data*);'
11715         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11716         esac
11717         case "$endhostent_r_proto" in
11718         ''|0) try='void endhostent_r(struct hostent_data*);'
11719         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11720         esac
11721         case "$endhostent_r_proto" in
11722         ''|0)   d_endhostent_r=undef
11723                 endhostent_r_proto=0
11724                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11725         * )     case "$endhostent_r_proto" in
11726                 REENTRANT_PROTO*) ;;
11727                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11728                 esac
11729                 echo "Prototype: $try" ;;
11730         esac
11731         ;;
11732         *)      case "$usethreads" in
11733                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11734                 esac
11735                 d_endhostent_r=undef
11736                 endhostent_r_proto=0
11737                 ;;
11738         esac
11739         ;;
11740 *)      endhostent_r_proto=0
11741         ;;
11742 esac
11743
11744 : see if endnetent exists
11745 set endnetent d_endnent
11746 eval $inlibc
11747
11748 : see if endnetent_r exists
11749 set endnetent_r d_endnetent_r
11750 eval $inlibc
11751 case "$d_endnetent_r" in
11752 "$define")
11753         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11754         case "$d_endnetent_r_proto:$usethreads" in
11755         ":define")      d_endnetent_r_proto=define
11756                 set d_endnetent_r_proto endnetent_r $hdrs
11757                 eval $hasproto ;;
11758         *)      ;;
11759         esac
11760         case "$d_endnetent_r_proto" in
11761         define)
11762         case "$endnetent_r_proto" in
11763         ''|0) try='int endnetent_r(struct netent_data*);'
11764         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11765         esac
11766         case "$endnetent_r_proto" in
11767         ''|0) try='void endnetent_r(struct netent_data*);'
11768         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11769         esac
11770         case "$endnetent_r_proto" in
11771         ''|0)   d_endnetent_r=undef
11772                 endnetent_r_proto=0
11773                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11774         * )     case "$endnetent_r_proto" in
11775                 REENTRANT_PROTO*) ;;
11776                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11777                 esac
11778                 echo "Prototype: $try" ;;
11779         esac
11780         ;;
11781         *)      case "$usethreads" in
11782                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11783                 esac
11784                 d_endnetent_r=undef
11785                 endnetent_r_proto=0
11786                 ;;
11787         esac
11788         ;;
11789 *)      endnetent_r_proto=0
11790         ;;
11791 esac
11792
11793 : see if endprotoent exists
11794 set endprotoent d_endpent
11795 eval $inlibc
11796
11797 : see if endprotoent_r exists
11798 set endprotoent_r d_endprotoent_r
11799 eval $inlibc
11800 case "$d_endprotoent_r" in
11801 "$define")
11802         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11803         case "$d_endprotoent_r_proto:$usethreads" in
11804         ":define")      d_endprotoent_r_proto=define
11805                 set d_endprotoent_r_proto endprotoent_r $hdrs
11806                 eval $hasproto ;;
11807         *)      ;;
11808         esac
11809         case "$d_endprotoent_r_proto" in
11810         define)
11811         case "$endprotoent_r_proto" in
11812         ''|0) try='int endprotoent_r(struct protoent_data*);'
11813         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11814         esac
11815         case "$endprotoent_r_proto" in
11816         ''|0) try='void endprotoent_r(struct protoent_data*);'
11817         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11818         esac
11819         case "$endprotoent_r_proto" in
11820         ''|0)   d_endprotoent_r=undef
11821                 endprotoent_r_proto=0
11822                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11823         * )     case "$endprotoent_r_proto" in
11824                 REENTRANT_PROTO*) ;;
11825                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11826                 esac
11827                 echo "Prototype: $try" ;;
11828         esac
11829         ;;
11830         *)      case "$usethreads" in
11831                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11832                 esac
11833                 d_endprotoent_r=undef
11834                 endprotoent_r_proto=0
11835                 ;;
11836         esac
11837         ;;
11838 *)      endprotoent_r_proto=0
11839         ;;
11840 esac
11841
11842 : see if endpwent exists
11843 set endpwent d_endpwent
11844 eval $inlibc
11845
11846 : see if this is a pwd.h system
11847 set pwd.h i_pwd
11848 eval $inhdr
11849
11850 case "$i_pwd" in
11851 $define)
11852         xxx=`./findhdr pwd.h`
11853         $cppstdin $cppflags $cppminus < $xxx >$$.h
11854
11855         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11856                 val="$define"
11857         else
11858                 val="$undef"
11859         fi
11860         set d_pwquota
11861         eval $setvar
11862
11863         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11864                 val="$define"
11865         else
11866                 val="$undef"
11867         fi
11868         set d_pwage
11869         eval $setvar
11870
11871         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11872                 val="$define"
11873         else
11874                 val="$undef"
11875         fi
11876         set d_pwchange
11877         eval $setvar
11878
11879         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11880                 val="$define"
11881         else
11882                 val="$undef"
11883         fi
11884         set d_pwclass
11885         eval $setvar
11886
11887         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11888                 val="$define"
11889         else
11890                 val="$undef"
11891         fi
11892         set d_pwexpire
11893         eval $setvar
11894
11895         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11896                 val="$define"
11897         else
11898                 val="$undef"
11899         fi
11900         set d_pwcomment
11901         eval $setvar
11902
11903         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11904                 val="$define"
11905         else
11906                 val="$undef"
11907         fi
11908         set d_pwgecos
11909         eval $setvar
11910
11911         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11912                 val="$define"
11913         else
11914                 val="$undef"
11915         fi
11916         set d_pwpasswd
11917         eval $setvar
11918
11919         $rm -f $$.h
11920         ;;
11921 *)
11922         val="$undef"; 
11923         set d_pwquota; eval $setvar
11924         set d_pwage; eval $setvar
11925         set d_pwchange; eval $setvar
11926         set d_pwclass; eval $setvar
11927         set d_pwexpire; eval $setvar
11928         set d_pwcomment; eval $setvar
11929         set d_pwgecos; eval $setvar
11930         set d_pwpasswd; eval $setvar
11931         ;;
11932 esac
11933
11934 : see if endpwent_r exists
11935 set endpwent_r d_endpwent_r
11936 eval $inlibc
11937 case "$d_endpwent_r" in
11938 "$define")
11939         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11940         case "$d_endpwent_r_proto:$usethreads" in
11941         ":define")      d_endpwent_r_proto=define
11942                 set d_endpwent_r_proto endpwent_r $hdrs
11943                 eval $hasproto ;;
11944         *)      ;;
11945         esac
11946         case "$d_endpwent_r_proto" in
11947         define)
11948         case "$endpwent_r_proto" in
11949         ''|0) try='int endpwent_r(FILE**);'
11950         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11951         esac
11952         case "$endpwent_r_proto" in
11953         ''|0) try='void endpwent_r(FILE**);'
11954         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11955         esac
11956         case "$endpwent_r_proto" in
11957         ''|0)   d_endpwent_r=undef
11958                 endpwent_r_proto=0
11959                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11960         * )     case "$endpwent_r_proto" in
11961                 REENTRANT_PROTO*) ;;
11962                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11963                 esac
11964                 echo "Prototype: $try" ;;
11965         esac
11966         ;;
11967         *)      case "$usethreads" in
11968                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11969                 esac
11970                 d_endpwent_r=undef
11971                 endpwent_r_proto=0
11972                 ;;
11973         esac
11974         ;;
11975 *)      endpwent_r_proto=0
11976         ;;
11977 esac
11978
11979 : see if endservent exists
11980 set endservent d_endsent
11981 eval $inlibc
11982
11983 : see if endservent_r exists
11984 set endservent_r d_endservent_r
11985 eval $inlibc
11986 case "$d_endservent_r" in
11987 "$define")
11988         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11989         case "$d_endservent_r_proto:$usethreads" in
11990         ":define")      d_endservent_r_proto=define
11991                 set d_endservent_r_proto endservent_r $hdrs
11992                 eval $hasproto ;;
11993         *)      ;;
11994         esac
11995         case "$d_endservent_r_proto" in
11996         define)
11997         case "$endservent_r_proto" in
11998         ''|0) try='int endservent_r(struct servent_data*);'
11999         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12000         esac
12001         case "$endservent_r_proto" in
12002         ''|0) try='void endservent_r(struct servent_data*);'
12003         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12004         esac
12005         case "$endservent_r_proto" in
12006         ''|0)   d_endservent_r=undef
12007                 endservent_r_proto=0
12008                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12009         * )     case "$endservent_r_proto" in
12010                 REENTRANT_PROTO*) ;;
12011                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12012                 esac
12013                 echo "Prototype: $try" ;;
12014         esac
12015         ;;
12016         *)      case "$usethreads" in
12017                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12018                 esac
12019                 d_endservent_r=undef
12020                 endservent_r_proto=0
12021                 ;;
12022         esac
12023         ;;
12024 *)      endservent_r_proto=0
12025         ;;
12026 esac
12027
12028 : Locate the flags for 'open()'
12029 echo " "
12030 $cat >try.c <<EOCP
12031 #include <sys/types.h>
12032 #ifdef I_FCNTL
12033 #include <fcntl.h>
12034 #endif
12035 #ifdef I_SYS_FILE
12036 #include <sys/file.h>
12037 #endif
12038 #$i_stdlib I_STDLIB
12039 #ifdef I_STDLIB
12040 #include <stdlib.h>
12041 #endif
12042 int main() {
12043         if(O_RDONLY);
12044 #ifdef O_TRUNC
12045         exit(0);
12046 #else
12047         exit(1);
12048 #endif
12049 }
12050 EOCP
12051 : check sys/file.h first to get FREAD on Sun
12052 if $test `./findhdr sys/file.h` && \
12053                 set try -DI_SYS_FILE && eval $compile; then
12054         h_sysfile=true;
12055         echo "<sys/file.h> defines the O_* constants..." >&4
12056         if $run ./try; then
12057                 echo "and you have the 3 argument form of open()." >&4
12058                 val="$define"
12059         else
12060                 echo "but not the 3 argument form of open().  Oh, well." >&4
12061                 val="$undef"
12062         fi
12063 elif $test `./findhdr fcntl.h` && \
12064                 set try -DI_FCNTL && eval $compile; then
12065         h_fcntl=true;
12066         echo "<fcntl.h> defines the O_* constants..." >&4
12067         if $run ./try; then
12068                 echo "and you have the 3 argument form of open()." >&4
12069                 val="$define"
12070         else
12071                 echo "but not the 3 argument form of open().  Oh, well." >&4
12072                 val="$undef"
12073         fi
12074 else
12075         val="$undef"
12076         echo "I can't find the O_* constant definitions!  You got problems." >&4
12077 fi
12078 set d_open3
12079 eval $setvar
12080 $rm -f try try.*
12081
12082 : see which of string.h or strings.h is needed
12083 echo " "
12084 strings=`./findhdr string.h`
12085 if $test "$strings" && $test -r "$strings"; then
12086         echo "Using <string.h> instead of <strings.h>." >&4
12087         val="$define"
12088 else
12089         val="$undef"
12090         strings=`./findhdr strings.h`
12091         if $test "$strings" && $test -r "$strings"; then
12092                 echo "Using <strings.h> instead of <string.h>." >&4
12093         else
12094                 echo "No string header found -- You'll surely have problems." >&4
12095         fi
12096 fi
12097 set i_string
12098 eval $setvar
12099 case "$i_string" in
12100 "$undef") strings=`./findhdr strings.h`;;
12101 *)        strings=`./findhdr string.h`;;
12102 esac
12103
12104 : see if this is a sys/file.h system
12105 val=''
12106 set sys/file.h val
12107 eval $inhdr
12108
12109 : do we need to include sys/file.h ?
12110 case "$val" in
12111 "$define")
12112         echo " "
12113         if $h_sysfile; then
12114                 val="$define"
12115                 echo "We'll be including <sys/file.h>." >&4
12116         else
12117                 val="$undef"
12118                 echo "We won't be including <sys/file.h>." >&4
12119         fi
12120         ;;
12121 *)
12122         h_sysfile=false
12123         ;;
12124 esac
12125 set i_sysfile
12126 eval $setvar
12127
12128 : see if fcntl.h is there
12129 val=''
12130 set fcntl.h val
12131 eval $inhdr
12132
12133 : see if we can include fcntl.h
12134 case "$val" in
12135 "$define")
12136         echo " "
12137         if $h_fcntl; then
12138                 val="$define"
12139                 echo "We'll be including <fcntl.h>." >&4
12140         else
12141                 val="$undef"
12142                 if $h_sysfile; then
12143         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12144                 else
12145                         echo "We won't be including <fcntl.h>." >&4
12146                 fi
12147         fi
12148         ;;
12149 *)
12150         h_fcntl=false
12151         val="$undef"
12152         ;;
12153 esac
12154 set i_fcntl
12155 eval $setvar
12156
12157 : check for non-blocking I/O stuff
12158 case "$h_sysfile" in
12159 true) echo "#include <sys/file.h>" > head.c;;
12160 *)
12161        case "$h_fcntl" in
12162        true) echo "#include <fcntl.h>" > head.c;;
12163        *) echo "#include <sys/fcntl.h>" > head.c;;
12164        esac
12165        ;;
12166 esac
12167 echo " "
12168 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12169 case "$o_nonblock" in
12170 '')
12171         $cat head.c > try.c
12172         $cat >>try.c <<EOCP
12173 #include <stdio.h>
12174 #$i_stdlib I_STDLIB
12175 #ifdef I_STDLIB
12176 #include <stdlib.h>
12177 #endif
12178 #$i_fcntl I_FCNTL
12179 #ifdef I_FCNTL
12180 #include <fcntl.h>
12181 #endif
12182 int main() {
12183 #ifdef O_NONBLOCK
12184         printf("O_NONBLOCK\n");
12185         exit(0);
12186 #endif
12187 #ifdef O_NDELAY
12188         printf("O_NDELAY\n");
12189         exit(0);
12190 #endif
12191 #ifdef FNDELAY
12192         printf("FNDELAY\n");
12193         exit(0);
12194 #endif
12195         exit(0);
12196 }
12197 EOCP
12198         set try
12199         if eval $compile_ok; then
12200                 o_nonblock=`$run ./try`
12201                 case "$o_nonblock" in
12202                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12203                 *) echo "Seems like we can use $o_nonblock.";;
12204                 esac
12205         else
12206                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12207         fi
12208         ;;
12209 *) echo "Using $hint value $o_nonblock.";;
12210 esac
12211 $rm -f try try.* .out core
12212
12213 echo " "
12214 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12215 case "$eagain" in
12216 '')
12217         $cat head.c > try.c
12218         $cat >>try.c <<EOCP
12219 #include <errno.h>
12220 #include <sys/types.h>
12221 #include <signal.h>
12222 #include <stdio.h> 
12223 #$i_stdlib I_STDLIB
12224 #ifdef I_STDLIB
12225 #include <stdlib.h>
12226 #endif
12227 #$i_fcntl I_FCNTL
12228 #ifdef I_FCNTL
12229 #include <fcntl.h>
12230 #endif
12231 #define MY_O_NONBLOCK $o_nonblock
12232 #ifndef errno  /* XXX need better Configure test */
12233 extern int errno;
12234 #endif
12235 #$i_unistd I_UNISTD
12236 #ifdef I_UNISTD
12237 #include <unistd.h>
12238 #endif
12239 #$i_string I_STRING
12240 #ifdef I_STRING
12241 #include <string.h>
12242 #else
12243 #include <strings.h>
12244 #endif
12245 $signal_t blech(int x) { exit(3); }
12246 EOCP
12247         $cat >> try.c <<'EOCP'
12248 int main()
12249 {
12250         int pd[2];
12251         int pu[2];
12252         char buf[1];
12253         char string[100];
12254
12255         pipe(pd);       /* Down: child -> parent */
12256         pipe(pu);       /* Up: parent -> child */
12257         if (0 != fork()) {
12258                 int ret;
12259                 close(pd[1]);   /* Parent reads from pd[0] */
12260                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12261 #ifdef F_SETFL
12262                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12263                         exit(1);
12264 #else
12265                 exit(4);
12266 #endif
12267                 signal(SIGALRM, blech);
12268                 alarm(5);
12269                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12270                         exit(2);
12271                 sprintf(string, "%d\n", ret);
12272                 write(2, string, strlen(string));
12273                 alarm(0);
12274 #ifdef EAGAIN
12275                 if (errno == EAGAIN) {
12276                         printf("EAGAIN\n");
12277                         goto ok;
12278                 }
12279 #endif
12280 #ifdef EWOULDBLOCK
12281                 if (errno == EWOULDBLOCK)
12282                         printf("EWOULDBLOCK\n");
12283 #endif
12284         ok:
12285                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12286                 sleep(2);                               /* Give it time to close our pipe */
12287                 alarm(5);
12288                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12289                 alarm(0);
12290                 sprintf(string, "%d\n", ret);
12291                 write(4, string, strlen(string));
12292                 exit(0);
12293         }
12294
12295         close(pd[0]);                   /* We write to pd[1] */
12296         close(pu[1]);                   /* We read from pu[0] */
12297         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12298         close(pd[1]);                   /* Pipe pd is now fully closed! */
12299         exit(0);                                /* Bye bye, thank you for playing! */
12300 }
12301 EOCP
12302         set try
12303         if eval $compile_ok; then
12304                 echo "$startsh" >mtry
12305                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12306                 chmod +x mtry
12307                 ./mtry >/dev/null 2>&1
12308                 case $? in
12309                 0) eagain=`$cat try.out`;;
12310                 1) echo "Could not perform non-blocking setting!";;
12311                 2) echo "I did a successful read() for something that was not there!";;
12312                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12313                 4) echo "Could not find F_SETFL!";;
12314                 *) echo "Something terribly wrong happened during testing.";;
12315                 esac
12316                 rd_nodata=`$cat try.ret`
12317                 echo "A read() system call with no data present returns $rd_nodata."
12318                 case "$rd_nodata" in
12319                 0|-1) ;;
12320                 *)
12321                         echo "(That's peculiar, fixing that to be -1.)"
12322                         rd_nodata=-1
12323                         ;;
12324                 esac
12325                 case "$eagain" in
12326                 '')
12327                         echo "Forcing errno EAGAIN on read() with no data available."
12328                         eagain=EAGAIN
12329                         ;;
12330                 *)
12331                         echo "Your read() sets errno to $eagain when no data is available."
12332                         ;;
12333                 esac
12334                 status=`$cat try.err`
12335                 case "$status" in
12336                 0) echo "And it correctly returns 0 to signal EOF.";;
12337                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12338                 *) echo "However, your read() returns '$status' on EOF??";;
12339                 esac
12340                 val="$define"
12341                 if test "$status" = "$rd_nodata"; then
12342                         echo "WARNING: you can't distinguish between EOF and no data!"
12343                         val="$undef"
12344                 fi
12345         else
12346                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12347                 eagain=EAGAIN
12348         fi
12349         set d_eofnblk
12350         eval $setvar
12351         ;;
12352 *)
12353         echo "Using $hint value $eagain."
12354         echo "Your read() returns $rd_nodata when no data is present."
12355         case "$d_eofnblk" in
12356         "$define") echo "And you can see EOF because read() returns 0.";;
12357         "$undef") echo "But you can't see EOF status from read() returned value.";;
12358         *)
12359                 echo "(Assuming you can't see EOF status from read anyway.)"
12360                 d_eofnblk=$undef
12361                 ;;
12362         esac
12363         ;;
12364 esac
12365 $rm -f try try.* .out core head.c mtry
12366
12367 : see if _ptr and _cnt from stdio act std
12368 echo " "
12369
12370 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12371         echo "(Looks like you have stdio.h from BSD.)"
12372         case "$stdio_ptr" in
12373         '') stdio_ptr='((fp)->_p)'
12374                 ptr_lval=$define
12375                 ;;
12376         *)      ptr_lval=$d_stdio_ptr_lval;;
12377         esac
12378         case "$stdio_cnt" in
12379         '') stdio_cnt='((fp)->_r)'
12380                 cnt_lval=$define
12381                 ;;
12382         *)      cnt_lval=$d_stdio_cnt_lval;;
12383         esac
12384         case "$stdio_base" in
12385         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12386         esac
12387         case "$stdio_bufsiz" in
12388         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12389         esac
12390 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12391         echo "(Looks like you have stdio.h from Linux.)"
12392         case "$stdio_ptr" in
12393         '') stdio_ptr='((fp)->_IO_read_ptr)'
12394                 ptr_lval=$define
12395                 ;;
12396         *)      ptr_lval=$d_stdio_ptr_lval;;
12397         esac
12398         case "$stdio_cnt" in
12399         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12400                 cnt_lval=$undef
12401                 ;;
12402         *)      cnt_lval=$d_stdio_cnt_lval;;
12403         esac
12404         case "$stdio_base" in
12405         '') stdio_base='((fp)->_IO_read_base)';;
12406         esac
12407         case "$stdio_bufsiz" in
12408         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12409         esac
12410 else
12411         case "$stdio_ptr" in
12412         '') stdio_ptr='((fp)->_ptr)'
12413                 ptr_lval=$define
12414                 ;;
12415         *)      ptr_lval=$d_stdio_ptr_lval;;
12416         esac
12417         case "$stdio_cnt" in
12418         '') stdio_cnt='((fp)->_cnt)'
12419                 cnt_lval=$define
12420                 ;;
12421         *)      cnt_lval=$d_stdio_cnt_lval;;
12422         esac
12423         case "$stdio_base" in
12424         '') stdio_base='((fp)->_base)';;
12425         esac
12426         case "$stdio_bufsiz" in
12427         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12428         esac
12429 fi
12430
12431 : test whether _ptr and _cnt really work
12432 echo "Checking how std your stdio is..." >&4
12433 $cat >try.c <<EOP
12434 #include <stdio.h>
12435 #$i_stdlib I_STDLIB
12436 #ifdef I_STDLIB
12437 #include <stdlib.h>
12438 #endif
12439 #define FILE_ptr(fp)    $stdio_ptr
12440 #define FILE_cnt(fp)    $stdio_cnt
12441 int main() {
12442         FILE *fp = fopen("try.c", "r");
12443         char c = getc(fp);
12444         if (
12445                 18 <= FILE_cnt(fp) &&
12446                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12447         )
12448                 exit(0);
12449         exit(1);
12450 }
12451 EOP
12452 val="$undef"
12453 set try
12454 if eval $compile && $to try.c; then
12455         if $run ./try; then
12456                 echo "Your stdio acts pretty std."
12457                 val="$define"
12458         else
12459                 echo "Your stdio isn't very std."
12460         fi
12461 else
12462         echo "Your stdio doesn't appear very std."
12463 fi
12464 $rm -f try.c try
12465
12466 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12467 # direct buffer manipulation no longer works.  The Configure tests
12468 # should be changed to correctly detect this, but until then,
12469 # the following check should at least let perl compile and run.
12470 # (This quick fix should be updated before 5.8.1.)
12471 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12472 # A. Dougherty, June 3, 2002.
12473 case "$d_gnulibc" in
12474 $define)
12475         case "$gnulibc_version" in
12476         2.[01]*)  ;;
12477         2.2) ;;
12478         2.2.[0-9]) ;;
12479         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12480                 val="$undef"
12481                 ;;
12482         esac
12483         ;;
12484 esac
12485 set d_stdstdio
12486 eval $setvar
12487
12488 : Can _ptr be used as an lvalue?
12489 case "$d_stdstdio$ptr_lval" in
12490 $define$define) val=$define ;;
12491 *) val=$undef ;;
12492 esac
12493 set d_stdio_ptr_lval
12494 eval $setvar
12495
12496 : Can _cnt be used as an lvalue?
12497 case "$d_stdstdio$cnt_lval" in
12498 $define$define) val=$define ;;
12499 *) val=$undef ;;
12500 esac
12501 set d_stdio_cnt_lval
12502 eval $setvar
12503
12504
12505 : test whether setting _ptr sets _cnt as a side effect
12506 d_stdio_ptr_lval_sets_cnt="$undef"
12507 d_stdio_ptr_lval_nochange_cnt="$undef"
12508 case "$d_stdio_ptr_lval$d_stdstdio" in
12509 $define$define)
12510         echo "Checking to see what happens if we set the stdio ptr..." >&4
12511 $cat >try.c <<EOP
12512 #include <stdio.h>
12513 /* Can we scream? */
12514 /* Eat dust sed :-) */
12515 /* In the buffer space, no one can hear you scream. */
12516 #$i_stdlib I_STDLIB
12517 #ifdef I_STDLIB
12518 #include <stdlib.h>
12519 #endif
12520 #define FILE_ptr(fp)    $stdio_ptr
12521 #define FILE_cnt(fp)    $stdio_cnt
12522 #include <sys/types.h>
12523 int main() {
12524         FILE *fp = fopen("try.c", "r");
12525         int c;
12526         char *ptr;
12527         size_t cnt;
12528         if (!fp) {
12529             puts("Fail even to read");
12530             exit(1);
12531         }
12532         c = getc(fp); /* Read away the first # */
12533         if (c == EOF) {
12534             puts("Fail even to read");
12535             exit(1);
12536         }
12537         if (!(
12538                 18 <= FILE_cnt(fp) &&
12539                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12540         )) {
12541                 puts("Fail even to read");
12542                 exit (1);
12543         }
12544         ptr = (char*) FILE_ptr(fp);
12545         cnt = (size_t)FILE_cnt(fp);
12546
12547         FILE_ptr(fp) += 42;
12548
12549         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12550                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12551                 exit (1);
12552         }
12553         if (FILE_cnt(fp) <= 20) {
12554                 printf ("Fail (<20 chars to test)");
12555                 exit (1);
12556         }
12557         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12558                 puts("Fail compare");
12559                 exit (1);
12560         }
12561         if (cnt == FILE_cnt(fp)) {
12562                 puts("Pass_unchanged");
12563                 exit (0);
12564         }       
12565         if (FILE_cnt(fp) == (cnt - 42)) {
12566                 puts("Pass_changed");
12567                 exit (0);
12568         }
12569         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12570         return 1;
12571
12572 }
12573 EOP
12574         set try
12575         if eval $compile && $to try.c; then
12576                 case `$run ./try` in
12577                 Pass_changed)
12578                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12579                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12580                 Pass_unchanged)
12581                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12582                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12583                 Fail*)
12584                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12585                 *)
12586                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12587         esac
12588         else
12589                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12590         fi
12591         $rm -f try.c try
12592         ;;
12593 esac
12594
12595 : see if _base is also standard
12596 val="$undef"
12597 case "$d_stdstdio" in
12598 $define)
12599         $cat >try.c <<EOP
12600 #include <stdio.h>
12601 #$i_stdlib I_STDLIB
12602 #ifdef I_STDLIB
12603 #include <stdlib.h>
12604 #endif
12605 #define FILE_base(fp)   $stdio_base
12606 #define FILE_bufsiz(fp) $stdio_bufsiz
12607 int main() {
12608         FILE *fp = fopen("try.c", "r");
12609         char c = getc(fp);
12610         if (
12611                 19 <= FILE_bufsiz(fp) &&
12612                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12613         )
12614                 exit(0);
12615         exit(1);
12616 }
12617 EOP
12618         set try
12619         if eval $compile && $to try.c; then
12620                 if $run ./try; then
12621                         echo "And its _base field acts std."
12622                         val="$define"
12623                 else
12624                         echo "But its _base field isn't std."
12625                 fi
12626         else
12627                 echo "However, it seems to be lacking the _base field."
12628         fi
12629         $rm -f try.c try
12630         ;;
12631 esac
12632 set d_stdiobase
12633 eval $setvar
12634
12635 : see if fast_stdio exists
12636 val="$undef"
12637 case "$d_stdstdio:$d_stdio_ptr_lval" in
12638 "$define:$define")
12639         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12640         *$define*)
12641                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12642                 val="$define"
12643                 ;;
12644         esac
12645         ;;
12646 esac
12647 set d_faststdio
12648 eval $setvar
12649
12650
12651
12652 : see if fchdir exists
12653 set fchdir d_fchdir
12654 eval $inlibc
12655
12656 : see if fchmod exists
12657 set fchmod d_fchmod
12658 eval $inlibc
12659
12660 : see if fchown exists
12661 set fchown d_fchown
12662 eval $inlibc
12663
12664 : see if this is an fcntl system
12665 set fcntl d_fcntl
12666 eval $inlibc
12667
12668 echo " "
12669 : See if fcntl-based locking works.
12670 $cat >try.c <<EOCP
12671 #$i_stdlib I_STDLIB
12672 #ifdef I_STDLIB
12673 #include <stdlib.h>
12674 #endif
12675 #include <unistd.h>
12676 #include <fcntl.h>
12677 #include <signal.h>
12678 $signal_t blech(int x) { exit(3); }
12679 int main() {
12680 #if defined(F_SETLK) && defined(F_SETLKW)
12681      struct flock flock;
12682      int retval, fd;
12683      fd = open("try.c", O_RDONLY);
12684      flock.l_type = F_RDLCK;
12685      flock.l_whence = SEEK_SET;
12686      flock.l_start = flock.l_len = 0;
12687      signal(SIGALRM, blech);
12688      alarm(10);
12689      retval = fcntl(fd, F_SETLK, &flock);
12690      close(fd);
12691      (retval < 0 ? exit(2) : exit(0));
12692 #else
12693      exit(2);
12694 #endif
12695 }
12696 EOCP
12697 echo "Checking if fcntl-based file locking works... "
12698 case "$d_fcntl" in
12699 "$define")
12700         set try
12701         if eval $compile_ok; then
12702                 if $run ./try; then
12703                         echo "Yes, it seems to work."
12704                         val="$define"
12705                 else
12706                         echo "Nope, it didn't work."
12707                         val="$undef"
12708                         case "$?" in
12709                         3) $cat >&4 <<EOM
12710 ***
12711 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12712 *** This is (almost) impossible.
12713 *** If your NFS lock daemons are not feeling well, something like
12714 *** this may happen, please investigate.  Cannot continue, aborting.
12715 ***
12716 EOM
12717                                 exit 1
12718                                 ;;
12719                         esac
12720                 fi
12721         else
12722                 echo "I'm unable to compile the test program, so I'll assume not."
12723                 val="$undef"
12724         fi
12725         ;;
12726 *) val="$undef";
12727         echo "Nope, since you don't even have fcntl()."
12728         ;;
12729 esac
12730 set d_fcntl_can_lock
12731 eval $setvar
12732 $rm -f try*
12733
12734
12735 : check for fd_set items
12736 $cat <<EOM
12737
12738 Checking to see how well your C compiler handles fd_set and friends ...
12739 EOM
12740 $cat >try.c <<EOCP
12741 #$i_stdlib I_STDLIB
12742 #ifdef I_STDLIB
12743 #include <stdlib.h>
12744 #endif
12745 #$i_systime I_SYS_TIME
12746 #$i_sysselct I_SYS_SELECT
12747 #$d_socket HAS_SOCKET
12748 #include <sys/types.h>
12749 #ifdef HAS_SOCKET
12750 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12751 #endif
12752 #ifdef I_SYS_TIME
12753 #include <sys/time.h>
12754 #endif
12755 #ifdef I_SYS_SELECT
12756 #include <sys/select.h>
12757 #endif
12758 int main() {
12759         fd_set fds;
12760
12761 #ifdef TRYBITS
12762         if(fds.fds_bits);
12763 #endif
12764
12765 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12766         exit(0);
12767 #else
12768         exit(1);
12769 #endif
12770 }
12771 EOCP
12772 set try -DTRYBITS
12773 if eval $compile; then
12774         d_fds_bits="$define"
12775         d_fd_set="$define"
12776         echo "Well, your system knows about the normal fd_set typedef..." >&4
12777         if $run ./try; then
12778                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12779                 d_fd_macros="$define"
12780         else
12781                 $cat >&4 <<'EOM'
12782 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12783 EOM
12784                 d_fd_macros="$undef"
12785         fi
12786 else
12787         $cat <<'EOM'
12788 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12789 EOM
12790         set try
12791         if eval $compile; then
12792                 d_fds_bits="$undef"
12793                 d_fd_set="$define"
12794                 echo "Well, your system has some sort of fd_set available..." >&4
12795                 if $run ./try; then
12796                         echo "and you have the normal fd_set macros." >&4
12797                         d_fd_macros="$define"
12798                 else
12799                         $cat <<'EOM'
12800 but not the normal fd_set macros!  Gross!  More work for me...
12801 EOM
12802                         d_fd_macros="$undef"
12803                 fi
12804         else
12805         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12806                 d_fd_set="$undef"
12807                 d_fds_bits="$undef"
12808                 d_fd_macros="$undef"
12809         fi
12810 fi
12811 $rm -f try try.*
12812
12813 : see if fgetpos exists
12814 set fgetpos d_fgetpos
12815 eval $inlibc
12816
12817 : see if finite exists
12818 set finite d_finite
12819 eval $inlibc
12820
12821 : see if finitel exists
12822 set finitel d_finitel
12823 eval $inlibc
12824
12825 : see if flock exists
12826 set flock d_flock
12827 eval $inlibc
12828
12829 : see if prototype for flock is available
12830 echo " "
12831 set d_flockproto flock $i_sysfile sys/file.h
12832 eval $hasproto
12833
12834 : see if fork exists
12835 set fork d_fork
12836 eval $inlibc
12837
12838 : see if fp_class exists
12839 set fp_class d_fp_class
12840 eval $inlibc
12841
12842 : see if pathconf exists
12843 set pathconf d_pathconf
12844 eval $inlibc
12845
12846 : see if fpathconf exists
12847 set fpathconf d_fpathconf
12848 eval $inlibc
12849
12850 : see if fpclass exists
12851 set fpclass d_fpclass
12852 eval $inlibc
12853
12854 : see if fpclassify exists
12855 set fpclassify d_fpclassify
12856 eval $inlibc
12857
12858 : see if fpclassl exists
12859 set fpclassl d_fpclassl
12860 eval $inlibc
12861
12862
12863 : check for fpos64_t
12864 echo " "
12865 echo "Checking to see if you have fpos64_t..." >&4
12866 $cat >try.c <<EOCP
12867 #include <stdio.h>
12868 int main() { fpos64_t x = 7; }
12869 EOCP
12870 set try
12871 if eval $compile; then
12872         val="$define"
12873         echo "You have fpos64_t."
12874 else
12875         val="$undef"
12876         echo "You do not have fpos64_t."
12877         case "$fpossize" in
12878         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12879         esac
12880 fi
12881 $rm -f try.* try
12882 set d_fpos64_t
12883 eval $setvar
12884
12885 : see if frexpl exists
12886 set frexpl d_frexpl
12887 eval $inlibc
12888
12889 : see if this is a sys/param system
12890 set sys/param.h i_sysparam
12891 eval $inhdr
12892
12893 : see if this is a sys/mount.h system
12894 set sys/mount.h i_sysmount
12895 eval $inhdr
12896
12897
12898 echo " "
12899 echo "Checking to see if your system supports struct fs_data..." >&4
12900 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12901 eval $hasstruct
12902 case "$d_fs_data_s" in
12903 "$define")      echo "Yes, it does."   ;;
12904 *)              echo "No, it doesn't." ;;
12905 esac
12906
12907 : see if fseeko exists
12908 set fseeko d_fseeko
12909 eval $inlibc
12910 case "$longsize" in
12911 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12912 esac
12913
12914 : see if fsetpos exists
12915 set fsetpos d_fsetpos
12916 eval $inlibc
12917
12918
12919 : see if fstatfs exists
12920 set fstatfs d_fstatfs
12921 eval $inlibc
12922
12923
12924 : see if statvfs exists
12925 set statvfs d_statvfs
12926 eval $inlibc
12927
12928 : see if fstatvfs exists
12929 set fstatvfs d_fstatvfs
12930 eval $inlibc
12931
12932
12933 : see if fsync exists
12934 set fsync d_fsync
12935 eval $inlibc
12936
12937 : see if ftello exists
12938 set ftello d_ftello
12939 eval $inlibc
12940 case "$longsize" in
12941 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12942 esac
12943
12944 d_futimes="$undef"
12945 : check for a working futimes
12946 echo " "
12947 echo "Checking for a working futimes()" >&4
12948 $cat >try.c <<EOCP
12949 #include <stdio.h>
12950 #include <sys/time.h>
12951 #include <errno.h>
12952 #include <fcntl.h>
12953
12954 int main ()
12955 {
12956     int fd, rv;
12957     fd = open ("try.c", O_RDWR);
12958     if (-1 == fd) exit (1);
12959     rv = futimes (fd, NULL);
12960     exit (rv == -1 ? errno : 0);
12961 }
12962 EOCP
12963 set try
12964 if eval $compile; then
12965     `$run ./try`
12966     rc=$?
12967     case "$rc" in
12968         0)  echo "Yes, it does" >&4
12969             d_futimes="$define"
12970             ;;
12971         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12972             ;;
12973     esac
12974 else
12975     echo "No, it does not (probably harmless)\n" >&4
12976 fi
12977 $rm -f try.* try core core.try.*
12978
12979 : see if getcwd exists
12980 set getcwd d_getcwd
12981 eval $inlibc
12982
12983 : see if getespwnam exists
12984 set getespwnam d_getespwnam
12985 eval $inlibc
12986
12987
12988 : see if getfsstat exists
12989 set getfsstat d_getfsstat
12990 eval $inlibc
12991
12992 : see if getgrent exists
12993 set getgrent d_getgrent
12994 eval $inlibc
12995
12996 : see if getgrent_r exists
12997 set getgrent_r d_getgrent_r
12998 eval $inlibc
12999 case "$d_getgrent_r" in
13000 "$define")
13001         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13002         case "$d_getgrent_r_proto:$usethreads" in
13003         ":define")      d_getgrent_r_proto=define
13004                 set d_getgrent_r_proto getgrent_r $hdrs
13005                 eval $hasproto ;;
13006         *)      ;;
13007         esac
13008         case "$d_getgrent_r_proto" in
13009         define)
13010         case "$getgrent_r_proto" in
13011         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13012         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13013         esac
13014         case "$getgrent_r_proto" in
13015         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13016         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13017         esac
13018         case "$getgrent_r_proto" in
13019         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13020         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13021         esac
13022         case "$getgrent_r_proto" in
13023         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13024         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13025         esac
13026         case "$getgrent_r_proto" in
13027         ''|0) try='int getgrent_r(struct group*, char*, int);'
13028         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13029         esac
13030         case "$getgrent_r_proto" in
13031         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13032         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13033         esac
13034         case "$getgrent_r_proto" in
13035         ''|0)   d_getgrent_r=undef
13036                 getgrent_r_proto=0
13037                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13038         * )     case "$getgrent_r_proto" in
13039                 REENTRANT_PROTO*) ;;
13040                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13041                 esac
13042                 echo "Prototype: $try" ;;
13043         esac
13044         ;;
13045         *)      case "$usethreads" in
13046                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13047                 esac
13048                 d_getgrent_r=undef
13049                 getgrent_r_proto=0
13050                 ;;
13051         esac
13052         ;;
13053 *)      getgrent_r_proto=0
13054         ;;
13055 esac
13056
13057 : see if getgrgid_r exists
13058 set getgrgid_r d_getgrgid_r
13059 eval $inlibc
13060 case "$d_getgrgid_r" in
13061 "$define")
13062         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13063         case "$d_getgrgid_r_proto:$usethreads" in
13064         ":define")      d_getgrgid_r_proto=define
13065                 set d_getgrgid_r_proto getgrgid_r $hdrs
13066                 eval $hasproto ;;
13067         *)      ;;
13068         esac
13069         case "$d_getgrgid_r_proto" in
13070         define)
13071         case "$getgrgid_r_proto" in
13072         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13073         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13074         esac
13075         case "$getgrgid_r_proto" in
13076         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13077         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13078         esac
13079         case "$getgrgid_r_proto" in
13080         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13081         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13082         esac
13083         case "$getgrgid_r_proto" in
13084         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13085         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13086         esac
13087         case "$getgrgid_r_proto" in
13088         ''|0)   d_getgrgid_r=undef
13089                 getgrgid_r_proto=0
13090                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13091         * )     case "$getgrgid_r_proto" in
13092                 REENTRANT_PROTO*) ;;
13093                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13094                 esac
13095                 echo "Prototype: $try" ;;
13096         esac
13097         ;;
13098         *)      case "$usethreads" in
13099                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13100                 esac
13101                 d_getgrgid_r=undef
13102                 getgrgid_r_proto=0
13103                 ;;
13104         esac
13105         ;;
13106 *)      getgrgid_r_proto=0
13107         ;;
13108 esac
13109
13110 : see if getgrnam_r exists
13111 set getgrnam_r d_getgrnam_r
13112 eval $inlibc
13113 case "$d_getgrnam_r" in
13114 "$define")
13115         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13116         case "$d_getgrnam_r_proto:$usethreads" in
13117         ":define")      d_getgrnam_r_proto=define
13118                 set d_getgrnam_r_proto getgrnam_r $hdrs
13119                 eval $hasproto ;;
13120         *)      ;;
13121         esac
13122         case "$d_getgrnam_r_proto" in
13123         define)
13124         case "$getgrnam_r_proto" in
13125         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13126         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13127         esac
13128         case "$getgrnam_r_proto" in
13129         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13130         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13131         esac
13132         case "$getgrnam_r_proto" in
13133         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13134         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13135         esac
13136         case "$getgrnam_r_proto" in
13137         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13138         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13139         esac
13140         case "$getgrnam_r_proto" in
13141         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13142         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13143         esac
13144         case "$getgrnam_r_proto" in
13145         ''|0)   d_getgrnam_r=undef
13146                 getgrnam_r_proto=0
13147                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13148         * )     case "$getgrnam_r_proto" in
13149                 REENTRANT_PROTO*) ;;
13150                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13151                 esac
13152                 echo "Prototype: $try" ;;
13153         esac
13154         ;;
13155         *)      case "$usethreads" in
13156                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13157                 esac
13158                 d_getgrnam_r=undef
13159                 getgrnam_r_proto=0
13160                 ;;
13161         esac
13162         ;;
13163 *)      getgrnam_r_proto=0
13164         ;;
13165 esac
13166
13167 : see if gethostbyaddr exists
13168 set gethostbyaddr d_gethbyaddr
13169 eval $inlibc
13170
13171 : see if gethostbyname exists
13172 set gethostbyname d_gethbyname
13173 eval $inlibc
13174
13175 : see if gethostent exists
13176 set gethostent d_gethent
13177 eval $inlibc
13178
13179 : see how we will look up host name
13180 echo " "
13181 call=''
13182 if set gethostname val -f d_gethname; eval $csym; $val; then
13183         echo 'gethostname() found.' >&4
13184         d_gethname="$define"
13185         call=gethostname
13186 fi
13187 if set uname val -f d_uname; eval $csym; $val; then
13188         if ./xenix; then
13189                 $cat <<'EOM'
13190 uname() was found, but you're running xenix, and older versions of xenix
13191 have a broken uname(). If you don't really know whether your xenix is old
13192 enough to have a broken system call, use the default answer.
13193
13194 EOM
13195                 dflt=y
13196                 case "$d_uname" in
13197                 "$define") dflt=n;;
13198                 esac
13199                 rp='Is your uname() broken?'
13200                 . ./myread
13201                 case "$ans" in
13202                 n*) d_uname="$define"; call=uname;;
13203                 esac
13204         else
13205                 echo 'uname() found.' >&4
13206                 d_uname="$define"
13207                 case "$call" in
13208                 '') call=uname ;;
13209                 esac
13210         fi
13211 fi
13212 case "$d_gethname" in
13213 '') d_gethname="$undef";;
13214 esac
13215 case "$d_uname" in
13216 '') d_uname="$undef";;
13217 esac
13218 case "$d_uname$d_gethname" in
13219 *define*)
13220         dflt=n
13221         cat <<EOM
13222  
13223 Every now and then someone has a $call() that lies about the hostname
13224 but can't be fixed for political or economic reasons.  If you wish, I can
13225 pretend $call() isn't there and maybe compute hostname at run-time
13226 thanks to the '$phostname' command.
13227
13228 EOM
13229         rp="Shall I ignore $call() from now on?"
13230         . ./myread
13231         case "$ans" in
13232         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13233         esac;;
13234 esac
13235 case "$phostname" in
13236 '') aphostname='';;
13237 *) case "$aphostname" in
13238         /*) ;;
13239         *) set X $phostname
13240                 shift
13241                 file=$1
13242                 shift
13243                 file=`./loc $file $file $pth`
13244                 aphostname=`echo $file $*`
13245                 ;;
13246         esac
13247         ;;
13248 esac
13249 case "$d_uname$d_gethname" in
13250 *define*) ;;
13251 *)
13252         case "$phostname" in
13253         '')
13254                 echo "There will be no way for $package to get your hostname." >&4;;
13255         *)
13256         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13257                 ;;
13258         esac;;
13259 esac
13260 case "$d_phostname" in
13261 '') d_phostname="$undef";;
13262 esac
13263
13264 : see if gethostbyaddr_r exists
13265 set gethostbyaddr_r d_gethostbyaddr_r
13266 eval $inlibc
13267 case "$d_gethostbyaddr_r" in
13268 "$define")
13269         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13270         case "$d_gethostbyaddr_r_proto:$usethreads" in
13271         ":define")      d_gethostbyaddr_r_proto=define
13272                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13273                 eval $hasproto ;;
13274         *)      ;;
13275         esac
13276         case "$d_gethostbyaddr_r_proto" in
13277         define)
13278         case "$gethostbyaddr_r_proto" in
13279         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13280         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13281         esac
13282         case "$gethostbyaddr_r_proto" in
13283         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13284         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13285         esac
13286         case "$gethostbyaddr_r_proto" in
13287         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13288         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13289         esac
13290         case "$gethostbyaddr_r_proto" in
13291         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13292         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13293         esac
13294         case "$gethostbyaddr_r_proto" in
13295         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13296         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13297         esac
13298         case "$gethostbyaddr_r_proto" in
13299         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13300         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13301         esac
13302         case "$gethostbyaddr_r_proto" in
13303         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13304         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13305         esac
13306         case "$gethostbyaddr_r_proto" in
13307         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13308         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13309         esac
13310         case "$gethostbyaddr_r_proto" in
13311         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13312         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13313         esac
13314         case "$gethostbyaddr_r_proto" in
13315         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13316         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13317         esac
13318         case "$gethostbyaddr_r_proto" in
13319         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13320         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13321         esac
13322         case "$gethostbyaddr_r_proto" in
13323         ''|0)   d_gethostbyaddr_r=undef
13324                 gethostbyaddr_r_proto=0
13325                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13326         * )     case "$gethostbyaddr_r_proto" in
13327                 REENTRANT_PROTO*) ;;
13328                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13329                 esac
13330                 echo "Prototype: $try" ;;
13331         esac
13332         ;;
13333         *)      case "$usethreads" in
13334                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13335                 esac
13336                 d_gethostbyaddr_r=undef
13337                 gethostbyaddr_r_proto=0
13338                 ;;
13339         esac
13340         ;;
13341 *)      gethostbyaddr_r_proto=0
13342         ;;
13343 esac
13344
13345 : see if gethostbyname_r exists
13346 set gethostbyname_r d_gethostbyname_r
13347 eval $inlibc
13348 case "$d_gethostbyname_r" in
13349 "$define")
13350         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13351         case "$d_gethostbyname_r_proto:$usethreads" in
13352         ":define")      d_gethostbyname_r_proto=define
13353                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13354                 eval $hasproto ;;
13355         *)      ;;
13356         esac
13357         case "$d_gethostbyname_r_proto" in
13358         define)
13359         case "$gethostbyname_r_proto" in
13360         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13361         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13362         esac
13363         case "$gethostbyname_r_proto" in
13364         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13365         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13366         esac
13367         case "$gethostbyname_r_proto" in
13368         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13369         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13370         esac
13371         case "$gethostbyname_r_proto" in
13372         ''|0)   d_gethostbyname_r=undef
13373                 gethostbyname_r_proto=0
13374                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13375         * )     case "$gethostbyname_r_proto" in
13376                 REENTRANT_PROTO*) ;;
13377                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13378                 esac
13379                 echo "Prototype: $try" ;;
13380         esac
13381         ;;
13382         *)      case "$usethreads" in
13383                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13384                 esac
13385                 d_gethostbyname_r=undef
13386                 gethostbyname_r_proto=0
13387                 ;;
13388         esac
13389         ;;
13390 *)      gethostbyname_r_proto=0
13391         ;;
13392 esac
13393
13394 : see if gethostent_r exists
13395 set gethostent_r d_gethostent_r
13396 eval $inlibc
13397 case "$d_gethostent_r" in
13398 "$define")
13399         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13400         case "$d_gethostent_r_proto:$usethreads" in
13401         ":define")      d_gethostent_r_proto=define
13402                 set d_gethostent_r_proto gethostent_r $hdrs
13403                 eval $hasproto ;;
13404         *)      ;;
13405         esac
13406         case "$d_gethostent_r_proto" in
13407         define)
13408         case "$gethostent_r_proto" in
13409         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13410         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13411         esac
13412         case "$gethostent_r_proto" in
13413         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13414         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13415         esac
13416         case "$gethostent_r_proto" in
13417         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13418         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13419         esac
13420         case "$gethostent_r_proto" in
13421         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13422         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13423         esac
13424         case "$gethostent_r_proto" in
13425         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13426         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13427         esac
13428         case "$gethostent_r_proto" in
13429         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13430         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13431         esac
13432         case "$gethostent_r_proto" in
13433         ''|0)   d_gethostent_r=undef
13434                 gethostent_r_proto=0
13435                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13436         * )     case "$gethostent_r_proto" in
13437                 REENTRANT_PROTO*) ;;
13438                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13439                 esac
13440                 echo "Prototype: $try" ;;
13441         esac
13442         ;;
13443         *)      case "$usethreads" in
13444                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13445                 esac
13446                 d_gethostent_r=undef
13447                 gethostent_r_proto=0
13448                 ;;
13449         esac
13450         ;;
13451 *)      gethostent_r_proto=0
13452         ;;
13453 esac
13454
13455 : see if prototypes for various gethostxxx netdb.h functions are available
13456 echo " "
13457 set d_gethostprotos gethostent $i_netdb netdb.h
13458 eval $hasproto
13459
13460 : see if getitimer exists
13461 set getitimer d_getitimer
13462 eval $inlibc
13463
13464 : see if getlogin exists
13465 set getlogin d_getlogin
13466 eval $inlibc
13467
13468 : see if getlogin_r exists
13469 set getlogin_r d_getlogin_r
13470 eval $inlibc
13471 case "$d_getlogin_r" in
13472 "$define")
13473         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13474         case "$d_getlogin_r_proto:$usethreads" in
13475         ":define")      d_getlogin_r_proto=define
13476                 set d_getlogin_r_proto getlogin_r $hdrs
13477                 eval $hasproto ;;
13478         *)      ;;
13479         esac
13480         case "$d_getlogin_r_proto" in
13481         define)
13482         case "$getlogin_r_proto" in
13483         ''|0) try='int getlogin_r(char*, size_t);'
13484         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13485         esac
13486         case "$getlogin_r_proto" in
13487         ''|0) try='int getlogin_r(char*, int);'
13488         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13489         esac
13490         case "$getlogin_r_proto" in
13491         ''|0) try='char* getlogin_r(char*, size_t);'
13492         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13493         esac
13494         case "$getlogin_r_proto" in
13495         ''|0) try='char* getlogin_r(char*, int);'
13496         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13497         esac
13498         case "$getlogin_r_proto" in
13499         ''|0)   d_getlogin_r=undef
13500                 getlogin_r_proto=0
13501                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13502         * )     case "$getlogin_r_proto" in
13503                 REENTRANT_PROTO*) ;;
13504                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13505                 esac
13506                 echo "Prototype: $try" ;;
13507         esac
13508         ;;
13509         *)      case "$usethreads" in
13510                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13511                 esac
13512                 d_getlogin_r=undef
13513                 getlogin_r_proto=0
13514                 ;;
13515         esac
13516         ;;
13517 *)      getlogin_r_proto=0
13518         ;;
13519 esac
13520
13521 : see if getmnt exists
13522 set getmnt d_getmnt
13523 eval $inlibc
13524
13525 : see if getmntent exists
13526 set getmntent d_getmntent
13527 eval $inlibc
13528
13529 : see if getnetbyaddr exists
13530 set getnetbyaddr d_getnbyaddr
13531 eval $inlibc
13532
13533 : see if getnetbyname exists
13534 set getnetbyname d_getnbyname
13535 eval $inlibc
13536
13537 : see if getnetent exists
13538 set getnetent d_getnent
13539 eval $inlibc
13540
13541 : see if getnetbyaddr_r exists
13542 set getnetbyaddr_r d_getnetbyaddr_r
13543 eval $inlibc
13544 case "$d_getnetbyaddr_r" in
13545 "$define")
13546         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13547         case "$d_getnetbyaddr_r_proto:$usethreads" in
13548         ":define")      d_getnetbyaddr_r_proto=define
13549                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13550                 eval $hasproto ;;
13551         *)      ;;
13552         esac
13553         case "$d_getnetbyaddr_r_proto" in
13554         define)
13555         case "$getnetbyaddr_r_proto" in
13556         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13557         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13558         esac
13559         case "$getnetbyaddr_r_proto" in
13560         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13561         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13562         esac
13563         case "$getnetbyaddr_r_proto" in
13564         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13565         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13566         esac
13567         case "$getnetbyaddr_r_proto" in
13568         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13569         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13570         esac
13571         case "$getnetbyaddr_r_proto" in
13572         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13573         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13574         esac
13575         case "$getnetbyaddr_r_proto" in
13576         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13577         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13578         esac
13579         case "$getnetbyaddr_r_proto" in
13580         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13581         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13582         esac
13583         case "$getnetbyaddr_r_proto" in
13584         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13585         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13586         esac
13587         case "$getnetbyaddr_r_proto" in
13588         ''|0)   d_getnetbyaddr_r=undef
13589                 getnetbyaddr_r_proto=0
13590                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13591         * )     case "$getnetbyaddr_r_proto" in
13592                 REENTRANT_PROTO*) ;;
13593                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13594                 esac
13595                 echo "Prototype: $try" ;;
13596         esac
13597         ;;
13598         *)      case "$usethreads" in
13599                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13600                 esac
13601                 d_getnetbyaddr_r=undef
13602                 getnetbyaddr_r_proto=0
13603                 ;;
13604         esac
13605         ;;
13606 *)      getnetbyaddr_r_proto=0
13607         ;;
13608 esac
13609
13610 : see if getnetbyname_r exists
13611 set getnetbyname_r d_getnetbyname_r
13612 eval $inlibc
13613 case "$d_getnetbyname_r" in
13614 "$define")
13615         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13616         case "$d_getnetbyname_r_proto:$usethreads" in
13617         ":define")      d_getnetbyname_r_proto=define
13618                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13619                 eval $hasproto ;;
13620         *)      ;;
13621         esac
13622         case "$d_getnetbyname_r_proto" in
13623         define)
13624         case "$getnetbyname_r_proto" in
13625         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13626         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13627         esac
13628         case "$getnetbyname_r_proto" in
13629         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13630         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13631         esac
13632         case "$getnetbyname_r_proto" in
13633         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13634         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13635         esac
13636         case "$getnetbyname_r_proto" in
13637         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13638         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13639         esac
13640         case "$getnetbyname_r_proto" in
13641         ''|0)   d_getnetbyname_r=undef
13642                 getnetbyname_r_proto=0
13643                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13644         * )     case "$getnetbyname_r_proto" in
13645                 REENTRANT_PROTO*) ;;
13646                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13647                 esac
13648                 echo "Prototype: $try" ;;
13649         esac
13650         ;;
13651         *)      case "$usethreads" in
13652                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13653                 esac
13654                 d_getnetbyname_r=undef
13655                 getnetbyname_r_proto=0
13656                 ;;
13657         esac
13658         ;;
13659 *)      getnetbyname_r_proto=0
13660         ;;
13661 esac
13662
13663 : see if getnetent_r exists
13664 set getnetent_r d_getnetent_r
13665 eval $inlibc
13666 case "$d_getnetent_r" in
13667 "$define")
13668         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13669         case "$d_getnetent_r_proto:$usethreads" in
13670         ":define")      d_getnetent_r_proto=define
13671                 set d_getnetent_r_proto getnetent_r $hdrs
13672                 eval $hasproto ;;
13673         *)      ;;
13674         esac
13675         case "$d_getnetent_r_proto" in
13676         define)
13677         case "$getnetent_r_proto" in
13678         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13679         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13680         esac
13681         case "$getnetent_r_proto" in
13682         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13683         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13684         esac
13685         case "$getnetent_r_proto" in
13686         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13687         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13688         esac
13689         case "$getnetent_r_proto" in
13690         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13691         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13692         esac
13693         case "$getnetent_r_proto" in
13694         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13695         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13696         esac
13697         case "$getnetent_r_proto" in
13698         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13699         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13700         esac
13701         case "$getnetent_r_proto" in
13702         ''|0)   d_getnetent_r=undef
13703                 getnetent_r_proto=0
13704                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13705         * )     case "$getnetent_r_proto" in
13706                 REENTRANT_PROTO*) ;;
13707                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13708                 esac
13709                 echo "Prototype: $try" ;;
13710         esac
13711         ;;
13712         *)      case "$usethreads" in
13713                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13714                 esac
13715                 d_getnetent_r=undef
13716                 getnetent_r_proto=0
13717                 ;;
13718         esac
13719         ;;
13720 *)      getnetent_r_proto=0
13721         ;;
13722 esac
13723
13724 : see if prototypes for various getnetxxx netdb.h functions are available
13725 echo " "
13726 set d_getnetprotos getnetent $i_netdb netdb.h
13727 eval $hasproto
13728
13729 : see if getpagesize exists
13730 set getpagesize d_getpagsz
13731 eval $inlibc
13732
13733
13734 : see if getprotobyname exists
13735 set getprotobyname d_getpbyname
13736 eval $inlibc
13737
13738 : see if getprotobynumber exists
13739 set getprotobynumber d_getpbynumber
13740 eval $inlibc
13741
13742 : see if getprotoent exists
13743 set getprotoent d_getpent
13744 eval $inlibc
13745
13746 : see if getpgid exists
13747 set getpgid d_getpgid
13748 eval $inlibc
13749
13750 : see if getpgrp2 exists
13751 set getpgrp2 d_getpgrp2
13752 eval $inlibc
13753
13754 : see if getppid exists
13755 set getppid d_getppid
13756 eval $inlibc
13757
13758 : see if getpriority exists
13759 set getpriority d_getprior
13760 eval $inlibc
13761
13762 : see if getprotobyname_r exists
13763 set getprotobyname_r d_getprotobyname_r
13764 eval $inlibc
13765 case "$d_getprotobyname_r" in
13766 "$define")
13767         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13768         case "$d_getprotobyname_r_proto:$usethreads" in
13769         ":define")      d_getprotobyname_r_proto=define
13770                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13771                 eval $hasproto ;;
13772         *)      ;;
13773         esac
13774         case "$d_getprotobyname_r_proto" in
13775         define)
13776         case "$getprotobyname_r_proto" in
13777         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13778         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13779         esac
13780         case "$getprotobyname_r_proto" in
13781         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13782         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13783         esac
13784         case "$getprotobyname_r_proto" in
13785         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13786         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13787         esac
13788         case "$getprotobyname_r_proto" in
13789         ''|0)   d_getprotobyname_r=undef
13790                 getprotobyname_r_proto=0
13791                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13792         * )     case "$getprotobyname_r_proto" in
13793                 REENTRANT_PROTO*) ;;
13794                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13795                 esac
13796                 echo "Prototype: $try" ;;
13797         esac
13798         ;;
13799         *)      case "$usethreads" in
13800                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13801                 esac
13802                 d_getprotobyname_r=undef
13803                 getprotobyname_r_proto=0
13804                 ;;
13805         esac
13806         ;;
13807 *)      getprotobyname_r_proto=0
13808         ;;
13809 esac
13810
13811 : see if getprotobynumber_r exists
13812 set getprotobynumber_r d_getprotobynumber_r
13813 eval $inlibc
13814 case "$d_getprotobynumber_r" in
13815 "$define")
13816         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13817         case "$d_getprotobynumber_r_proto:$usethreads" in
13818         ":define")      d_getprotobynumber_r_proto=define
13819                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13820                 eval $hasproto ;;
13821         *)      ;;
13822         esac
13823         case "$d_getprotobynumber_r_proto" in
13824         define)
13825         case "$getprotobynumber_r_proto" in
13826         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13827         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13828         esac
13829         case "$getprotobynumber_r_proto" in
13830         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13831         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13832         esac
13833         case "$getprotobynumber_r_proto" in
13834         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13835         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13836         esac
13837         case "$getprotobynumber_r_proto" in
13838         ''|0)   d_getprotobynumber_r=undef
13839                 getprotobynumber_r_proto=0
13840                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13841         * )     case "$getprotobynumber_r_proto" in
13842                 REENTRANT_PROTO*) ;;
13843                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13844                 esac
13845                 echo "Prototype: $try" ;;
13846         esac
13847         ;;
13848         *)      case "$usethreads" in
13849                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13850                 esac
13851                 d_getprotobynumber_r=undef
13852                 getprotobynumber_r_proto=0
13853                 ;;
13854         esac
13855         ;;
13856 *)      getprotobynumber_r_proto=0
13857         ;;
13858 esac
13859
13860 : see if getprotoent_r exists
13861 set getprotoent_r d_getprotoent_r
13862 eval $inlibc
13863 case "$d_getprotoent_r" in
13864 "$define")
13865         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13866         case "$d_getprotoent_r_proto:$usethreads" in
13867         ":define")      d_getprotoent_r_proto=define
13868                 set d_getprotoent_r_proto getprotoent_r $hdrs
13869                 eval $hasproto ;;
13870         *)      ;;
13871         esac
13872         case "$d_getprotoent_r_proto" in
13873         define)
13874         case "$getprotoent_r_proto" in
13875         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13876         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13877         esac
13878         case "$getprotoent_r_proto" in
13879         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13880         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13881         esac
13882         case "$getprotoent_r_proto" in
13883         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13884         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13885         esac
13886         case "$getprotoent_r_proto" in
13887         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13888         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13889         esac
13890         case "$getprotoent_r_proto" in
13891         ''|0)   d_getprotoent_r=undef
13892                 getprotoent_r_proto=0
13893                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13894         * )     case "$getprotoent_r_proto" in
13895                 REENTRANT_PROTO*) ;;
13896                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13897                 esac
13898                 echo "Prototype: $try" ;;
13899         esac
13900         ;;
13901         *)      case "$usethreads" in
13902                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13903                 esac
13904                 d_getprotoent_r=undef
13905                 getprotoent_r_proto=0
13906                 ;;
13907         esac
13908         ;;
13909 *)      getprotoent_r_proto=0
13910         ;;
13911 esac
13912
13913 : see if prototypes for various getprotoxxx netdb.h functions are available
13914 echo " "
13915 set d_getprotoprotos getprotoent $i_netdb netdb.h
13916 eval $hasproto
13917
13918 : see if getprpwnam exists
13919 set getprpwnam d_getprpwnam
13920 eval $inlibc
13921
13922 : see if getpwent exists
13923 set getpwent d_getpwent
13924 eval $inlibc
13925
13926 : see if getpwent_r exists
13927 set getpwent_r d_getpwent_r
13928 eval $inlibc
13929 case "$d_getpwent_r" in
13930 "$define")
13931         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13932         case "$d_getpwent_r_proto:$usethreads" in
13933         ":define")      d_getpwent_r_proto=define
13934                 set d_getpwent_r_proto getpwent_r $hdrs
13935                 eval $hasproto ;;
13936         *)      ;;
13937         esac
13938         case "$d_getpwent_r_proto" in
13939         define)
13940         case "$getpwent_r_proto" in
13941         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13942         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13943         esac
13944         case "$getpwent_r_proto" in
13945         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13946         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13947         esac
13948         case "$getpwent_r_proto" in
13949         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13950         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13951         esac
13952         case "$getpwent_r_proto" in
13953         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13954         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13955         esac
13956         case "$getpwent_r_proto" in
13957         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13958         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13959         esac
13960         case "$getpwent_r_proto" in
13961         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13962         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13963         esac
13964         case "$getpwent_r_proto" in
13965         ''|0)   d_getpwent_r=undef
13966                 getpwent_r_proto=0
13967                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13968         * )     case "$getpwent_r_proto" in
13969                 REENTRANT_PROTO*) ;;
13970                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13971                 esac
13972                 echo "Prototype: $try" ;;
13973         esac
13974         ;;
13975         *)      case "$usethreads" in
13976                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13977                 esac
13978                 d_getpwent_r=undef
13979                 getpwent_r_proto=0
13980                 ;;
13981         esac
13982         ;;
13983 *)      getpwent_r_proto=0
13984         ;;
13985 esac
13986
13987 : see if getpwnam_r exists
13988 set getpwnam_r d_getpwnam_r
13989 eval $inlibc
13990 case "$d_getpwnam_r" in
13991 "$define")
13992         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13993         case "$d_getpwnam_r_proto:$usethreads" in
13994         ":define")      d_getpwnam_r_proto=define
13995                 set d_getpwnam_r_proto getpwnam_r $hdrs
13996                 eval $hasproto ;;
13997         *)      ;;
13998         esac
13999         case "$d_getpwnam_r_proto" in
14000         define)
14001         case "$getpwnam_r_proto" in
14002         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14003         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14004         esac
14005         case "$getpwnam_r_proto" in
14006         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14007         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14008         esac
14009         case "$getpwnam_r_proto" in
14010         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14011         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14012         esac
14013         case "$getpwnam_r_proto" in
14014         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14015         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14016         esac
14017         case "$getpwnam_r_proto" in
14018         ''|0)   d_getpwnam_r=undef
14019                 getpwnam_r_proto=0
14020                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14021         * )     case "$getpwnam_r_proto" in
14022                 REENTRANT_PROTO*) ;;
14023                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14024                 esac
14025                 echo "Prototype: $try" ;;
14026         esac
14027         ;;
14028         *)      case "$usethreads" in
14029                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14030                 esac
14031                 d_getpwnam_r=undef
14032                 getpwnam_r_proto=0
14033                 ;;
14034         esac
14035         ;;
14036 *)      getpwnam_r_proto=0
14037         ;;
14038 esac
14039
14040 : see if getpwuid_r exists
14041 set getpwuid_r d_getpwuid_r
14042 eval $inlibc
14043 case "$d_getpwuid_r" in
14044 "$define")
14045         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14046         case "$d_getpwuid_r_proto:$usethreads" in
14047         ":define")      d_getpwuid_r_proto=define
14048                 set d_getpwuid_r_proto getpwuid_r $hdrs
14049                 eval $hasproto ;;
14050         *)      ;;
14051         esac
14052         case "$d_getpwuid_r_proto" in
14053         define)
14054         case "$getpwuid_r_proto" in
14055         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14056         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14057         esac
14058         case "$getpwuid_r_proto" in
14059         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14060         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14061         esac
14062         case "$getpwuid_r_proto" in
14063         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14064         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14065         esac
14066         case "$getpwuid_r_proto" in
14067         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14068         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14069         esac
14070         case "$getpwuid_r_proto" in
14071         ''|0)   d_getpwuid_r=undef
14072                 getpwuid_r_proto=0
14073                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14074         * )     case "$getpwuid_r_proto" in
14075                 REENTRANT_PROTO*) ;;
14076                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14077                 esac
14078                 echo "Prototype: $try" ;;
14079         esac
14080         ;;
14081         *)      case "$usethreads" in
14082                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14083                 esac
14084                 d_getpwuid_r=undef
14085                 getpwuid_r_proto=0
14086                 ;;
14087         esac
14088         ;;
14089 *)      getpwuid_r_proto=0
14090         ;;
14091 esac
14092
14093
14094 : see if getservbyname exists
14095 set getservbyname d_getsbyname
14096 eval $inlibc
14097
14098 : see if getservbyport exists
14099 set getservbyport d_getsbyport
14100 eval $inlibc
14101
14102 : see if getservent exists
14103 set getservent d_getsent
14104 eval $inlibc
14105
14106 : see if getservbyname_r exists
14107 set getservbyname_r d_getservbyname_r
14108 eval $inlibc
14109 case "$d_getservbyname_r" in
14110 "$define")
14111         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14112         case "$d_getservbyname_r_proto:$usethreads" in
14113         ":define")      d_getservbyname_r_proto=define
14114                 set d_getservbyname_r_proto getservbyname_r $hdrs
14115                 eval $hasproto ;;
14116         *)      ;;
14117         esac
14118         case "$d_getservbyname_r_proto" in
14119         define)
14120         case "$getservbyname_r_proto" in
14121         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14122         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14123         esac
14124         case "$getservbyname_r_proto" in
14125         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14126         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14127         esac
14128         case "$getservbyname_r_proto" in
14129         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14130         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14131         esac
14132         case "$getservbyname_r_proto" in
14133         ''|0)   d_getservbyname_r=undef
14134                 getservbyname_r_proto=0
14135                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14136         * )     case "$getservbyname_r_proto" in
14137                 REENTRANT_PROTO*) ;;
14138                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14139                 esac
14140                 echo "Prototype: $try" ;;
14141         esac
14142         ;;
14143         *)      case "$usethreads" in
14144                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14145                 esac
14146                 d_getservbyname_r=undef
14147                 getservbyname_r_proto=0
14148                 ;;
14149         esac
14150         ;;
14151 *)      getservbyname_r_proto=0
14152         ;;
14153 esac
14154
14155 : see if getservbyport_r exists
14156 set getservbyport_r d_getservbyport_r
14157 eval $inlibc
14158 case "$d_getservbyport_r" in
14159 "$define")
14160         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14161         case "$d_getservbyport_r_proto:$usethreads" in
14162         ":define")      d_getservbyport_r_proto=define
14163                 set d_getservbyport_r_proto getservbyport_r $hdrs
14164                 eval $hasproto ;;
14165         *)      ;;
14166         esac
14167         case "$d_getservbyport_r_proto" in
14168         define)
14169         case "$getservbyport_r_proto" in
14170         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14171         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14172         esac
14173         case "$getservbyport_r_proto" in
14174         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14175         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14176         esac
14177         case "$getservbyport_r_proto" in
14178         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14179         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14180         esac
14181         case "$getservbyport_r_proto" in
14182         ''|0)   d_getservbyport_r=undef
14183                 getservbyport_r_proto=0
14184                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14185         * )     case "$getservbyport_r_proto" in
14186                 REENTRANT_PROTO*) ;;
14187                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14188                 esac
14189                 echo "Prototype: $try" ;;
14190         esac
14191         ;;
14192         *)      case "$usethreads" in
14193                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14194                 esac
14195                 d_getservbyport_r=undef
14196                 getservbyport_r_proto=0
14197                 ;;
14198         esac
14199         ;;
14200 *)      getservbyport_r_proto=0
14201         ;;
14202 esac
14203
14204 : see if getservent_r exists
14205 set getservent_r d_getservent_r
14206 eval $inlibc
14207 case "$d_getservent_r" in
14208 "$define")
14209         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14210         case "$d_getservent_r_proto:$usethreads" in
14211         ":define")      d_getservent_r_proto=define
14212                 set d_getservent_r_proto getservent_r $hdrs
14213                 eval $hasproto ;;
14214         *)      ;;
14215         esac
14216         case "$d_getservent_r_proto" in
14217         define)
14218         case "$getservent_r_proto" in
14219         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14220         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14221         esac
14222         case "$getservent_r_proto" in
14223         ''|0) try='int getservent_r(struct servent*, char*, int);'
14224         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14225         esac
14226         case "$getservent_r_proto" in
14227         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14228         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14229         esac
14230         case "$getservent_r_proto" in
14231         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14232         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14233         esac
14234         case "$getservent_r_proto" in
14235         ''|0)   d_getservent_r=undef
14236                 getservent_r_proto=0
14237                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14238         * )     case "$getservent_r_proto" in
14239                 REENTRANT_PROTO*) ;;
14240                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14241                 esac
14242                 echo "Prototype: $try" ;;
14243         esac
14244         ;;
14245         *)      case "$usethreads" in
14246                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14247                 esac
14248                 d_getservent_r=undef
14249                 getservent_r_proto=0
14250                 ;;
14251         esac
14252         ;;
14253 *)      getservent_r_proto=0
14254         ;;
14255 esac
14256
14257 : see if prototypes for various getservxxx netdb.h functions are available
14258 echo " "
14259 set d_getservprotos getservent $i_netdb netdb.h
14260 eval $hasproto
14261
14262 : see if getspnam exists
14263 set getspnam d_getspnam
14264 eval $inlibc
14265
14266 : see if this is a shadow.h system
14267 set shadow.h i_shadow
14268 eval $inhdr
14269
14270 : see if getspnam_r exists
14271 set getspnam_r d_getspnam_r
14272 eval $inlibc
14273 case "$d_getspnam_r" in
14274 "$define")
14275         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14276         case "$d_getspnam_r_proto:$usethreads" in
14277         ":define")      d_getspnam_r_proto=define
14278                 set d_getspnam_r_proto getspnam_r $hdrs
14279                 eval $hasproto ;;
14280         *)      ;;
14281         esac
14282         case "$d_getspnam_r_proto" in
14283         define)
14284         case "$getspnam_r_proto" in
14285         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14286         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14287         esac
14288         case "$getspnam_r_proto" in
14289         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14290         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14291         esac
14292         case "$getspnam_r_proto" in
14293         ''|0)   d_getspnam_r=undef
14294                 getspnam_r_proto=0
14295                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14296         * )     case "$getspnam_r_proto" in
14297                 REENTRANT_PROTO*) ;;
14298                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14299                 esac
14300                 echo "Prototype: $try" ;;
14301         esac
14302         ;;
14303         *)      case "$usethreads" in
14304                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14305                 esac
14306                 d_getspnam_r=undef
14307                 getspnam_r_proto=0
14308                 ;;
14309         esac
14310         ;;
14311 *)      getspnam_r_proto=0
14312         ;;
14313 esac
14314
14315 : see if gettimeofday or ftime exists
14316 set gettimeofday d_gettimeod
14317 eval $inlibc
14318 case "$d_gettimeod" in
14319 "$undef")
14320         set ftime d_ftime 
14321         eval $inlibc
14322         ;;
14323 *)
14324         val="$undef"; set d_ftime; eval $setvar
14325         ;;
14326 esac
14327 case "$d_gettimeod$d_ftime" in
14328 "$undef$undef")
14329         echo " "
14330         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14331         ;;
14332 esac
14333
14334 : see if gmtime_r exists
14335 set gmtime_r d_gmtime_r
14336 eval $inlibc
14337 case "$d_gmtime_r" in
14338 "$define")
14339         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14340         case "$d_gmtime_r_proto:$usethreads" in
14341         ":define")      d_gmtime_r_proto=define
14342                 set d_gmtime_r_proto gmtime_r $hdrs
14343                 eval $hasproto ;;
14344         *)      ;;
14345         esac
14346         case "$d_gmtime_r_proto" in
14347         define)
14348         case "$gmtime_r_proto" in
14349         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14350         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14351         esac
14352         case "$gmtime_r_proto" in
14353         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14354         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14355         esac
14356         case "$gmtime_r_proto" in
14357         ''|0)   d_gmtime_r=undef
14358                 gmtime_r_proto=0
14359                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14360         * )     case "$gmtime_r_proto" in
14361                 REENTRANT_PROTO*) ;;
14362                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14363                 esac
14364                 echo "Prototype: $try" ;;
14365         esac
14366         ;;
14367         *)      case "$usethreads" in
14368                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14369                 esac
14370                 d_gmtime_r=undef
14371                 gmtime_r_proto=0
14372                 ;;
14373         esac
14374         ;;
14375 *)      gmtime_r_proto=0
14376         ;;
14377 esac
14378
14379 : see if hasmntopt exists
14380 set hasmntopt d_hasmntopt
14381 eval $inlibc
14382
14383 : see if this is a netinet/in.h or sys/in.h system
14384 set netinet/in.h i_niin sys/in.h i_sysin
14385 eval $inhdr
14386
14387 : see if arpa/inet.h has to be included
14388 set arpa/inet.h i_arpainet
14389 eval $inhdr
14390
14391 : see if htonl --and friends-- exists
14392 val=''
14393 set htonl val
14394 eval $inlibc
14395
14396 : Maybe they are macros.
14397 case "$val" in
14398 $undef)
14399         $cat >htonl.c <<EOM
14400 #include <stdio.h>
14401 #include <sys/types.h>
14402 #$i_niin I_NETINET_IN
14403 #$i_sysin I_SYS_IN
14404 #$i_arpainet I_ARPA_INET
14405 #ifdef I_NETINET_IN
14406 #include <netinet/in.h>
14407 #endif
14408 #ifdef I_SYS_IN
14409 #include <sys/in.h>
14410 #endif
14411 #ifdef I_ARPA_INET
14412 #include <arpa/inet.h>
14413 #endif
14414 #ifdef htonl
14415 printf("Defined as a macro.");
14416 #endif
14417 EOM
14418         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14419         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14420                 val="$define"
14421                 echo "But it seems to be defined as a macro." >&4
14422         fi
14423         $rm -f htonl.?
14424         ;;
14425 esac
14426 set d_htonl
14427 eval $setvar
14428
14429 : see if ilogbl exists
14430 set ilogbl d_ilogbl
14431 eval $inlibc
14432
14433 : index or strchr
14434 echo " "
14435 if set index val -f; eval $csym; $val; then
14436         if set strchr val -f d_strchr; eval $csym; $val; then
14437                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14438                         val="$define"
14439                         vali="$undef"
14440                         echo "strchr() found." >&4
14441                 else
14442                         val="$undef"
14443                         vali="$define"
14444                         echo "index() found." >&4
14445                 fi
14446         else
14447                 val="$undef"
14448                 vali="$define"
14449                 echo "index() found." >&4
14450         fi
14451 else
14452         if set strchr val -f d_strchr; eval $csym; $val; then
14453                 val="$define"
14454                 vali="$undef"
14455                 echo "strchr() found." >&4
14456         else
14457                 echo "No index() or strchr() found!" >&4
14458                 val="$undef"
14459                 vali="$undef"
14460         fi
14461 fi
14462 set d_strchr; eval $setvar
14463 val="$vali"
14464 set d_index; eval $setvar
14465
14466 : check whether inet_aton exists
14467 set inet_aton d_inetaton
14468 eval $inlibc
14469
14470 : Look for isascii
14471 echo " "
14472 $cat >isascii.c <<EOCP
14473 #include <stdio.h>
14474 #include <ctype.h>
14475 #$i_stdlib I_STDLIB
14476 #ifdef I_STDLIB
14477 #include <stdlib.h>
14478 #endif
14479 int main() {
14480         int c = 'A';
14481         if (isascii(c))
14482                 exit(0);
14483         else
14484                 exit(1);
14485 }
14486 EOCP
14487 set isascii
14488 if eval $compile; then
14489         echo "isascii() found." >&4
14490         val="$define"
14491 else
14492         echo "isascii() NOT found." >&4
14493         val="$undef"
14494 fi
14495 set d_isascii
14496 eval $setvar
14497 $rm -f isascii*
14498
14499 : see if isfinite exists
14500 set isfinite d_isfinite
14501 eval $inlibc
14502
14503 : see if isinf exists
14504 set isinf d_isinf
14505 eval $inlibc
14506
14507 : see if isnan exists
14508 set isnan d_isnan
14509 eval $inlibc
14510
14511 : see if isnanl exists
14512 set isnanl d_isnanl
14513 eval $inlibc
14514
14515 : see if killpg exists
14516 set killpg d_killpg
14517 eval $inlibc
14518
14519 : see if lchown exists
14520 echo " "
14521 $cat > try.c <<'EOCP'
14522 /* System header to define __stub macros and hopefully few prototypes,
14523     which can conflict with char lchown(); below.  */
14524 #include <assert.h>
14525 /* Override any gcc2 internal prototype to avoid an error.  */
14526 /* We use char because int might match the return type of a gcc2
14527    builtin and then its argument prototype would still apply.  */
14528 char lchown();
14529 int main() {
14530     /*  The GNU C library defines this for functions which it implements
14531         to always fail with ENOSYS.  Some functions are actually named
14532         something starting with __ and the normal name is an alias.  */
14533 #if defined (__stub_lchown) || defined (__stub___lchown)
14534 choke me
14535 #else
14536 lchown();
14537 #endif
14538 ; return 0; }
14539 EOCP
14540 set try
14541 if eval $compile; then
14542     $echo "lchown() found." >&4
14543     val="$define"
14544 else
14545     $echo "lchown() NOT found." >&4
14546     val="$undef"
14547 fi
14548 set d_lchown
14549 eval $setvar
14550
14551 : See if number of significant digits in a double precision number is known
14552 echo " "
14553 $cat >ldbl_dig.c <<EOM
14554 #$i_limits I_LIMITS
14555 #$i_float I_FLOAT
14556 #ifdef I_LIMITS
14557 #include <limits.h>
14558 #endif
14559 #ifdef I_FLOAT
14560 #include <float.h>
14561 #endif
14562 #ifdef LDBL_DIG
14563 printf("Contains LDBL_DIG");
14564 #endif
14565 EOM
14566 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14567 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14568         echo "LDBL_DIG found." >&4
14569         val="$define"
14570 else
14571         echo "LDBL_DIG NOT found." >&4
14572         val="$undef"
14573 fi
14574 $rm -f ldbl_dig.?
14575 set d_ldbl_dig
14576 eval $setvar
14577
14578 : see if this is a math.h system
14579 set math.h i_math
14580 eval $inhdr
14581
14582 d_libm_lib_version="$undef"
14583 case $i_math in
14584     $define)
14585         : check to see if math.h defines _LIB_VERSION
14586         echo " "
14587         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14588         $cat >try.c <<EOCP
14589 #include <unistd.h>
14590 #include <math.h>
14591 int main (int argc, char *argv[])
14592 {
14593     printf ("%d\n", _LIB_VERSION);
14594     return (0);
14595     } /* main */
14596 EOCP
14597         set try
14598         if eval $compile; then
14599             foo=`$run ./try`
14600             echo "Yes, it does ($foo)" >&4
14601             d_libm_lib_version="$define"
14602         else
14603             echo "No, it does not (probably harmless)\n" >&4
14604             fi
14605         $rm -f try.* try core core.try.*
14606         ;;
14607
14608     esac
14609
14610 : see if link exists
14611 set link d_link
14612 eval $inlibc
14613
14614 : see if localtime_r exists
14615 set localtime_r d_localtime_r
14616 eval $inlibc
14617 case "$d_localtime_r" in
14618 "$define")
14619         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14620         case "$d_localtime_r_proto:$usethreads" in
14621         ":define")      d_localtime_r_proto=define
14622                 set d_localtime_r_proto localtime_r $hdrs
14623                 eval $hasproto ;;
14624         *)      ;;
14625         esac
14626         case "$d_localtime_r_proto" in
14627         define)
14628         case "$localtime_r_proto" in
14629         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14630         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14631         esac
14632         case "$localtime_r_proto" in
14633         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14634         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14635         esac
14636         case "$localtime_r_proto" in
14637         ''|0)   d_localtime_r=undef
14638                 localtime_r_proto=0
14639                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14640         * )     case "$localtime_r_proto" in
14641                 REENTRANT_PROTO*) ;;
14642                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14643                 esac
14644                 echo "Prototype: $try" ;;
14645         esac
14646         ;;
14647         *)      case "$usethreads" in
14648                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14649                 esac
14650                 d_localtime_r=undef
14651                 localtime_r_proto=0
14652                 ;;
14653         esac
14654         ;;
14655 *)      localtime_r_proto=0
14656         ;;
14657 esac
14658
14659 : see if localtime_r calls tzset
14660 case "$localtime_r_proto" in
14661 REENTRANT_PROTO*)
14662         $cat >try.c <<EOCP
14663 /*  Does our libc's localtime_r call tzset ?
14664  *  return 0 if so, 1 otherwise.
14665  */
14666 #include <sys/types.h>
14667 #include <unistd.h>
14668 #include <time.h>
14669 #include <string.h>
14670 #include <malloc.h>
14671 int main()
14672 {
14673     time_t t = time(0L);
14674     char w_tz[]="TZ" "=GMT+5",
14675          e_tz[]="TZ" "=GMT-5",
14676         *tz_e = (char*)malloc(16),
14677         *tz_w = (char*)malloc(16);
14678     struct tm tm_e, tm_w;
14679     memset(&tm_e,'\0',sizeof(struct tm));
14680     memset(&tm_w,'\0',sizeof(struct tm));
14681     strcpy(tz_e,e_tz);
14682     strcpy(tz_w,w_tz);
14683
14684     putenv(tz_e);
14685     localtime_r(&t, &tm_e);
14686
14687     putenv(tz_w);
14688     localtime_r(&t, &tm_w);
14689
14690     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14691         return 1;
14692     return 0;
14693 }
14694 EOCP
14695         set try
14696         if eval $compile; then
14697             if ./try; then
14698                 d_localtime_r_needs_tzset=undef;
14699             else
14700                 d_localtime_r_needs_tzset=define;
14701             fi;
14702         else
14703             d_localtime_r_needs_tzset=undef;
14704         fi;
14705      ;;
14706   *)
14707      d_localtime_r_needs_tzset=undef;
14708      ;;
14709 esac
14710 $rm -f try try.* core
14711
14712 : see if localeconv exists
14713 set localeconv d_locconv
14714 eval $inlibc
14715
14716 : see if lockf exists
14717 set lockf d_lockf
14718 eval $inlibc
14719
14720 : see if prototype for lseek is available
14721 echo " "
14722 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14723 eval $hasproto
14724
14725 : see if lstat exists
14726 set lstat d_lstat
14727 eval $inlibc
14728
14729 : see if madvise exists
14730 set madvise d_madvise
14731 eval $inlibc
14732
14733 : see if malloc_size exists
14734 set malloc_size d_malloc_size
14735 eval $inlibc
14736
14737 : see if malloc_size_good exists
14738 set malloc_good_size d_malloc_good_size
14739 eval $inlibc
14740
14741 : see if mblen exists
14742 set mblen d_mblen
14743 eval $inlibc
14744
14745 : see if mbstowcs exists
14746 set mbstowcs d_mbstowcs
14747 eval $inlibc
14748
14749 : see if mbtowc exists
14750 set mbtowc d_mbtowc
14751 eval $inlibc
14752
14753 : see if memchr exists
14754 set memchr d_memchr
14755 eval $inlibc
14756
14757 : see if memcmp exists
14758 set memcmp d_memcmp
14759 eval $inlibc
14760
14761 : see if memcpy exists
14762 set memcpy d_memcpy
14763 eval $inlibc
14764
14765 : see if memmove exists
14766 set memmove d_memmove
14767 eval $inlibc
14768
14769 : see if memset exists
14770 set memset d_memset
14771 eval $inlibc
14772
14773 : see if mkdir exists
14774 set mkdir d_mkdir
14775 eval $inlibc
14776
14777 : see if mkdtemp exists
14778 set mkdtemp d_mkdtemp
14779 eval $inlibc
14780
14781 : see if mkfifo exists
14782 set mkfifo d_mkfifo
14783 eval $inlibc
14784
14785 : see if mkstemp exists
14786 set mkstemp d_mkstemp
14787 eval $inlibc
14788
14789 : see if mkstemps exists
14790 set mkstemps d_mkstemps
14791 eval $inlibc
14792
14793 : see if mktime exists
14794 set mktime d_mktime
14795 eval $inlibc
14796
14797 : see if this is a sys/mman.h system
14798 set sys/mman.h i_sysmman
14799 eval $inhdr
14800
14801 : see if mmap exists
14802 set mmap d_mmap
14803 eval $inlibc
14804 : see what shmat returns
14805 : default to something harmless
14806 mmaptype='void *'
14807 case "$i_sysmman$d_mmap" in
14808 "$define$define")
14809         $cat >mmap.c <<'END'
14810 #include <sys/mman.h>
14811 void *mmap();
14812 END
14813         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14814                 mmaptype='void *'
14815         else
14816                 mmaptype='caddr_t'
14817         fi
14818         echo "and it returns ($mmaptype)." >&4
14819         ;;
14820 esac
14821
14822
14823
14824 : see if sqrtl exists
14825 set sqrtl d_sqrtl
14826 eval $inlibc
14827
14828 : see if scalbnl exists
14829 set scalbnl d_scalbnl
14830 eval $inlibc
14831
14832 : see if modfl exists
14833 set modfl d_modfl
14834 eval $inlibc
14835
14836 : see if prototype for modfl is available
14837 echo " "
14838 set d_modflproto modfl $i_math math.h
14839 eval $hasproto
14840
14841 d_modfl_pow32_bug="$undef"
14842
14843 case "$d_longdbl$d_modfl" in
14844 $define$define)
14845         $cat <<EOM
14846 Checking to see whether your modfl() is okay for large values...
14847 EOM
14848 $cat >try.c <<EOCP
14849 #include <math.h> 
14850 #include <stdio.h>
14851 EOCP
14852 if $test "X$d_modflproto" != "X$define"; then
14853         $cat >>try.c <<EOCP
14854 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14855 long double modfl (long double, long double *);
14856 EOCP
14857 fi
14858 $cat >>try.c <<EOCP
14859 int main() {
14860     long double nv = 4294967303.15;
14861     long double v, w;
14862     v = modfl(nv, &w);         
14863 #ifdef __GLIBC__
14864     printf("glibc");
14865 #endif
14866     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14867     return 0;
14868 }
14869 EOCP
14870         case "$osname:$gccversion" in
14871         aix:)   saveccflags="$ccflags"
14872                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14873         esac
14874         set try
14875         if eval $compile; then
14876                 foo=`$run ./try`
14877                 case "$foo" in
14878                 *" 4294967303.150000 1.150000 4294967302.000000")
14879                         echo >&4 "Your modfl() is broken for large values."
14880                         d_modfl_pow32_bug="$define"
14881                         case "$foo" in
14882                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14883                         ;;
14884                         esac
14885                         ;;
14886                 *" 4294967303.150000 0.150000 4294967303.000000")
14887                         echo >&4 "Your modfl() seems okay for large values."
14888                         ;;
14889                 *)      echo >&4 "I don't understand your modfl() at all."
14890                         d_modfl="$undef"
14891                         ;;
14892                 esac
14893                 $rm -f try.* try core core.try.*
14894         else
14895                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14896                 d_modfl="$undef"
14897         fi
14898         case "$osname:$gccversion" in
14899         aix:)   ccflags="$saveccflags" ;; # restore
14900         esac
14901         ;;
14902 esac
14903
14904 if $test "$uselongdouble" = "$define"; then
14905     message=""
14906     if $test "$d_sqrtl" != "$define"; then
14907         message="$message sqrtl"
14908     fi
14909     if $test "$d_modfl" != "$define"; then
14910         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14911             echo "You have both aintl and copysignl, so I can emulate modfl."
14912         else
14913             message="$message modfl"
14914         fi
14915     fi
14916     if $test "$d_frexpl" != "$define"; then
14917         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14918             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14919         else
14920             message="$message frexpl"
14921         fi
14922     fi
14923
14924     if $test "$message" != ""; then
14925         $cat <<EOM >&4
14926
14927 *** You requested the use of long doubles but you do not seem to have
14928 *** the following mathematical functions needed for long double support:
14929 ***    $message
14930 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14931 *** Cannot continue, aborting.
14932
14933 EOM
14934
14935         exit 1
14936     fi
14937 fi
14938
14939 : see if mprotect exists
14940 set mprotect d_mprotect
14941 eval $inlibc
14942
14943 : see if msgctl exists
14944 set msgctl d_msgctl
14945 eval $inlibc
14946
14947 : see if msgget exists
14948 set msgget d_msgget
14949 eval $inlibc
14950
14951 : see if msgsnd exists
14952 set msgsnd d_msgsnd
14953 eval $inlibc
14954
14955 : see if msgrcv exists
14956 set msgrcv d_msgrcv
14957 eval $inlibc
14958
14959 : see how much of the 'msg*(2)' library is present.
14960 h_msg=true
14961 echo " "
14962 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14963 *"$undef"*) h_msg=false;;
14964 esac
14965 case "$osname" in
14966 freebsd)
14967     case "`ipcs 2>&1`" in
14968     "SVID messages"*"not configured"*)
14969         echo "Your $osname does not have the msg*(2) configured." >&4
14970         h_msg=false
14971         val="$undef"
14972         set msgctl d_msgctl
14973         eval $setvar
14974         set msgget d_msgget
14975         eval $setvar
14976         set msgsnd d_msgsnd
14977         eval $setvar
14978         set msgrcv d_msgrcv
14979         eval $setvar
14980         ;;
14981     esac
14982     ;;
14983 esac
14984 : we could also check for sys/ipc.h ...
14985 if $h_msg && $test `./findhdr sys/msg.h`; then
14986         echo "You have the full msg*(2) library." >&4
14987         val="$define"
14988 else
14989         echo "You don't have the full msg*(2) library." >&4
14990         val="$undef"
14991 fi
14992 set d_msg
14993 eval $setvar
14994
14995
14996 echo " "
14997 echo "Checking to see if your system supports struct msghdr..." >&4
14998 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14999 eval $hasstruct
15000 case "$d_msghdr_s" in
15001 "$define")      echo "Yes, it does."   ;;
15002 *)              echo "No, it doesn't." ;;
15003 esac
15004
15005
15006 : see if msync exists
15007 set msync d_msync
15008 eval $inlibc
15009
15010 : see if munmap exists
15011 set munmap d_munmap
15012 eval $inlibc
15013
15014 : see if nice exists
15015 set nice d_nice
15016 eval $inlibc
15017
15018 : see if this is a langinfo.h system
15019 set langinfo.h i_langinfo
15020 eval $inhdr
15021
15022 : see if nl_langinfo exists
15023 set nl_langinfo d_nl_langinfo
15024 eval $inlibc
15025
15026 : check for length of character
15027 echo " "
15028 case "$charsize" in
15029 '')
15030         echo "Checking to see how big your characters are (hey, you never know)..." >&4
15031         $cat >try.c <<EOCP
15032 #include <stdio.h>
15033 #$i_stdlib I_STDLIB
15034 #ifdef I_STDLIB
15035 #include <stdlib.h>
15036 #endif
15037 int main()
15038 {
15039     printf("%d\n", (int)sizeof(char));
15040     exit(0);
15041 }
15042 EOCP
15043         set try
15044         if eval $compile_ok; then
15045                 dflt=`$run ./try`
15046         else
15047                 dflt='1'
15048                 echo "(I can't seem to compile the test program.  Guessing...)"
15049         fi
15050         ;;
15051 *)
15052         dflt="$charsize"
15053         ;;
15054 esac
15055 rp="What is the size of a character (in bytes)?"
15056 . ./myread
15057 charsize="$ans"
15058 $rm -f try.c try
15059
15060 : check for volatile keyword
15061 echo " "
15062 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15063 $cat >try.c <<'EOCP'
15064 int main()
15065 {
15066         typedef struct _goo_struct goo_struct;
15067         goo_struct * volatile goo = ((goo_struct *)0);
15068         struct _goo_struct {
15069                 long long_int;
15070                 int reg_int;
15071                 char char_var;
15072         };
15073         typedef unsigned short foo_t;
15074         char *volatile foo;
15075         volatile int bar;
15076         volatile foo_t blech;
15077         foo = foo;
15078 }
15079 EOCP
15080 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15081         val="$define"
15082         echo "Yup, it does."
15083 else
15084         val="$undef"
15085         echo "Nope, it doesn't."
15086 fi
15087 set d_volatile
15088 eval $setvar
15089 $rm -f try try.*
15090
15091
15092 echo " "
15093 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15094
15095 case "$use64bitint:$d_quad:$quadtype" in
15096 define:define:?*)
15097         ivtype="$quadtype"
15098         uvtype="$uquadtype"
15099         ivsize=8
15100         uvsize=8
15101         ;;
15102 *)      ivtype="long"
15103         uvtype="unsigned long"
15104         ivsize=$longsize
15105         uvsize=$longsize
15106         ;;
15107 esac
15108
15109 case "$uselongdouble:$d_longdbl" in
15110 define:define)
15111         nvtype="long double"
15112         nvsize=$longdblsize
15113         ;;
15114 *)      nvtype=double
15115         nvsize=$doublesize
15116         ;;
15117 esac
15118
15119 $echo "(IV will be "$ivtype", $ivsize bytes)"
15120 $echo "(UV will be "$uvtype", $uvsize bytes)"
15121 $echo "(NV will be "$nvtype", $nvsize bytes)"
15122
15123 $cat >try.c <<EOCP
15124 #$i_inttypes I_INTTYPES
15125 #ifdef I_INTTYPES
15126 #include <inttypes.h>
15127 #endif
15128 #include <stdio.h>
15129 int main() {
15130 #ifdef INT8
15131    int8_t i =  INT8_MAX;
15132   uint8_t u = UINT8_MAX;
15133   printf("int8_t\n");
15134 #endif
15135 #ifdef INT16
15136    int16_t i =  INT16_MAX;
15137   uint16_t i = UINT16_MAX;
15138   printf("int16_t\n");
15139 #endif
15140 #ifdef INT32
15141    int32_t i =  INT32_MAX;
15142   uint32_t u = UINT32_MAX;
15143   printf("int32_t\n");
15144 #endif
15145 }
15146 EOCP
15147
15148 case "$i8type" in
15149 '')     case "$charsize" in
15150         1)      i8type=char
15151                 u8type="unsigned char"
15152                 i8size=$charsize
15153                 u8size=$charsize
15154                 ;;
15155         esac
15156         ;;
15157 esac
15158 case "$i8type" in
15159 '')     set try -DINT8
15160         if eval $compile; then
15161                 case "`$run ./try`" in
15162                 int8_t) i8type=int8_t
15163                         u8type=uint8_t
15164                         i8size=1
15165                         u8size=1
15166                         ;;
15167                 esac
15168         fi
15169         ;;
15170 esac
15171 case "$i8type" in
15172 '')     if $test $charsize -ge 1; then
15173                 i8type=char
15174                 u8type="unsigned char"
15175                 i8size=$charsize
15176                 u8size=$charsize
15177         fi
15178         ;;
15179 esac
15180
15181 case "$i16type" in
15182 '')     case "$shortsize" in
15183         2)      i16type=short
15184                 u16type="unsigned short"
15185                 i16size=$shortsize
15186                 u16size=$shortsize
15187                 ;;
15188         esac
15189         ;;
15190 esac
15191 case "$i16type" in
15192 '')     set try -DINT16
15193         if eval $compile; then
15194                 case "`$run ./try`" in
15195                 int16_t)
15196                         i16type=int16_t
15197                         u16type=uint16_t
15198                         i16size=2
15199                         u16size=2
15200                         ;;
15201                 esac
15202         fi
15203         ;;
15204 esac
15205 case "$i16type" in
15206 '')     if $test $shortsize -ge 2; then
15207                 i16type=short
15208                 u16type="unsigned short"
15209                 i16size=$shortsize
15210                 u16size=$shortsize
15211         fi
15212         ;;
15213 esac
15214
15215 case "$i32type" in
15216 '')     case "$longsize" in
15217         4)      i32type=long
15218                 u32type="unsigned long"
15219                 i32size=$longsize
15220                 u32size=$longsize
15221                 ;;
15222         *)      case "$intsize" in
15223                 4)      i32type=int
15224                         u32type="unsigned int"
15225                         i32size=$intsize
15226                         u32size=$intsize
15227                         ;;
15228                 esac
15229                 ;;
15230         esac
15231         ;;
15232 esac
15233 case "$i32type" in
15234 '')     set try -DINT32
15235         if eval $compile; then
15236                 case "`$run ./try`" in
15237                 int32_t)
15238                         i32type=int32_t
15239                         u32type=uint32_t
15240                         i32size=4
15241                         u32size=4
15242                         ;;
15243                 esac
15244         fi
15245         ;;
15246 esac
15247 case "$i32type" in
15248 '')     if $test $intsize -ge 4; then
15249                 i32type=int
15250                 u32type="unsigned int"
15251                 i32size=$intsize
15252                 u32size=$intsize
15253         fi
15254         ;;
15255 esac
15256
15257 case "$i64type" in
15258 '')     case "$d_quad:$quadtype" in
15259         define:?*)
15260                 i64type="$quadtype"
15261                 u64type="$uquadtype"
15262                 i64size=8
15263                 u64size=8
15264                 ;;
15265         esac
15266         ;;
15267 esac
15268
15269 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15270 : volatile so that the compiler has to store it out to memory.
15271 if test X"$d_volatile" = X"$define"; then
15272         volatile=volatile
15273 fi
15274 $cat <<EOP >try.c
15275 #include <stdio.h>
15276 #$i_stdlib I_STDLIB
15277 #ifdef I_STDLIB
15278 #include <stdlib.h>
15279 #endif
15280 #include <sys/types.h>
15281 #include <signal.h>
15282 #ifdef SIGFPE
15283 $volatile int bletched = 0;
15284 $signal_t blech(int s) { bletched = 1; }
15285 #endif
15286 int main() {
15287     $uvtype u = 0;
15288     $nvtype d;
15289     int     n = 8 * $uvsize;
15290     int     i;
15291 #ifdef SIGFPE
15292     signal(SIGFPE, blech);
15293 #endif
15294
15295     for (i = 0; i < n; i++) {
15296       u = u << 1 | ($uvtype)1;
15297       d = ($nvtype)u;
15298       if (($uvtype)d != u)
15299         break;
15300       if (d <= 0)
15301         break;
15302       d = ($nvtype)(u - 1);
15303       if (($uvtype)d != (u - 1))
15304         break;
15305 #ifdef SIGFPE
15306       if (bletched)
15307         break;
15308 #endif
15309     }
15310     printf("%d\n", ((i == n) ? -n : i));
15311     exit(0);
15312 }
15313 EOP
15314 set try
15315
15316 d_nv_preserves_uv="$undef"
15317 if eval $compile; then
15318         nv_preserves_uv_bits="`$run ./try`"
15319 fi
15320 case "$nv_preserves_uv_bits" in
15321 \-[1-9]*)       
15322         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15323         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15324         d_nv_preserves_uv="$define"
15325         ;;
15326 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15327         d_nv_preserves_uv="$undef" ;;
15328 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15329         nv_preserves_uv_bits="0" ;;
15330 esac
15331
15332 $rm -f try.* try
15333
15334 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15335 : volatile so that the compiler has to store it out to memory.
15336 if test X"$d_volatile" = X"$define"; then
15337         volatile=volatile
15338 fi
15339 $cat <<EOP >try.c
15340 #include <stdio.h>
15341 #$i_stdlib I_STDLIB
15342 #ifdef I_STDLIB
15343 #include <stdlib.h>
15344 #endif
15345 #$i_string I_STRING
15346 #ifdef I_STRING
15347 #  include <string.h>
15348 #else
15349 #  include <strings.h>
15350 #endif
15351 #include <sys/types.h>
15352 #include <signal.h>
15353 #ifdef SIGFPE
15354 $volatile int bletched = 0;
15355 $signal_t blech(int s) { bletched = 1; }
15356 #endif
15357
15358 int checkit($nvtype d, char *where) {
15359     unsigned char *p = (char *)&d;
15360     unsigned char *end = p + sizeof(d);
15361     int fail = 0;
15362
15363     while (p < end)
15364         fail += *p++;
15365
15366     if (!fail)
15367         return 0;
15368
15369     p = (char *)&d;
15370     printf("No - %s: 0x", where);
15371     while (p < end)
15372         printf ("%02X", *p++);
15373     printf("\n");
15374     return 1;
15375 }
15376
15377 int main(int argc, char **argv) {
15378     $nvtype d = 0.0;
15379     int fail = 0;
15380     fail += checkit(d, "0.0");
15381
15382     /* The compiler shouldn't be assuming that bletched is 0  */
15383     d = bletched;
15384
15385     fail += checkit(d, "bleched");
15386
15387 #ifdef SIGFPE
15388     signal(SIGFPE, blech);
15389 #endif
15390
15391     /* Paranoia - the compiler should have no way of knowing that ANSI says
15392        that argv[argc] will always be NULL.  Actually, if it did assume this it
15393        would be buggy, as this is C and main() can be called from elsewhere in
15394        the program.  */
15395     d = argv[argc] ? 1 : 0;
15396
15397     if (d) {
15398         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15399     }
15400
15401     fail += checkit(d, "ternary");
15402
15403     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15404
15405     if (d != 0.0) {
15406         printf("No - memset doesn't give 0.0\n");
15407         /* This might just blow up:  */
15408         printf("(gives %g)\n", d);
15409         return 1;
15410     }
15411     
15412 #ifdef SIGFPE
15413     if (bletched) {
15414         printf("No - something bleched\n");
15415         return 1;
15416     }
15417 #endif
15418     if (fail) {
15419       printf("No - %d fail(s)\n", fail);
15420       return 1;
15421     }
15422     printf("Yes\n");
15423     return 0;
15424 }
15425 EOP
15426 set try
15427
15428 d_nv_zero_is_allbits_zero="$undef"
15429 if eval $compile; then
15430     xxx="`$run ./try`"
15431     case "$?" in
15432         0)
15433             case "$xxx" in
15434                 Yes)  cat >&4 <<EOM
15435 0.0 is represented as all bits zero in memory
15436 EOM
15437                     d_nv_zero_is_allbits_zero="$define"
15438                     ;;
15439                 *)  cat >&4 <<EOM
15440 0.0 is not represented as all bits zero in memory
15441 EOM
15442                     d_nv_zero_is_allbits_zero="$undef"
15443                     ;;
15444             esac
15445             ;;
15446         *)  cat >&4 <<EOM
15447 0.0 is not represented as all bits zero in memory
15448 EOM
15449             d_nv_zero_is_allbits_zero="$undef"
15450             ;;
15451     esac
15452 fi
15453
15454 $rm -f try.* try
15455
15456
15457 : check for off64_t
15458 echo " "
15459 echo "Checking to see if you have off64_t..." >&4
15460 $cat >try.c <<EOCP
15461 #include <sys/types.h>
15462 #include <unistd.h>
15463 int main() { off64_t x = 7; }
15464 EOCP
15465 set try
15466 if eval $compile; then
15467         val="$define"
15468         echo "You have off64_t."
15469 else
15470         val="$undef"
15471         echo "You do not have off64_t."
15472         case "$lseeksize" in
15473         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15474         esac
15475 fi
15476 $rm -f try.* try
15477 set d_off64_t
15478 eval $setvar
15479
15480 : how to create joinable pthreads
15481 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15482         echo " "
15483         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15484         $cat >try.c <<'EOCP'
15485 #include <pthread.h>
15486 int main() {
15487     int detachstate = JOINABLE;
15488 }
15489 EOCP
15490         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15491         if eval $compile; then
15492                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15493                 val="$undef" # Yes, undef.
15494                 set d_old_pthread_create_joinable
15495                 eval $setvar
15496                 val=""
15497                 set old_pthread_create_joinable
15498                 eval $setvar
15499         else
15500                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15501                 if eval $compile; then
15502                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15503                         val="$define"
15504                         set d_old_pthread_create_joinable
15505                         eval $setvar
15506                         val=PTHREAD_CREATE_UNDETACHED
15507                         set old_pthread_create_joinable
15508                         eval $setvar
15509                 else            
15510                         set try -DJOINABLE=__UNDETACHED
15511                         if eval $compile; then
15512                                 echo "You seem to use __UNDETACHED." >&4
15513                                 val="$define"
15514                                 set d_old_pthread_create_joinable
15515                                 eval $setvar
15516                                 val=__UNDETACHED
15517                                 set old_pthread_create_joinable
15518                                 eval $setvar
15519                         else
15520                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15521                                 val="$define"
15522                                 set d_old_pthread_create_joinable
15523                                 eval $setvar
15524                                 val=0
15525                                 set old_pthread_create_joinable
15526                                 eval $setvar
15527                         fi
15528                 fi
15529         fi
15530         $rm -f try try.*
15531 else
15532     d_old_pthread_create_joinable="$undef"
15533     old_pthread_create_joinable=""
15534 fi
15535
15536 : see if pause exists
15537 set pause d_pause
15538 eval $inlibc
15539
15540 : see if pipe exists
15541 set pipe d_pipe
15542 eval $inlibc
15543
15544 : see if poll exists
15545 set poll d_poll
15546 eval $inlibc
15547
15548 : see if readlink exists
15549 set readlink d_readlink
15550 eval $inlibc
15551
15552 echo " "
15553 procselfexe=''
15554 val="$undef"
15555 case "$d_readlink" in
15556 "$define")
15557         if $issymlink /proc/self/exe ; then
15558                 $ls -l /proc/self/exe > reflect
15559                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15560                         echo "You have Linux-like /proc/self/exe."
15561                         procselfexe='"/proc/self/exe"'
15562                         val="$define"
15563                 fi
15564         fi
15565         if $issymlink /proc/curproc/file ; then
15566                 $ls -l /proc/curproc/file > reflect
15567                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15568                         echo "You have BSD-like /proc/curproc/file."
15569                         procselfexe='"/proc/curproc/file"'
15570                         val="$define"
15571                 fi
15572         fi
15573         ;;
15574 esac
15575 $rm -f reflect
15576 set d_procselfexe
15577 eval $setvar
15578
15579 : backward compatibility for d_hvfork
15580 if test X$d_hvfork != X; then
15581         d_vfork="$d_hvfork"
15582         d_hvfork=''
15583 fi
15584 : see if there is a vfork
15585 val=''
15586 set vfork val
15587 eval $inlibc
15588
15589 d_pseudofork=$undef
15590
15591 : Ok, but do we want to use it. vfork is reportedly unreliable in
15592 : perl on Solaris 2.x, and probably elsewhere.
15593 case "$val" in
15594 $define)
15595         echo " "
15596         case "$usevfork" in
15597         false) dflt='n';;
15598         *) dflt='y';;
15599         esac
15600         cat <<'EOM'
15601
15602 Perl can only use a vfork() that doesn't suffer from strict
15603 restrictions on calling functions or modifying global data in
15604 the child.  For example, glibc-2.1 contains such a vfork()
15605 that is unsuitable.  If your system provides a proper fork()
15606 call, chances are that you do NOT want perl to use vfork().
15607
15608 EOM
15609         rp="Do you still want to use vfork()?"
15610         . ./myread
15611         case "$ans" in
15612         y|Y) ;;
15613         *)
15614                 echo "Ok, we won't use vfork()."
15615                 val="$undef"
15616                 ;;
15617         esac
15618         ;;
15619 esac
15620 set d_vfork
15621 eval $setvar
15622 case "$d_vfork" in
15623 $define) usevfork='true';;
15624 *) usevfork='false';;
15625 esac
15626
15627 : see whether the pthread_atfork exists
15628 $cat >try.c <<EOP
15629 #include <pthread.h>
15630 #include <stdio.h>
15631 int main() {
15632 #ifdef  PTHREAD_ATFORK
15633         pthread_atfork(NULL,NULL,NULL);
15634 #endif
15635 }
15636 EOP
15637
15638 : see if pthread_atfork exists
15639 set try -DPTHREAD_ATFORK
15640 if eval $compile; then
15641     val="$define"
15642 else
15643     val="$undef"
15644 fi
15645 case "$usethreads" in
15646 $define)
15647         case "$val" in
15648         $define) echo 'pthread_atfork found.' >&4        ;;
15649         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15650         esac
15651 esac
15652 set d_pthread_atfork
15653 eval $setvar
15654
15655 : see if pthread_attr_setscope exists
15656 set pthread_attr_setscope d_pthread_attr_setscope
15657 eval $inlibc
15658
15659
15660 : see whether the various POSIXish _yields exist
15661 $cat >try.c <<EOP
15662 #include <pthread.h>
15663 #include <stdio.h>
15664 int main() {
15665 #ifdef SCHED_YIELD
15666         sched_yield();
15667 #else
15668 #ifdef PTHREAD_YIELD
15669         pthread_yield();
15670 #else
15671 #ifdef PTHREAD_YIELD_NULL
15672         pthread_yield(NULL);
15673 #endif
15674 #endif
15675 #endif
15676 }
15677 EOP
15678 : see if sched_yield exists
15679 set try -DSCHED_YIELD
15680 if eval $compile; then
15681     val="$define"
15682     sched_yield='sched_yield()'
15683 else
15684     val="$undef"
15685 fi
15686 case "$usethreads" in
15687 $define)
15688         case "$val" in
15689         $define) echo 'sched_yield() found.' >&4        ;;
15690         *)       echo 'sched_yield() NOT found.' >&4    ;;
15691         esac
15692 esac
15693 set d_sched_yield
15694 eval $setvar
15695
15696 : see if pthread_yield exists
15697 set try -DPTHREAD_YIELD
15698 if eval $compile; then
15699     val="$define"
15700     case "$sched_yield" in
15701     '') sched_yield='pthread_yield()' ;;
15702     esac
15703 else
15704     set try -DPTHREAD_YIELD_NULL
15705     if eval $compile; then
15706         val="$define"
15707         case "$sched_yield" in
15708         '') sched_yield='pthread_yield(NULL)' ;;
15709         esac
15710     else
15711         val="$undef"
15712     fi
15713 fi
15714 case "$usethreads" in
15715 $define)
15716         case "$val" in
15717         $define) echo 'pthread_yield() found.' >&4      ;;
15718         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15719         esac
15720         ;;
15721 esac
15722 set d_pthread_yield
15723 eval $setvar
15724
15725 case "$sched_yield" in
15726 '') sched_yield=undef ;;
15727 esac
15728
15729 $rm -f try try.*
15730
15731 : see if random_r exists
15732 set random_r d_random_r
15733 eval $inlibc
15734 case "$d_random_r" in
15735 "$define")
15736         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15737         case "$d_random_r_proto:$usethreads" in
15738         ":define")      d_random_r_proto=define
15739                 set d_random_r_proto random_r $hdrs
15740                 eval $hasproto ;;
15741         *)      ;;
15742         esac
15743         case "$d_random_r_proto" in
15744         define)
15745         case "$random_r_proto" in
15746         ''|0) try='int random_r(int*, struct random_data*);'
15747         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15748         esac
15749         case "$random_r_proto" in
15750         ''|0) try='int random_r(long*, struct random_data*);'
15751         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15752         esac
15753         case "$random_r_proto" in
15754         ''|0) try='int random_r(struct random_data*, int32_t*);'
15755         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15756         esac
15757         case "$random_r_proto" in
15758         ''|0)   d_random_r=undef
15759                 random_r_proto=0
15760                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15761         * )     case "$random_r_proto" in
15762                 REENTRANT_PROTO*) ;;
15763                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15764                 esac
15765                 echo "Prototype: $try" ;;
15766         esac
15767         ;;
15768         *)      case "$usethreads" in
15769                 define) echo "random_r has no prototype, not using it." >&4 ;;
15770                 esac
15771                 d_random_r=undef
15772                 random_r_proto=0
15773                 ;;
15774         esac
15775         ;;
15776 *)      random_r_proto=0
15777         ;;
15778 esac
15779
15780 : see if readdir and friends exist
15781 set readdir d_readdir
15782 eval $inlibc
15783 set seekdir d_seekdir
15784 eval $inlibc
15785 set telldir d_telldir
15786 eval $inlibc
15787 set rewinddir d_rewinddir
15788 eval $inlibc
15789
15790 : see if readdir64_r exists
15791 set readdir64_r d_readdir64_r
15792 eval $inlibc
15793 case "$d_readdir64_r" in
15794 "$define")
15795         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15796         case "$d_readdir64_r_proto:$usethreads" in
15797         ":define")      d_readdir64_r_proto=define
15798                 set d_readdir64_r_proto readdir64_r $hdrs
15799                 eval $hasproto ;;
15800         *)      ;;
15801         esac
15802         case "$d_readdir64_r_proto" in
15803         define)
15804         case "$readdir64_r_proto" in
15805         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15806         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15807         esac
15808         case "$readdir64_r_proto" in
15809         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15810         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15811         esac
15812         case "$readdir64_r_proto" in
15813         ''|0)   d_readdir64_r=undef
15814                 readdir64_r_proto=0
15815                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15816         * )     case "$readdir64_r_proto" in
15817                 REENTRANT_PROTO*) ;;
15818                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15819                 esac
15820                 echo "Prototype: $try" ;;
15821         esac
15822         ;;
15823         *)      case "$usethreads" in
15824                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15825                 esac
15826                 d_readdir64_r=undef
15827                 readdir64_r_proto=0
15828                 ;;
15829         esac
15830         ;;
15831 *)      readdir64_r_proto=0
15832         ;;
15833 esac
15834
15835 : see if readdir_r exists
15836 set readdir_r d_readdir_r
15837 eval $inlibc
15838 case "$d_readdir_r" in
15839 "$define")
15840         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15841         case "$d_readdir_r_proto:$usethreads" in
15842         ":define")      d_readdir_r_proto=define
15843                 set d_readdir_r_proto readdir_r $hdrs
15844                 eval $hasproto ;;
15845         *)      ;;
15846         esac
15847         case "$d_readdir_r_proto" in
15848         define)
15849         case "$readdir_r_proto" in
15850         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15851         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15852         esac
15853         case "$readdir_r_proto" in
15854         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15855         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15856         esac
15857         case "$readdir_r_proto" in
15858         ''|0)   d_readdir_r=undef
15859                 readdir_r_proto=0
15860                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15861         * )     case "$readdir_r_proto" in
15862                 REENTRANT_PROTO*) ;;
15863                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15864                 esac
15865                 echo "Prototype: $try" ;;
15866         esac
15867         ;;
15868         *)      case "$usethreads" in
15869                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15870                 esac
15871                 d_readdir_r=undef
15872                 readdir_r_proto=0
15873                 ;;
15874         esac
15875         ;;
15876 *)      readdir_r_proto=0
15877         ;;
15878 esac
15879
15880 : see if readv exists
15881 set readv d_readv
15882 eval $inlibc
15883
15884 : see if recvmsg exists
15885 set recvmsg d_recvmsg
15886 eval $inlibc
15887
15888 : see if rename exists
15889 set rename d_rename
15890 eval $inlibc
15891
15892 : see if rmdir exists
15893 set rmdir d_rmdir
15894 eval $inlibc
15895
15896 : see if memory.h is available.
15897 val=''
15898 set memory.h val
15899 eval $inhdr
15900
15901 : See if it conflicts with string.h
15902 case "$val" in
15903 $define)
15904         case "$strings" in
15905         '') ;;
15906         *)
15907                 $cppstdin $cppflags $cppminus < $strings > mem.h
15908                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15909                         echo " "
15910                         echo "We won't be including <memory.h>."
15911                         val="$undef"
15912                 fi
15913                 $rm -f mem.h
15914                 ;;
15915         esac
15916 esac
15917 set i_memory
15918 eval $setvar
15919
15920 : can bcopy handle overlapping blocks?
15921 echo " "
15922 val="$undef"
15923 case "$d_memmove" in
15924 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15925 *)      case "$d_bcopy" in
15926         "$define")
15927                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15928                 $cat >try.c <<EOCP
15929 #$i_memory I_MEMORY
15930 #$i_stdlib I_STDLIB
15931 #$i_string I_STRING
15932 #$i_unistd I_UNISTD
15933 EOCP
15934         $cat >>try.c <<'EOCP'
15935 #include <stdio.h>
15936 #ifdef I_MEMORY
15937 #  include <memory.h>
15938 #endif
15939 #ifdef I_STDLIB
15940 #  include <stdlib.h>
15941 #endif
15942 #ifdef I_STRING
15943 #  include <string.h>
15944 #else
15945 #  include <strings.h>
15946 #endif
15947 #ifdef I_UNISTD
15948 #  include <unistd.h>  /* Needed for NetBSD */
15949 #endif
15950 int main()
15951 {
15952 char buf[128], abc[128];
15953 char *b;
15954 int len;
15955 int off;
15956 int align;
15957
15958 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15959    try to store the string in read-only memory. */
15960 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15961
15962 for (align = 7; align >= 0; align--) {
15963         for (len = 36; len; len--) {
15964                 b = buf+align;
15965                 bcopy(abc, b, len);
15966                 for (off = 1; off <= len; off++) {
15967                         bcopy(b, b+off, len);
15968                         bcopy(b+off, b, len);
15969                         if (bcmp(b, abc, len))
15970                                 exit(1);
15971                 }
15972         }
15973 }
15974 exit(0);
15975 }
15976 EOCP
15977                 set try
15978                 if eval $compile_ok; then
15979                         if ./try 2>/dev/null; then
15980                                 echo "Yes, it can."
15981                                 val="$define"
15982                         else
15983                                 echo "It can't, sorry."
15984                         fi
15985                 else
15986                         echo "(I can't compile the test program, so we'll assume not...)"
15987                 fi
15988                 ;;
15989         esac
15990         $rm -f try.* try core
15991         ;;
15992 esac
15993 set d_safebcpy
15994 eval $setvar
15995
15996 : can memcpy handle overlapping blocks?
15997 echo " "
15998 val="$undef"
15999 case "$d_memmove" in
16000 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16001 *)      case "$d_memcpy" in
16002         "$define")
16003                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16004                 $cat >try.c <<EOCP
16005 #$i_memory I_MEMORY
16006 #$i_stdlib I_STDLIB
16007 #$i_string I_STRING
16008 #$i_unistd I_UNISTD
16009 EOCP
16010         $cat >>try.c <<'EOCP'
16011 #include <stdio.h>
16012 #ifdef I_MEMORY
16013 #  include <memory.h>
16014 #endif
16015 #ifdef I_STDLIB
16016 #  include <stdlib.h>
16017 #endif
16018 #ifdef I_STRING
16019 #  include <string.h>
16020 #else
16021 #  include <strings.h>
16022 #endif
16023 #ifdef I_UNISTD
16024 #  include <unistd.h>  /* Needed for NetBSD */
16025 #endif
16026 int main()
16027 {
16028 char buf[128], abc[128];
16029 char *b;
16030 int len;
16031 int off;
16032 int align;
16033
16034 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16035    try to store the string in read-only memory. */
16036 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16037
16038 for (align = 7; align >= 0; align--) {
16039         for (len = 36; len; len--) {
16040                 b = buf+align;
16041                 memcpy(b, abc, len);
16042                 for (off = 1; off <= len; off++) {
16043                         memcpy(b+off, b, len);
16044                         memcpy(b, b+off, len);
16045                         if (memcmp(b, abc, len))
16046                                 exit(1);
16047                 }
16048         }
16049 }
16050 exit(0);
16051 }
16052 EOCP
16053                 set try
16054                 if eval $compile_ok; then
16055                         if ./try 2>/dev/null; then
16056                                 echo "Yes, it can."
16057                                 val="$define"
16058                         else
16059                                 echo "It can't, sorry."
16060                         fi
16061                 else
16062                         echo "(I can't compile the test program, so we'll assume not...)"
16063                 fi
16064                 ;;
16065         esac
16066         $rm -f try.* try core
16067         ;;
16068 esac
16069 set d_safemcpy
16070 eval $setvar
16071
16072 : can memcmp be trusted to compare relative magnitude?
16073 val="$undef"
16074 case "$d_memcmp" in
16075 "$define")
16076         echo " "
16077         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16078         $cat >try.c <<EOCP
16079 #$i_memory I_MEMORY
16080 #$i_stdlib I_STDLIB
16081 #$i_string I_STRING
16082 #$i_unistd I_UNISTD
16083 EOCP
16084         $cat >>try.c <<'EOCP'
16085 #include <stdio.h>
16086 #ifdef I_MEMORY
16087 #  include <memory.h>
16088 #endif
16089 #ifdef I_STDLIB
16090 #  include <stdlib.h>
16091 #endif
16092 #ifdef I_STRING
16093 #  include <string.h>
16094 #else
16095 #  include <strings.h>
16096 #endif
16097 #ifdef I_UNISTD
16098 #  include <unistd.h>  /* Needed for NetBSD */
16099 #endif
16100 int main()
16101 {
16102 char a = -1;
16103 char b = 0;
16104 if ((a < b) && memcmp(&a, &b, 1) < 0)
16105         exit(1);
16106 exit(0);
16107 }
16108 EOCP
16109         set try
16110         if eval $compile_ok; then
16111                 if $run ./try 2>/dev/null; then
16112                         echo "Yes, it can."
16113                         val="$define"
16114                 else
16115                         echo "No, it can't (it uses signed chars)."
16116                 fi
16117         else
16118                 echo "(I can't compile the test program, so we'll assume not...)"
16119         fi
16120         ;;
16121 esac
16122 $rm -f try.* try core
16123 set d_sanemcmp
16124 eval $setvar
16125
16126 : see if prototype for sbrk is available
16127 echo " "
16128 set d_sbrkproto sbrk $i_unistd unistd.h
16129 eval $hasproto
16130
16131 : see if select exists
16132 set select d_select
16133 eval $inlibc
16134
16135 : see if semctl exists
16136 set semctl d_semctl
16137 eval $inlibc
16138
16139 : see if semget exists
16140 set semget d_semget
16141 eval $inlibc
16142
16143 : see if semop exists
16144 set semop d_semop
16145 eval $inlibc
16146
16147 : see how much of the 'sem*(2)' library is present.
16148 h_sem=true
16149 echo " "
16150 case "$d_semctl$d_semget$d_semop" in
16151 *"$undef"*) h_sem=false;;
16152 esac
16153 case "$osname" in
16154 freebsd)
16155     case "`ipcs 2>&1`" in
16156     "SVID messages"*"not configured"*)
16157         echo "Your $osname does not have the sem*(2) configured." >&4
16158         h_sem=false
16159         val="$undef"
16160         set semctl d_semctl
16161         eval $setvar
16162         set semget d_semget
16163         eval $setvar
16164         set semop d_semop
16165         eval $setvar
16166         ;;
16167     esac
16168     ;;
16169 esac
16170 : we could also check for sys/ipc.h ...
16171 if $h_sem && $test `./findhdr sys/sem.h`; then
16172         echo "You have the full sem*(2) library." >&4
16173         val="$define"
16174 else
16175         echo "You don't have the full sem*(2) library." >&4
16176         val="$undef"
16177 fi
16178 set d_sem
16179 eval $setvar
16180
16181 : see whether sys/sem.h defines union semun
16182 echo " "
16183 $cat > try.c <<'END'
16184 #include <sys/types.h>
16185 #include <sys/ipc.h>
16186 #include <sys/sem.h>
16187 int main () { union semun semun; semun.buf = 0; }
16188 END
16189 set try
16190 if eval $compile; then
16191     echo "You have union semun in <sys/sem.h>." >&4
16192     val="$define"
16193 else
16194     echo "You do not have union semun in <sys/sem.h>." >&4
16195     val="$undef"
16196 fi
16197 $rm -f try try.c
16198 set d_union_semun
16199 eval $setvar
16200
16201 : see how to do semctl IPC_STAT
16202 case "$d_sem" in
16203 $define)
16204     echo " "
16205     $cat > try.h <<END
16206 #ifndef S_IRUSR
16207 #   ifdef S_IREAD
16208 #       define S_IRUSR S_IREAD
16209 #       define S_IWUSR S_IWRITE
16210 #       define S_IXUSR S_IEXEC
16211 #   else
16212 #       define S_IRUSR 0400
16213 #       define S_IWUSR 0200
16214 #       define S_IXUSR 0100
16215 #   endif
16216 #   define S_IRGRP (S_IRUSR>>3)
16217 #   define S_IWGRP (S_IWUSR>>3)
16218 #   define S_IXGRP (S_IXUSR>>3)
16219 #   define S_IROTH (S_IRUSR>>6)
16220 #   define S_IWOTH (S_IWUSR>>6)
16221 #   define S_IXOTH (S_IXUSR>>6)
16222 #endif
16223 #ifndef S_IRWXU
16224 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16225 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16226 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16227 #endif
16228 END
16229     : see whether semctl IPC_STAT can use union semun
16230     case "$d_semctl_semun" in
16231     '')
16232       val="$undef"
16233       $cat > try.c <<END
16234 #include <sys/types.h>
16235 #include <sys/ipc.h>
16236 #include <sys/sem.h>
16237 #include <sys/stat.h>
16238 #include <stdio.h>
16239 #include <errno.h>
16240 #include "try.h"
16241 #ifndef errno
16242 extern int errno;
16243 #endif
16244 #$d_union_semun HAS_UNION_SEMUN
16245 int main() {
16246     union semun
16247 #ifndef HAS_UNION_SEMUN
16248     {
16249         int val;
16250         struct semid_ds *buf;
16251         unsigned short *array;
16252     }
16253 #endif
16254     arg;
16255     int sem, st;
16256
16257 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16258     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16259     if (sem > -1) {
16260         struct semid_ds argbuf;
16261         arg.buf = &argbuf;
16262 #       ifdef IPC_STAT
16263         st = semctl(sem, 0, IPC_STAT, arg);
16264         if (st == 0)
16265             printf("semun\n");
16266         else
16267 #       endif /* IPC_STAT */
16268             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16269 #       ifdef IPC_RMID
16270         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16271 #       endif /* IPC_RMID */
16272             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16273     } else
16274 #endif /* IPC_PRIVATE && ... */
16275         printf("semget failed: errno = %d\n", errno);
16276   return 0;
16277 }
16278 END
16279       set try
16280       if eval $compile; then
16281           xxx=`$run ./try`
16282           case "$xxx" in
16283           semun) val="$define" ;;
16284           esac
16285       fi
16286       $rm -f try try.c
16287       set d_semctl_semun
16288       eval $setvar
16289       ;;
16290     esac
16291     case "$d_semctl_semun" in
16292     $define)
16293         echo "You can use union semun for semctl IPC_STAT." >&4
16294         also='also'
16295         ;;
16296     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16297         also=''
16298         ;;
16299     esac
16300
16301     : see whether semctl IPC_STAT can use struct semid_ds pointer
16302     case "$d_semctl_semid_ds" in
16303     '')
16304       val="$undef"
16305       $cat > try.c <<'END'
16306 #include <sys/types.h>
16307 #include <sys/ipc.h>
16308 #include <sys/sem.h>
16309 #include <sys/stat.h>
16310 #include "try.h"
16311 #include <stdio.h>
16312 #include <errno.h>
16313 #ifndef errno
16314 extern int errno;
16315 #endif
16316 int main() {
16317     struct semid_ds arg;
16318     int sem, st;
16319
16320 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16321     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16322     if (sem > -1) {
16323 #       ifdef IPC_STAT
16324         st = semctl(sem, 0, IPC_STAT, &arg);
16325         if (st == 0)
16326             printf("semid_ds\n");
16327         else
16328 #       endif /* IPC_STAT */
16329             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16330 #       ifdef IPC_RMID
16331         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16332 #       endif /* IPC_RMID */
16333             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16334     } else
16335 #endif /* IPC_PRIVATE && ... */
16336         printf("semget failed: errno = %d\n", errno);
16337
16338     return 0;
16339 }
16340 END
16341       set try
16342       if eval $compile; then
16343           xxx=`$run ./try`
16344           case "$xxx" in
16345           semid_ds) val="$define" ;;
16346           esac
16347       fi
16348       $rm -f try try.c
16349       set d_semctl_semid_ds
16350       eval $setvar
16351       ;;
16352     esac
16353     case "$d_semctl_semid_ds" in
16354     $define)
16355         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16356         ;;
16357     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16358         ;;
16359     esac
16360     $rm -f try.h
16361     ;;
16362 *)  val="$undef"
16363
16364     # We do not have the full sem*(2) library, so assume we can not
16365     # use either.
16366
16367     set d_semctl_semun
16368     eval $setvar
16369
16370     set d_semctl_semid_ds
16371     eval $setvar
16372     ;;
16373 esac
16374
16375 : see if sendmsg exists
16376 set sendmsg d_sendmsg
16377 eval $inlibc
16378
16379 : see if setegid exists
16380 set setegid d_setegid
16381 eval $inlibc
16382
16383 : see if seteuid exists
16384 set seteuid d_seteuid
16385 eval $inlibc
16386
16387 : see if setgrent exists
16388 set setgrent d_setgrent
16389 eval $inlibc
16390
16391 : see if setgrent_r exists
16392 set setgrent_r d_setgrent_r
16393 eval $inlibc
16394 case "$d_setgrent_r" in
16395 "$define")
16396         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16397         case "$d_setgrent_r_proto:$usethreads" in
16398         ":define")      d_setgrent_r_proto=define
16399                 set d_setgrent_r_proto setgrent_r $hdrs
16400                 eval $hasproto ;;
16401         *)      ;;
16402         esac
16403         case "$d_setgrent_r_proto" in
16404         define)
16405         case "$setgrent_r_proto" in
16406         ''|0) try='int setgrent_r(FILE**);'
16407         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16408         esac
16409         case "$setgrent_r_proto" in
16410         ''|0) try='void setgrent_r(FILE**);'
16411         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16412         esac
16413         case "$setgrent_r_proto" in
16414         ''|0)   d_setgrent_r=undef
16415                 setgrent_r_proto=0
16416                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16417         * )     case "$setgrent_r_proto" in
16418                 REENTRANT_PROTO*) ;;
16419                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16420                 esac
16421                 echo "Prototype: $try" ;;
16422         esac
16423         ;;
16424         *)      case "$usethreads" in
16425                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16426                 esac
16427                 d_setgrent_r=undef
16428                 setgrent_r_proto=0
16429                 ;;
16430         esac
16431         ;;
16432 *)      setgrent_r_proto=0
16433         ;;
16434 esac
16435
16436 : see if sethostent exists
16437 set sethostent d_sethent
16438 eval $inlibc
16439
16440 : see if sethostent_r exists
16441 set sethostent_r d_sethostent_r
16442 eval $inlibc
16443 case "$d_sethostent_r" in
16444 "$define")
16445         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16446         case "$d_sethostent_r_proto:$usethreads" in
16447         ":define")      d_sethostent_r_proto=define
16448                 set d_sethostent_r_proto sethostent_r $hdrs
16449                 eval $hasproto ;;
16450         *)      ;;
16451         esac
16452         case "$d_sethostent_r_proto" in
16453         define)
16454         case "$sethostent_r_proto" in
16455         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16456         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16457         esac
16458         case "$sethostent_r_proto" in
16459         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16460         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16461         esac
16462         case "$sethostent_r_proto" in
16463         ''|0)   d_sethostent_r=undef
16464                 sethostent_r_proto=0
16465                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16466         * )     case "$sethostent_r_proto" in
16467                 REENTRANT_PROTO*) ;;
16468                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16469                 esac
16470                 echo "Prototype: $try" ;;
16471         esac
16472         ;;
16473         *)      case "$usethreads" in
16474                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16475                 esac
16476                 d_sethostent_r=undef
16477                 sethostent_r_proto=0
16478                 ;;
16479         esac
16480         ;;
16481 *)      sethostent_r_proto=0
16482         ;;
16483 esac
16484
16485 : see if setitimer exists
16486 set setitimer d_setitimer
16487 eval $inlibc
16488
16489 : see if setlinebuf exists
16490 set setlinebuf d_setlinebuf
16491 eval $inlibc
16492
16493 : see if setlocale exists
16494 set setlocale d_setlocale
16495 eval $inlibc
16496
16497 : see if locale.h is available
16498 set locale.h i_locale
16499 eval $inhdr
16500
16501 : see if setlocale_r exists
16502 set setlocale_r d_setlocale_r
16503 eval $inlibc
16504 case "$d_setlocale_r" in
16505 "$define")
16506         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16507         case "$d_setlocale_r_proto:$usethreads" in
16508         ":define")      d_setlocale_r_proto=define
16509                 set d_setlocale_r_proto setlocale_r $hdrs
16510                 eval $hasproto ;;
16511         *)      ;;
16512         esac
16513         case "$d_setlocale_r_proto" in
16514         define)
16515         case "$setlocale_r_proto" in
16516         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16517         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16518         esac
16519         case "$setlocale_r_proto" in
16520         ''|0)   d_setlocale_r=undef
16521                 setlocale_r_proto=0
16522                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16523         * )     case "$setlocale_r_proto" in
16524                 REENTRANT_PROTO*) ;;
16525                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16526                 esac
16527                 echo "Prototype: $try" ;;
16528         esac
16529         ;;
16530         *)      case "$usethreads" in
16531                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16532                 esac
16533                 d_setlocale_r=undef
16534                 setlocale_r_proto=0
16535                 ;;
16536         esac
16537         ;;
16538 *)      setlocale_r_proto=0
16539         ;;
16540 esac
16541
16542 : see if setnetent exists
16543 set setnetent d_setnent
16544 eval $inlibc
16545
16546 : see if setnetent_r exists
16547 set setnetent_r d_setnetent_r
16548 eval $inlibc
16549 case "$d_setnetent_r" in
16550 "$define")
16551         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16552         case "$d_setnetent_r_proto:$usethreads" in
16553         ":define")      d_setnetent_r_proto=define
16554                 set d_setnetent_r_proto setnetent_r $hdrs
16555                 eval $hasproto ;;
16556         *)      ;;
16557         esac
16558         case "$d_setnetent_r_proto" in
16559         define)
16560         case "$setnetent_r_proto" in
16561         ''|0) try='int setnetent_r(int, struct netent_data*);'
16562         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16563         esac
16564         case "$setnetent_r_proto" in
16565         ''|0) try='void setnetent_r(int, struct netent_data*);'
16566         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16567         esac
16568         case "$setnetent_r_proto" in
16569         ''|0)   d_setnetent_r=undef
16570                 setnetent_r_proto=0
16571                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16572         * )     case "$setnetent_r_proto" in
16573                 REENTRANT_PROTO*) ;;
16574                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16575                 esac
16576                 echo "Prototype: $try" ;;
16577         esac
16578         ;;
16579         *)      case "$usethreads" in
16580                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16581                 esac
16582                 d_setnetent_r=undef
16583                 setnetent_r_proto=0
16584                 ;;
16585         esac
16586         ;;
16587 *)      setnetent_r_proto=0
16588         ;;
16589 esac
16590
16591 : see if setprotoent exists
16592 set setprotoent d_setpent
16593 eval $inlibc
16594
16595 : see if setpgid exists
16596 set setpgid d_setpgid
16597 eval $inlibc
16598
16599 : see if setpgrp2 exists
16600 set setpgrp2 d_setpgrp2
16601 eval $inlibc
16602
16603 : see if setpriority exists
16604 set setpriority d_setprior
16605 eval $inlibc
16606
16607 : see if setproctitle exists
16608 set setproctitle d_setproctitle
16609 eval $inlibc
16610
16611 : see if setprotoent_r exists
16612 set setprotoent_r d_setprotoent_r
16613 eval $inlibc
16614 case "$d_setprotoent_r" in
16615 "$define")
16616         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16617         case "$d_setprotoent_r_proto:$usethreads" in
16618         ":define")      d_setprotoent_r_proto=define
16619                 set d_setprotoent_r_proto setprotoent_r $hdrs
16620                 eval $hasproto ;;
16621         *)      ;;
16622         esac
16623         case "$d_setprotoent_r_proto" in
16624         define)
16625         case "$setprotoent_r_proto" in
16626         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16627         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16628         esac
16629         case "$setprotoent_r_proto" in
16630         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16631         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16632         esac
16633         case "$setprotoent_r_proto" in
16634         ''|0)   d_setprotoent_r=undef
16635                 setprotoent_r_proto=0
16636                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16637         * )     case "$setprotoent_r_proto" in
16638                 REENTRANT_PROTO*) ;;
16639                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16640                 esac
16641                 echo "Prototype: $try" ;;
16642         esac
16643         ;;
16644         *)      case "$usethreads" in
16645                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16646                 esac
16647                 d_setprotoent_r=undef
16648                 setprotoent_r_proto=0
16649                 ;;
16650         esac
16651         ;;
16652 *)      setprotoent_r_proto=0
16653         ;;
16654 esac
16655
16656 : see if setpwent exists
16657 set setpwent d_setpwent
16658 eval $inlibc
16659
16660 : see if setpwent_r exists
16661 set setpwent_r d_setpwent_r
16662 eval $inlibc
16663 case "$d_setpwent_r" in
16664 "$define")
16665         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16666         case "$d_setpwent_r_proto:$usethreads" in
16667         ":define")      d_setpwent_r_proto=define
16668                 set d_setpwent_r_proto setpwent_r $hdrs
16669                 eval $hasproto ;;
16670         *)      ;;
16671         esac
16672         case "$d_setpwent_r_proto" in
16673         define)
16674         case "$setpwent_r_proto" in
16675         ''|0) try='int setpwent_r(FILE**);'
16676         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16677         esac
16678         case "$setpwent_r_proto" in
16679         ''|0) try='void setpwent_r(FILE**);'
16680         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16681         esac
16682         case "$setpwent_r_proto" in
16683         ''|0)   d_setpwent_r=undef
16684                 setpwent_r_proto=0
16685                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16686         * )     case "$setpwent_r_proto" in
16687                 REENTRANT_PROTO*) ;;
16688                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16689                 esac
16690                 echo "Prototype: $try" ;;
16691         esac
16692         ;;
16693         *)      case "$usethreads" in
16694                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16695                 esac
16696                 d_setpwent_r=undef
16697                 setpwent_r_proto=0
16698                 ;;
16699         esac
16700         ;;
16701 *)      setpwent_r_proto=0
16702         ;;
16703 esac
16704
16705 : see if setregid exists
16706 set setregid d_setregid
16707 eval $inlibc
16708 set setresgid d_setresgid
16709 eval $inlibc
16710
16711 : see if setreuid exists
16712 set setreuid d_setreuid
16713 eval $inlibc
16714 set setresuid d_setresuid
16715 eval $inlibc
16716
16717 : see if setrgid exists
16718 set setrgid d_setrgid
16719 eval $inlibc
16720
16721 : see if setruid exists
16722 set setruid d_setruid
16723 eval $inlibc
16724
16725 : see if setservent exists
16726 set setservent d_setsent
16727 eval $inlibc
16728
16729 : see if setservent_r exists
16730 set setservent_r d_setservent_r
16731 eval $inlibc
16732 case "$d_setservent_r" in
16733 "$define")
16734         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16735         case "$d_setservent_r_proto:$usethreads" in
16736         ":define")      d_setservent_r_proto=define
16737                 set d_setservent_r_proto setservent_r $hdrs
16738                 eval $hasproto ;;
16739         *)      ;;
16740         esac
16741         case "$d_setservent_r_proto" in
16742         define)
16743         case "$setservent_r_proto" in
16744         ''|0) try='int setservent_r(int, struct servent_data*);'
16745         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16746         esac
16747         case "$setservent_r_proto" in
16748         ''|0) try='void setservent_r(int, struct servent_data*);'
16749         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16750         esac
16751         case "$setservent_r_proto" in
16752         ''|0)   d_setservent_r=undef
16753                 setservent_r_proto=0
16754                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16755         * )     case "$setservent_r_proto" in
16756                 REENTRANT_PROTO*) ;;
16757                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16758                 esac
16759                 echo "Prototype: $try" ;;
16760         esac
16761         ;;
16762         *)      case "$usethreads" in
16763                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16764                 esac
16765                 d_setservent_r=undef
16766                 setservent_r_proto=0
16767                 ;;
16768         esac
16769         ;;
16770 *)      setservent_r_proto=0
16771         ;;
16772 esac
16773
16774 : see if setsid exists
16775 set setsid d_setsid
16776 eval $inlibc
16777
16778 : see if setvbuf exists
16779 set setvbuf d_setvbuf
16780 eval $inlibc
16781
16782 : see if sfio.h is available
16783 set sfio.h i_sfio
16784 eval $inhdr
16785
16786
16787 : see if sfio library is available
16788 case "$i_sfio" in
16789 $define)
16790         val=''
16791         set sfreserve val
16792         eval $inlibc
16793         ;;
16794 *)
16795         val="$undef"
16796         ;;
16797 esac
16798 : Ok, but do we want to use it.
16799 case "$val" in
16800 $define)
16801         case "$usesfio" in
16802         true|$define|[yY]*) dflt='y';;
16803         *) dflt='n';;
16804         esac
16805         echo "$package can use the sfio library, but it is experimental."
16806         case "$useperlio" in
16807         "$undef")
16808             echo "For sfio also the PerlIO abstraction layer is needed."
16809             echo "Earlier you said you wouldn't want that."
16810             ;;
16811         esac
16812         rp="You seem to have sfio available, do you want to try using it?"
16813         . ./myread
16814         case "$ans" in
16815         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16816                 useperlio="$define"
16817                 val="$define"
16818                 ;;
16819         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16820                 val="$undef"
16821                 ;;
16822         esac
16823         ;;
16824 *)      case "$usesfio" in
16825         true|$define|[yY]*)
16826                 echo "Sorry, cannot find sfio on this machine." >&4
16827                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16828                 val="$undef"
16829                 ;;
16830         esac
16831         ;;
16832 esac
16833 set d_sfio
16834 eval $setvar
16835 case "$d_sfio" in
16836 $define) usesfio='true';;
16837 *) usesfio='false';;
16838 esac
16839 case "$d_sfio" in
16840 $define) ;;
16841 *)      : Remove sfio from list of libraries to use
16842         case "$libs" in
16843         *-lsfio*)
16844                 echo "Removing unneeded -lsfio from library list" >&4
16845                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16846                 shift
16847                 libs="$*"
16848                 echo "libs = $libs" >&4
16849                 ;;
16850         esac
16851 ;;
16852 esac
16853
16854
16855 : see if shmctl exists
16856 set shmctl d_shmctl
16857 eval $inlibc
16858
16859 : see if shmget exists
16860 set shmget d_shmget
16861 eval $inlibc
16862
16863 : see if shmat exists
16864 set shmat d_shmat
16865 eval $inlibc
16866 : see what shmat returns
16867 case "$d_shmat" in
16868 "$define")
16869         $cat >shmat.c <<'END'
16870 #include <sys/shm.h>
16871 void *shmat();
16872 END
16873         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16874                 shmattype='void *'
16875         else
16876                 shmattype='char *'
16877         fi
16878         echo "and it returns ($shmattype)." >&4
16879         : see if a prototype for shmat is available
16880         xxx=`./findhdr sys/shm.h`
16881         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16882         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16883                 val="$define"
16884         else
16885                 val="$undef"
16886         fi
16887         $rm -f shmat.[co]
16888         ;;
16889 *)
16890         val="$undef"
16891         ;;
16892 esac
16893 set d_shmatprototype
16894 eval $setvar
16895
16896 : see if shmdt exists
16897 set shmdt d_shmdt
16898 eval $inlibc
16899
16900 : see how much of the 'shm*(2)' library is present.
16901 h_shm=true
16902 echo " "
16903 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16904 *"$undef"*) h_shm=false;;
16905 esac
16906 case "$osname" in
16907 freebsd)
16908     case "`ipcs 2>&1`" in
16909     "SVID shared memory"*"not configured"*)
16910         echo "Your $osname does not have the shm*(2) configured." >&4
16911         h_shm=false
16912         val="$undef"
16913         set shmctl d_shmctl
16914         evat $setvar
16915         set shmget d_shmget
16916         evat $setvar
16917         set shmat d_shmat
16918         evat $setvar
16919         set shmdt d_shmdt
16920         evat $setvar
16921         ;;
16922     esac
16923     ;;
16924 esac
16925 : we could also check for sys/ipc.h ...
16926 if $h_shm && $test `./findhdr sys/shm.h`; then
16927         echo "You have the full shm*(2) library." >&4
16928         val="$define"
16929 else
16930         echo "You don't have the full shm*(2) library." >&4
16931         val="$undef"
16932 fi
16933 set d_shm
16934 eval $setvar
16935
16936 echo " "
16937 : see if we have sigaction
16938 if set sigaction val -f d_sigaction; eval $csym; $val; then
16939         echo 'sigaction() found.' >&4
16940         $cat > try.c <<EOP
16941 #include <stdio.h>
16942 #include <sys/types.h>
16943 #include <signal.h>
16944 #$i_stdlib I_STDLIB
16945 #ifdef I_STDLIB
16946 #include <stdlib.h>
16947 #endif
16948 int main()
16949 {
16950     struct sigaction act, oact;
16951     act.sa_flags = 0;
16952     oact.sa_handler = 0;
16953     /* so that act and oact are used */
16954     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16955 }
16956 EOP
16957         set try
16958         if eval $compile_ok; then
16959                 val="$define"
16960         else
16961                 echo "But you don't seem to have a useable struct sigaction." >&4
16962                 val="$undef"
16963         fi
16964 else
16965         echo 'sigaction NOT found.' >&4
16966         val="$undef"
16967 fi
16968 set d_sigaction; eval $setvar
16969 $rm -f try try$_o try.c
16970
16971 : see if this is a sunmath.h system
16972 set sunmath.h i_sunmath
16973 eval $inhdr
16974
16975 : see if signbit exists
16976 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
16977 $cat >try.c <<EOCP
16978 #$i_math I_MATH
16979 #$i_sunmath I_SUNMATH
16980 #ifdef I_MATH
16981 #  include <math.h>
16982 #endif
16983 #ifdef I_SUNMATH  /* Solaris special math library */
16984 #  include <sunmath.h>
16985 #endif
16986 #define NV $nvtype
16987 int main(int argc, char **argv)
16988 {
16989     NV x = 0.0;
16990     NV y = -0.0;
16991     if ((signbit(x) == 0) && (signbit(y) != 0))
16992         return 0;
16993     else
16994         return 1;
16995 }
16996 EOCP
16997 val="$undef"
16998 set try
16999 if eval $compile; then
17000     if $run ./try; then
17001         $echo "Yes." >&4
17002         val="$define"
17003     else
17004         $echo "Signbit seems to be available, but doesn't work as I expected."
17005         $echo "I won't use it." >&4
17006         val="$undef"
17007     fi
17008 else
17009     $echo "Nope." >&4
17010     dflt="$undef"
17011 fi
17012 set d_signbit
17013 eval $setvar
17014 $rm -f try.* try
17015
17016 : see if sigprocmask exists
17017 set sigprocmask d_sigprocmask
17018 eval $inlibc
17019
17020 : see if sigsetjmp exists
17021 echo " "
17022 case "$d_sigsetjmp" in
17023 '')
17024         $cat >try.c <<EOP
17025 #include <setjmp.h>
17026 #$i_stdlib I_STDLIB
17027 #ifdef I_STDLIB
17028 #include <stdlib.h>
17029 #endif
17030 sigjmp_buf env;
17031 int set = 1;
17032 int main()
17033 {
17034         if (sigsetjmp(env,1))
17035                 exit(set);
17036         set = 0;
17037         siglongjmp(env, 1);
17038         exit(1);
17039 }
17040 EOP
17041         set try
17042         if eval $compile; then
17043                 if $run ./try >/dev/null 2>&1; then
17044                         echo "POSIX sigsetjmp found." >&4
17045                         val="$define"
17046                 else
17047                         $cat >&4 <<EOM
17048 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17049 I'll ignore them.
17050 EOM
17051                         val="$undef"
17052                 fi
17053         else
17054                 echo "sigsetjmp not found." >&4
17055                 val="$undef"
17056         fi
17057         ;;
17058 *) val="$d_sigsetjmp"
17059         case "$d_sigsetjmp" in
17060         $define) echo "POSIX sigsetjmp found." >&4;;
17061         $undef) echo "sigsetjmp not found." >&4;;
17062         esac
17063         ;;
17064 esac
17065 set d_sigsetjmp
17066 eval $setvar
17067 $rm -f try.c try
17068
17069 : see if snprintf exists
17070 set snprintf d_snprintf
17071 eval $inlibc
17072
17073 : see if vsnprintf exists
17074 set vsnprintf d_vsnprintf
17075 eval $inlibc
17076
17077 case "$d_snprintf-$d_vsnprintf" in
17078 "$define-$define")
17079     $cat <<EOM
17080 Checking whether your snprintf() and vsnprintf() work okay...
17081 EOM
17082     $cat >try.c <<'EOCP'
17083 /* v?snprintf testing logic courtesy of Russ Allbery.
17084  * According to C99:
17085  * - if the buffer is too short it still must be \0-terminated
17086  * - if the buffer is too short the potentially required length
17087  *   must be returned and not -1
17088  * - if the buffer is NULL the potentially required length
17089  *   must be returned and not -1 or core dump
17090  */
17091 #include <stdio.h>
17092 #include <stdarg.h>
17093
17094 char buf[2];
17095
17096 int test (char *format, ...)
17097 {
17098     va_list args;
17099     int count;
17100
17101     va_start (args, format);
17102     count = vsnprintf (buf, sizeof buf, format, args);
17103     va_end (args);
17104     return count;
17105 }
17106
17107 int main ()
17108 {
17109     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17110              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17111 }
17112 EOCP
17113     set try
17114     if eval $compile; then
17115         `$run ./try`
17116         case "$?" in
17117         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17118         *) cat <<EOM >&4
17119 Your snprintf() and snprintf() don't seem to be working okay.
17120 EOM
17121            d_snprintf="$undef"
17122            d_vsnprintf="$undef"
17123            ;;
17124         esac
17125     else
17126         echo "(I can't seem to compile the test program--assuming they don't)"
17127         d_snprintf="$undef"
17128         d_vsnprintf="$undef"
17129     fi
17130     $rm -f try.* try core core.try.*
17131     ;;
17132 esac
17133
17134 : see if sockatmark exists
17135 set sockatmark d_sockatmark
17136 eval $inlibc
17137
17138 : see if prototype for sockatmark is available
17139 echo " "
17140 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17141 eval $hasproto
17142
17143 : see if socks5_init exists
17144 set socks5_init d_socks5_init
17145 eval $inlibc
17146
17147 : see if sprintf returns the length of the string in the buffer as per ANSI
17148 $echo "Checking whether sprintf returns the length of the string..." >&4
17149 $cat <<EOP >try.c
17150 #include <stdio.h>
17151 #$i_stdlib I_STDLIB
17152 #ifdef I_STDLIB
17153 #include <stdlib.h>
17154 #endif
17155 #$i_string I_STRING
17156 #ifdef I_STRING
17157 #  include <string.h>
17158 #else
17159 #  include <strings.h>
17160 #endif
17161 #$i_math I_MATH
17162 #ifdef I_MATH
17163 #include <math.h>
17164 #endif
17165
17166 char buffer[256];
17167
17168 int check (size_t expect, int test) {
17169   size_t got = strlen(buffer);
17170   if (expect == got)
17171     return 0;
17172
17173   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17174        test, buffer);
17175   exit (test);
17176 }
17177
17178 int main(int argc, char **argv) {
17179   int test = 0;
17180
17181   check(sprintf(buffer, ""), ++test);
17182   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17183   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17184
17185   return 0;
17186 }
17187 EOP
17188 set try
17189
17190 d_sprintf_returns_strlen="$undef"
17191 if eval $compile; then
17192     xxx="`$run ./try`"
17193     case "$?" in
17194         0) cat >&4 <<EOM
17195 sprintf returns the length of the string (as ANSI says it should)
17196 EOM
17197         d_sprintf_returns_strlen="$define"
17198         ;;
17199         *) cat >&4 <<EOM
17200 sprintf does not return the length of the string (how old is this system?)
17201 EOM
17202         d_sprintf_returns_strlen="$undef"
17203         ;;
17204     esac
17205 fi
17206
17207 $rm -f try.* try
17208
17209 : see if srand48_r exists
17210 set srand48_r d_srand48_r
17211 eval $inlibc
17212 case "$d_srand48_r" in
17213 "$define")
17214         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17215         case "$d_srand48_r_proto:$usethreads" in
17216         ":define")      d_srand48_r_proto=define
17217                 set d_srand48_r_proto srand48_r $hdrs
17218                 eval $hasproto ;;
17219         *)      ;;
17220         esac
17221         case "$d_srand48_r_proto" in
17222         define)
17223         case "$srand48_r_proto" in
17224         ''|0) try='int srand48_r(long, struct drand48_data*);'
17225         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17226         esac
17227         case "$srand48_r_proto" in
17228         ''|0)   d_srand48_r=undef
17229                 srand48_r_proto=0
17230                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17231         * )     case "$srand48_r_proto" in
17232                 REENTRANT_PROTO*) ;;
17233                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17234                 esac
17235                 echo "Prototype: $try" ;;
17236         esac
17237         ;;
17238         *)      case "$usethreads" in
17239                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17240                 esac
17241                 d_srand48_r=undef
17242                 srand48_r_proto=0
17243                 ;;
17244         esac
17245         ;;
17246 *)      srand48_r_proto=0
17247         ;;
17248 esac
17249
17250 : see if srandom_r exists
17251 set srandom_r d_srandom_r
17252 eval $inlibc
17253 case "$d_srandom_r" in
17254 "$define")
17255         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17256         case "$d_srandom_r_proto:$usethreads" in
17257         ":define")      d_srandom_r_proto=define
17258                 set d_srandom_r_proto srandom_r $hdrs
17259                 eval $hasproto ;;
17260         *)      ;;
17261         esac
17262         case "$d_srandom_r_proto" in
17263         define)
17264         case "$srandom_r_proto" in
17265         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17266         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17267         esac
17268         case "$srandom_r_proto" in
17269         ''|0)   d_srandom_r=undef
17270                 srandom_r_proto=0
17271                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17272         * )     case "$srandom_r_proto" in
17273                 REENTRANT_PROTO*) ;;
17274                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17275                 esac
17276                 echo "Prototype: $try" ;;
17277         esac
17278         ;;
17279         *)      case "$usethreads" in
17280                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17281                 esac
17282                 d_srandom_r=undef
17283                 srandom_r_proto=0
17284                 ;;
17285         esac
17286         ;;
17287 *)      srandom_r_proto=0
17288         ;;
17289 esac
17290
17291 : see if prototype for setresgid is available
17292 echo " "
17293 set d_sresgproto setresgid $i_unistd unistd.h
17294 eval $hasproto
17295
17296 : see if prototype for setresuid is available
17297 echo " "
17298 set d_sresuproto setresuid $i_unistd unistd.h
17299 eval $hasproto
17300
17301 : see if sys/stat.h is available
17302 set sys/stat.h i_sysstat
17303 eval $inhdr
17304
17305
17306 : see if stat knows about block sizes
17307 echo " "
17308 echo "Checking to see if your struct stat has st_blocks field..." >&4
17309 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17310 eval $hasfield
17311
17312
17313 : see if this is a sys/vfs.h system
17314 set sys/vfs.h i_sysvfs
17315 eval $inhdr
17316
17317
17318 : see if this is a sys/statfs.h system
17319 set sys/statfs.h i_sysstatfs
17320 eval $inhdr
17321
17322
17323 echo " "
17324 echo "Checking to see if your system supports struct statfs..." >&4
17325 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
17326 eval $hasstruct
17327 case "$d_statfs_s" in
17328 "$define")      echo "Yes, it does."   ;;
17329 *)              echo "No, it doesn't." ;;
17330 esac
17331
17332
17333
17334 : see if struct statfs knows about f_flags
17335 case "$d_statfs_s" in
17336 define) 
17337         echo " "
17338         echo "Checking to see if your struct statfs has f_flags field..." >&4
17339         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
17340         eval $hasfield
17341         ;;
17342 *)      val="$undef"
17343         set d_statfs_f_flags
17344         eval $setvar
17345         ;;
17346 esac
17347 case "$d_statfs_f_flags" in
17348 "$define")      echo "Yes, it does."   ;;
17349 *)              echo "No, it doesn't." ;;
17350 esac
17351
17352 $cat >&4 <<EOM
17353 Checking how to access stdio streams by file descriptor number...
17354 EOM
17355 case "$stdio_stream_array" in
17356 '')     $cat >try.c <<EOCP
17357 #include <stdio.h>
17358 int main() {
17359   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17360     printf("yes\n");
17361 }
17362 EOCP
17363         for s in _iob __iob __sF
17364         do
17365                 set try -DSTDIO_STREAM_ARRAY=$s
17366                 if eval $compile; then
17367                         case "`$run ./try`" in
17368                         yes)    stdio_stream_array=$s; break ;;
17369                         esac
17370                 fi
17371         done
17372         $rm -f try.* try$exe_ext
17373 esac
17374 case "$stdio_stream_array" in
17375 '')     $cat >&4 <<EOM
17376 I can't figure out how to access stdio streams by file descriptor number.
17377 EOM
17378         d_stdio_stream_array="$undef"
17379         ;;
17380 *)      $cat >&4 <<EOM
17381 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17382 EOM
17383         d_stdio_stream_array="$define"
17384         ;;
17385 esac
17386
17387 : see if strcoll exists
17388 set strcoll d_strcoll
17389 eval $inlibc
17390
17391 : check for structure copying
17392 echo " "
17393 echo "Checking to see if your C compiler can copy structs..." >&4
17394 $cat >try.c <<'EOCP'
17395 int main()
17396 {
17397         struct blurfl {
17398                 int dyick;
17399         } foo, bar;
17400
17401         foo = bar;
17402 }
17403 EOCP
17404 if $cc -c try.c >/dev/null 2>&1 ; then
17405         val="$define"
17406         echo "Yup, it can."
17407 else
17408         val="$undef"
17409         echo "Nope, it can't."
17410 fi
17411 set d_strctcpy
17412 eval $setvar
17413 $rm -f try try.*
17414
17415 : see if strerror and/or sys_errlist[] exist
17416 echo " "
17417 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17418     if set strerror val -f d_strerror; eval $csym; $val; then
17419                 echo 'strerror() found.' >&4
17420                 d_strerror="$define"
17421                 d_strerrm='strerror(e)'
17422                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17423                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17424                         d_syserrlst="$define"
17425                 else
17426                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17427                         d_syserrlst="$undef"
17428                 fi
17429     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17430                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17431                 echo 'strerror() found in string header.' >&4
17432                 d_strerror="$define"
17433                 d_strerrm='strerror(e)'
17434                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17435                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17436                                 d_syserrlst="$define"
17437                 else
17438                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17439                         d_syserrlst="$undef"
17440                 fi
17441     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17442                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17443                 d_strerror="$undef"
17444                 d_syserrlst="$define"
17445                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17446     else
17447                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17448                 d_strerror="$undef"
17449                 d_syserrlst="$undef"
17450                 d_strerrm='"unknown"'
17451     fi
17452 fi
17453
17454 : see if strerror_r exists
17455 set strerror_r d_strerror_r
17456 eval $inlibc
17457 case "$d_strerror_r" in
17458 "$define")
17459         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17460         case "$d_strerror_r_proto:$usethreads" in
17461         ":define")      d_strerror_r_proto=define
17462                 set d_strerror_r_proto strerror_r $hdrs
17463                 eval $hasproto ;;
17464         *)      ;;
17465         esac
17466         case "$d_strerror_r_proto" in
17467         define)
17468         case "$strerror_r_proto" in
17469         ''|0) try='int strerror_r(int, char*, size_t);'
17470         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17471         esac
17472         case "$strerror_r_proto" in
17473         ''|0) try='int strerror_r(int, char*, int);'
17474         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17475         esac
17476         case "$strerror_r_proto" in
17477         ''|0) try='char* strerror_r(int, char*, size_t);'
17478         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17479         esac
17480         case "$strerror_r_proto" in
17481         ''|0)   d_strerror_r=undef
17482                 strerror_r_proto=0
17483                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17484         * )     case "$strerror_r_proto" in
17485                 REENTRANT_PROTO*) ;;
17486                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17487                 esac
17488                 echo "Prototype: $try" ;;
17489         esac
17490         ;;
17491         *)      case "$usethreads" in
17492                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17493                 esac
17494                 d_strerror_r=undef
17495                 strerror_r_proto=0
17496                 ;;
17497         esac
17498         ;;
17499 *)      strerror_r_proto=0
17500         ;;
17501 esac
17502
17503 : see if strftime exists
17504 set strftime d_strftime
17505 eval $inlibc
17506
17507 : see if strlcat exists
17508 set strlcat d_strlcat
17509 eval $inlibc
17510
17511 : see if strlcpy exists
17512 set strlcpy d_strlcpy
17513 eval $inlibc
17514
17515 : see if strtod exists
17516 set strtod d_strtod
17517 eval $inlibc
17518
17519 : see if strtol exists
17520 set strtol d_strtol
17521 eval $inlibc
17522
17523 : see if strtold exists
17524 set strtold d_strtold
17525 eval $inlibc
17526
17527 : see if strtoll exists
17528 set strtoll d_strtoll
17529 eval $inlibc
17530
17531 case "$d_longlong-$d_strtoll" in
17532 "$define-$define")
17533         $cat <<EOM
17534 Checking whether your strtoll() works okay...
17535 EOM
17536         $cat >try.c <<'EOCP'
17537 #include <errno.h>
17538 #ifdef __hpux
17539 #define strtoll __strtoll
17540 #endif
17541 #ifdef __EMX__
17542 #define strtoll _strtoll
17543 #endif
17544 #include <stdio.h>
17545 extern long long int strtoll(char *s, char **, int); 
17546 static int bad = 0;
17547 int check(char *s, long long ell, int een) {
17548         long long gll;
17549         errno = 0;
17550         gll = strtoll(s, 0, 10);
17551         if (!((gll == ell) && (errno == een)))
17552                 bad++;
17553 }
17554 int main() {
17555         check(" 1",                                      1LL, 0);
17556         check(" 0",                                      0LL, 0);
17557         check("-1",                                     -1LL, 0);
17558         check("-9223372036854775808", -9223372036854775808LL, 0);
17559         check("-9223372036854775808", -9223372036854775808LL, 0);
17560         check(" 9223372036854775807",  9223372036854775807LL, 0);
17561         check("-9223372036854775808", -9223372036854775808LL, 0);
17562         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17563         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17564         if (!bad)
17565                 printf("ok\n");
17566 }
17567 EOCP
17568         set try
17569         if eval $compile; then
17570                 yyy=`$run ./try`
17571                 case "$yyy" in
17572                 ok) echo "Your strtoll() seems to be working okay." ;;
17573                 *) cat <<EOM >&4
17574 Your strtoll() doesn't seem to be working okay.
17575 EOM
17576                    d_strtoll="$undef"
17577                    ;;
17578                 esac
17579         else
17580                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17581                 d_strtoll="$undef"
17582         fi
17583         ;;
17584 esac
17585
17586 : see if strtoq exists
17587 set strtoq d_strtoq
17588 eval $inlibc
17589
17590 : see if strtoul exists
17591 set strtoul d_strtoul
17592 eval $inlibc
17593
17594 case "$d_strtoul" in
17595 "$define")
17596         $cat <<EOM
17597 Checking whether your strtoul() works okay...
17598 EOM
17599         $cat >try.c <<'EOCP'
17600 #include <errno.h>
17601 #include <stdio.h>
17602 extern unsigned long int strtoul(char *s, char **, int); 
17603 static int bad = 0;
17604 void check(char *s, unsigned long eul, int een) {
17605         unsigned long gul;
17606         errno = 0;
17607         gul = strtoul(s, 0, 10);
17608         if (!((gul == eul) && (errno == een)))
17609                 bad++;
17610 }
17611 int main() {
17612         check(" 1", 1L, 0);
17613         check(" 0", 0L, 0);
17614 EOCP
17615         case "$longsize" in
17616         8)
17617             $cat >>try.c <<'EOCP'
17618         check("18446744073709551615", 18446744073709551615UL, 0);
17619         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17620 #if 0 /* strtoul() for /^-/ strings is undefined. */
17621         check("-1", 18446744073709551615UL, 0);
17622         check("-18446744073709551614", 2, 0);
17623         check("-18446744073709551615", 1, 0);
17624         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17625         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17626 #endif
17627 EOCP
17628                 ;;
17629         4)
17630                     $cat >>try.c <<'EOCP'
17631         check("4294967295", 4294967295UL, 0);
17632         check("4294967296", 4294967295UL, ERANGE);
17633 #if 0 /* strtoul() for /^-/ strings is undefined. */
17634         check("-1", 4294967295UL, 0);
17635         check("-4294967294", 2, 0);
17636         check("-4294967295", 1, 0);
17637         check("-4294967296", 4294967295UL, ERANGE);
17638         check("-4294967297", 4294967295UL, ERANGE);
17639 #endif
17640 EOCP
17641                 ;;
17642         *)
17643 : Should we write these tests to be more portable by sprintf-ing
17644 : ~0 and then manipulating that char string as input for strtol?
17645                 ;;
17646         esac
17647         $cat >>try.c <<'EOCP'
17648         if (!bad)
17649                 printf("ok\n");
17650         return 0;
17651 }
17652 EOCP
17653         set try
17654         if eval $compile; then
17655                 case "`$run ./try`" in
17656                 ok) echo "Your strtoul() seems to be working okay." ;;
17657                 *) cat <<EOM >&4
17658 Your strtoul() doesn't seem to be working okay.
17659 EOM
17660                    d_strtoul="$undef"
17661                    ;;
17662                 esac
17663         else
17664                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17665                 d_strtoul="$undef"
17666         fi
17667         ;;
17668 esac
17669
17670 : see if strtoull exists
17671 set strtoull d_strtoull
17672 eval $inlibc
17673
17674 case "$d_longlong-$d_strtoull" in
17675 "$define-$define")
17676         $cat <<EOM
17677 Checking whether your strtoull() works okay...
17678 EOM
17679         $cat >try.c <<'EOCP'
17680 #include <errno.h>
17681 #ifdef __hpux
17682 #define strtoull __strtoull
17683 #endif
17684 #include <stdio.h>
17685 extern unsigned long long int strtoull(char *s, char **, int); 
17686 static int bad = 0;
17687 int check(char *s, long long eull, int een) {
17688         long long gull;
17689         errno = 0;
17690         gull = strtoull(s, 0, 10);
17691         if (!((gull == eull) && (errno == een)))
17692                 bad++;
17693 }
17694 int main() {
17695         check(" 1",                                        1LL, 0);
17696         check(" 0",                                        0LL, 0);
17697         check("18446744073709551615",  18446744073709551615ULL, 0);
17698         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17699 #if 0 /* strtoull() for /^-/ strings is undefined. */
17700         check("-1",                    18446744073709551615ULL, 0);
17701         check("-18446744073709551614",                     2LL, 0);
17702         check("-18446744073709551615",                     1LL, 0);
17703         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17704         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17705 #endif
17706         if (!bad)
17707                 printf("ok\n");
17708 }
17709 EOCP
17710         set try
17711         if eval $compile; then
17712                 case "`$run ./try`" in
17713                 ok) echo "Your strtoull() seems to be working okay." ;;
17714                 *) cat <<EOM >&4
17715 Your strtoull() doesn't seem to be working okay.
17716 EOM
17717                    d_strtoull="$undef"
17718                    ;;
17719                 esac
17720         else
17721                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17722                 d_strtoull="$undef"
17723         fi
17724         ;;
17725 esac
17726
17727 : see if strtouq exists
17728 set strtouq d_strtouq
17729 eval $inlibc
17730
17731 case "$d_strtouq" in
17732 "$define")
17733         $cat <<EOM
17734 Checking whether your strtouq() works okay...
17735 EOM
17736         $cat >try.c <<'EOCP'
17737 #include <errno.h>
17738 #include <stdio.h>
17739 extern unsigned long long int strtouq(char *s, char **, int); 
17740 static int bad = 0;
17741 void check(char *s, unsigned long long eull, int een) {
17742         unsigned long long gull;
17743         errno = 0;
17744         gull = strtouq(s, 0, 10);
17745         if (!((gull == eull) && (errno == een)))
17746                 bad++;
17747 }
17748 int main() {
17749         check(" 1",                                        1LL, 0);
17750         check(" 0",                                        0LL, 0);
17751         check("18446744073709551615",  18446744073709551615ULL, 0);
17752         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17753 #if 0 /* strtouq() for /^-/ strings is undefined. */
17754         check("-1",                    18446744073709551615ULL, 0);
17755         check("-18446744073709551614",                     2LL, 0);
17756         check("-18446744073709551615",                     1LL, 0);
17757         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17758         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17759 #endif
17760         if (!bad)
17761                 printf("ok\n");
17762         return 0;
17763 }
17764 EOCP
17765         set try
17766         if eval $compile; then
17767                 case "`$run ./try`" in
17768                 ok) echo "Your strtouq() seems to be working okay." ;;
17769                 *) cat <<EOM >&4
17770 Your strtouq() doesn't seem to be working okay.
17771 EOM
17772                    d_strtouq="$undef"
17773                    ;;
17774                 esac
17775         else
17776                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17777                 d_strtouq="$undef"
17778         fi
17779         ;;
17780 esac
17781
17782 : see if strxfrm exists
17783 set strxfrm d_strxfrm
17784 eval $inlibc
17785
17786 : see if symlink exists
17787 set symlink d_symlink
17788 eval $inlibc
17789
17790 : see if syscall exists
17791 set syscall d_syscall
17792 eval $inlibc
17793
17794 : see if prototype for syscall is available
17795 echo " "
17796 set d_syscallproto syscall $i_unistd unistd.h
17797 eval $hasproto
17798
17799 : see if sysconf exists
17800 set sysconf d_sysconf
17801 eval $inlibc
17802
17803 : see if system exists
17804 set system d_system
17805 eval $inlibc
17806
17807 : see if tcgetpgrp exists
17808 set tcgetpgrp d_tcgetpgrp
17809 eval $inlibc
17810
17811 : see if tcsetpgrp exists
17812 set tcsetpgrp d_tcsetpgrp
17813 eval $inlibc
17814
17815 : see if prototype for telldir is available
17816 echo " "
17817 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17818 eval $hasproto
17819
17820 : see if time exists
17821 echo " "
17822 if test "X$d_time" = X -o X"$timetype" = X; then
17823     if set time val -f d_time; eval $csym; $val; then
17824                 echo 'time() found.' >&4
17825                 val="$define"
17826                 rp="What is the type returned by time() on this system?"
17827                 set time_t timetype long stdio.h sys/types.h
17828                 eval $typedef_ask
17829     else
17830                 echo 'time() not found, hope that will do.' >&4
17831                 val="$undef"
17832                 timetype='int';
17833     fi
17834     set d_time
17835     eval $setvar
17836 fi
17837
17838 : see if this is a sys/times.h system
17839 set sys/times.h i_systimes
17840 eval $inhdr
17841
17842 : see if times exists
17843 echo " "
17844 if set times val -f d_times; eval $csym; $val; then
17845         echo 'times() found.' >&4
17846         d_times="$define"
17847         inc=''
17848         case "$i_systimes" in
17849         "$define") inc='sys/times.h';;
17850         esac
17851         rp="What is the type returned by times() on this system?"
17852         set clock_t clocktype long stdio.h sys/types.h $inc
17853         eval $typedef_ask
17854 else
17855         echo 'times() NOT found, hope that will do.' >&4
17856         d_times="$undef"
17857         clocktype='int'
17858 fi
17859
17860 : see if tmpnam_r exists
17861 set tmpnam_r d_tmpnam_r
17862 eval $inlibc
17863 case "$d_tmpnam_r" in
17864 "$define")
17865         hdrs="$i_systypes sys/types.h define stdio.h "
17866         case "$d_tmpnam_r_proto:$usethreads" in
17867         ":define")      d_tmpnam_r_proto=define
17868                 set d_tmpnam_r_proto tmpnam_r $hdrs
17869                 eval $hasproto ;;
17870         *)      ;;
17871         esac
17872         case "$d_tmpnam_r_proto" in
17873         define)
17874         case "$tmpnam_r_proto" in
17875         ''|0) try='char* tmpnam_r(char*);'
17876         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17877         esac
17878         case "$tmpnam_r_proto" in
17879         ''|0)   d_tmpnam_r=undef
17880                 tmpnam_r_proto=0
17881                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17882         * )     case "$tmpnam_r_proto" in
17883                 REENTRANT_PROTO*) ;;
17884                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17885                 esac
17886                 echo "Prototype: $try" ;;
17887         esac
17888         ;;
17889         *)      case "$usethreads" in
17890                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17891                 esac
17892                 d_tmpnam_r=undef
17893                 tmpnam_r_proto=0
17894                 ;;
17895         esac
17896         ;;
17897 *)      tmpnam_r_proto=0
17898         ;;
17899 esac
17900
17901 : see if truncate exists
17902 set truncate d_truncate
17903 eval $inlibc
17904
17905 : see if ttyname_r exists
17906 set ttyname_r d_ttyname_r
17907 eval $inlibc
17908 case "$d_ttyname_r" in
17909 "$define")
17910         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17911         case "$d_ttyname_r_proto:$usethreads" in
17912         ":define")      d_ttyname_r_proto=define
17913                 set d_ttyname_r_proto ttyname_r $hdrs
17914                 eval $hasproto ;;
17915         *)      ;;
17916         esac
17917         case "$d_ttyname_r_proto" in
17918         define)
17919         case "$ttyname_r_proto" in
17920         ''|0) try='int ttyname_r(int, char*, size_t);'
17921         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17922         esac
17923         case "$ttyname_r_proto" in
17924         ''|0) try='int ttyname_r(int, char*, int);'
17925         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17926         esac
17927         case "$ttyname_r_proto" in
17928         ''|0) try='char* ttyname_r(int, char*, int);'
17929         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17930         esac
17931         case "$ttyname_r_proto" in
17932         ''|0)   d_ttyname_r=undef
17933                 ttyname_r_proto=0
17934                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17935         * )     case "$ttyname_r_proto" in
17936                 REENTRANT_PROTO*) ;;
17937                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17938                 esac
17939                 echo "Prototype: $try" ;;
17940         esac
17941         ;;
17942         *)      case "$usethreads" in
17943                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17944                 esac
17945                 d_ttyname_r=undef
17946                 ttyname_r_proto=0
17947                 ;;
17948         esac
17949         ;;
17950 *)      ttyname_r_proto=0
17951         ;;
17952 esac
17953
17954 : see if tzname[] exists
17955 echo " "
17956 if set tzname val -a d_tzname; eval $csym; $val; then
17957         val="$define"
17958         echo 'tzname[] found.' >&4
17959 else
17960         val="$undef"
17961         echo 'tzname[] NOT found.' >&4
17962 fi
17963 set d_tzname
17964 eval $setvar
17965
17966 case "$osname" in
17967 next|rhapsody|darwin) multiarch="$define" ;;
17968 esac
17969 case "$multiarch" in
17970 ''|[nN]*) multiarch="$undef" ;;
17971 esac
17972
17973 : check for ordering of bytes in a UV
17974 echo " "
17975 case "$usecrosscompile$multiarch" in
17976 *$define*)
17977         $cat <<EOM
17978 You seem to be either cross-compiling or doing a multiarchitecture build,
17979 skipping the byteorder check.
17980
17981 EOM
17982         byteorder='ffff'
17983         ;;
17984 *)
17985         case "$byteorder" in
17986         '')
17987                 $cat <<'EOM'
17988 In the following, larger digits indicate more significance.  A big-endian
17989 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17990 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17991 machines may have weird orders like 3412.  A Cray will report 87654321,
17992 an Alpha will report 12345678. If the test program works the default is
17993 probably right.
17994 I'm now running the test program...
17995 EOM
17996                 $cat >try.c <<EOCP
17997 #include <stdio.h>
17998 #$i_stdlib I_STDLIB
17999 #ifdef I_STDLIB
18000 #include <stdlib.h>
18001 #endif
18002 #include <sys/types.h>
18003 typedef $uvtype UV;
18004 int main()
18005 {
18006         int i;
18007         union {
18008                 UV l;
18009                 char c[$uvsize];
18010         } u;
18011
18012         if ($uvsize > 4)
18013                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18014         else
18015                 u.l = (UV)0x04030201;
18016         for (i = 0; i < $uvsize; i++)
18017                 printf("%c", u.c[i]+'0');
18018         printf("\n");
18019         exit(0);
18020 }
18021 EOCP
18022                 xxx_prompt=y
18023                 set try
18024                 if eval $compile && ./try > /dev/null; then
18025                         dflt=`$run ./try`
18026                         case "$dflt" in
18027                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18028                                 echo "(The test program ran ok.)"
18029                                 echo "byteorder=$dflt"
18030                                 xxx_prompt=n
18031                         ;;
18032                         ????|????????) echo "(The test program ran ok.)" ;;
18033                         *) echo "(The test program didn't run right for some reason.)" ;;
18034                         esac
18035                 else
18036                         dflt='4321'
18037                         cat <<'EOM'
18038 (I can't seem to compile the test program.  Guessing big-endian...)
18039 EOM
18040                 fi
18041                 case "$xxx_prompt" in
18042                 y)
18043                         rp="What is the order of bytes in $uvtype?"
18044                         . ./myread
18045                         byteorder="$ans"
18046                         ;;
18047                 *)      byteorder=$dflt
18048                         ;;
18049                 esac
18050                 ;;
18051         esac
18052         $rm -f try.c try
18053         ;;
18054 esac
18055
18056
18057 $cat <<EOM
18058
18059 Checking to see whether you can access character data unalignedly...
18060 EOM
18061 case "$d_u32align" in
18062 '')   $cat >try.c <<EOCP
18063 #include <stdio.h>
18064 #$i_stdlib I_STDLIB
18065 #ifdef I_STDLIB
18066 #include <stdlib.h>
18067 #endif
18068 #define U32 $u32type
18069 #define BYTEORDER 0x$byteorder
18070 #define U8 $u8type
18071 #include <signal.h>
18072 #ifdef SIGBUS
18073 $signal_t bletch(int s) { exit(4); }
18074 #endif
18075 int main() {
18076 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18077     U8 buf[8];
18078     U32 *up;
18079     int i;
18080
18081     if (sizeof(U32) != 4) {
18082         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18083         exit(1);
18084     }
18085
18086     fflush(stdout);
18087
18088 #ifdef SIGBUS
18089     signal(SIGBUS, bletch);
18090 #endif
18091
18092     buf[0] = 0;
18093     buf[1] = 0;
18094     buf[2] = 0;
18095     buf[3] = 1;
18096     buf[4] = 0;
18097     buf[5] = 0;
18098     buf[6] = 0;
18099     buf[7] = 1;
18100
18101     for (i = 0; i < 4; i++) {
18102         up = (U32*)(buf + i);
18103         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18104                (*up == 1 << (8*(3-i)))  /* little-endian */
18105               )
18106            )
18107         {
18108             printf("read failed (%x)\n", *up);
18109             exit(2);
18110         }
18111     }
18112
18113     /* write test */
18114     for (i = 0; i < 4; i++) {
18115         up = (U32*)(buf + i);
18116         *up = 0xBeef;
18117         if (*up != 0xBeef) {
18118             printf("write failed (%x)\n", *up);
18119             exit(3);
18120         }
18121     }
18122
18123     exit(0);
18124 #else
18125     printf("1\n");
18126     exit(1);
18127 #endif
18128     return 0;
18129 }
18130 EOCP
18131 set try
18132 if eval $compile_ok; then
18133         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18134         $run ./try 2>&1 >/dev/null
18135         case "$?" in
18136         0)      cat >&4 <<EOM
18137 You can access character data pretty unalignedly.
18138 EOM
18139                 d_u32align="$undef"
18140                 ;;
18141         *)      cat >&4 <<EOM
18142 It seems that you must access character data in an aligned manner.
18143 EOM
18144                 d_u32align="$define"
18145                 ;;
18146         esac
18147 else
18148         rp='Can you access character data at unaligned addresses?'
18149         dflt='n'
18150         . ./myread
18151         case "$ans" in
18152         [yY]*)  d_u32align="$undef"  ;;
18153         *)      d_u32align="$define" ;;
18154         esac
18155 fi
18156 $rm -f core core.try.* try.core
18157 ;;
18158 esac
18159
18160 : see if ualarm exists
18161 set ualarm d_ualarm
18162 eval $inlibc
18163
18164 : see if umask exists
18165 set umask d_umask
18166 eval $inlibc
18167
18168 : see if unordered exists
18169 set unordered d_unordered
18170 eval $inlibc
18171
18172 : see if unsetenv exists
18173 set unsetenv d_unsetenv
18174 eval $inlibc
18175
18176 : see if usleep exists
18177 set usleep d_usleep
18178 eval $inlibc
18179
18180 : see if prototype for usleep is available
18181 echo " "
18182 set d_usleepproto usleep $i_unistd unistd.h
18183 eval $hasproto
18184
18185 : see if ustat exists
18186 set ustat d_ustat
18187 eval $inlibc
18188
18189 : see if closedir exists
18190 set closedir d_closedir
18191 eval $inlibc
18192
18193 case "$d_closedir" in
18194 "$define")
18195         echo " "
18196         echo "Checking whether closedir() returns a status..." >&4
18197         cat > try.c <<EOM
18198 #$i_dirent I_DIRENT             /**/
18199 #$i_sysdir I_SYS_DIR            /**/
18200 #$i_sysndir I_SYS_NDIR          /**/
18201 #$i_systypes I_SYS_TYPES        /**/
18202
18203 #if defined(I_SYS_TYPES)
18204 #include <sys/types.h>
18205 #endif
18206 #if defined(I_DIRENT)
18207 #include <dirent.h>
18208 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18209 #include <sys/dir.h>
18210 #endif
18211 #else
18212 #ifdef I_SYS_NDIR
18213 #include <sys/ndir.h>
18214 #else
18215 #ifdef I_SYS_DIR
18216 #ifdef hp9000s500
18217 #include <ndir.h>       /* may be wrong in the future */
18218 #else
18219 #include <sys/dir.h>
18220 #endif
18221 #endif
18222 #endif
18223 #endif 
18224 int main() { return closedir(opendir(".")); }
18225 EOM
18226         set try
18227         if eval $compile_ok; then
18228                 if $run ./try > /dev/null 2>&1 ; then
18229                         echo "Yes, it does."
18230                         val="$undef"
18231                 else
18232                         echo "No, it doesn't."
18233                         val="$define"
18234                 fi
18235         else
18236                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18237                 val="$define"
18238         fi
18239         ;;
18240 *)
18241         val="$undef";
18242         ;;
18243 esac
18244 set d_void_closedir
18245 eval $setvar
18246 $rm -f try try.*
18247 : see if there is a wait4
18248 set wait4 d_wait4
18249 eval $inlibc
18250
18251 : see if waitpid exists
18252 set waitpid d_waitpid
18253 eval $inlibc
18254
18255 : see if wcstombs exists
18256 set wcstombs d_wcstombs
18257 eval $inlibc
18258
18259 : see if wctomb exists
18260 set wctomb d_wctomb
18261 eval $inlibc
18262
18263 : see if writev exists
18264 set writev d_writev
18265 eval $inlibc
18266
18267 : preserve RCS keywords in files with variable substitution, grrr
18268 Date='$Date'
18269 Id='$Id'
18270 Log='$Log'
18271 RCSfile='$RCSfile'
18272 Revision='$Revision'
18273
18274 : check for alignment requirements
18275 echo " "
18276 case "$usecrosscompile$multiarch" in
18277 *$define*)
18278         $cat <<EOM
18279 You seem to be either cross-compiling or doing a multiarchitecture build,
18280 skipping the memory alignment check.
18281
18282 EOM
18283         case "$alignbytes" in
18284         '') alignbytes=8 ;;
18285         esac
18286         ;;
18287 *)
18288         case "$alignbytes" in
18289         '') echo "Checking alignment constraints..." >&4
18290                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18291                         $cat >try.c <<'EOCP'
18292 typedef long double NV;
18293 EOCP
18294                 else
18295                         $cat >try.c <<'EOCP'
18296 typedef double NV;
18297 EOCP
18298                 fi
18299                 $cat >>try.c <<'EOCP'
18300 #include <stdio.h>
18301 struct foobar {
18302         char foo;
18303         NV bar;
18304 } try_algn;
18305 int main()
18306 {
18307     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18308     return(0);
18309 }
18310 EOCP
18311                 set try
18312                 if eval $compile_ok; then
18313                         dflt=`$run ./try`
18314                 else
18315                         dflt='8'
18316                         echo "(I can't seem to compile the test program...)"
18317                 fi
18318                 ;;
18319         *) dflt="$alignbytes"
18320                 ;;
18321         esac
18322         rp="Doubles must be aligned on a how-many-byte boundary?"
18323         . ./myread
18324         alignbytes="$ans"
18325         $rm -f try.c try
18326         ;;
18327 esac
18328
18329
18330 : set the base revision
18331 baserev=5.0
18332
18333 : how do we concatenate cpp tokens here?
18334 echo " "
18335 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18336 $cat >cpp_stuff.c <<'EOCP'
18337 #define RCAT(a,b)a/**/b
18338 #define ACAT(a,b)a ## b
18339 RCAT(Rei,ser)
18340 ACAT(Cir,cus)
18341 EOCP
18342 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18343 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18344         echo "Oh!  Smells like ANSI's been here." >&4
18345         echo "We can catify or stringify, separately or together!"
18346         cpp_stuff=42
18347 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18348         echo "Ah, yes!  The good old days!" >&4
18349         echo "However, in the good old days we don't know how to stringify and"
18350         echo "catify at the same time."
18351         cpp_stuff=1
18352 else
18353         $cat >&4 <<EOM
18354 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18355 You're going to have to edit the values of CAT[2-5] in config.h...
18356 EOM
18357         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18358 fi
18359 $rm -f cpp_stuff.*
18360
18361 : see if this is a db.h system
18362 set db.h i_db
18363 eval $inhdr
18364
18365 case "$i_db" in
18366 $define)
18367         : Check db version.
18368         echo " "
18369         echo "Checking Berkeley DB version ..." >&4
18370         $cat >try.c <<EOCP
18371 #$d_const HASCONST
18372 #ifndef HASCONST
18373 #define const
18374 #endif
18375 #include <sys/types.h>
18376 #include <stdio.h>
18377 #$i_stdlib I_STDLIB
18378 #ifdef I_STDLIB
18379 #include <stdlib.h>
18380 #endif
18381 #include <db.h>
18382 int main(int argc, char *argv[])
18383 {
18384 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18385     int Major, Minor, Patch ;
18386     unsigned long Version ;
18387     (void)db_version(&Major, &Minor, &Patch) ;
18388     if (argc == 2) {
18389         printf("%d %d %d %d %d %d\n",
18390                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18391                Major, Minor, Patch);
18392         exit(0);
18393     }
18394     printf("You have Berkeley DB Version 2 or greater.\n");
18395
18396     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18397                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18398     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18399                 Major, Minor, Patch) ;
18400
18401     /* check that db.h & libdb are compatible */
18402     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18403         printf("db.h and libdb are incompatible.\n") ;
18404         exit(3);        
18405     }
18406
18407     printf("db.h and libdb are compatible.\n") ;
18408
18409     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18410                 + DB_VERSION_PATCH ;
18411
18412     /* needs to be >= 2.3.4 */
18413     if (Version < 2003004) {
18414     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18415         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18416         exit(2);        
18417     }
18418
18419     exit(0);
18420 #else
18421 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18422     if (argc == 2) {
18423         printf("1 0 0\n");
18424         exit(0);
18425     }
18426     printf("You have Berkeley DB Version 1.\n");
18427     exit(0);    /* DB version < 2: the coast is clear. */
18428 #else
18429     exit(1);    /* <db.h> not Berkeley DB? */
18430 #endif
18431 #endif
18432 }
18433 EOCP
18434         set try
18435         if eval $compile_ok && $run ./try; then
18436                 echo 'Looks OK.' >&4
18437                 set `$run ./try 1`
18438                 db_version_major=$1
18439                 db_version_minor=$2
18440                 db_version_patch=$3
18441         else
18442                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18443                 i_db=$undef
18444                 case " $libs " in
18445                 *"-ldb "*)
18446                         : Remove db from list of libraries to use
18447                         echo "Removing unusable -ldb from library list" >&4
18448                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18449                         shift
18450                         libs="$*"
18451                         echo "libs = $libs" >&4
18452                         ;;
18453                 esac
18454         fi
18455         $rm -f try try.*
18456         ;;
18457 esac
18458
18459 case "$i_db" in
18460 define)
18461         : Check the return type needed for hash 
18462         echo " "
18463         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18464         $cat >try.c <<EOCP
18465 #$d_const HASCONST
18466 #ifndef HASCONST
18467 #define const
18468 #endif
18469 #include <sys/types.h>
18470 #include <db.h>
18471
18472 #ifndef DB_VERSION_MAJOR
18473 u_int32_t hash_cb (ptr, size)
18474 const void *ptr;
18475 size_t size;
18476 {
18477 }
18478 HASHINFO info;
18479 int main()
18480 {
18481         info.hash = hash_cb;
18482 }
18483 #endif
18484 EOCP
18485         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18486                 if $contains warning try.out >>/dev/null 2>&1 ; then
18487                         db_hashtype='int'
18488                 else
18489                         db_hashtype='u_int32_t'
18490                 fi
18491         else
18492                 : XXX Maybe we should just give up here.
18493                 db_hashtype=u_int32_t
18494                 $cat try.out >&4
18495                 echo "Help:  I can't seem to compile the db test program." >&4
18496                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18497         fi
18498         $rm -f try try.*
18499         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18500         ;;
18501 *)      db_hashtype=u_int32_t
18502         ;;
18503 esac
18504 case "$i_db" in
18505 define)
18506         : Check the return type needed for prefix 
18507         echo " "
18508         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18509         cat >try.c <<EOCP
18510 #$d_const HASCONST
18511 #ifndef HASCONST
18512 #define const
18513 #endif
18514 #include <sys/types.h>
18515 #include <db.h>
18516
18517 #ifndef DB_VERSION_MAJOR
18518 size_t prefix_cb (key1, key2)
18519 const DBT *key1;
18520 const DBT *key2;
18521 {
18522 }
18523 BTREEINFO info;
18524 int main()
18525 {
18526         info.prefix = prefix_cb;
18527 }
18528 #endif
18529 EOCP
18530         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18531                 if $contains warning try.out >>/dev/null 2>&1 ; then
18532                         db_prefixtype='int'
18533                 else
18534                         db_prefixtype='size_t'
18535                 fi
18536         else
18537                 db_prefixtype='size_t'
18538                 : XXX Maybe we should just give up here.
18539                 $cat try.out >&4
18540                 echo "Help:  I can't seem to compile the db test program." >&4
18541                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18542         fi
18543         $rm -f try try.*
18544         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18545         ;;
18546 *)      db_prefixtype='size_t'
18547         ;;
18548 esac
18549
18550
18551 : How can we generate normalized random numbers ?
18552 echo " "
18553 echo "Looking for a random number function..." >&4
18554 case "$randfunc" in
18555 '')
18556         if set drand48 val -f; eval $csym; $val; then
18557                 dflt="drand48"
18558                 echo "Good, found drand48()." >&4
18559         elif set random val -f; eval $csym; $val; then
18560                 dflt="random"
18561                 echo "OK, found random()." >&4
18562         else
18563                 dflt="rand"
18564                 echo "Yick, looks like I have to use rand()." >&4
18565         fi
18566         echo " "
18567         ;;
18568 *)
18569         dflt="$randfunc"
18570         ;;
18571 esac
18572 cont=true
18573
18574 case "$ccflags" in
18575 *-Dmy_rand=*|*-Dmy_srand=*)
18576         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18577         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18578         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18579         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18580         ;;
18581 esac
18582
18583 while $test "$cont"; do
18584         rp="Use which function to generate random numbers?"
18585         . ./myread
18586         if $test "$ans" = "$dflt"; then
18587                 : null
18588         else
18589                 randbits=''
18590         fi
18591         randfunc="$ans"
18592         if set $ans val -f; eval $csym; $val; then
18593                 cont=''
18594         else
18595                 dflt=y
18596                 rp="I cannot find function $ans. Use that name anyway?"
18597                 . ./myread
18598                 dflt=rand
18599                 case "$ans" in
18600                         [yY]*) cont='';;
18601                 esac
18602         fi
18603         case "$cont" in
18604         '')
18605                 case "$randfunc" in
18606                 drand48)
18607                         drand01="drand48()"
18608                         seedfunc="srand48"
18609                         randbits=48
18610                         randseedtype=long
18611                         ;;
18612                 rand|random)
18613                         case "$randbits" in
18614                         '')
18615 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18616                                 $cat >try.c <<EOCP
18617 #$i_unistd I_UNISTD
18618 #$i_stdlib I_STDLIB
18619 #include <stdio.h>
18620 #ifdef I_UNISTD
18621 #  include <unistd.h>
18622 #endif
18623 #ifdef I_STDLIB
18624 #  include <stdlib.h>
18625 #endif
18626 int main()
18627 {
18628         register int i;
18629         register unsigned long tmp;
18630         register unsigned long max = 0L;
18631
18632         for (i = 1000; i; i--) {
18633                 tmp = (unsigned long) $randfunc();
18634                 if (tmp > max) max = tmp;
18635         }
18636         for (i = 0; max; i++)
18637                 max /= 2;
18638         printf("%d\n",i);
18639 }
18640 EOCP
18641                                 set try
18642                                 if eval $compile_ok; then
18643                                         dflt=`try`
18644                                 else
18645                                         dflt='?'
18646                                         echo "(I can't seem to compile the test program...)"
18647                                 fi
18648                                 ;;
18649                         *)
18650                                 dflt="$randbits"
18651                                 ;;
18652                         esac
18653                         rp="How many bits does your $randfunc() function produce?"
18654                         . ./myread
18655                         randbits="$ans"
18656                         $rm -f try.c try
18657                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18658                         seedfunc="s$randfunc"
18659                         randseedtype=unsigned
18660                         ;;
18661                 *)
18662                         dflt="31"
18663                         rp="How many bits does your $randfunc() function produce?"
18664                         . ./myread
18665                         randbits="$ans"
18666                         seedfunc="s$randfunc"
18667                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18668                         if set $seedfunc val -f; eval $csym; $val; then
18669                                 echo "(Using $seedfunc() to seed random generator)"
18670                         else
18671                                 echo "(Warning: no $seedfunc() to seed random generator)"
18672                                 seedfunc=rand
18673                         fi
18674                         randseedtype=unsigned
18675                         ;;
18676                 esac
18677                 ;;
18678         esac
18679 done
18680
18681 echo " "
18682 echo "Determining whether or not we are on an EBCDIC system..." >&4
18683 $cat >try.c <<'EOM'
18684 int main()
18685 {
18686   if ('M'==0xd4) return 0;
18687   return 1;
18688 }
18689 EOM
18690
18691 val=$undef
18692 set try
18693 if eval $compile_ok; then
18694         if $run ./try; then
18695                 echo "You seem to speak EBCDIC." >&4
18696                 val="$define"
18697         else
18698                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18699         fi
18700 else
18701         echo "I'm unable to compile the test program." >&4
18702         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18703 fi
18704 $rm -f try try.*
18705 set ebcdic
18706 eval $setvar
18707
18708 echo " "
18709 $cat >&4 <<EOM
18710 Checking how to flush all pending stdio output...
18711 EOM
18712 # I only know how to find the first 32 possibly open files on SunOS.
18713 # See also hints/sunos_4_1.sh and util.c  --AD
18714 case "$osname" in
18715 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18716 esac
18717 $cat >>try.c <<EOCP
18718 #include <stdio.h>
18719 #$i_stdlib I_STDLIB
18720 #ifdef I_STDLIB
18721 #include <stdlib.h>
18722 #endif
18723 #$i_unistd I_UNISTD
18724 #ifdef I_UNISTD
18725 # include <unistd.h>
18726 #endif
18727 #$d_sysconf HAS_SYSCONF
18728 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18729 #ifdef HAS_STDIO_STREAM_ARRAY
18730 # define STDIO_STREAM_ARRAY $stdio_stream_array
18731 #endif
18732 int main() {
18733   FILE* p;
18734   unlink("try.out");
18735   p = fopen("try.out", "w");
18736 #ifdef TRY_FPUTC
18737   fputc('x', p);
18738 #else
18739 # ifdef TRY_FPRINTF
18740   fprintf(p, "x");
18741 # endif
18742 #endif
18743 #ifdef TRY_FFLUSH_NULL
18744   fflush(NULL);
18745 #endif
18746 #ifdef TRY_FFLUSH_ALL
18747   {
18748     long open_max = -1;
18749 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18750     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18751 # else
18752 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18753     open_max = sysconf(_SC_OPEN_MAX);
18754 #  else
18755 #   ifdef FOPEN_MAX
18756     open_max = FOPEN_MAX;
18757 #   else
18758 #    ifdef OPEN_MAX
18759     open_max = OPEN_MAX;
18760 #    else
18761 #     ifdef _NFILE
18762     open_max = _NFILE;
18763 #     endif
18764 #    endif
18765 #   endif
18766 #  endif
18767 # endif 
18768 # ifdef HAS_STDIO_STREAM_ARRAY
18769     if (open_max > 0) {
18770       long i;
18771       for (i = 0; i < open_max; i++)
18772             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18773                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18774                 STDIO_STREAM_ARRAY[i]._flag)
18775                 fflush(&STDIO_STREAM_ARRAY[i]);
18776     }   
18777   }
18778 # endif
18779 #endif
18780   _exit(42);
18781 }
18782 EOCP
18783 : first we have to find out how _not_ to flush
18784 $to try.c
18785 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18786     output=''
18787     set try -DTRY_FPUTC
18788     if eval $compile; then
18789             $run ./try 2>/dev/null
18790             code="$?"
18791             $from try.out
18792             if $test ! -s try.out -a "X$code" = X42; then
18793                 output=-DTRY_FPUTC
18794             fi
18795     fi
18796     case "$output" in
18797     '')
18798             set try -DTRY_FPRINTF
18799             if eval $compile; then
18800                     $run ./try 2>/dev/null
18801                     code="$?"
18802                     $from try.out
18803                     if $test ! -s try.out -a "X$code" = X42; then
18804                         output=-DTRY_FPRINTF
18805                     fi
18806             fi
18807         ;;
18808     esac
18809 fi
18810 : check for fflush NULL behaviour
18811 case "$fflushNULL" in
18812 '')     set try -DTRY_FFLUSH_NULL $output
18813         if eval $compile; then
18814                 $run ./try 2>/dev/null
18815                 code="$?"
18816                 $from try.out
18817                 if $test -s try.out -a "X$code" = X42; then
18818                         fflushNULL="`$cat try.out`"
18819                 else
18820                         if $test "X$code" != X42; then
18821                                 $cat >&4 <<EOM
18822 (If this test failed, don't worry, we'll try another method shortly.)
18823 EOM
18824                         fi
18825                 fi
18826         fi
18827         $rm -f core try.core core.try.*
18828         case "$fflushNULL" in
18829         x)      $cat >&4 <<EOM
18830 Your fflush(NULL) works okay for output streams.
18831 Let's see if it clobbers input pipes...
18832 EOM
18833 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18834 # bug that improperly flushes the input end of pipes.  So we avoid the
18835 # autoflush on fork/system/exec support for now. :-(
18836 $cat >tryp.c <<EOCP
18837 #include <stdio.h>
18838 int
18839 main(int argc, char **argv)
18840 {
18841     char buf[1024];
18842     int i;
18843     char *bp = buf;
18844     while (1) {
18845         while ((i = getc(stdin)) != -1
18846                && (*bp++ = i) != '\n'
18847                && bp < &buf[1024])
18848         /* DO NOTHING */ ;
18849         *bp = '\0';
18850         fprintf(stdout, "%s", buf);
18851         fflush(NULL);
18852         if (i == -1)
18853             return 0;
18854         bp = buf;
18855     }
18856 }
18857 EOCP
18858                 fflushNULL="$define"
18859                 set tryp
18860                 if eval $compile; then
18861                     $rm -f tryp.out
18862                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18863                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18864                        $cat >&4 <<EOM
18865 fflush(NULL) seems to behave okay with input streams.
18866 EOM
18867                         fflushNULL="$define"
18868                     else
18869                         $cat >&4 <<EOM
18870 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18871 EOM
18872                         fflushNULL="$undef"
18873                     fi
18874                 fi
18875                 $rm -f core tryp.c tryp.core core.tryp.*
18876                 ;;
18877         '')     $cat >&4 <<EOM
18878 Your fflush(NULL) isn't working (contrary to ANSI C).
18879 EOM
18880                 fflushNULL="$undef"
18881                 ;;
18882         *)      $cat >&4 <<EOM
18883 Cannot figure out whether your fflush(NULL) works or not.
18884 I'm assuming it doesn't (contrary to ANSI C).
18885 EOM
18886                 fflushNULL="$undef"
18887                 ;;
18888         esac
18889         ;;
18890 $define|true|[yY]*)
18891         fflushNULL="$define"
18892         ;;
18893 *)
18894         fflushNULL="$undef"
18895         ;;
18896 esac
18897 : check explicit looping only if NULL did not work, and if the pipe
18898 : bug does not show up on an explicit flush too
18899 case "$fflushNULL" in
18900 "$undef")
18901         $cat >tryp.c <<EOCP
18902 #include <stdio.h>
18903 int
18904 main(int argc, char **argv)
18905 {
18906     char buf[1024];
18907     int i;
18908     char *bp = buf;
18909     while (1) {
18910         while ((i = getc(stdin)) != -1
18911                && (*bp++ = i) != '\n'
18912                && bp < &buf[1024])
18913         /* DO NOTHING */ ;
18914         *bp = '\0';
18915         fprintf(stdout, "%s", buf);
18916         fflush(stdin);
18917         if (i == -1)
18918             return 0;
18919         bp = buf;
18920     }
18921 }
18922 EOCP
18923         set tryp
18924         if eval $compile; then
18925             $rm -f tryp.out
18926             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18927             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18928                $cat >&4 <<EOM
18929 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18930 EOM
18931                 : now check for fflushall behaviour
18932                 case "$fflushall" in
18933                 '')     set try -DTRY_FFLUSH_ALL $output
18934                         if eval $compile; then
18935                                 $cat >&4 <<EOM
18936 (Now testing the other method--but note that this also may fail.)
18937 EOM
18938                                 $run ./try 2>/dev/null
18939                                 code=$?
18940                                 $from try.out
18941                                 if $test -s try.out -a "X$code" = X42; then
18942                                         fflushall="`$cat try.out`"
18943                                 fi
18944                         fi
18945                         $rm -f core try.core core.try.*
18946                         case "$fflushall" in
18947                         x)      $cat >&4 <<EOM
18948 Whew. Flushing explicitly all the stdio streams works.
18949 EOM
18950                                 fflushall="$define"
18951                                 ;;
18952                         '')     $cat >&4 <<EOM
18953 Sigh. Flushing explicitly all the stdio streams doesn't work.
18954 EOM
18955                                 fflushall="$undef"
18956                                 ;;
18957                         *)      $cat >&4 <<EOM
18958 Cannot figure out whether flushing stdio streams explicitly works or not.
18959 I'm assuming it doesn't.
18960 EOM
18961                                 fflushall="$undef"
18962                                 ;;
18963                         esac
18964                         ;;
18965                 "$define"|true|[yY]*)
18966                         fflushall="$define"
18967                         ;;
18968                 *)
18969                         fflushall="$undef"
18970                         ;;
18971                 esac
18972             else
18973                 $cat >&4 <<EOM
18974 All is futile.  Even fflush(stdin) clobbers input pipes!
18975 EOM
18976                 fflushall="$undef"
18977             fi
18978         else
18979             fflushall="$undef"
18980         fi
18981         $rm -f core tryp.c tryp.core core.tryp.*
18982         ;;
18983 *)      fflushall="$undef"
18984         ;;
18985 esac
18986
18987 case "$fflushNULL$fflushall" in
18988 undefundef)
18989         $cat <<EOM
18990 OK, I give up.  I cannot figure out how to flush pending stdio output.
18991 We won't be flushing handles at all before fork/exec/popen.
18992 EOM
18993         ;;
18994 esac
18995 $rm -f try.* try$exe_ext
18996
18997 : Store the full pathname to the ar program for use in the C program
18998 : Respect a hint or command line value for full_ar.
18999 case "$full_ar" in
19000 '') full_ar=$ar ;;
19001 esac
19002
19003 : Store the full pathname to the sed program for use in the C program
19004 full_sed=$sed
19005
19006 : see what type gids are declared as in the kernel
19007 echo " "
19008 echo "Looking for the type for group ids returned by getgid()."
19009 set gid_t gidtype xxx stdio.h sys/types.h
19010 eval $typedef
19011 case "$gidtype" in
19012 xxx)
19013         xxx=`./findhdr sys/user.h`
19014         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19015         case $1 in
19016         unsigned) dflt="$1 $2" ;;
19017         *) dflt="$1" ;;
19018         esac
19019         ;;
19020 *) dflt="$gidtype";;
19021 esac
19022 case "$gidtype" in
19023 gid_t) echo "gid_t found." ;;
19024 *)      rp="What is the type for group ids returned by getgid()?"
19025         . ./myread
19026         gidtype="$ans"
19027         ;;
19028 esac
19029
19030 echo " "
19031 case "$gidtype" in
19032 *_t) zzz="$gidtype"     ;;
19033 *)   zzz="gid"          ;;
19034 esac
19035 echo "Checking the size of $zzz..." >&4 
19036 cat > try.c <<EOCP
19037 #include <sys/types.h>
19038 #include <stdio.h>
19039 #$i_stdlib I_STDLIB
19040 #ifdef I_STDLIB
19041 #include <stdlib.h>
19042 #endif
19043 int main() {
19044     printf("%d\n", (int)sizeof($gidtype));
19045     exit(0);
19046 }
19047 EOCP
19048 set try
19049 if eval $compile_ok; then
19050         yyy=`$run ./try`
19051         case "$yyy" in
19052         '')     gidsize=4
19053                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19054                 ;;
19055         *)      gidsize=$yyy
19056                 echo "Your $zzz is $gidsize bytes long."
19057                 ;;
19058         esac
19059 else
19060         gidsize=4
19061         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19062 fi
19063
19064
19065 echo " "
19066 case "$gidtype" in
19067 *_t) zzz="$gidtype"     ;;
19068 *)   zzz="gid"          ;;
19069 esac
19070 echo "Checking the sign of $zzz..." >&4 
19071 cat > try.c <<EOCP
19072 #include <sys/types.h>
19073 #include <stdio.h>
19074 int main() {
19075         $gidtype foo = -1;
19076         if (foo < 0)
19077                 printf("-1\n");
19078         else
19079                 printf("1\n");
19080 }
19081 EOCP
19082 set try
19083 if eval $compile; then
19084         yyy=`$run ./try`
19085         case "$yyy" in
19086         '')     gidsign=1
19087                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19088                 ;;
19089         *)      gidsign=$yyy
19090                 case "$gidsign" in
19091                  1) echo "Your $zzz is unsigned." ;;
19092                 -1) echo "Your $zzz is signed."   ;;
19093                 esac
19094                 ;;
19095         esac
19096 else
19097         gidsign=1
19098         echo "(I can't compile the test program--guessing unsigned.)" >&4
19099 fi
19100
19101
19102 echo " "
19103
19104 if $test X"$quadtype" != X; then
19105
19106 echo "Checking how to print 64-bit integers..." >&4
19107
19108 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19109         $cat >try.c <<'EOCP'
19110 #include <sys/types.h>
19111 #include <stdio.h>
19112 int main() {
19113   int q = 12345678901;
19114   printf("%ld\n", q);
19115 }
19116 EOCP
19117         set try
19118         if eval $compile; then
19119                 yyy=`$run ./try`
19120                 case "$yyy" in
19121                 12345678901)
19122                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19123                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19124                         echo "We will use %d."
19125                         ;;
19126                 esac
19127         fi
19128 fi
19129
19130 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19131         $cat >try.c <<'EOCP'
19132 #include <sys/types.h>
19133 #include <stdio.h>
19134 int main() {
19135   long q = 12345678901;
19136   printf("%ld\n", q);
19137 }
19138 EOCP
19139         set try
19140         if eval $compile; then
19141                 yyy=`$run ./try`
19142                 case "$yyy" in
19143                 12345678901)
19144                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19145                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19146                         echo "We will use %ld."
19147                         ;;
19148                 esac
19149         fi
19150 fi
19151
19152 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19153         $cat >try.c <<'EOCP'
19154 #include <sys/types.h>
19155 #include <inttypes.h>
19156 #include <stdio.h>
19157 int main() {
19158   int64_t q = 12345678901;
19159   printf("%" PRId64 "\n", q);
19160 }
19161 EOCP
19162         set try
19163         if eval $compile; then
19164                 yyy=`$run ./try`
19165                 case "$yyy" in
19166                 12345678901)
19167                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19168                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19169                         echo "We will use the C9X style."
19170                         ;;
19171                 esac
19172         fi
19173 fi
19174
19175 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19176         $cat >try.c <<EOCP
19177 #include <sys/types.h>
19178 #include <stdio.h>
19179 int main() {
19180   $quadtype q = 12345678901;
19181   printf("%Ld\n", q);
19182 }
19183 EOCP
19184         set try
19185         if eval $compile; then
19186                 yyy=`$run ./try`
19187                 case "$yyy" in
19188                 12345678901)
19189                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19190                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19191                         echo "We will use %Ld."
19192                         ;;
19193                 esac
19194         fi
19195 fi
19196
19197 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19198         $cat >try.c <<'EOCP'
19199 #include <sys/types.h>
19200 #include <stdio.h>
19201 int main() {
19202   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19203   printf("%lld\n", q);
19204 }
19205 EOCP
19206         set try
19207         if eval $compile; then
19208                 yyy=`$run ./try`
19209                 case "$yyy" in
19210                 12345678901)
19211                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19212                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19213                         echo "We will use the %lld style."
19214                         ;;
19215                 esac
19216         fi
19217 fi
19218
19219 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19220         $cat >try.c <<EOCP
19221 #include <sys/types.h>
19222 #include <stdio.h>
19223 int main() {
19224   $quadtype q = 12345678901;
19225   printf("%qd\n", q);
19226 }
19227 EOCP
19228         set try
19229         if eval $compile; then
19230                 yyy=`$run ./try`
19231                 case "$yyy" in
19232                 12345678901)
19233                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19234                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19235                         echo "We will use %qd."
19236                         ;;
19237                 esac
19238         fi
19239 fi
19240
19241 if $test X"$sPRId64" = X; then
19242         echo "Cannot figure out how to print 64-bit integers." >&4
19243 fi
19244
19245 $rm -f try try.*
19246
19247 fi
19248
19249 case "$sPRId64" in
19250 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
19251         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
19252         ;;
19253 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
19254         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
19255         ;;
19256 esac
19257
19258
19259 echo " "
19260 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19261
19262 if $test X"$ivsize" = X8; then
19263         ivdformat="$sPRId64"
19264         uvuformat="$sPRIu64"
19265         uvoformat="$sPRIo64"
19266         uvxformat="$sPRIx64"
19267         uvXUformat="$sPRIXU64"
19268 else
19269         if $test X"$ivsize" = X"$longsize"; then
19270                 ivdformat='"ld"'
19271                 uvuformat='"lu"'
19272                 uvoformat='"lo"'
19273                 uvxformat='"lx"'
19274                 uvXUformat='"lX"'
19275         else
19276                 if $test X"$ivsize" = X"$intsize"; then
19277                         ivdformat='"d"'
19278                         uvuformat='"u"'
19279                         uvoformat='"o"'
19280                         uvxformat='"x"'
19281                         uvXUformat='"X"'
19282                 else
19283                         : far out
19284                         if $test X"$ivsize" = X"$shortsize"; then
19285                                 ivdformat='"hd"'
19286                                 uvuformat='"hu"'
19287                                 uvoformat='"ho"'
19288                                 uvxformat='"hx"'
19289                                 uvXUformat='"hX"'
19290                         fi
19291                 fi
19292         fi
19293 fi
19294
19295 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19296         nveformat="$sPRIeldbl"
19297         nvfformat="$sPRIfldbl"
19298         nvgformat="$sPRIgldbl"
19299         nvEUformat="$sPRIEUldbl"
19300         nvFUformat="$sPRIFUldbl"
19301         nvGUformat="$sPRIGUldbl"
19302 else
19303         nveformat='"e"'
19304         nvfformat='"f"'
19305         nvgformat='"g"'
19306         nvEUformat='"E"'
19307         nvFUformat='"F"'
19308         nvGUformat='"G"'
19309 fi
19310
19311 case "$ivdformat" in
19312 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19313     exit 1
19314     ;;
19315 esac
19316
19317
19318 echo " "
19319 $echo "Checking the format string to be used for gids..." >&4
19320
19321 case "$gidsign" in
19322 -1)     if $test X"$gidsize" = X"$ivsize"; then
19323                 gidformat="$ivdformat"
19324         else
19325                 if $test X"$gidsize" = X"$longsize"; then
19326                         gidformat='"ld"'
19327                 else
19328                         if $test X"$gidsize" = X"$intsize"; then
19329                                 gidformat='"d"'
19330                         else
19331                                 if $test X"$gidsize" = X"$shortsize"; then
19332                                         gidformat='"hd"'
19333                                 fi
19334                         fi
19335                 fi
19336         fi
19337         ;;
19338 *)      if $test X"$gidsize" = X"$uvsize"; then
19339                 gidformat="$uvuformat"
19340         else
19341                 if $test X"$gidsize" = X"$longsize"; then
19342                         gidformat='"lu"'
19343                 else
19344                         if $test X"$gidsize" = X"$intsize"; then
19345                                 gidformat='"u"'
19346                         else
19347                                 if $test X"$gidsize" = X"$shortsize"; then
19348                                         gidformat='"hu"'
19349                                 fi
19350                         fi
19351                 fi
19352         fi
19353         ;;
19354 esac
19355
19356 : see if getgroups exists
19357 set getgroups d_getgrps
19358 eval $inlibc
19359
19360 : see if setgroups exists
19361 set setgroups d_setgrps
19362 eval $inlibc
19363
19364
19365 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19366 echo " "
19367 case "$d_getgrps$d_setgrps" in
19368 *define*)
19369         case "$groupstype" in
19370         '') dflt="$gidtype" ;;
19371         *)  dflt="$groupstype" ;;
19372         esac
19373         $cat <<EOM
19374 What type of pointer is the second argument to getgroups() and setgroups()?
19375 Usually this is the same as group ids, $gidtype, but not always.
19376
19377 EOM
19378         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19379         . ./myread
19380         groupstype="$ans"
19381         ;;
19382 *)  groupstype="$gidtype";;
19383 esac
19384
19385
19386 if $test $patchlevel -lt 9; then
19387 : MAD is not available in 5.8.x or earlier.
19388     ans=n;
19389 else
19390     case "$mad" in
19391     $define|true|[yY]*) dflt='y' ;;
19392     *)                  dflt='n' ;;
19393     esac
19394     cat <<EOM
19395
19396 Would you like to build with Misc Attribute Decoration? This is development
19397 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19398 overhead on the interpreter.
19399
19400 If this doesn't make any sense to you, just accept the default '$dflt'.
19401 EOM
19402     rp='Build Perl with MAD?'
19403     . ./myread
19404 fi
19405 case "$ans" in
19406 y|Y)    val="$define"
19407         madlyh='madly.h madly.act madly.tab'
19408         madlysrc='madly.c'
19409         madlyobj="madly$_o" ;;
19410 *)      val="$undef"
19411         madlyh=''
19412         madlysrc=''
19413         madlyobj='' ;;
19414 esac
19415 set mad
19416 eval $setvar
19417
19418 echo " "
19419 echo "Checking if your $make program sets \$(MAKE)..." >&4
19420 case "$make_set_make" in
19421 '')
19422         $sed 's/^X //' > testmake.mak << 'EOF'
19423 Xall:
19424 X       @echo 'maketemp="$(MAKE)"'
19425 EOF
19426         case "`$make -f testmake.mak 2>/dev/null`" in
19427         *maketemp=*) make_set_make='#' ;;
19428         *)      make_set_make="MAKE=$make" ;;
19429         esac
19430         $rm -f testmake.mak
19431         ;;
19432 esac
19433 case "$make_set_make" in
19434 '#') echo "Yup, it does.";;
19435 *) echo "Nope, it doesn't.";;
19436 esac
19437
19438 : see what type is used for mode_t
19439 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19440 set mode_t modetype int stdio.h sys/types.h
19441 eval $typedef_ask
19442
19443 : see if we need va_copy
19444 echo " "
19445 case "$i_stdarg" in
19446 "$define")
19447         $cat >try.c <<EOCP
19448 #include <stdarg.h>
19449 #include <stdio.h>
19450 #$i_stdlib I_STDLIB
19451 #ifdef I_STDLIB
19452 #include <stdlib.h>
19453 #endif
19454 #include <signal.h>
19455
19456 int
19457 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19458 {
19459   return vfprintf(f, fmt, *valp);
19460 }
19461  
19462 int    
19463 myvfprintf(FILE *f, const  char *fmt, va_list val)
19464 {
19465   return ivfprintf(f, fmt, &val);
19466 }
19467       
19468 int
19469 myprintf(char *fmt, ...) 
19470 {
19471   va_list val;
19472   va_start(val, fmt);
19473   return myvfprintf(stdout, fmt, val); 
19474 }         
19475
19476 int
19477 main(int ac, char **av)
19478 {
19479   signal(SIGSEGV, exit);
19480
19481   myprintf("%s%cs all right, then\n", "that", '\'');                            
19482   exit(0);      
19483 }
19484 EOCP
19485         set try
19486         if eval $compile && $run ./try 2>&1 >/dev/null; then
19487                 case "`$run ./try`" in
19488                 "that's all right, then")
19489                         okay=yes
19490                         ;;
19491                 esac
19492         fi
19493         case "$okay" in
19494         yes)    echo "It seems that you don't need va_copy()." >&4
19495                 need_va_copy="$undef"
19496                 ;;
19497         *)      echo "It seems that va_copy() or similar will be needed." >&4
19498                 need_va_copy="$define"
19499                 ;;
19500         esac
19501         $rm -f try.* core core.* *.core *.core.*
19502         ;;
19503 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19504         ;;
19505 esac
19506
19507 : see what type is used for size_t
19508 rp="What is the type used for the length parameter for string functions?"
19509 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19510 eval $typedef_ask
19511
19512 : check for type of arguments to gethostbyaddr. 
19513 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19514         case "$d_gethbyaddr" in
19515         $define)
19516                 $cat <<EOM
19517
19518 Checking to see what type of arguments are accepted by gethostbyaddr().
19519 EOM
19520                 hdrs="$define sys/types.h
19521                         $d_socket sys/socket.h 
19522                         $i_niin netinet/in.h 
19523                         $i_netdb netdb.h
19524                         $i_unistd unistd.h"
19525                 : The first arg can 'char *' or 'void *'
19526                 : The second arg is some of integral type
19527                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19528                         for yyy in size_t long int; do
19529                                 case "$netdb_host_type" in
19530                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19531                                         if ./protochk "$try" $hdrs; then
19532                                                 echo "Your system accepts $xxx for the first arg."
19533                                                 echo "...and $yyy for the second arg."
19534                                                 netdb_host_type="$xxx"
19535                                                 netdb_hlen_type="$yyy"
19536                                         fi
19537                                         ;;
19538                                 esac
19539                         done
19540                 done
19541                 : In case none of those worked, prompt the user.
19542                 case "$netdb_host_type" in
19543                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19544                         dflt='char *'
19545                         . ./myread
19546                         netdb_host_type=$ans
19547                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19548                         dflt="$sizetype"
19549                         . ./myread
19550                         netdb_hlen_type=$ans
19551                         ;;
19552                 esac
19553                 ;;
19554         *)      : no gethostbyaddr, so pick harmless defaults
19555                 netdb_host_type='char *'
19556                 netdb_hlen_type="$sizetype"
19557                 ;;
19558         esac
19559         # Remove the "const" if needed. -- but then we'll have a 
19560         # prototype clash!
19561         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19562 fi
19563
19564 : check for type of argument to gethostbyname. 
19565 if test "X$netdb_name_type" = X ; then
19566         case "$d_gethbyname" in
19567         $define)
19568                 $cat <<EOM
19569
19570 Checking to see what type of argument is accepted by gethostbyname().
19571 EOM
19572                 hdrs="$define sys/types.h
19573                         $d_socket sys/socket.h 
19574                         $i_niin netinet/in.h 
19575                         $i_netdb netdb.h
19576                         $i_unistd unistd.h"
19577                 for xxx in "const char *" "char *"; do
19578                         case "$netdb_name_type" in
19579                         '')     try="extern struct hostent *gethostbyname($xxx);"
19580                                 if ./protochk "$try" $hdrs; then
19581                                         echo "Your system accepts $xxx."
19582                                         netdb_name_type="$xxx"
19583                                 fi
19584                                 ;;
19585                         esac
19586                 done
19587                 : In case none of those worked, prompt the user.
19588                 case "$netdb_name_type" in
19589                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19590                         dflt='char *'
19591                         . ./myread
19592                         netdb_name_type=$ans
19593                         ;;
19594                 esac
19595                 ;;
19596         *)      : no gethostbyname, so pick harmless default
19597                 netdb_name_type='char *'
19598                 ;;
19599         esac
19600 fi
19601
19602 : check for type of 1st argument to getnetbyaddr. 
19603 if test "X$netdb_net_type" = X ; then
19604         case "$d_getnbyaddr" in
19605         $define)
19606                 $cat <<EOM
19607
19608 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19609 EOM
19610                 hdrs="$define sys/types.h
19611                         $d_socket sys/socket.h 
19612                         $i_niin netinet/in.h 
19613                         $i_netdb netdb.h
19614                         $i_unistd unistd.h"
19615                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19616                         case "$netdb_net_type" in
19617                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19618                                 if ./protochk "$try" $hdrs; then
19619                                         echo "Your system accepts $xxx."
19620                                         netdb_net_type="$xxx"
19621                                 fi
19622                                 ;;
19623                         esac
19624                 done
19625                 : In case none of those worked, prompt the user.
19626                 case "$netdb_net_type" in
19627                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19628                         dflt='long'
19629                         . ./myread
19630                         netdb_net_type=$ans
19631                         ;;
19632                 esac
19633                 ;;
19634         *)      : no getnetbyaddr, so pick harmless default
19635                 netdb_net_type='long'
19636                 ;;
19637         esac
19638 fi
19639 : locate the preferred pager for this system
19640 fn=f/
19641 case "$pager" in
19642 '')
19643         dflt=''
19644         case "$pg" in
19645         /*) dflt=$pg;;
19646         [a-zA-Z]:/*) dflt=$pg;;
19647         esac
19648         case "$more" in
19649         /*) dflt=$more;;
19650         [a-zA-Z]:/*) dflt=$more;;
19651         esac
19652         case "$less" in
19653         /*) dflt=$less;;
19654         [a-zA-Z]:/*) dflt=$less;;
19655         esac
19656         case "$dflt" in
19657         '') dflt=/usr/ucb/more;;
19658         esac
19659         ;;
19660 *)      dflt="$pager"
19661         : Instruct ./getfile to trust the hinted or previous pager value,
19662         : even if it does not begin with a slash.  For example, on os2,
19663         : pager might be cmd /c more.  See comments in UU/getfile.
19664         fn="f/($pager)"
19665         ;;
19666 esac
19667 echo " "
19668 rp='What pager is used on your system?'
19669 . ./getfile
19670 pager="$ans"
19671
19672 : see what type pids are declared as in the kernel
19673 rp="What is the type of process ids on this system?"
19674 set pid_t pidtype int stdio.h sys/types.h
19675 eval $typedef_ask
19676
19677 : see if ar generates random libraries by itself
19678 echo " "
19679 echo "Checking how to generate random libraries on your machine..." >&4
19680 echo 'int bar1() { return bar2(); }' > bar1.c
19681 echo 'int bar2() { return 2; }' > bar2.c
19682 $cat > foo.c <<EOP
19683 #$i_stdlib I_STDLIB
19684 #ifdef I_STDLIB
19685 #include <stdlib.h>
19686 #endif
19687 int main() { printf("%d\n", bar1()); exit(0); }
19688 EOP
19689 $cc $ccflags -c bar1.c >/dev/null 2>&1
19690 $cc $ccflags -c bar2.c >/dev/null 2>&1
19691 $cc $ccflags -c foo.c >/dev/null 2>&1
19692 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19693 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19694         $run ./foobar >/dev/null 2>&1; then
19695         echo "$ar appears to generate random libraries itself."
19696         orderlib=false
19697         if [ "X$ranlib" = "X" ]; then
19698             ranlib=":"
19699         fi
19700 elif $ar s bar$_a >/dev/null 2>&1 &&
19701         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19702         $run ./foobar >/dev/null 2>&1; then
19703                 echo "a table of contents needs to be added with '$ar s'."
19704                 orderlib=false
19705                 ranlib="$ar s"
19706 elif $ar ts bar$_a >/dev/null 2>&1 &&
19707         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19708         $run ./foobar >/dev/null 2>&1; then
19709                 echo "a table of contents needs to be added with '$ar ts'."
19710                 orderlib=false
19711                 ranlib="$ar ts"
19712 else
19713         case "$ranlib" in
19714         :) ranlib='';;
19715         '')
19716                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19717                 $test -f $ranlib || ranlib=''
19718                 ;;
19719         esac
19720         if $test -n "$ranlib"; then
19721                 echo "your system has '$ranlib'; we'll use that."
19722                 orderlib=false
19723         else
19724                 echo "your system doesn't seem to support random libraries"
19725                 echo "so we'll use lorder and tsort to order the libraries."
19726                 orderlib=true
19727                 ranlib=":"
19728         fi
19729 fi
19730 $rm -f foo* bar*
19731
19732 : check for type of arguments to select. 
19733 case "$selecttype" in
19734 '') case "$d_select" in
19735         $define)
19736                 echo " "
19737                 $cat <<EOM
19738 Checking to see what type of arguments are accepted by select().
19739 EOM
19740                 hdrs="$define sys/types.h
19741                         $i_systime sys/time.h 
19742                         $i_sysselct sys/select.h
19743                         $d_socket sys/socket.h"
19744                 : The first arg can be int, unsigned, or size_t
19745                 : The last arg may or may not be 'const'
19746                 val=''
19747                 : void pointer has been seen but using that
19748                 : breaks the selectminbits test
19749                 for xxx in 'fd_set *' 'int *'; do
19750                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19751                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19752                                         case "$val" in
19753                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19754                                                 if ./protochk "$try" $hdrs; then
19755                                                         echo "Your system accepts $xxx."
19756                                                         val="$xxx"
19757                                                 fi
19758                                                 ;;
19759                                         esac
19760                                 done
19761                         done
19762                 done
19763                 case "$val" in
19764                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19765                         case "$d_fd_set" in
19766                                 $define) dflt="fd_set *" ;;
19767                                 *)              dflt="int *" ;;
19768                         esac
19769                         . ./myread
19770                         val=$ans
19771                         ;;
19772                 esac
19773                 selecttype="$val"
19774                 ;;
19775         *)      : no select, so pick a harmless default
19776                 selecttype='int *'
19777                 ;;
19778         esac
19779         ;;
19780 esac
19781
19782 : check for the select 'width'
19783 case "$selectminbits" in
19784 '') safebits=`expr $ptrsize \* 8`
19785     case "$d_select" in
19786         $define)
19787                 $cat <<EOM
19788
19789 Checking to see on how many bits at a time your select() operates...
19790 EOM
19791                 $cat >try.c <<EOCP
19792 #include <sys/types.h>
19793 #$i_time I_TIME
19794 #$i_systime I_SYS_TIME
19795 #$i_systimek I_SYS_TIME_KERNEL
19796 #ifdef I_TIME
19797 #   include <time.h>
19798 #endif
19799 #ifdef I_SYS_TIME
19800 #   ifdef I_SYS_TIME_KERNEL
19801 #       define KERNEL
19802 #   endif
19803 #   include <sys/time.h>
19804 #   ifdef I_SYS_TIME_KERNEL
19805 #       undef KERNEL
19806 #   endif
19807 #endif
19808 #$i_sysselct I_SYS_SELECT
19809 #ifdef I_SYS_SELECT
19810 #include <sys/select.h>
19811 #endif
19812 #$d_socket HAS_SOCKET
19813 #ifdef HAS_SOCKET
19814 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19815 #endif
19816 #include <stdio.h>
19817 #$i_stdlib I_STDLIB
19818 #ifdef I_STDLIB
19819 #include <stdlib.h>
19820 #endif
19821 $selecttype b;
19822 #define S sizeof(*(b))
19823 #define MINBITS 64
19824 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19825 #define NBITS  (NBYTES * 8)
19826 int main() {
19827     char *s = (char *)malloc(NBYTES);
19828     struct timeval t;
19829     int i;
19830     FILE* fp;
19831     int fd;
19832
19833     if (!s)
19834         exit(1);
19835     fclose(stdin);
19836     fp = fopen("try.c", "r");
19837     if (fp == 0)
19838       exit(2);
19839     fd = fileno(fp);
19840     if (fd < 0)
19841       exit(3);
19842     b = ($selecttype)s;
19843     for (i = 0; i < NBITS; i++)
19844         FD_SET(i, b);
19845     t.tv_sec  = 0;
19846     t.tv_usec = 0;
19847     select(fd + 1, b, 0, 0, &t);
19848     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19849     free(s);
19850     printf("%d\n", i + 1);
19851     return 0;
19852 }
19853 EOCP
19854                 set try
19855                 if eval $compile_ok; then
19856                         selectminbits=`$run ./try`
19857                         case "$selectminbits" in
19858                         '')     cat >&4 <<EOM
19859 Cannot figure out on how many bits at a time your select() operates.
19860 I'll play safe and guess it is $safebits bits.
19861 EOM
19862                                 selectminbits=$safebits
19863                                 bits="$safebits bits"
19864                                 ;;
19865                         1)      bits="1 bit" ;;
19866                         *)      bits="$selectminbits bits" ;;
19867                         esac
19868                         echo "Your select() operates on $bits at a time." >&4
19869                 else
19870                         rp='What is the minimum number of bits your select() operates on?'
19871                         case "$byteorder" in
19872                         12345678)       dflt=64 ;;
19873                         1234)           dflt=32 ;;
19874                         *)              dflt=1  ;;
19875                         esac
19876                         . ./myread
19877                         val=$ans
19878                         selectminbits="$val"
19879                 fi
19880                 $rm -f try.* try
19881                 ;;
19882         *)      : no select, so pick a harmless default
19883                 selectminbits=$safebits
19884                 ;;
19885         esac
19886         ;;
19887 esac
19888
19889 : Trace out the files included by signal.h, then look for SIGxxx names.
19890 : Remove SIGARRAYSIZE used by HPUX.
19891 : Remove SIGSTKSIZE used by Linux.
19892 : Remove SIGSTKSZ used by Posix.
19893 : Remove SIGTYP void lines used by OS2.
19894 : Some cpps, like os390, dont give the file name anywhere
19895 if [ "X$fieldn" = X ]; then
19896         : Just make some guesses.  We check them later.
19897         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19898 else
19899         xxx=`echo '#include <signal.h>' |
19900         $cppstdin $cppminus $cppflags 2>/dev/null |
19901         $grep '^[       ]*#.*include' | 
19902         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19903 fi
19904 : Check this list of files to be sure we have parsed the cpp output ok.
19905 : This will also avoid potentially non-existent files, such 
19906 : as ../foo/bar.h
19907 xxxfiles=''
19908 for xx in $xxx /dev/null ; do
19909         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19910 done
19911 : If we have found no files, at least try signal.h
19912 case "$xxxfiles" in
19913 '')     xxxfiles=`./findhdr signal.h` ;;
19914 esac
19915 xxx=`awk '
19916 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19917         print substr($2, 4, 20)
19918 }
19919 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19920         print substr($3, 4, 20)
19921 }' $xxxfiles`
19922 : Append some common names just in case the awk scan failed.
19923 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19924 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19925 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19926 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19927 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19928
19929 : generate a few handy files for later
19930 $cat > signal.c <<EOCP
19931 #include <sys/types.h>
19932 #include <signal.h>
19933 #$i_stdlib I_STDLIB
19934 #ifdef I_STDLIB
19935 #include <stdlib.h>
19936 #endif
19937 #include <stdio.h>
19938 int main() {
19939
19940 /* Strange style to avoid deeply-nested #if/#else/#endif */
19941 #ifndef NSIG
19942 #  ifdef _NSIG
19943 #    define NSIG (_NSIG)
19944 #  endif
19945 #endif
19946
19947 #ifndef NSIG
19948 #  ifdef SIGMAX
19949 #    define NSIG (SIGMAX+1)
19950 #  endif
19951 #endif
19952
19953 #ifndef NSIG
19954 #  ifdef SIG_MAX
19955 #    define NSIG (SIG_MAX+1)
19956 #  endif
19957 #endif
19958
19959 #ifndef NSIG
19960 #  ifdef _SIG_MAX
19961 #    define NSIG (_SIG_MAX+1)
19962 #  endif
19963 #endif
19964
19965 #ifndef NSIG
19966 #  ifdef MAXSIG
19967 #    define NSIG (MAXSIG+1)
19968 #  endif
19969 #endif
19970
19971 #ifndef NSIG
19972 #  ifdef MAX_SIG
19973 #    define NSIG (MAX_SIG+1)
19974 #  endif
19975 #endif
19976
19977 #ifndef NSIG
19978 #  ifdef SIGARRAYSIZE
19979 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19980 #  endif
19981 #endif
19982
19983 #ifndef NSIG
19984 #  ifdef _sys_nsig
19985 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19986 #  endif
19987 #endif
19988
19989 /* Default to some arbitrary number that's big enough to get most
19990    of the common signals.
19991 */
19992 #ifndef NSIG
19993 #    define NSIG 50
19994 #endif
19995
19996 printf("NSIG %d\n", NSIG);
19997
19998 #ifndef JUST_NSIG
19999
20000 EOCP
20001
20002 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20003 {
20004         printf "#ifdef SIG"; printf $1; printf "\n"
20005         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20006         printf $1; printf ");\n"
20007         printf "#endif\n"
20008 }
20009 END {
20010         printf "#endif /* JUST_NSIG */\n";
20011         printf "exit(0);\n}\n";
20012 }
20013 ' >>signal.c
20014 $cat >signal.awk <<'EOP'
20015 BEGIN { ndups = 0 }
20016 $1 ~ /^NSIG$/ { nsig = $2 }
20017 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20018     if ($2 > maxsig) { maxsig = $2 }
20019     if (sig_name[$2]) {
20020         dup_name[ndups] = $1
20021         dup_num[ndups] = $2
20022         ndups++ 
20023     }
20024     else {
20025         sig_name[$2] = $1
20026         sig_num[$2] = $2
20027     }
20028 }
20029 END { 
20030     if (nsig == 0) {
20031         nsig = maxsig + 1
20032     }
20033     printf("NSIG %d\n", nsig);
20034     for (n = 1; n < nsig; n++) {
20035         if (sig_name[n]) {
20036             printf("%s %d\n", sig_name[n], sig_num[n])
20037         }
20038         else {
20039             printf("NUM%d %d\n", n, n) 
20040         }
20041     }
20042     for (n = 0; n < ndups; n++) {
20043         printf("%s %d\n", dup_name[n], dup_num[n])
20044     }
20045 }
20046 EOP
20047 $cat >signal_cmd <<EOS
20048 $startsh
20049 if $test -s signal.lst; then
20050     echo "Using your existing signal.lst file"
20051         exit 0
20052 fi
20053 xxx="$xxx"
20054 EOS
20055 $cat >>signal_cmd <<'EOS'
20056
20057 set signal
20058 if eval $compile_ok; then
20059         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
20060 else
20061         echo "(I can't seem be able to compile the whole test program)" >&4
20062         echo "(I'll try it in little pieces.)" >&4
20063         set signal -DJUST_NSIG
20064         if eval $compile_ok; then
20065                 $run ./signal$_exe > signal.nsg
20066                 $cat signal.nsg
20067         else
20068                 echo "I can't seem to figure out how many signals you have." >&4
20069                 echo "Guessing 50." >&4
20070                 echo 'NSIG 50' > signal.nsg
20071         fi
20072         : Now look at all the signal names, one at a time.
20073         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20074                 $cat > signal.c <<EOCP
20075 #include <sys/types.h>
20076 #include <signal.h>
20077 #include <stdio.h>
20078 int main() {
20079 printf("$xx %d\n", SIG${xx});
20080 return 0;
20081 }
20082 EOCP
20083                 set signal
20084                 if eval $compile; then
20085                         echo "SIG${xx} found."
20086                         $run ./signal$_exe  >> signal.ls1
20087                 else
20088                         echo "SIG${xx} NOT found."
20089                 fi
20090         done
20091         if $test -s signal.ls1; then
20092                 $cat signal.nsg signal.ls1 |
20093                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20094         fi
20095
20096 fi
20097 if $test -s signal.lst; then
20098         :
20099 else
20100         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20101         echo 'kill -l' >signal
20102         set X `csh -f <signal`
20103         $rm -f signal
20104         shift
20105         case $# in
20106         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20107         esac
20108         echo $@ | $tr ' ' $trnl | \
20109             $awk '{ printf "%s %d\n", $1, ++s; }
20110                   END { printf "NSIG %d\n", ++s }' >signal.lst
20111 fi
20112 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20113 EOS
20114 chmod a+x signal_cmd
20115 $eunicefix signal_cmd
20116
20117 : generate list of signal names
20118 echo " "
20119 case "$sig_name_init" in
20120 '') doinit=yes ;;
20121 *)  case "$sig_num_init" in
20122     ''|*,*) doinit=yes ;;
20123     esac ;;
20124 esac
20125 case "$doinit" in
20126 yes)
20127         echo "Generating a list of signal names and numbers..." >&4
20128         . ./signal_cmd
20129         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20130         sig_name=`$awk 'BEGIN { printf "ZERO " }
20131                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20132         sig_num=`$awk  'BEGIN { printf "0 " }
20133                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20134         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20135                              !/^NSIG/   { printf "\"%s\", ", $1 }
20136                              END        { printf "0\n" }' signal.lst`
20137         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20138                              !/^NSIG/   { printf "%d, ", $2}
20139                              END        { printf "0\n"}' signal.lst`
20140         ;;
20141 esac
20142 echo "The following $sig_count signals are available:"
20143 echo " "
20144 echo $sig_name | $awk \
20145 'BEGIN { linelen = 0 }
20146 {
20147         for (i = 1; i <= NF; i++) {
20148                 name = "SIG" $i " "
20149                 linelen = linelen + length(name)
20150                 if (linelen > 70) {
20151                         printf "\n"
20152                         linelen = length(name)
20153                 }
20154                 printf "%s", name
20155         }
20156         printf "\n"
20157 }'
20158 sig_size=`echo $sig_name | awk '{print NF}'`
20159 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
20160
20161 echo " "
20162 case "$sizetype" in
20163 *_t) zzz="$sizetype"    ;;
20164 *)   zzz="filesize"     ;;
20165 esac
20166 echo "Checking the size of $zzz..." >&4 
20167 cat > try.c <<EOCP
20168 #include <sys/types.h>
20169 #include <stdio.h>
20170 #$i_stdlib I_STDLIB
20171 #ifdef I_STDLIB
20172 #include <stdlib.h>
20173 #endif
20174 int main() {
20175     printf("%d\n", (int)sizeof($sizetype));
20176     exit(0);
20177 }
20178 EOCP
20179 set try
20180 if eval $compile_ok; then
20181         yyy=`$run ./try`
20182         case "$yyy" in
20183         '')     sizesize=4
20184                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20185                 ;;
20186         *)      sizesize=$yyy
20187                 echo "Your $zzz size is $sizesize bytes."
20188                 ;;
20189         esac
20190 else
20191         sizesize=4
20192         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20193 fi
20194
20195
20196 : check for socklen_t
20197 echo " "
20198 echo "Checking to see if you have socklen_t..." >&4
20199 $cat >try.c <<EOCP
20200 #include <sys/types.h>
20201 #$d_socket HAS_SOCKET
20202 #ifdef HAS_SOCKET
20203 #include <sys/socket.h>
20204 #endif
20205 int main() { socklen_t x = 16; }
20206 EOCP
20207 set try
20208 if eval $compile; then
20209         val="$define"
20210         echo "You have socklen_t."
20211 else
20212         val="$undef"
20213         echo "You do not have socklen_t."
20214         case "$sizetype" in
20215         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20216         esac
20217 fi
20218 $rm -f try try.*
20219 set d_socklen_t
20220 eval $setvar
20221
20222 : see if this is a socks.h system
20223 set socks.h i_socks
20224 eval $inhdr
20225
20226 : check for type of the size argument to socket calls
20227 case "$d_socket" in
20228 "$define")
20229         $cat <<EOM
20230
20231 Checking to see what type is the last argument of accept().
20232 EOM
20233         yyy=''
20234         case "$d_socklen_t" in
20235         "$define") yyy="$yyy socklen_t"
20236         esac
20237         yyy="$yyy $sizetype int long unsigned"
20238         for xxx in $yyy; do
20239                 case "$socksizetype" in
20240                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20241                         case "$usesocks" in
20242                         "$define")
20243                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20244                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20245                                         socksizetype="$xxx"
20246                                 fi
20247                                 ;;
20248                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20249                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20250                                         socksizetype="$xxx"
20251                                 fi
20252                                 ;;
20253                         esac
20254                         ;;
20255                 esac
20256         done
20257 : In case none of those worked, prompt the user.
20258         case "$socksizetype" in
20259         '')     rp='What is the type for socket address structure sizes?'
20260                 dflt='int'
20261                 . ./myread
20262                 socksizetype=$ans
20263                 ;;
20264         esac
20265         ;;
20266 *)      : no sockets, so pick relatively harmless default
20267         socksizetype='int'
20268         ;;
20269 esac
20270
20271 : see what type is used for signed size_t
20272 set ssize_t ssizetype int stdio.h sys/types.h
20273 eval $typedef
20274 dflt="$ssizetype"
20275 $cat > try.c <<EOM
20276 #include <stdio.h>
20277 #$i_stdlib I_STDLIB
20278 #ifdef I_STDLIB
20279 #include <stdlib.h>
20280 #endif
20281 #include <sys/types.h>
20282 #define Size_t $sizetype
20283 #define SSize_t $dflt
20284 int main()
20285 {
20286         if (sizeof(Size_t) == sizeof(SSize_t))
20287                 printf("$dflt\n");
20288         else if (sizeof(Size_t) == sizeof(int))
20289                 printf("int\n");
20290         else 
20291                 printf("long\n");
20292         exit(0);
20293 }
20294 EOM
20295 echo " "
20296 set try
20297 if eval $compile_ok && $run ./try > /dev/null; then
20298         ssizetype=`$run ./try`
20299         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20300 else
20301         $cat >&4 <<EOM
20302 Help! I can't compile and run the ssize_t test program: please enlighten me!
20303 (This is probably a misconfiguration in your system or libraries, and
20304 you really ought to fix it.  Still, I'll try anyway.)
20305
20306 I need a type that is the same size as $sizetype, but is guaranteed to
20307 be signed.  Common values are ssize_t, int and long.
20308
20309 EOM
20310         rp="What signed type is the same size as $sizetype?"
20311         . ./myread
20312         ssizetype="$ans"
20313 fi
20314 $rm -f try try.*
20315
20316 : see what type of char stdio uses.
20317 echo " "
20318 echo '#include <stdio.h>' > stdio.c
20319 $cppstdin $cppminus < stdio.c > stdioh
20320 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20321         echo "Your stdio uses unsigned chars." >&4
20322         stdchar="unsigned char"
20323 else
20324         echo "Your stdio uses signed chars." >&4
20325         stdchar="char"
20326 fi
20327 $rm -f stdio.* stdioh
20328
20329 : see what type uids are declared as in the kernel
20330 echo " "
20331 echo "Looking for the type for user ids returned by getuid()."
20332 set uid_t uidtype xxx stdio.h sys/types.h
20333 eval $typedef
20334 case "$uidtype" in
20335 xxx)
20336         xxx=`./findhdr sys/user.h`
20337         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20338         case $1 in
20339         unsigned) dflt="$1 $2" ;;
20340         *) dflt="$1" ;;
20341         esac
20342         ;;
20343 *) dflt="$uidtype";;
20344 esac
20345 case "$uidtype" in
20346 uid_t)  echo "uid_t found." ;;
20347 *)      rp="What is the type for user ids returned by getuid()?"
20348         . ./myread
20349         uidtype="$ans"
20350         ;;
20351 esac
20352
20353 echo " "
20354 case "$uidtype" in
20355 *_t) zzz="$uidtype"     ;;
20356 *)   zzz="uid"          ;;
20357 esac
20358 echo "Checking the size of $zzz..." >&4 
20359 cat > try.c <<EOCP
20360 #include <sys/types.h>
20361 #include <stdio.h>
20362 #$i_stdlib I_STDLIB
20363 #ifdef I_STDLIB
20364 #include <stdlib.h>
20365 #endif
20366 int main() {
20367     printf("%d\n", (int)sizeof($uidtype));
20368     exit(0);
20369 }
20370 EOCP
20371 set try
20372 if eval $compile_ok; then
20373         yyy=`$run ./try`
20374         case "$yyy" in
20375         '')     uidsize=4
20376                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20377                 ;;
20378         *)      uidsize=$yyy
20379                 echo "Your $zzz is $uidsize bytes long."
20380                 ;;
20381         esac
20382 else
20383         uidsize=4
20384         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20385 fi
20386
20387 echo " "
20388 case "$uidtype" in
20389 *_t) zzz="$uidtype"     ;;
20390 *)   zzz="uid"          ;;
20391 esac
20392 echo "Checking the sign of $zzz..." >&4
20393 cat > try.c <<EOCP
20394 #include <sys/types.h>
20395 #include <stdio.h>
20396 int main() {
20397         $uidtype foo = -1;
20398         if (foo < 0)
20399                 printf("-1\n");
20400         else
20401                 printf("1\n");
20402 }
20403 EOCP
20404 set try
20405 if eval $compile; then
20406         yyy=`$run ./try`
20407         case "$yyy" in
20408         '')     uidsign=1
20409                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20410                 ;;
20411         *)      uidsign=$yyy
20412                 case "$uidsign" in
20413                  1) echo "Your $zzz is unsigned." ;;
20414                 -1) echo "Your $zzz is signed."   ;;
20415                 esac
20416                 ;;
20417         esac
20418 else
20419         uidsign=1
20420         echo "(I can't compile the test program--guessing unsigned.)" >&4
20421 fi
20422
20423
20424
20425 echo " "
20426 $echo "Checking the format string to be used for uids..." >&4
20427
20428 case "$uidsign" in
20429 -1)     if $test X"$uidsize" = X"$ivsize"; then
20430                 uidformat="$ivdformat"
20431         else
20432                 if $test X"$uidsize" = X"$longsize"; then
20433                         uidformat='"ld"'
20434                 else
20435                         if $test X"$uidsize" = X"$intsize"; then
20436                                 uidformat='"d"'
20437                         else
20438                                 if $test X"$uidsize" = X"$shortsize"; then
20439                                         uidformat='"hd"'
20440                                 fi
20441                         fi
20442                 fi
20443         fi
20444         ;;
20445 *)      if $test X"$uidsize" = X"$uvsize"; then
20446                 uidformat="$uvuformat"
20447         else
20448                 if $test X"$uidsize" = X"$longsize"; then
20449                         uidformat='"lu"'
20450                 else
20451                         if $test X"$uidsize" = X"$intsize"; then
20452                                 uidformat='"u"'
20453                         else
20454                                 if $test X"$uidsize" = X"$shortsize"; then
20455                                         uidformat='"hu"'
20456                                 fi
20457                         fi
20458                 fi
20459         fi
20460         ;;
20461 esac
20462
20463
20464 case "$usesitecustomize" in
20465     $define|true|[Yy]*)
20466         usesitecustomize="$define"
20467         ;;
20468     *)
20469         usesitecustomize="$undef"
20470         ;;
20471     esac
20472
20473 : determine compiler compiler
20474 case "$yacc" in
20475 '')
20476         dflt=yacc;;
20477 *)
20478         dflt="$yacc";;
20479 esac
20480 echo " "
20481 comp='yacc'
20482 if $test -f "$byacc$_exe"; then
20483         dflt="$byacc"
20484         comp="byacc or $comp"
20485 fi
20486 if $test -f "$bison$_exe"; then
20487         comp="$comp or bison -y"
20488 fi
20489 rp="Which compiler compiler ($comp) shall I use?"
20490 . ./myread
20491 yacc="$ans"
20492 case "$yacc" in
20493 *bis*)
20494         case "$yacc" in
20495         *-y*) ;;
20496         *)
20497                 yacc="$yacc -y"
20498                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20499                 ;;
20500         esac
20501         ;;
20502 esac
20503
20504 : see if this is a fp.h system
20505 set fp.h i_fp
20506 eval $inhdr
20507
20508 : see if this is a fp_class.h system
20509 set fp_class.h i_fp_class
20510 eval $inhdr
20511
20512 : see if gdbm.h is available
20513 set gdbm.h t_gdbm
20514 eval $inhdr
20515 case "$t_gdbm" in
20516 $define)
20517         : see if gdbm_open exists
20518         set gdbm_open d_gdbm_open
20519         eval $inlibc
20520         case "$d_gdbm_open" in
20521         $undef)
20522                 t_gdbm="$undef"
20523                 echo "We won't be including <gdbm.h>"
20524                 ;;
20525         esac
20526         ;;
20527 esac
20528 val="$t_gdbm"
20529 set i_gdbm
20530 eval $setvar
20531
20532 : see if this is a ieeefp.h system
20533 case "$i_ieeefp" in
20534 '' ) set ieeefp.h i_ieeefp
20535      eval $inhdr
20536      ;;
20537 esac
20538
20539 : see if this is a libutil.h system
20540 set libutil.h i_libutil
20541 eval $inhdr
20542
20543 : see if mach cthreads are available
20544 if test "X$usethreads" = "X$define"; then
20545         set mach/cthreads.h i_machcthr
20546         eval $inhdr
20547 else
20548         i_machcthr="$undef"
20549 fi
20550
20551
20552
20553 : see if this is a mntent.h system
20554 set mntent.h i_mntent
20555 eval $inhdr
20556
20557 : see if ndbm.h is available
20558 set ndbm.h t_ndbm
20559 eval $inhdr
20560
20561 case "$t_ndbm" in
20562 $undef)
20563     # Some Linux distributions such as RedHat 7.1 put the
20564     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20565     if $test -f /usr/include/gdbm/ndbm.h; then
20566         echo '<gdbm/ndbm.h> found.'
20567         ccflags="$ccflags -I/usr/include/gdbm"
20568         cppflags="$cppflags -I/usr/include/gdbm"
20569         t_ndbm=$define
20570     fi
20571     ;;
20572 esac
20573
20574 case "$t_ndbm" in
20575 $define)
20576         : see if dbm_open exists
20577         set dbm_open d_dbm_open
20578         eval $inlibc
20579         case "$d_dbm_open" in
20580         $undef)
20581                 t_ndbm="$undef"
20582                 echo "We won't be including <ndbm.h>"
20583                 ;;
20584         esac
20585         ;;
20586 esac
20587 val="$t_ndbm"
20588 set i_ndbm
20589 eval $setvar
20590
20591 : see if net/errno.h is available
20592 val=''
20593 set net/errno.h val
20594 eval $inhdr
20595
20596 : Unfortunately, it causes problems on some systems.  Arrgh.
20597 case "$val" in
20598 $define)
20599         cat > try.c <<'EOM'
20600 #include <stdio.h>
20601 #include <errno.h>
20602 #include <net/errno.h>
20603 int func()
20604 {
20605         return ENOTSOCK;
20606 }
20607 EOM
20608         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20609                 echo "We'll be including <net/errno.h>." >&4
20610         else
20611                 echo "We won't be including <net/errno.h>." >&4
20612                 val="$undef"
20613         fi
20614         $rm -f try.* try
20615         ;;
20616 esac
20617 set i_neterrno
20618 eval $setvar
20619
20620 : see if netinet/tcp.h is available
20621 set netinet/tcp.h i_netinettcp
20622 eval $inhdr
20623
20624 : see if this is a poll.h system
20625 set poll.h i_poll
20626 eval $inhdr
20627
20628 : see if this is a prot.h system
20629 set prot.h i_prot
20630 eval $inhdr
20631
20632 echo " "
20633 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20634 $cat <<'EOSH' > Cppsym.know
20635 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20636 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20637 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20638 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20639 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20640 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20641 bull c cadmus clipper CMU COFF COMPILER_VERSION
20642 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20643 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20644 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20645 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20646 GLIBC GLIBC_MINOR
20647 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20648 H3050R H3050RX hbullx20 hcx host_mips
20649 hp200 hp300 hp700 HP700 hp800 hp9000
20650 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20651 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20652 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20653 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20654 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20655 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20656 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20657 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20658 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20659 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20660 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20661 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20662 MATH_HAS_NO_SIDE_EFFECTS
20663 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20664 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20665 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20666 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20667 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20668 NetBSD news1500 news1700 news1800 news1900 news3700
20669 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20670 ns32016 ns32332 ns32k nsc32000
20671 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20672 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20673 pc532 pdp11 PGC PIC plexus PORTAR posix
20674 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20675 POSIX_C_SOURCE POSIX_SOURCE POWER
20676 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20677 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20678 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20679 sony sony_news sonyrisc sparc sparclite spectrum
20680 stardent stdc STDC_EXT stratos sun sun3 sun386
20681 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20682 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20683 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20684 sysV68 sysV88 Tek4132 Tek4300 titan
20685 TM3200 TM5400 TM5600
20686 tower tower32 tower32_200 tower32_600 tower32_700
20687 tower32_800 tower32_850 tss
20688 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20689 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20690 unix UNIX95 UNIX99 unixpc unos
20691 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20692 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20693 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20694 USGr4 USGr4_2
20695 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20696 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20697 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20698 z8000
20699 EOSH
20700 # Maybe put other stuff here too.
20701 cat <<EOSH >>Cppsym.know
20702 $osname
20703 EOSH
20704 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20705 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20706 $cat Cppsym.know > Cppsym.c
20707 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20708 $rm -f Cppsym.a Cppsym.b Cppsym.c
20709 cat <<EOSH > Cppsym
20710 $startsh
20711 if $test \$# -gt 0; then
20712     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20713     if $test -s Cppsym.got; then
20714         $rm -f Cppsym.got
20715         exit 0
20716     fi
20717     $rm -f Cppsym.got
20718     exit 1
20719 else
20720     $tr " " "$trnl" | ./Cppsym.try
20721     exit 0
20722 fi
20723 EOSH
20724 chmod +x Cppsym
20725 $eunicefix Cppsym
20726 cat <<EOSH > Cppsym.try
20727 $startsh
20728 cat <<'EOCP' > try.c
20729 #include <stdio.h>
20730 #if cpp_stuff == 1
20731 #define STRINGIFY(a)    "a"
20732 #endif
20733 #if cpp_stuff == 42
20734 #define StGiFy(a)  #a
20735 #define STRINGIFY(a)    StGiFy(a)
20736 #endif
20737 #if $cpp_stuff != 1 && $cpp_stuff != 42
20738 #   include "Bletch: How does this C preprocessor stringify macros?"
20739 #endif
20740 int main() {
20741 EOCP
20742 $awk \\
20743 EOSH
20744 cat <<'EOSH' >> Cppsym.try
20745 'length($1) > 0 {
20746     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20747     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20748     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20749     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20750 }'       >> try.c
20751 echo 'return 0;}' >> try.c
20752 EOSH
20753 cat <<EOSH >> Cppsym.try
20754 ccflags="$ccflags"
20755 case "$osname-$gccversion" in
20756 irix-) ccflags="\$ccflags -woff 1178" ;;
20757 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20758 esac
20759 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20760 EOSH
20761 chmod +x Cppsym.try
20762 $eunicefix Cppsym.try
20763 ./Cppsym < Cppsym.know > Cppsym.true
20764 : Add in any linux cpp "predefined macros":
20765 case "$osname::$gccversion" in
20766   *linux*::*.*)
20767     tHdrH=_tmpHdr
20768     rm -f $tHdrH'.h' $tHdrH
20769     touch $tHdrH'.h'
20770     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20771        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20772        if [ -s $tHdrH'_cppsym.real' ]; then
20773           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20774        fi
20775     fi
20776     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20777   ;;
20778 esac
20779 : now check the C compiler for additional symbols
20780 postprocess_cc_v=''
20781 case "$osname" in
20782 aix) postprocess_cc_v="|$tr , ' '" ;;
20783 esac
20784 $cat >ccsym <<EOS
20785 $startsh
20786 $cat >tmp.c <<EOF
20787 extern int foo;
20788 EOF
20789 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20790 do
20791         case "\$i" in
20792         -D*) echo "\$i" | $sed 's/^-D//';;
20793         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20794         esac
20795 done
20796 $rm -f try.c
20797 EOS
20798 postprocess_cc_v=''
20799 chmod +x ccsym
20800 $eunicefix ccsym
20801 ./ccsym > ccsym1.raw
20802 if $test -s ccsym1.raw; then
20803        $sort ccsym1.raw | $uniq >ccsym.raw
20804 else
20805        mv ccsym1.raw ccsym.raw
20806 fi
20807
20808 $awk '/\=/ { print $0; next }
20809         { print $0"=1" }' ccsym.raw >ccsym.list
20810 $comm -13 Cppsym.true ccsym.list >ccsym.own
20811 $comm -12 Cppsym.true ccsym.list >ccsym.com
20812 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20813 also=''
20814 if $test -z ccsym.raw; then
20815         echo "Your C compiler doesn't seem to define any symbols!" >&4
20816         echo " "
20817         echo "However, your C preprocessor defines the following symbols:"
20818         $cat Cppsym.true
20819         ccsymbols=''
20820         cppsymbols=`$cat Cppsym.true`
20821         cppsymbols=`echo $cppsymbols`
20822         cppccsymbols="$cppsymbols"
20823 else
20824         if $test -s ccsym.com; then
20825                 echo "Your C compiler and pre-processor define these symbols:"
20826                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20827                 also='also '
20828                 symbols='ones'
20829                 cppccsymbols=`$cat ccsym.com`
20830                 cppccsymbols=`echo $cppccsymbols`
20831                 $test "$silent" || sleep 1
20832         fi
20833         if $test -s ccsym.cpp; then
20834                 $test "$also" && echo " "
20835                 echo "Your C pre-processor ${also}defines the following symbols:"
20836                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20837                 also='further '
20838                 cppsymbols=`$cat ccsym.cpp`
20839                 cppsymbols=`echo $cppsymbols`
20840                 $test "$silent" || sleep 1
20841         fi
20842         if $test -s ccsym.own; then
20843                 $test "$also" && echo " "
20844                 echo "Your C compiler ${also}defines the following cpp symbols:"
20845                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20846                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20847                 ccsymbols=`$cat ccsym.own`
20848                 ccsymbols=`echo $ccsymbols`
20849                 $test "$silent" || sleep 1
20850         fi
20851 fi
20852
20853 : see if this is a termio system
20854 val="$undef"
20855 val2="$undef"
20856 val3="$undef"
20857 if $test `./findhdr termios.h`; then
20858         set tcsetattr i_termios
20859         eval $inlibc
20860         val3="$i_termios"
20861 fi
20862 echo " "
20863 case "$val3" in
20864 "$define") echo "You have POSIX termios.h... good!" >&4;;
20865 *) if ./Cppsym pyr; then
20866                 case "`/bin/universe`" in
20867                 ucb) if $test `./findhdr sgtty.h`; then
20868                                 val2="$define"
20869                                 echo "<sgtty.h> found." >&4
20870                         else
20871                                 echo "System is pyramid with BSD universe."
20872                                 echo "<sgtty.h> not found--you could have problems." >&4
20873                         fi;;
20874                 *) if $test `./findhdr termio.h`; then
20875                                 val="$define"
20876                                 echo "<termio.h> found." >&4
20877                         else
20878                                 echo "System is pyramid with USG universe."
20879                                 echo "<termio.h> not found--you could have problems." >&4
20880                         fi;;
20881                 esac
20882         elif ./usg; then
20883                 if $test `./findhdr termio.h`; then
20884                         echo "<termio.h> found." >&4
20885                         val="$define"
20886                 elif $test `./findhdr sgtty.h`; then
20887                         echo "<sgtty.h> found." >&4
20888                         val2="$define"
20889                 else
20890 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20891                 fi
20892         else
20893                 if $test `./findhdr sgtty.h`; then
20894                         echo "<sgtty.h> found." >&4
20895                         val2="$define"
20896                 elif $test `./findhdr termio.h`; then
20897                         echo "<termio.h> found." >&4
20898                         val="$define"
20899                 else
20900 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20901                 fi
20902         fi;;
20903 esac
20904 set i_termio; eval $setvar
20905 val=$val2; set i_sgtty; eval $setvar
20906 val=$val3; set i_termios; eval $setvar
20907
20908 : see if stddef is available
20909 set stddef.h i_stddef
20910 eval $inhdr
20911
20912 : see if sys/access.h is available
20913 set sys/access.h i_sysaccess
20914 eval $inhdr
20915
20916 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20917 set sys/filio.h i_sysfilio
20918 eval $inhdr
20919 echo " "
20920 if $test `./findhdr sys/ioctl.h`; then
20921         val="$define"
20922         echo '<sys/ioctl.h> found.' >&4
20923 else
20924         val="$undef"
20925         if $test $i_sysfilio = "$define"; then
20926             echo '<sys/ioctl.h> NOT found.' >&4
20927         else
20928                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20929                 $test $i_termio = "$define" && xxx="termio.h"
20930                 $test $i_termios = "$define" && xxx="termios.h"
20931 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20932         fi
20933 fi
20934 set i_sysioctl
20935 eval $setvar
20936
20937 : see if socket ioctl defs are in sys/sockio.h
20938 echo " "
20939 xxx=`./findhdr sys/sockio.h`
20940 if $test "$xxx"; then
20941         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20942                 val="$define"
20943                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20944         else
20945                 val="$undef"
20946                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20947         fi
20948 else
20949         val="$undef"
20950         $cat <<EOM
20951 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20952 EOM
20953 fi
20954 set i_syssockio
20955 eval $setvar
20956
20957
20958 : see if this is a syslog.h system
20959 set syslog.h i_syslog
20960 eval $inhdr
20961
20962
20963 : see if this is a sys/mode.h system
20964 set sys/mode.h i_sysmode
20965 eval $inhdr
20966
20967 : see if sys/resource.h has to be included
20968 set sys/resource.h i_sysresrc
20969 eval $inhdr
20970
20971 : see if sys/security.h is available
20972 set sys/security.h i_syssecrt
20973 eval $inhdr
20974
20975 : see if this is a sys/statvfs.h system
20976 set sys/statvfs.h i_sysstatvfs
20977 eval $inhdr
20978
20979 : see if this is a sys/un.h system
20980 set sys/un.h i_sysun
20981 eval $inhdr
20982
20983
20984 : see if this is a sys/utsname.h system
20985 set sys/utsname.h i_sysutsname
20986 eval $inhdr
20987
20988 : see if this is a syswait system
20989 set sys/wait.h i_syswait
20990 eval $inhdr
20991
20992 : see if this is a ustat.h system
20993 set ustat.h i_ustat
20994 eval $inhdr
20995
20996 : see if this is an utime system
20997 set utime.h i_utime
20998 eval $inhdr
20999
21000 : see if this is a values.h system
21001 set values.h i_values
21002 eval $inhdr
21003
21004 : see if this is a vfork system
21005 case "$d_vfork" in
21006 "$define")
21007         set vfork.h i_vfork
21008         eval $inhdr
21009         ;;
21010 *)
21011         i_vfork="$undef"
21012         ;;
21013 esac
21014
21015 echo " "
21016 echo "Looking for extensions..." >&4
21017 : If we are using the old config.sh, known_extensions may contain
21018 : old or inaccurate or duplicate values.
21019 known_extensions=''
21020 nonxs_extensions=''
21021 : We do not use find because it might not be available.
21022 : We do not just use MANIFEST because the user may have dropped
21023 : some additional extensions into the source tree and expect them
21024 : to be built.
21025
21026 : Function to recursively find available extensions, ignoring DynaLoader
21027 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21028 find_extensions='
21029     for xxx in *; do
21030         case "$xxx" in
21031             DynaLoader|dynaload) ;;
21032             *)
21033             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21034                 known_extensions="$known_extensions $1$xxx";
21035             elif $test -f $xxx/Makefile.PL; then
21036                 nonxs_extensions="$nonxs_extensions $1$xxx";
21037             else
21038                 if $test -d $xxx -a $# -lt 10; then
21039                     set $1$xxx/ $*;
21040                     cd "$xxx";
21041                     eval $find_extensions;
21042                     cd ..;
21043                     shift;
21044                 fi;
21045             fi
21046             ;;
21047         esac;
21048     done'
21049 tdir=`pwd`
21050 cd "$rsrc/ext"
21051 set X
21052 shift
21053 eval $find_extensions
21054 # Special case:  Add in threads/shared since it is not picked up by the
21055 # recursive find above (and adding in general recursive finding breaks
21056 # SDBM_File/sdbm).  A.D.  10/25/2001.
21057 known_extensions="$known_extensions threads/shared"
21058 set X $known_extensions
21059 shift
21060 known_extensions="$*"
21061 #  Ditto for IO/Compress/Base and IO/Compress/Zlib
21062 nonxs_extensions="$nonxs_extensions IO/Compress/Base IO/Compress/Zlib"
21063 set X $nonxs_extensions
21064 shift
21065 nonxs_extensions="$*"
21066 cd "$tdir"
21067
21068 : Now see which are supported on this system.
21069 avail_ext=''
21070 for xxx in $known_extensions ; do
21071         case "$xxx" in
21072         DB_File|db_file)
21073                 case "$i_db" in
21074                 $define) avail_ext="$avail_ext $xxx" ;;
21075                 esac
21076                 ;;
21077         GDBM_File|gdbm_fil)
21078                 case "$i_gdbm" in
21079                 $define) avail_ext="$avail_ext $xxx" ;;
21080                 esac
21081                 ;;
21082         I18N/Langinfo|i18n_lan)
21083                 case "$i_langinfo$d_nl_langinfo" in
21084                 $define$define) avail_ext="$avail_ext $xxx" ;;
21085                 esac
21086                 ;;
21087         NDBM_File|ndbm_fil)
21088                 case "$i_ndbm" in
21089                 $define)
21090                     case "$osname-$use64bitint" in
21091                     hpux-define)
21092                         case "$libs" in
21093                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21094                         esac
21095                         ;;
21096                     *) avail_ext="$avail_ext $xxx" ;;
21097                     esac
21098                     ;;
21099                 esac
21100                 ;;
21101         ODBM_File|odbm_fil)
21102                 case "${i_dbm}${i_rpcsvcdbm}" in
21103                 *"${define}"*)
21104                     case "$osname-$use64bitint" in
21105                     hpux-define)
21106                         case "$libs" in
21107                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21108                         esac
21109                         ;;
21110                     *) avail_ext="$avail_ext $xxx" ;;
21111                     esac
21112                     ;;
21113                 esac
21114                 ;;
21115         POSIX|posix)
21116                 case "$useposix" in
21117                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21118                 esac
21119                 ;;
21120         Opcode|opcode)
21121                 case "$useopcode" in
21122                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21123                 esac
21124                 ;;
21125         Socket|socket)
21126                 case "$d_socket" in
21127                 true|$define|y)
21128                     case "$osname" in
21129                     beos) ;; # not unless BONE
21130                     *) avail_ext="$avail_ext $xxx" ;;
21131                     esac
21132                     ;;
21133                 esac
21134                 ;;
21135         Sys/Syslog|sys/syslog)
21136                 : XXX syslog requires socket
21137                 case "$d_socket" in
21138                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21139                 esac
21140                 ;;
21141         Thread|thread)
21142                 case "$usethreads" in
21143                 true|$define|y)
21144                         case "$useithreads" in
21145                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
21146                         esac
21147                 esac
21148                 ;;
21149         Win32*)
21150                 case "$osname" in
21151                 cygwin) avail_ext="$avail_ext $xxx" ;;
21152                 esac
21153                 ;;
21154         XS/APItest|xs/apitest)
21155                 # This is just for testing.  Skip it unless we have dynamic loading.
21156
21157                 case "$usedl" in
21158                 $define) avail_ext="$avail_ext $xxx" ;;
21159                 esac
21160                 ;;
21161         XS/Typemap|xs/typemap)
21162                 # This is just for testing.  Skip it unless we have dynamic loading.
21163                 case "$usedl" in
21164                 $define) avail_ext="$avail_ext $xxx" ;;
21165                 esac
21166                 ;;
21167         threads|threads/shared)
21168                 # threads and threads::shared are special cases.
21169                 # To stop people from asking "Perl 5.8.0 was supposed
21170                 # to have this new fancy threads implementation but my
21171                 # perl doesn't have it" and from people trying to
21172                 # (re)install the threads module using CPAN.pm and
21173                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21174                 # the threads.pm and threads/shared.pm will always be
21175                 # there, croaking informatively ("you need to rebuild
21176                 # all of Perl with threads, sorry") when threads haven't
21177                 # been compiled in.
21178                 # --jhi
21179                 avail_ext="$avail_ext $xxx"
21180                 ;;
21181         IPC/SysV|ipc/sysv)
21182                 : XXX Do we need a useipcsysv variable here
21183                 case "${d_msg}${d_sem}${d_shm}" in
21184                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21185                 esac
21186                 ;;
21187         *)      avail_ext="$avail_ext $xxx"
21188                 ;;
21189         esac
21190 done
21191
21192 set X $avail_ext
21193 shift
21194 avail_ext="$*"
21195
21196 case "$onlyextensions" in
21197 '') ;;
21198 *)  keepextensions=''
21199     echo "You have requested that only certains extensions be included..." >&4
21200     for i in $onlyextensions; do
21201         case " $avail_ext " in
21202         *" $i "*)
21203             echo "Keeping extension $i."
21204             keepextensions="$keepextensions $i"
21205             ;;
21206         *) echo "Ignoring extension $i." ;;
21207         esac
21208     done
21209     avail_ext="$keepextensions"
21210     ;;
21211 esac
21212
21213 case "$noextensions" in
21214 '') ;;
21215 *)  keepextensions=''
21216     echo "You have requested that certain extensions be ignored..." >&4
21217     for i in $avail_ext; do
21218         case " $noextensions " in
21219         *" $i "*) echo "Ignoring extension $i." ;;
21220         *) echo "Keeping extension $i.";
21221            keepextensions="$keepextensions $i"
21222            ;;
21223         esac
21224     done
21225     avail_ext="$keepextensions"
21226     ;;
21227 esac
21228
21229 : Now see which nonxs extensions are supported on this system.
21230 : For now assume all are.
21231 nonxs_ext=''
21232 for xxx in $nonxs_extensions ; do
21233         case "$xxx" in
21234         *)      nonxs_ext="$nonxs_ext $xxx"
21235                 ;;
21236         esac
21237 done
21238
21239 set X $nonxs_ext
21240 shift
21241 nonxs_ext="$*"
21242
21243 case $usedl in
21244 $define)
21245         $cat <<EOM
21246 A number of extensions are supplied with $package.  You may choose to
21247 compile these extensions for dynamic loading (the default), compile
21248 them into the $package executable (static loading), or not include
21249 them at all.  Answer "none" to include no extensions.
21250 Note that DynaLoader is always built and need not be mentioned here.
21251
21252 EOM
21253         case "$dynamic_ext" in
21254         '')
21255                 : Exclude those listed in static_ext
21256                 dflt=''
21257                 for xxx in $avail_ext; do
21258                         case " $static_ext " in
21259                         *" $xxx "*) ;;
21260                         *) dflt="$dflt $xxx" ;;
21261                         esac
21262                 done
21263                 set X $dflt
21264                 shift
21265                 dflt="$*"
21266                 ;;
21267         *)      dflt="$dynamic_ext"
21268                 # Perhaps we are reusing an old out-of-date config.sh.
21269                 case "$hint" in
21270                 previous)
21271                         if test X"$dynamic_ext" != X"$avail_ext"; then
21272                                 $cat <<EOM
21273 NOTICE:  Your previous config.sh list may be incorrect.
21274 The extensions now available to you are
21275         ${avail_ext}
21276 but the default list from your previous config.sh is
21277         ${dynamic_ext}
21278
21279 EOM
21280                         fi
21281                         ;;
21282                 esac
21283                 ;;
21284         esac
21285         case "$dflt" in
21286         '')     dflt=none;;
21287         esac
21288         rp="What extensions do you wish to load dynamically?"
21289         . ./myread
21290         case "$ans" in
21291         none) dynamic_ext=' ' ;;
21292         *) dynamic_ext="$ans" ;;
21293         esac
21294
21295         case "$static_ext" in
21296         '')
21297                 : Exclude those already listed in dynamic linking
21298                 dflt=''
21299                 for xxx in $avail_ext; do
21300                         case " $dynamic_ext " in
21301                         *" $xxx "*) ;;
21302                         *) dflt="$dflt $xxx" ;;
21303                         esac
21304                 done
21305                 set X $dflt
21306                 shift
21307                 dflt="$*"
21308                 ;;
21309         *)  dflt="$static_ext"
21310                 ;;
21311         esac
21312
21313         case "$dflt" in
21314         '')     dflt=none;;
21315         esac
21316         rp="What extensions do you wish to load statically?"
21317         . ./myread
21318         case "$ans" in
21319         none) static_ext=' ' ;;
21320         *) static_ext="$ans" ;;
21321         esac
21322         ;;
21323 *)
21324         $cat <<EOM
21325 A number of extensions are supplied with $package.  Answer "none"
21326 to include no extensions.
21327 Note that DynaLoader is always built and need not be mentioned here.
21328
21329 EOM
21330         case "$static_ext" in
21331         '') dflt="$avail_ext" ;;
21332         *)      dflt="$static_ext"
21333                 # Perhaps we are reusing an old out-of-date config.sh.
21334                 case "$hint" in
21335                 previous)
21336                         if test X"$static_ext" != X"$avail_ext"; then
21337                                 $cat <<EOM
21338 NOTICE:  Your previous config.sh list may be incorrect.
21339 The extensions now available to you are
21340         ${avail_ext}
21341 but the default list from your previous config.sh is
21342         ${static_ext}
21343
21344 EOM
21345                         fi
21346                         ;;
21347                 esac
21348                 ;;
21349         esac
21350         : Exclude those that are not xs extensions
21351         case "$dflt" in
21352         '')     dflt=none;;
21353         esac
21354         rp="What extensions do you wish to include?"
21355         . ./myread
21356         case "$ans" in
21357         none) static_ext=' ' ;;
21358         *) static_ext="$ans" ;;
21359         esac
21360         ;;
21361 esac
21362 #
21363 # Encode is a special case.  If we are building Encode as a static
21364 # extension, we need to explicitly list its subextensions as well.
21365 # For other nested extensions, this is handled automatically by
21366 # the appropriate Makefile.PL.
21367 case " $static_ext " in
21368         *" Encode "*) # Add the subextensions of Encode
21369         cd "$rsrc/ext"
21370         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21371                 static_ext="$static_ext Encode/$xxx"
21372         done
21373         cd "$tdir"
21374         ;;
21375 esac
21376
21377 set X $dynamic_ext $static_ext $nonxs_ext
21378 shift
21379 extensions="$*"
21380
21381 # Sanity check:  We require an extension suitable for use with
21382 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21383 # should show up as failures in the test suite, but it's helpful to
21384 # catch them now.) The 'extensions' list is normally sorted
21385 # alphabetically, so we need to accept either
21386 #    DB_File ... Fcntl ... IO  ....
21387 # or something like
21388 #    Fcntl ... NDBM_File ... IO  ....
21389 case " $extensions"  in
21390 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21391 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21392 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21393 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21394    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21395    ;;
21396 esac
21397
21398 : Remove libraries needed only for extensions
21399 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21400 : The exception is SunOS 4.x, which needs them.
21401 case "${osname}X${osvers}" in
21402 sunos*X4*)
21403     perllibs="$libs"
21404     ;;
21405 *) case "$usedl" in
21406     $define|true|[yY]*)
21407             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21408             shift
21409             perllibs="$*"
21410             ;;
21411     *)  perllibs="$libs"
21412             ;;
21413     esac
21414     ;;
21415 esac
21416
21417 : Remove build directory name from cppstdin so it can be used from
21418 : either the present location or the final installed location.
21419 echo " "
21420 : Get out of the UU directory to get correct path name.
21421 cd ..
21422 case "$cppstdin" in
21423 `pwd`/cppstdin)
21424         echo "Stripping down cppstdin path name"
21425         cppstdin=cppstdin
21426         ;;
21427 esac
21428 cd UU
21429
21430 : end of configuration questions
21431 echo " "
21432 echo "End of configuration questions."
21433 echo " "
21434
21435 : back to where it started
21436 if test -d ../UU; then
21437         cd ..
21438 fi
21439
21440 : configuration may be patched via a 'config.arch' file
21441 if $test -f config.arch; then
21442         echo "I see a config.arch file, loading it."
21443         . ./config.arch
21444 fi
21445
21446 : configuration may be patched via a 'config.over' file
21447 if $test -f config.over; then
21448         echo " "
21449         dflt=y
21450         rp='I see a config.over file.  Do you wish to load it?'
21451         . UU/myread
21452         case "$ans" in
21453         n*) echo "OK, I'll ignore it.";;
21454         *)      . ./config.over
21455                 echo "Configuration override changes have been loaded."
21456                 ;;
21457         esac
21458 fi
21459
21460 : in case they want portability, strip down executable paths
21461 case "$d_portable" in
21462 "$define")
21463         echo " "
21464         echo "Stripping down executable paths..." >&4
21465         for file in $loclist $trylist; do
21466                 eval temp=\$$file
21467                 eval $file=`basename $temp`
21468         done
21469         ;;
21470 esac
21471
21472 : create config.sh file
21473 echo " "
21474 echo "Creating config.sh..." >&4
21475 $spitshell <<EOT >config.sh
21476 $startsh
21477 #
21478 # This file was produced by running the Configure script. It holds all the
21479 # definitions figured out by Configure. Should you modify one of these values,
21480 # do not forget to propagate your changes by running "Configure -der". You may
21481 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21482 #
21483
21484 # Package name      : $package
21485 # Source directory  : $src
21486 # Configuration time: $cf_time
21487 # Configured by     : $cf_by
21488 # Target system     : $myuname
21489
21490 Author='$Author'
21491 Date='$Date'
21492 Header='$Header'
21493 Id='$Id'
21494 Locker='$Locker'
21495 Log='$Log'
21496 Mcc='$Mcc'
21497 RCSfile='$RCSfile'
21498 Revision='$Revision'
21499 Source='$Source'
21500 State='$State'
21501 _a='$_a'
21502 _exe='$_exe'
21503 _o='$_o'
21504 afs='$afs'
21505 afsroot='$afsroot'
21506 alignbytes='$alignbytes'
21507 ansi2knr='$ansi2knr'
21508 aphostname='$aphostname'
21509 api_revision='$api_revision'
21510 api_subversion='$api_subversion'
21511 api_version='$api_version'
21512 api_versionstring='$api_versionstring'
21513 ar='$ar'
21514 archlib='$archlib'
21515 archlibexp='$archlibexp'
21516 archname64='$archname64'
21517 archname='$archname'
21518 archobjs='$archobjs'
21519 asctime_r_proto='$asctime_r_proto'
21520 awk='$awk'
21521 baserev='$baserev'
21522 bash='$bash'
21523 bin='$bin'
21524 binexp='$binexp'
21525 bison='$bison'
21526 byacc='$byacc'
21527 byteorder='$byteorder'
21528 c='$c'
21529 castflags='$castflags'
21530 cat='$cat'
21531 cc='$cc'
21532 cccdlflags='$cccdlflags'
21533 ccdlflags='$ccdlflags'
21534 ccflags='$ccflags'
21535 ccflags_uselargefiles='$ccflags_uselargefiles'
21536 ccname='$ccname'
21537 ccsymbols='$ccsymbols'
21538 ccversion='$ccversion'
21539 cf_by='$cf_by'
21540 cf_email='$cf_email'
21541 cf_time='$cf_time'
21542 charsize='$charsize'
21543 chgrp='$chgrp'
21544 chmod='$chmod'
21545 chown='$chown'
21546 clocktype='$clocktype'
21547 comm='$comm'
21548 compress='$compress'
21549 contains='$contains'
21550 cp='$cp'
21551 cpio='$cpio'
21552 cpp='$cpp'
21553 cpp_stuff='$cpp_stuff'
21554 cppccsymbols='$cppccsymbols'
21555 cppflags='$cppflags'
21556 cpplast='$cpplast'
21557 cppminus='$cppminus'
21558 cpprun='$cpprun'
21559 cppstdin='$cppstdin'
21560 cppsymbols='$cppsymbols'
21561 crypt_r_proto='$crypt_r_proto'
21562 cryptlib='$cryptlib'
21563 csh='$csh'
21564 ctermid_r_proto='$ctermid_r_proto'
21565 ctime_r_proto='$ctime_r_proto'
21566 d_Gconvert='$d_Gconvert'
21567 d_PRIEUldbl='$d_PRIEUldbl'
21568 d_PRIFUldbl='$d_PRIFUldbl'
21569 d_PRIGUldbl='$d_PRIGUldbl'
21570 d_PRIXU64='$d_PRIXU64'
21571 d_PRId64='$d_PRId64'
21572 d_PRIeldbl='$d_PRIeldbl'
21573 d_PRIfldbl='$d_PRIfldbl'
21574 d_PRIgldbl='$d_PRIgldbl'
21575 d_PRIi64='$d_PRIi64'
21576 d_PRIo64='$d_PRIo64'
21577 d_PRIu64='$d_PRIu64'
21578 d_PRIx64='$d_PRIx64'
21579 d_SCNfldbl='$d_SCNfldbl'
21580 d__fwalk='$d__fwalk'
21581 d_access='$d_access'
21582 d_accessx='$d_accessx'
21583 d_aintl='$d_aintl'
21584 d_alarm='$d_alarm'
21585 d_archlib='$d_archlib'
21586 d_asctime_r='$d_asctime_r'
21587 d_atolf='$d_atolf'
21588 d_atoll='$d_atoll'
21589 d_attribute_format='$d_attribute_format'
21590 d_attribute_malloc='$d_attribute_malloc'
21591 d_attribute_nonnull='$d_attribute_nonnull'
21592 d_attribute_noreturn='$d_attribute_noreturn'
21593 d_attribute_pure='$d_attribute_pure'
21594 d_attribute_unused='$d_attribute_unused'
21595 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21596 d_bcmp='$d_bcmp'
21597 d_bcopy='$d_bcopy'
21598 d_bsd='$d_bsd'
21599 d_bsdgetpgrp='$d_bsdgetpgrp'
21600 d_bsdsetpgrp='$d_bsdsetpgrp'
21601 d_builtin_choose_expr='$d_builtin_choose_expr'
21602 d_builtin_expect='$d_builtin_expect'
21603 d_bzero='$d_bzero'
21604 d_c99_variadic_macros='$d_c99_variadic_macros'
21605 d_casti32='$d_casti32'
21606 d_castneg='$d_castneg'
21607 d_charvspr='$d_charvspr'
21608 d_chown='$d_chown'
21609 d_chroot='$d_chroot'
21610 d_chsize='$d_chsize'
21611 d_class='$d_class'
21612 d_clearenv='$d_clearenv'
21613 d_closedir='$d_closedir'
21614 d_cmsghdr_s='$d_cmsghdr_s'
21615 d_const='$d_const'
21616 d_copysignl='$d_copysignl'
21617 d_cplusplus='$d_cplusplus'
21618 d_crypt='$d_crypt'
21619 d_crypt_r='$d_crypt_r'
21620 d_csh='$d_csh'
21621 d_ctermid='$d_ctermid'
21622 d_ctermid_r='$d_ctermid_r'
21623 d_ctime_r='$d_ctime_r'
21624 d_cuserid='$d_cuserid'
21625 d_dbl_dig='$d_dbl_dig'
21626 d_dbminitproto='$d_dbminitproto'
21627 d_difftime='$d_difftime'
21628 d_dir_dd_fd='$d_dir_dd_fd'
21629 d_dirfd='$d_dirfd'
21630 d_dirnamlen='$d_dirnamlen'
21631 d_dlerror='$d_dlerror'
21632 d_dlopen='$d_dlopen'
21633 d_dlsymun='$d_dlsymun'
21634 d_dosuid='$d_dosuid'
21635 d_drand48_r='$d_drand48_r'
21636 d_drand48proto='$d_drand48proto'
21637 d_dup2='$d_dup2'
21638 d_eaccess='$d_eaccess'
21639 d_endgrent='$d_endgrent'
21640 d_endgrent_r='$d_endgrent_r'
21641 d_endhent='$d_endhent'
21642 d_endhostent_r='$d_endhostent_r'
21643 d_endnent='$d_endnent'
21644 d_endnetent_r='$d_endnetent_r'
21645 d_endpent='$d_endpent'
21646 d_endprotoent_r='$d_endprotoent_r'
21647 d_endpwent='$d_endpwent'
21648 d_endpwent_r='$d_endpwent_r'
21649 d_endsent='$d_endsent'
21650 d_endservent_r='$d_endservent_r'
21651 d_eofnblk='$d_eofnblk'
21652 d_eunice='$d_eunice'
21653 d_faststdio='$d_faststdio'
21654 d_fchdir='$d_fchdir'
21655 d_fchmod='$d_fchmod'
21656 d_fchown='$d_fchown'
21657 d_fcntl='$d_fcntl'
21658 d_fcntl_can_lock='$d_fcntl_can_lock'
21659 d_fd_macros='$d_fd_macros'
21660 d_fd_set='$d_fd_set'
21661 d_fds_bits='$d_fds_bits'
21662 d_fgetpos='$d_fgetpos'
21663 d_finite='$d_finite'
21664 d_finitel='$d_finitel'
21665 d_flexfnam='$d_flexfnam'
21666 d_flock='$d_flock'
21667 d_flockproto='$d_flockproto'
21668 d_fork='$d_fork'
21669 d_fp_class='$d_fp_class'
21670 d_fpathconf='$d_fpathconf'
21671 d_fpclass='$d_fpclass'
21672 d_fpclassify='$d_fpclassify'
21673 d_fpclassl='$d_fpclassl'
21674 d_fpos64_t='$d_fpos64_t'
21675 d_frexpl='$d_frexpl'
21676 d_fs_data_s='$d_fs_data_s'
21677 d_fseeko='$d_fseeko'
21678 d_fsetpos='$d_fsetpos'
21679 d_fstatfs='$d_fstatfs'
21680 d_fstatvfs='$d_fstatvfs'
21681 d_fsync='$d_fsync'
21682 d_ftello='$d_ftello'
21683 d_ftime='$d_ftime'
21684 d_futimes='$d_futimes'
21685 d_getcwd='$d_getcwd'
21686 d_getespwnam='$d_getespwnam'
21687 d_getfsstat='$d_getfsstat'
21688 d_getgrent='$d_getgrent'
21689 d_getgrent_r='$d_getgrent_r'
21690 d_getgrgid_r='$d_getgrgid_r'
21691 d_getgrnam_r='$d_getgrnam_r'
21692 d_getgrps='$d_getgrps'
21693 d_gethbyaddr='$d_gethbyaddr'
21694 d_gethbyname='$d_gethbyname'
21695 d_gethent='$d_gethent'
21696 d_gethname='$d_gethname'
21697 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21698 d_gethostbyname_r='$d_gethostbyname_r'
21699 d_gethostent_r='$d_gethostent_r'
21700 d_gethostprotos='$d_gethostprotos'
21701 d_getitimer='$d_getitimer'
21702 d_getlogin='$d_getlogin'
21703 d_getlogin_r='$d_getlogin_r'
21704 d_getmnt='$d_getmnt'
21705 d_getmntent='$d_getmntent'
21706 d_getnbyaddr='$d_getnbyaddr'
21707 d_getnbyname='$d_getnbyname'
21708 d_getnent='$d_getnent'
21709 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21710 d_getnetbyname_r='$d_getnetbyname_r'
21711 d_getnetent_r='$d_getnetent_r'
21712 d_getnetprotos='$d_getnetprotos'
21713 d_getpagsz='$d_getpagsz'
21714 d_getpbyname='$d_getpbyname'
21715 d_getpbynumber='$d_getpbynumber'
21716 d_getpent='$d_getpent'
21717 d_getpgid='$d_getpgid'
21718 d_getpgrp2='$d_getpgrp2'
21719 d_getpgrp='$d_getpgrp'
21720 d_getppid='$d_getppid'
21721 d_getprior='$d_getprior'
21722 d_getprotobyname_r='$d_getprotobyname_r'
21723 d_getprotobynumber_r='$d_getprotobynumber_r'
21724 d_getprotoent_r='$d_getprotoent_r'
21725 d_getprotoprotos='$d_getprotoprotos'
21726 d_getprpwnam='$d_getprpwnam'
21727 d_getpwent='$d_getpwent'
21728 d_getpwent_r='$d_getpwent_r'
21729 d_getpwnam_r='$d_getpwnam_r'
21730 d_getpwuid_r='$d_getpwuid_r'
21731 d_getsbyname='$d_getsbyname'
21732 d_getsbyport='$d_getsbyport'
21733 d_getsent='$d_getsent'
21734 d_getservbyname_r='$d_getservbyname_r'
21735 d_getservbyport_r='$d_getservbyport_r'
21736 d_getservent_r='$d_getservent_r'
21737 d_getservprotos='$d_getservprotos'
21738 d_getspnam='$d_getspnam'
21739 d_getspnam_r='$d_getspnam_r'
21740 d_gettimeod='$d_gettimeod'
21741 d_gmtime_r='$d_gmtime_r'
21742 d_gnulibc='$d_gnulibc'
21743 d_grpasswd='$d_grpasswd'
21744 d_hasmntopt='$d_hasmntopt'
21745 d_htonl='$d_htonl'
21746 d_ilogbl='$d_ilogbl'
21747 d_inc_version_list='$d_inc_version_list'
21748 d_index='$d_index'
21749 d_inetaton='$d_inetaton'
21750 d_int64_t='$d_int64_t'
21751 d_isascii='$d_isascii'
21752 d_isfinite='$d_isfinite'
21753 d_isinf='$d_isinf'
21754 d_isnan='$d_isnan'
21755 d_isnanl='$d_isnanl'
21756 d_killpg='$d_killpg'
21757 d_lchown='$d_lchown'
21758 d_ldbl_dig='$d_ldbl_dig'
21759 d_libm_lib_version='$d_libm_lib_version'
21760 d_link='$d_link'
21761 d_localtime_r='$d_localtime_r'
21762 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21763 d_locconv='$d_locconv'
21764 d_lockf='$d_lockf'
21765 d_longdbl='$d_longdbl'
21766 d_longlong='$d_longlong'
21767 d_lseekproto='$d_lseekproto'
21768 d_lstat='$d_lstat'
21769 d_madvise='$d_madvise'
21770 d_malloc_good_size='$d_malloc_good_size'
21771 d_malloc_size='$d_malloc_size'
21772 d_mblen='$d_mblen'
21773 d_mbstowcs='$d_mbstowcs'
21774 d_mbtowc='$d_mbtowc'
21775 d_memchr='$d_memchr'
21776 d_memcmp='$d_memcmp'
21777 d_memcpy='$d_memcpy'
21778 d_memmove='$d_memmove'
21779 d_memset='$d_memset'
21780 d_mkdir='$d_mkdir'
21781 d_mkdtemp='$d_mkdtemp'
21782 d_mkfifo='$d_mkfifo'
21783 d_mkstemp='$d_mkstemp'
21784 d_mkstemps='$d_mkstemps'
21785 d_mktime='$d_mktime'
21786 d_mmap='$d_mmap'
21787 d_modfl='$d_modfl'
21788 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21789 d_modflproto='$d_modflproto'
21790 d_mprotect='$d_mprotect'
21791 d_msg='$d_msg'
21792 d_msg_ctrunc='$d_msg_ctrunc'
21793 d_msg_dontroute='$d_msg_dontroute'
21794 d_msg_oob='$d_msg_oob'
21795 d_msg_peek='$d_msg_peek'
21796 d_msg_proxy='$d_msg_proxy'
21797 d_msgctl='$d_msgctl'
21798 d_msgget='$d_msgget'
21799 d_msghdr_s='$d_msghdr_s'
21800 d_msgrcv='$d_msgrcv'
21801 d_msgsnd='$d_msgsnd'
21802 d_msync='$d_msync'
21803 d_munmap='$d_munmap'
21804 d_mymalloc='$d_mymalloc'
21805 d_nice='$d_nice'
21806 d_nl_langinfo='$d_nl_langinfo'
21807 d_nv_preserves_uv='$d_nv_preserves_uv'
21808 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21809 d_off64_t='$d_off64_t'
21810 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21811 d_oldpthreads='$d_oldpthreads'
21812 d_oldsock='$d_oldsock'
21813 d_open3='$d_open3'
21814 d_pathconf='$d_pathconf'
21815 d_pause='$d_pause'
21816 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21817 d_phostname='$d_phostname'
21818 d_pipe='$d_pipe'
21819 d_poll='$d_poll'
21820 d_portable='$d_portable'
21821 d_printf_format_null='$d_printf_format_null'
21822 d_procselfexe='$d_procselfexe'
21823 d_pseudofork='$d_pseudofork'
21824 d_pthread_atfork='$d_pthread_atfork'
21825 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21826 d_pthread_yield='$d_pthread_yield'
21827 d_pwage='$d_pwage'
21828 d_pwchange='$d_pwchange'
21829 d_pwclass='$d_pwclass'
21830 d_pwcomment='$d_pwcomment'
21831 d_pwexpire='$d_pwexpire'
21832 d_pwgecos='$d_pwgecos'
21833 d_pwpasswd='$d_pwpasswd'
21834 d_pwquota='$d_pwquota'
21835 d_qgcvt='$d_qgcvt'
21836 d_quad='$d_quad'
21837 d_random_r='$d_random_r'
21838 d_readdir64_r='$d_readdir64_r'
21839 d_readdir='$d_readdir'
21840 d_readdir_r='$d_readdir_r'
21841 d_readlink='$d_readlink'
21842 d_readv='$d_readv'
21843 d_recvmsg='$d_recvmsg'
21844 d_rename='$d_rename'
21845 d_rewinddir='$d_rewinddir'
21846 d_rmdir='$d_rmdir'
21847 d_safebcpy='$d_safebcpy'
21848 d_safemcpy='$d_safemcpy'
21849 d_sanemcmp='$d_sanemcmp'
21850 d_sbrkproto='$d_sbrkproto'
21851 d_scalbnl='$d_scalbnl'
21852 d_sched_yield='$d_sched_yield'
21853 d_scm_rights='$d_scm_rights'
21854 d_seekdir='$d_seekdir'
21855 d_select='$d_select'
21856 d_sem='$d_sem'
21857 d_semctl='$d_semctl'
21858 d_semctl_semid_ds='$d_semctl_semid_ds'
21859 d_semctl_semun='$d_semctl_semun'
21860 d_semget='$d_semget'
21861 d_semop='$d_semop'
21862 d_sendmsg='$d_sendmsg'
21863 d_setegid='$d_setegid'
21864 d_seteuid='$d_seteuid'
21865 d_setgrent='$d_setgrent'
21866 d_setgrent_r='$d_setgrent_r'
21867 d_setgrps='$d_setgrps'
21868 d_sethent='$d_sethent'
21869 d_sethostent_r='$d_sethostent_r'
21870 d_setitimer='$d_setitimer'
21871 d_setlinebuf='$d_setlinebuf'
21872 d_setlocale='$d_setlocale'
21873 d_setlocale_r='$d_setlocale_r'
21874 d_setnent='$d_setnent'
21875 d_setnetent_r='$d_setnetent_r'
21876 d_setpent='$d_setpent'
21877 d_setpgid='$d_setpgid'
21878 d_setpgrp2='$d_setpgrp2'
21879 d_setpgrp='$d_setpgrp'
21880 d_setprior='$d_setprior'
21881 d_setproctitle='$d_setproctitle'
21882 d_setprotoent_r='$d_setprotoent_r'
21883 d_setpwent='$d_setpwent'
21884 d_setpwent_r='$d_setpwent_r'
21885 d_setregid='$d_setregid'
21886 d_setresgid='$d_setresgid'
21887 d_setresuid='$d_setresuid'
21888 d_setreuid='$d_setreuid'
21889 d_setrgid='$d_setrgid'
21890 d_setruid='$d_setruid'
21891 d_setsent='$d_setsent'
21892 d_setservent_r='$d_setservent_r'
21893 d_setsid='$d_setsid'
21894 d_setvbuf='$d_setvbuf'
21895 d_sfio='$d_sfio'
21896 d_shm='$d_shm'
21897 d_shmat='$d_shmat'
21898 d_shmatprototype='$d_shmatprototype'
21899 d_shmctl='$d_shmctl'
21900 d_shmdt='$d_shmdt'
21901 d_shmget='$d_shmget'
21902 d_sigaction='$d_sigaction'
21903 d_signbit='$d_signbit'
21904 d_sigprocmask='$d_sigprocmask'
21905 d_sigsetjmp='$d_sigsetjmp'
21906 d_sitearch='$d_sitearch'
21907 d_snprintf='$d_snprintf'
21908 d_sockatmark='$d_sockatmark'
21909 d_sockatmarkproto='$d_sockatmarkproto'
21910 d_socket='$d_socket'
21911 d_socklen_t='$d_socklen_t'
21912 d_sockpair='$d_sockpair'
21913 d_socks5_init='$d_socks5_init'
21914 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21915 d_sqrtl='$d_sqrtl'
21916 d_srand48_r='$d_srand48_r'
21917 d_srandom_r='$d_srandom_r'
21918 d_sresgproto='$d_sresgproto'
21919 d_sresuproto='$d_sresuproto'
21920 d_statblks='$d_statblks'
21921 d_statfs_f_flags='$d_statfs_f_flags'
21922 d_statfs_s='$d_statfs_s'
21923 d_statvfs='$d_statvfs'
21924 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21925 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21926 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21927 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21928 d_stdio_stream_array='$d_stdio_stream_array'
21929 d_stdiobase='$d_stdiobase'
21930 d_stdstdio='$d_stdstdio'
21931 d_strchr='$d_strchr'
21932 d_strcoll='$d_strcoll'
21933 d_strctcpy='$d_strctcpy'
21934 d_strerrm='$d_strerrm'
21935 d_strerror='$d_strerror'
21936 d_strerror_r='$d_strerror_r'
21937 d_strftime='$d_strftime'
21938 d_strlcat='$d_strlcat'
21939 d_strlcpy='$d_strlcpy'
21940 d_strtod='$d_strtod'
21941 d_strtol='$d_strtol'
21942 d_strtold='$d_strtold'
21943 d_strtoll='$d_strtoll'
21944 d_strtoq='$d_strtoq'
21945 d_strtoul='$d_strtoul'
21946 d_strtoull='$d_strtoull'
21947 d_strtouq='$d_strtouq'
21948 d_strxfrm='$d_strxfrm'
21949 d_suidsafe='$d_suidsafe'
21950 d_symlink='$d_symlink'
21951 d_syscall='$d_syscall'
21952 d_syscallproto='$d_syscallproto'
21953 d_sysconf='$d_sysconf'
21954 d_sysernlst='$d_sysernlst'
21955 d_syserrlst='$d_syserrlst'
21956 d_system='$d_system'
21957 d_tcgetpgrp='$d_tcgetpgrp'
21958 d_tcsetpgrp='$d_tcsetpgrp'
21959 d_telldir='$d_telldir'
21960 d_telldirproto='$d_telldirproto'
21961 d_time='$d_time'
21962 d_times='$d_times'
21963 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21964 d_tm_tm_zone='$d_tm_tm_zone'
21965 d_tmpnam_r='$d_tmpnam_r'
21966 d_truncate='$d_truncate'
21967 d_ttyname_r='$d_ttyname_r'
21968 d_tzname='$d_tzname'
21969 d_u32align='$d_u32align'
21970 d_ualarm='$d_ualarm'
21971 d_umask='$d_umask'
21972 d_uname='$d_uname'
21973 d_union_semun='$d_union_semun'
21974 d_unordered='$d_unordered'
21975 d_unsetenv='$d_unsetenv'
21976 d_usleep='$d_usleep'
21977 d_usleepproto='$d_usleepproto'
21978 d_ustat='$d_ustat'
21979 d_vendorarch='$d_vendorarch'
21980 d_vendorbin='$d_vendorbin'
21981 d_vendorlib='$d_vendorlib'
21982 d_vendorscript='$d_vendorscript'
21983 d_vfork='$d_vfork'
21984 d_void_closedir='$d_void_closedir'
21985 d_voidsig='$d_voidsig'
21986 d_voidtty='$d_voidtty'
21987 d_volatile='$d_volatile'
21988 d_vprintf='$d_vprintf'
21989 d_vsnprintf='$d_vsnprintf'
21990 d_wait4='$d_wait4'
21991 d_waitpid='$d_waitpid'
21992 d_wcstombs='$d_wcstombs'
21993 d_wctomb='$d_wctomb'
21994 d_writev='$d_writev'
21995 d_xenix='$d_xenix'
21996 date='$date'
21997 db_hashtype='$db_hashtype'
21998 db_prefixtype='$db_prefixtype'
21999 db_version_major='$db_version_major'
22000 db_version_minor='$db_version_minor'
22001 db_version_patch='$db_version_patch'
22002 defvoidused='$defvoidused'
22003 direntrytype='$direntrytype'
22004 dlext='$dlext'
22005 dlsrc='$dlsrc'
22006 doublesize='$doublesize'
22007 drand01='$drand01'
22008 drand48_r_proto='$drand48_r_proto'
22009 dynamic_ext='$dynamic_ext'
22010 eagain='$eagain'
22011 ebcdic='$ebcdic'
22012 echo='$echo'
22013 egrep='$egrep'
22014 emacs='$emacs'
22015 endgrent_r_proto='$endgrent_r_proto'
22016 endhostent_r_proto='$endhostent_r_proto'
22017 endnetent_r_proto='$endnetent_r_proto'
22018 endprotoent_r_proto='$endprotoent_r_proto'
22019 endpwent_r_proto='$endpwent_r_proto'
22020 endservent_r_proto='$endservent_r_proto'
22021 eunicefix='$eunicefix'
22022 exe_ext='$exe_ext'
22023 expr='$expr'
22024 extensions='$extensions'
22025 extras='$extras'
22026 fflushNULL='$fflushNULL'
22027 fflushall='$fflushall'
22028 find='$find'
22029 firstmakefile='$firstmakefile'
22030 flex='$flex'
22031 fpossize='$fpossize'
22032 fpostype='$fpostype'
22033 freetype='$freetype'
22034 from='$from'
22035 full_ar='$full_ar'
22036 full_csh='$full_csh'
22037 full_sed='$full_sed'
22038 gccansipedantic='$gccansipedantic'
22039 gccosandvers='$gccosandvers'
22040 gccversion='$gccversion'
22041 getgrent_r_proto='$getgrent_r_proto'
22042 getgrgid_r_proto='$getgrgid_r_proto'
22043 getgrnam_r_proto='$getgrnam_r_proto'
22044 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22045 gethostbyname_r_proto='$gethostbyname_r_proto'
22046 gethostent_r_proto='$gethostent_r_proto'
22047 getlogin_r_proto='$getlogin_r_proto'
22048 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22049 getnetbyname_r_proto='$getnetbyname_r_proto'
22050 getnetent_r_proto='$getnetent_r_proto'
22051 getprotobyname_r_proto='$getprotobyname_r_proto'
22052 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22053 getprotoent_r_proto='$getprotoent_r_proto'
22054 getpwent_r_proto='$getpwent_r_proto'
22055 getpwnam_r_proto='$getpwnam_r_proto'
22056 getpwuid_r_proto='$getpwuid_r_proto'
22057 getservbyname_r_proto='$getservbyname_r_proto'
22058 getservbyport_r_proto='$getservbyport_r_proto'
22059 getservent_r_proto='$getservent_r_proto'
22060 getspnam_r_proto='$getspnam_r_proto'
22061 gidformat='$gidformat'
22062 gidsign='$gidsign'
22063 gidsize='$gidsize'
22064 gidtype='$gidtype'
22065 glibpth='$glibpth'
22066 gmake='$gmake'
22067 gmtime_r_proto='$gmtime_r_proto'
22068 gnulibc_version='$gnulibc_version'
22069 grep='$grep'
22070 groupcat='$groupcat'
22071 groupstype='$groupstype'
22072 gzip='$gzip'
22073 h_fcntl='$h_fcntl'
22074 h_sysfile='$h_sysfile'
22075 hint='$hint'
22076 hostcat='$hostcat'
22077 html1dir='$html1dir'
22078 html1direxp='$html1direxp'
22079 html3dir='$html3dir'
22080 html3direxp='$html3direxp'
22081 i16size='$i16size'
22082 i16type='$i16type'
22083 i32size='$i32size'
22084 i32type='$i32type'
22085 i64size='$i64size'
22086 i64type='$i64type'
22087 i8size='$i8size'
22088 i8type='$i8type'
22089 i_arpainet='$i_arpainet'
22090 i_bsdioctl='$i_bsdioctl'
22091 i_crypt='$i_crypt'
22092 i_db='$i_db'
22093 i_dbm='$i_dbm'
22094 i_dirent='$i_dirent'
22095 i_dld='$i_dld'
22096 i_dlfcn='$i_dlfcn'
22097 i_fcntl='$i_fcntl'
22098 i_float='$i_float'
22099 i_fp='$i_fp'
22100 i_fp_class='$i_fp_class'
22101 i_gdbm='$i_gdbm'
22102 i_grp='$i_grp'
22103 i_ieeefp='$i_ieeefp'
22104 i_inttypes='$i_inttypes'
22105 i_langinfo='$i_langinfo'
22106 i_libutil='$i_libutil'
22107 i_limits='$i_limits'
22108 i_locale='$i_locale'
22109 i_machcthr='$i_machcthr'
22110 i_malloc='$i_malloc'
22111 i_math='$i_math'
22112 i_memory='$i_memory'
22113 i_mntent='$i_mntent'
22114 i_ndbm='$i_ndbm'
22115 i_netdb='$i_netdb'
22116 i_neterrno='$i_neterrno'
22117 i_netinettcp='$i_netinettcp'
22118 i_niin='$i_niin'
22119 i_poll='$i_poll'
22120 i_prot='$i_prot'
22121 i_pthread='$i_pthread'
22122 i_pwd='$i_pwd'
22123 i_rpcsvcdbm='$i_rpcsvcdbm'
22124 i_sfio='$i_sfio'
22125 i_sgtty='$i_sgtty'
22126 i_shadow='$i_shadow'
22127 i_socks='$i_socks'
22128 i_stdarg='$i_stdarg'
22129 i_stddef='$i_stddef'
22130 i_stdlib='$i_stdlib'
22131 i_string='$i_string'
22132 i_sunmath='$i_sunmath'
22133 i_sysaccess='$i_sysaccess'
22134 i_sysdir='$i_sysdir'
22135 i_sysfile='$i_sysfile'
22136 i_sysfilio='$i_sysfilio'
22137 i_sysin='$i_sysin'
22138 i_sysioctl='$i_sysioctl'
22139 i_syslog='$i_syslog'
22140 i_sysmman='$i_sysmman'
22141 i_sysmode='$i_sysmode'
22142 i_sysmount='$i_sysmount'
22143 i_sysndir='$i_sysndir'
22144 i_sysparam='$i_sysparam'
22145 i_sysresrc='$i_sysresrc'
22146 i_syssecrt='$i_syssecrt'
22147 i_sysselct='$i_sysselct'
22148 i_syssockio='$i_syssockio'
22149 i_sysstat='$i_sysstat'
22150 i_sysstatfs='$i_sysstatfs'
22151 i_sysstatvfs='$i_sysstatvfs'
22152 i_systime='$i_systime'
22153 i_systimek='$i_systimek'
22154 i_systimes='$i_systimes'
22155 i_systypes='$i_systypes'
22156 i_sysuio='$i_sysuio'
22157 i_sysun='$i_sysun'
22158 i_sysutsname='$i_sysutsname'
22159 i_sysvfs='$i_sysvfs'
22160 i_syswait='$i_syswait'
22161 i_termio='$i_termio'
22162 i_termios='$i_termios'
22163 i_time='$i_time'
22164 i_unistd='$i_unistd'
22165 i_ustat='$i_ustat'
22166 i_utime='$i_utime'
22167 i_values='$i_values'
22168 i_varargs='$i_varargs'
22169 i_varhdr='$i_varhdr'
22170 i_vfork='$i_vfork'
22171 ignore_versioned_solibs='$ignore_versioned_solibs'
22172 inc_version_list='$inc_version_list'
22173 inc_version_list_init='$inc_version_list_init'
22174 incpath='$incpath'
22175 inews='$inews'
22176 initialinstalllocation='$initialinstalllocation'
22177 installarchlib='$installarchlib'
22178 installbin='$installbin'
22179 installhtml1dir='$installhtml1dir'
22180 installhtml3dir='$installhtml3dir'
22181 installman1dir='$installman1dir'
22182 installman3dir='$installman3dir'
22183 installprefix='$installprefix'
22184 installprefixexp='$installprefixexp'
22185 installprivlib='$installprivlib'
22186 installscript='$installscript'
22187 installsitearch='$installsitearch'
22188 installsitebin='$installsitebin'
22189 installsitehtml1dir='$installsitehtml1dir'
22190 installsitehtml3dir='$installsitehtml3dir'
22191 installsitelib='$installsitelib'
22192 installsiteman1dir='$installsiteman1dir'
22193 installsiteman3dir='$installsiteman3dir'
22194 installsitescript='$installsitescript'
22195 installstyle='$installstyle'
22196 installusrbinperl='$installusrbinperl'
22197 installvendorarch='$installvendorarch'
22198 installvendorbin='$installvendorbin'
22199 installvendorhtml1dir='$installvendorhtml1dir'
22200 installvendorhtml3dir='$installvendorhtml3dir'
22201 installvendorlib='$installvendorlib'
22202 installvendorman1dir='$installvendorman1dir'
22203 installvendorman3dir='$installvendorman3dir'
22204 installvendorscript='$installvendorscript'
22205 intsize='$intsize'
22206 issymlink='$issymlink'
22207 ivdformat='$ivdformat'
22208 ivsize='$ivsize'
22209 ivtype='$ivtype'
22210 known_extensions='$known_extensions'
22211 ksh='$ksh'
22212 ld='$ld'
22213 lddlflags='$lddlflags'
22214 ldflags='$ldflags'
22215 ldflags_uselargefiles='$ldflags_uselargefiles'
22216 ldlibpthname='$ldlibpthname'
22217 less='$less'
22218 lib_ext='$lib_ext'
22219 libc='$libc'
22220 libperl='$libperl'
22221 libpth='$libpth'
22222 libs='$libs'
22223 libsdirs='$libsdirs'
22224 libsfiles='$libsfiles'
22225 libsfound='$libsfound'
22226 libspath='$libspath'
22227 libswanted='$libswanted'
22228 libswanted_uselargefiles='$libswanted_uselargefiles'
22229 line='$line'
22230 lint='$lint'
22231 lkflags='$lkflags'
22232 ln='$ln'
22233 lns='$lns'
22234 localtime_r_proto='$localtime_r_proto'
22235 locincpth='$locincpth'
22236 loclibpth='$loclibpth'
22237 longdblsize='$longdblsize'
22238 longlongsize='$longlongsize'
22239 longsize='$longsize'
22240 lp='$lp'
22241 lpr='$lpr'
22242 ls='$ls'
22243 lseeksize='$lseeksize'
22244 lseektype='$lseektype'
22245 mad='$mad'
22246 madlyh='$madlyh'
22247 madlyobj='$madlyobj'
22248 madlysrc='$madlysrc'
22249 mail='$mail'
22250 mailx='$mailx'
22251 make='$make'
22252 make_set_make='$make_set_make'
22253 mallocobj='$mallocobj'
22254 mallocsrc='$mallocsrc'
22255 malloctype='$malloctype'
22256 man1dir='$man1dir'
22257 man1direxp='$man1direxp'
22258 man1ext='$man1ext'
22259 man3dir='$man3dir'
22260 man3direxp='$man3direxp'
22261 man3ext='$man3ext'
22262 mips_type='$mips_type'
22263 mistrustnm='$mistrustnm'
22264 mkdir='$mkdir'
22265 mmaptype='$mmaptype'
22266 modetype='$modetype'
22267 more='$more'
22268 multiarch='$multiarch'
22269 mv='$mv'
22270 myarchname='$myarchname'
22271 mydomain='$mydomain'
22272 myhostname='$myhostname'
22273 myuname='$myuname'
22274 n='$n'
22275 need_va_copy='$need_va_copy'
22276 netdb_hlen_type='$netdb_hlen_type'
22277 netdb_host_type='$netdb_host_type'
22278 netdb_name_type='$netdb_name_type'
22279 netdb_net_type='$netdb_net_type'
22280 nm='$nm'
22281 nm_opt='$nm_opt'
22282 nm_so_opt='$nm_so_opt'
22283 nonxs_ext='$nonxs_ext'
22284 nroff='$nroff'
22285 nvEUformat='$nvEUformat'
22286 nvFUformat='$nvFUformat'
22287 nvGUformat='$nvGUformat'
22288 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22289 nveformat='$nveformat'
22290 nvfformat='$nvfformat'
22291 nvgformat='$nvgformat'
22292 nvsize='$nvsize'
22293 nvtype='$nvtype'
22294 o_nonblock='$o_nonblock'
22295 obj_ext='$obj_ext'
22296 old_pthread_create_joinable='$old_pthread_create_joinable'
22297 optimize='$optimize'
22298 orderlib='$orderlib'
22299 osname='$osname'
22300 osvers='$osvers'
22301 otherlibdirs='$otherlibdirs'
22302 package='$package'
22303 pager='$pager'
22304 passcat='$passcat'
22305 patchlevel='$patchlevel'
22306 path_sep='$path_sep'
22307 perl5='$perl5'
22308 perl='$perl'
22309 perl_patchlevel='$perl_patchlevel'
22310 perladmin='$perladmin'
22311 perllibs='$perllibs'
22312 perlpath='$perlpath'
22313 pg='$pg'
22314 phostname='$phostname'
22315 pidtype='$pidtype'
22316 plibpth='$plibpth'
22317 pmake='$pmake'
22318 pr='$pr'
22319 prefix='$prefix'
22320 prefixexp='$prefixexp'
22321 privlib='$privlib'
22322 privlibexp='$privlibexp'
22323 procselfexe='$procselfexe'
22324 prototype='$prototype'
22325 ptrsize='$ptrsize'
22326 quadkind='$quadkind'
22327 quadtype='$quadtype'
22328 randbits='$randbits'
22329 randfunc='$randfunc'
22330 random_r_proto='$random_r_proto'
22331 randseedtype='$randseedtype'
22332 ranlib='$ranlib'
22333 rd_nodata='$rd_nodata'
22334 readdir64_r_proto='$readdir64_r_proto'
22335 readdir_r_proto='$readdir_r_proto'
22336 revision='$revision'
22337 rm='$rm'
22338 rmail='$rmail'
22339 run='$run'
22340 runnm='$runnm'
22341 sPRIEUldbl='$sPRIEUldbl'
22342 sPRIFUldbl='$sPRIFUldbl'
22343 sPRIGUldbl='$sPRIGUldbl'
22344 sPRIXU64='$sPRIXU64'
22345 sPRId64='$sPRId64'
22346 sPRIeldbl='$sPRIeldbl'
22347 sPRIfldbl='$sPRIfldbl'
22348 sPRIgldbl='$sPRIgldbl'
22349 sPRIi64='$sPRIi64'
22350 sPRIo64='$sPRIo64'
22351 sPRIu64='$sPRIu64'
22352 sPRIx64='$sPRIx64'
22353 sSCNfldbl='$sSCNfldbl'
22354 sched_yield='$sched_yield'
22355 scriptdir='$scriptdir'
22356 scriptdirexp='$scriptdirexp'
22357 sed='$sed'
22358 seedfunc='$seedfunc'
22359 selectminbits='$selectminbits'
22360 selecttype='$selecttype'
22361 sendmail='$sendmail'
22362 setgrent_r_proto='$setgrent_r_proto'
22363 sethostent_r_proto='$sethostent_r_proto'
22364 setlocale_r_proto='$setlocale_r_proto'
22365 setnetent_r_proto='$setnetent_r_proto'
22366 setprotoent_r_proto='$setprotoent_r_proto'
22367 setpwent_r_proto='$setpwent_r_proto'
22368 setservent_r_proto='$setservent_r_proto'
22369 sh='$sh'
22370 shar='$shar'
22371 sharpbang='$sharpbang'
22372 shmattype='$shmattype'
22373 shortsize='$shortsize'
22374 shrpenv='$shrpenv'
22375 shsharp='$shsharp'
22376 sig_count='$sig_count'
22377 sig_name='$sig_name'
22378 sig_name_init='$sig_name_init'
22379 sig_num='$sig_num'
22380 sig_num_init='$sig_num_init'
22381 sig_size='$sig_size'
22382 signal_t='$signal_t'
22383 sitearch='$sitearch'
22384 sitearchexp='$sitearchexp'
22385 sitebin='$sitebin'
22386 sitebinexp='$sitebinexp'
22387 sitehtml1dir='$sitehtml1dir'
22388 sitehtml1direxp='$sitehtml1direxp'
22389 sitehtml3dir='$sitehtml3dir'
22390 sitehtml3direxp='$sitehtml3direxp'
22391 sitelib='$sitelib'
22392 sitelib_stem='$sitelib_stem'
22393 sitelibexp='$sitelibexp'
22394 siteman1dir='$siteman1dir'
22395 siteman1direxp='$siteman1direxp'
22396 siteman3dir='$siteman3dir'
22397 siteman3direxp='$siteman3direxp'
22398 siteprefix='$siteprefix'
22399 siteprefixexp='$siteprefixexp'
22400 sitescript='$sitescript'
22401 sitescriptexp='$sitescriptexp'
22402 sizesize='$sizesize'
22403 sizetype='$sizetype'
22404 sleep='$sleep'
22405 smail='$smail'
22406 so='$so'
22407 sockethdr='$sockethdr'
22408 socketlib='$socketlib'
22409 socksizetype='$socksizetype'
22410 sort='$sort'
22411 spackage='$spackage'
22412 spitshell='$spitshell'
22413 srand48_r_proto='$srand48_r_proto'
22414 srandom_r_proto='$srandom_r_proto'
22415 src='$src'
22416 ssizetype='$ssizetype'
22417 startperl='$startperl'
22418 startsh='$startsh'
22419 static_ext='$static_ext'
22420 stdchar='$stdchar'
22421 stdio_base='$stdio_base'
22422 stdio_bufsiz='$stdio_bufsiz'
22423 stdio_cnt='$stdio_cnt'
22424 stdio_filbuf='$stdio_filbuf'
22425 stdio_ptr='$stdio_ptr'
22426 stdio_stream_array='$stdio_stream_array'
22427 strerror_r_proto='$strerror_r_proto'
22428 strings='$strings'
22429 submit='$submit'
22430 subversion='$subversion'
22431 sysman='$sysman'
22432 tail='$tail'
22433 tar='$tar'
22434 targetarch='$targetarch'
22435 tbl='$tbl'
22436 tee='$tee'
22437 test='$test'
22438 timeincl='$timeincl'
22439 timetype='$timetype'
22440 tmpnam_r_proto='$tmpnam_r_proto'
22441 to='$to'
22442 touch='$touch'
22443 tr='$tr'
22444 trnl='$trnl'
22445 troff='$troff'
22446 ttyname_r_proto='$ttyname_r_proto'
22447 u16size='$u16size'
22448 u16type='$u16type'
22449 u32size='$u32size'
22450 u32type='$u32type'
22451 u64size='$u64size'
22452 u64type='$u64type'
22453 u8size='$u8size'
22454 u8type='$u8type'
22455 uidformat='$uidformat'
22456 uidsign='$uidsign'
22457 uidsize='$uidsize'
22458 uidtype='$uidtype'
22459 uname='$uname'
22460 uniq='$uniq'
22461 uquadtype='$uquadtype'
22462 use5005threads='$use5005threads'
22463 use64bitall='$use64bitall'
22464 use64bitint='$use64bitint'
22465 usecrosscompile='$usecrosscompile'
22466 usedl='$usedl'
22467 usefaststdio='$usefaststdio'
22468 useithreads='$useithreads'
22469 uselargefiles='$uselargefiles'
22470 uselongdouble='$uselongdouble'
22471 usemallocwrap='$usemallocwrap'
22472 usemorebits='$usemorebits'
22473 usemultiplicity='$usemultiplicity'
22474 usemymalloc='$usemymalloc'
22475 usenm='$usenm'
22476 useopcode='$useopcode'
22477 useperlio='$useperlio'
22478 useposix='$useposix'
22479 usereentrant='$usereentrant'
22480 userelocatableinc='$userelocatableinc'
22481 usesfio='$usesfio'
22482 useshrplib='$useshrplib'
22483 usesitecustomize='$usesitecustomize'
22484 usesocks='$usesocks'
22485 usethreads='$usethreads'
22486 usevendorprefix='$usevendorprefix'
22487 usevfork='$usevfork'
22488 usrinc='$usrinc'
22489 uuname='$uuname'
22490 uvXUformat='$uvXUformat'
22491 uvoformat='$uvoformat'
22492 uvsize='$uvsize'
22493 uvtype='$uvtype'
22494 uvuformat='$uvuformat'
22495 uvxformat='$uvxformat'
22496 vendorarch='$vendorarch'
22497 vendorarchexp='$vendorarchexp'
22498 vendorbin='$vendorbin'
22499 vendorbinexp='$vendorbinexp'
22500 vendorhtml1dir='$vendorhtml1dir'
22501 vendorhtml1direxp='$vendorhtml1direxp'
22502 vendorhtml3dir='$vendorhtml3dir'
22503 vendorhtml3direxp='$vendorhtml3direxp'
22504 vendorlib='$vendorlib'
22505 vendorlib_stem='$vendorlib_stem'
22506 vendorlibexp='$vendorlibexp'
22507 vendorman1dir='$vendorman1dir'
22508 vendorman1direxp='$vendorman1direxp'
22509 vendorman3dir='$vendorman3dir'
22510 vendorman3direxp='$vendorman3direxp'
22511 vendorprefix='$vendorprefix'
22512 vendorprefixexp='$vendorprefixexp'
22513 vendorscript='$vendorscript'
22514 vendorscriptexp='$vendorscriptexp'
22515 version='$version'
22516 version_patchlevel_string='$version_patchlevel_string'
22517 versiononly='$versiononly'
22518 vi='$vi'
22519 voidflags='$voidflags'
22520 xlibpth='$xlibpth'
22521 yacc='$yacc'
22522 yaccflags='$yaccflags'
22523 zcat='$zcat'
22524 zip='$zip'
22525 EOT
22526
22527 : Add in command line options if available
22528 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22529
22530 : add special variables
22531 $test -f $src/patchlevel.h && \
22532 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22533 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22534 echo "PERL_CONFIG_SH=true" >>config.sh
22535
22536 : propagate old symbols
22537 if $test -f UU/config.sh; then
22538         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22539         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22540         $sort | $uniq -u >UU/oldsyms
22541         set X `cat UU/oldsyms`
22542         shift
22543         case $# in
22544         0) ;;
22545         *)
22546                 cat <<EOM
22547 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22548 EOM
22549                 echo "# Variables propagated from previous config.sh file." >>config.sh
22550                 for sym in `cat UU/oldsyms`; do
22551                         echo "    Propagating $hint variable "'$'"$sym..."
22552                         eval 'tmp="$'"${sym}"'"'
22553                         echo "$tmp" | \
22554                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22555                 done
22556                 ;;
22557         esac
22558 fi
22559
22560 : Finish up by extracting the .SH files
22561 case "$alldone" in
22562 exit)
22563         $rm -rf UU
22564         echo "Extraction done."
22565         exit 0
22566         ;;
22567 cont)
22568         ;;
22569 '')
22570         dflt=''
22571         nostick=true
22572         $cat <<EOM
22573
22574 If you'd like to make any changes to the config.sh file before I begin
22575 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22576
22577 EOM
22578         rp="Press return or use a shell escape to edit config.sh:"
22579         . UU/myread
22580         nostick=''
22581         case "$ans" in
22582         '') ;;
22583         *) : in case they cannot read
22584                 sh 1>&4 -c "$ans";;
22585         esac
22586         ;;
22587 esac
22588
22589 : if this fails, just run all the .SH files by hand
22590 . ./config.sh
22591
22592 echo " "
22593 exec 1>&4
22594 pwd=`pwd`
22595 . ./UU/extract
22596 cd "$pwd"
22597
22598 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22599         dflt=y
22600         case "$silent" in
22601         true) ;;
22602         *)
22603                 $cat <<EOM
22604
22605 Now you need to generate make dependencies by running "$make depend".
22606 You might prefer to run it in background: "$make depend > makedepend.out &"
22607 It can take a while, so you might not want to run it right now.
22608
22609 EOM
22610                 ;;
22611         esac
22612         rp="Run $make depend now?"
22613         . UU/myread
22614         case "$ans" in
22615         y*)
22616                 $make depend && echo "Now you must run '$make'."
22617                 ;;
22618         *)
22619                 echo "You must run '$make depend' then '$make'."
22620                 ;;
22621         esac
22622 elif test -f [Mm]akefile; then
22623         echo " "
22624         echo "Now you must run a $make."
22625 else
22626         echo "Configure done."
22627 fi
22628
22629 if $test -f Policy.sh; then
22630     $cat <<EOM
22631
22632 If you compile $package on a different machine or from a different object
22633 directory, copy the Policy.sh file from this object directory to the
22634 new one before you run Configure -- this will help you with most of
22635 the policy defaults.
22636
22637 EOM
22638 fi
22639 if $test -f config.msg; then
22640     echo "Hmm.  I also noted the following information while running:"
22641     echo " "
22642     $cat config.msg >&4
22643     $rm -f config.msg
22644 fi
22645 $rm -f kit*isdone ark*isdone
22646 $rm -rf UU
22647
22648 : End of Configure
22649