This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix corelist.pl after the reorganisation of the
[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 Sat Jun 16 07:55:39 CEST 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 rm_try=''
320 afs=''
321 afsroot=''
322 alignbytes=''
323 ansi2knr=''
324 archlib=''
325 archlibexp=''
326 d_archlib=''
327 installarchlib=''
328 archname=''
329 myarchname=''
330 d_atolf=''
331 d_atoll=''
332 baserev=''
333 bin=''
334 binexp=''
335 initialinstalllocation=''
336 installbin=''
337 userelocatableinc=''
338 byteorder=''
339 cc=''
340 ccflags=''
341 cppflags=''
342 ldflags=''
343 lkflags=''
344 locincpth=''
345 optimize=''
346 cf_email=''
347 cf_by=''
348 cf_time=''
349 charsize=''
350 contains=''
351 cpp_stuff=''
352 cpplast=''
353 cppminus=''
354 cpprun=''
355 cppstdin=''
356 d__fwalk=''
357 d_access=''
358 d_accessx=''
359 d_aintl=''
360 d_alarm=''
361 asctime_r_proto=''
362 d_asctime_r=''
363 d_attribute_format=''
364 d_attribute_malloc=''
365 d_attribute_nonnull=''
366 d_attribute_noreturn=''
367 d_attribute_pure=''
368 d_attribute_unused=''
369 d_attribute_warn_unused_result=''
370 d_printf_format_null=''
371 d_bcmp=''
372 d_bcopy=''
373 d_builtin_choose_expr=''
374 d_builtin_expect=''
375 d_bzero=''
376 d_c99_variadic_macros=''
377 d_casti32=''
378 castflags=''
379 d_castneg=''
380 d_chown=''
381 d_chroot=''
382 d_chsize=''
383 d_class=''
384 d_clearenv=''
385 d_closedir=''
386 d_void_closedir=''
387 d_cmsghdr_s=''
388 d_const=''
389 d_copysignl=''
390 d_cplusplus=''
391 cryptlib=''
392 d_crypt=''
393 crypt_r_proto=''
394 d_crypt_r=''
395 d_csh=''
396 full_csh=''
397 d_ctermid=''
398 ctermid_r_proto=''
399 d_ctermid_r=''
400 ctime_r_proto=''
401 d_ctime_r=''
402 d_cuserid=''
403 d_dbl_dig=''
404 d_dbminitproto=''
405 d_difftime=''
406 d_dir_dd_fd=''
407 d_dirfd=''
408 d_dlerror=''
409 d_dlopen=''
410 d_dlsymun=''
411 d_dosuid=''
412 d_suidsafe=''
413 d_drand48_r=''
414 drand48_r_proto=''
415 d_drand48proto=''
416 d_dup2=''
417 d_eaccess=''
418 d_endgrent=''
419 d_endgrent_r=''
420 endgrent_r_proto=''
421 d_endhent=''
422 d_endhostent_r=''
423 endhostent_r_proto=''
424 d_endnent=''
425 d_endnetent_r=''
426 endnetent_r_proto=''
427 d_endpent=''
428 d_endprotoent_r=''
429 endprotoent_r_proto=''
430 d_endpwent=''
431 d_endpwent_r=''
432 endpwent_r_proto=''
433 d_endsent=''
434 d_endservent_r=''
435 endservent_r_proto=''
436 d_faststdio=''
437 d_fchdir=''
438 d_fchmod=''
439 d_fchown=''
440 d_fcntl=''
441 d_fcntl_can_lock=''
442 d_fd_macros=''
443 d_fd_set=''
444 d_fds_bits=''
445 d_fgetpos=''
446 d_finite=''
447 d_finitel=''
448 d_flexfnam=''
449 d_flock=''
450 d_flockproto=''
451 d_fork=''
452 d_fp_class=''
453 d_fpclass=''
454 d_fpclassify=''
455 d_fpclassl=''
456 d_fpos64_t=''
457 d_frexpl=''
458 d_fs_data_s=''
459 d_fseeko=''
460 d_fsetpos=''
461 d_fstatfs=''
462 d_fsync=''
463 d_ftello=''
464 d_ftime=''
465 d_gettimeod=''
466 d_futimes=''
467 d_Gconvert=''
468 d_getcwd=''
469 d_getespwnam=''
470 d_getfsstat=''
471 d_getgrent=''
472 d_getgrent_r=''
473 getgrent_r_proto=''
474 d_getgrgid_r=''
475 getgrgid_r_proto=''
476 d_getgrnam_r=''
477 getgrnam_r_proto=''
478 d_getgrps=''
479 d_gethbyaddr=''
480 d_gethbyname=''
481 d_gethent=''
482 aphostname=''
483 d_gethname=''
484 d_phostname=''
485 d_uname=''
486 d_gethostbyaddr_r=''
487 gethostbyaddr_r_proto=''
488 d_gethostbyname_r=''
489 gethostbyname_r_proto=''
490 d_gethostent_r=''
491 gethostent_r_proto=''
492 d_gethostprotos=''
493 d_getitimer=''
494 d_getlogin=''
495 d_getlogin_r=''
496 getlogin_r_proto=''
497 d_getmnt=''
498 d_getmntent=''
499 d_getnbyaddr=''
500 d_getnbyname=''
501 d_getnent=''
502 d_getnetbyaddr_r=''
503 getnetbyaddr_r_proto=''
504 d_getnetbyname_r=''
505 getnetbyname_r_proto=''
506 d_getnetent_r=''
507 getnetent_r_proto=''
508 d_getnetprotos=''
509 d_getpagsz=''
510 d_getpent=''
511 d_getpgid=''
512 d_getpgrp2=''
513 d_bsdgetpgrp=''
514 d_getpgrp=''
515 d_getppid=''
516 d_getprior=''
517 d_getpbyname=''
518 d_getpbynumber=''
519 d_getprotobyname_r=''
520 getprotobyname_r_proto=''
521 d_getprotobynumber_r=''
522 getprotobynumber_r_proto=''
523 d_getprotoent_r=''
524 getprotoent_r_proto=''
525 d_getprotoprotos=''
526 d_getprpwnam=''
527 d_getpwent=''
528 d_getpwent_r=''
529 getpwent_r_proto=''
530 d_getpwnam_r=''
531 getpwnam_r_proto=''
532 d_getpwuid_r=''
533 getpwuid_r_proto=''
534 d_getsent=''
535 d_getservbyname_r=''
536 getservbyname_r_proto=''
537 d_getservbyport_r=''
538 getservbyport_r_proto=''
539 d_getservent_r=''
540 getservent_r_proto=''
541 d_getservprotos=''
542 d_getspnam=''
543 d_getspnam_r=''
544 getspnam_r_proto=''
545 d_getsbyname=''
546 d_getsbyport=''
547 d_gmtime_r=''
548 gmtime_r_proto=''
549 d_gnulibc=''
550 gnulibc_version=''
551 d_hasmntopt=''
552 d_htonl=''
553 d_ilogbl=''
554 d_inetaton=''
555 d_int64_t=''
556 d_isascii=''
557 d_isfinite=''
558 d_isinf=''
559 d_isnan=''
560 d_isnanl=''
561 d_killpg=''
562 d_lchown=''
563 d_ldbl_dig=''
564 d_libm_lib_version=''
565 d_link=''
566 d_localtime_r=''
567 d_localtime_r_needs_tzset=''
568 localtime_r_proto=''
569 d_locconv=''
570 d_lockf=''
571 d_longdbl=''
572 longdblsize=''
573 d_longlong=''
574 longlongsize=''
575 d_lseekproto=''
576 d_lstat=''
577 d_madvise=''
578 d_malloc_good_size=''
579 d_malloc_size=''
580 d_mblen=''
581 d_mbstowcs=''
582 d_mbtowc=''
583 d_memchr=''
584 d_memcmp=''
585 d_memcpy=''
586 d_memmove=''
587 d_memset=''
588 d_mkdir=''
589 d_mkdtemp=''
590 d_mkfifo=''
591 d_mkstemp=''
592 d_mkstemps=''
593 d_mktime=''
594 d_mmap=''
595 mmaptype=''
596 d_modfl=''
597 d_modfl_pow32_bug=''
598 d_modflproto=''
599 d_mprotect=''
600 d_msg=''
601 d_msgctl=''
602 d_msgget=''
603 d_msghdr_s=''
604 d_msgrcv=''
605 d_msgsnd=''
606 d_msync=''
607 d_munmap=''
608 d_nice=''
609 d_nl_langinfo=''
610 d_off64_t=''
611 d_open3=''
612 d_fpathconf=''
613 d_pathconf=''
614 d_pause=''
615 d_pipe=''
616 d_poll=''
617 d_portable=''
618 d_procselfexe=''
619 procselfexe=''
620 d_old_pthread_create_joinable=''
621 old_pthread_create_joinable=''
622 d_pthread_atfork=''
623 d_pthread_attr_setscope=''
624 d_pthread_yield=''
625 d_sched_yield=''
626 sched_yield=''
627 d_qgcvt=''
628 d_random_r=''
629 random_r_proto=''
630 d_readdir64_r=''
631 readdir64_r_proto=''
632 d_readdir=''
633 d_rewinddir=''
634 d_seekdir=''
635 d_telldir=''
636 d_readdir_r=''
637 readdir_r_proto=''
638 d_readlink=''
639 d_readv=''
640 d_recvmsg=''
641 d_rename=''
642 d_rmdir=''
643 d_safebcpy=''
644 d_safemcpy=''
645 d_sanemcmp=''
646 d_sbrkproto=''
647 d_scalbnl=''
648 d_select=''
649 d_sem=''
650 d_semctl=''
651 d_semget=''
652 d_semop=''
653 d_sendmsg=''
654 d_setegid=''
655 d_seteuid=''
656 d_setgrent=''
657 d_setgrent_r=''
658 setgrent_r_proto=''
659 d_setgrps=''
660 d_sethent=''
661 d_sethostent_r=''
662 sethostent_r_proto=''
663 d_setitimer=''
664 d_setlinebuf=''
665 d_setlocale=''
666 d_setlocale_r=''
667 setlocale_r_proto=''
668 d_setnent=''
669 d_setnetent_r=''
670 setnetent_r_proto=''
671 d_setpent=''
672 d_setpgid=''
673 d_setpgrp2=''
674 d_bsdsetpgrp=''
675 d_setpgrp=''
676 d_setprior=''
677 d_setproctitle=''
678 d_setprotoent_r=''
679 setprotoent_r_proto=''
680 d_setpwent=''
681 d_setpwent_r=''
682 setpwent_r_proto=''
683 d_setregid=''
684 d_setresgid=''
685 d_setresuid=''
686 d_setreuid=''
687 d_setrgid=''
688 d_setruid=''
689 d_setsent=''
690 d_setservent_r=''
691 setservent_r_proto=''
692 d_setsid=''
693 d_setvbuf=''
694 d_sfio=''
695 usesfio=''
696 d_shm=''
697 d_shmat=''
698 d_shmatprototype=''
699 shmattype=''
700 d_shmctl=''
701 d_shmdt=''
702 d_shmget=''
703 d_sigaction=''
704 d_signbit=''
705 d_sigprocmask=''
706 d_sigsetjmp=''
707 usesitecustomize=''
708 d_snprintf=''
709 d_vsnprintf=''
710 d_sockatmark=''
711 d_sockatmarkproto=''
712 d_msg_ctrunc=''
713 d_msg_dontroute=''
714 d_msg_oob=''
715 d_msg_peek=''
716 d_msg_proxy=''
717 d_oldsock=''
718 d_scm_rights=''
719 d_socket=''
720 d_sockpair=''
721 sockethdr=''
722 socketlib=''
723 d_socklen_t=''
724 d_socks5_init=''
725 d_sprintf_returns_strlen=''
726 d_sqrtl=''
727 d_srand48_r=''
728 srand48_r_proto=''
729 d_srandom_r=''
730 srandom_r_proto=''
731 d_sresgproto=''
732 d_sresuproto=''
733 d_statblks=''
734 d_statfs_f_flags=''
735 d_statfs_s=''
736 d_fstatvfs=''
737 d_statvfs=''
738 d_stdio_cnt_lval=''
739 d_stdio_ptr_lval=''
740 d_stdio_ptr_lval_nochange_cnt=''
741 d_stdio_ptr_lval_sets_cnt=''
742 d_stdiobase=''
743 d_stdstdio=''
744 stdio_base=''
745 stdio_bufsiz=''
746 stdio_cnt=''
747 stdio_filbuf=''
748 stdio_ptr=''
749 d_index=''
750 d_strchr=''
751 d_strcoll=''
752 d_strctcpy=''
753 d_strerrm=''
754 d_strerror=''
755 d_sysernlst=''
756 d_syserrlst=''
757 d_strerror_r=''
758 strerror_r_proto=''
759 d_strftime=''
760 d_strlcat=''
761 d_strlcpy=''
762 d_strtod=''
763 d_strtol=''
764 d_strtold=''
765 d_strtoll=''
766 d_strtoq=''
767 d_strtoul=''
768 d_strtoull=''
769 d_strtouq=''
770 d_strxfrm=''
771 d_symlink=''
772 d_syscall=''
773 d_syscallproto=''
774 d_sysconf=''
775 d_system=''
776 d_tcgetpgrp=''
777 d_tcsetpgrp=''
778 d_telldirproto=''
779 d_time=''
780 timetype=''
781 clocktype=''
782 d_times=''
783 d_tmpnam_r=''
784 tmpnam_r_proto=''
785 d_truncate=''
786 d_ttyname_r=''
787 ttyname_r_proto=''
788 d_tzname=''
789 d_u32align=''
790 d_ualarm=''
791 d_umask=''
792 d_semctl_semid_ds=''
793 d_semctl_semun=''
794 d_union_semun=''
795 d_unordered=''
796 d_unsetenv=''
797 d_usleep=''
798 d_usleepproto=''
799 d_ustat=''
800 d_pseudofork=''
801 d_vfork=''
802 usevfork=''
803 d_voidsig=''
804 signal_t=''
805 d_volatile=''
806 d_charvspr=''
807 d_vprintf=''
808 d_wait4=''
809 d_waitpid=''
810 d_wcstombs=''
811 d_wctomb=''
812 d_writev=''
813 dlext=''
814 cccdlflags=''
815 ccdlflags=''
816 dlsrc=''
817 ld=''
818 lddlflags=''
819 usedl=''
820 doublesize=''
821 ebcdic=''
822 fflushNULL=''
823 fflushall=''
824 fpossize=''
825 fpostype=''
826 gccansipedantic=''
827 gccosandvers=''
828 gccversion=''
829 gidformat=''
830 gidsign=''
831 gidsize=''
832 gidtype=''
833 groupstype=''
834 h_fcntl=''
835 h_sysfile=''
836 html1dir=''
837 html1direxp=''
838 installhtml1dir=''
839 html3dir=''
840 html3direxp=''
841 installhtml3dir=''
842 i_arpainet=''
843 i_crypt=''
844 db_hashtype=''
845 db_prefixtype=''
846 db_version_major=''
847 db_version_minor=''
848 db_version_patch=''
849 i_db=''
850 i_dbm=''
851 i_rpcsvcdbm=''
852 d_dirnamlen=''
853 direntrytype=''
854 i_dirent=''
855 i_dld=''
856 i_dlfcn=''
857 i_fcntl=''
858 i_float=''
859 i_fp=''
860 i_fp_class=''
861 i_gdbm=''
862 d_grpasswd=''
863 i_grp=''
864 i_ieeefp=''
865 i_inttypes=''
866 i_langinfo=''
867 i_libutil=''
868 i_limits=''
869 i_locale=''
870 i_machcthr=''
871 i_malloc=''
872 i_math=''
873 i_memory=''
874 i_mntent=''
875 i_ndbm=''
876 i_netdb=''
877 i_neterrno=''
878 i_netinettcp=''
879 i_niin=''
880 i_sysin=''
881 i_poll=''
882 i_prot=''
883 i_pthread=''
884 d_pwage=''
885 d_pwchange=''
886 d_pwclass=''
887 d_pwcomment=''
888 d_pwexpire=''
889 d_pwgecos=''
890 d_pwpasswd=''
891 d_pwquota=''
892 i_pwd=''
893 i_sfio=''
894 i_shadow=''
895 i_socks=''
896 i_stddef=''
897 i_stdlib=''
898 i_string=''
899 strings=''
900 i_sunmath=''
901 i_sysaccess=''
902 i_sysdir=''
903 i_sysfile=''
904 d_voidtty=''
905 i_bsdioctl=''
906 i_sysfilio=''
907 i_sysioctl=''
908 i_syssockio=''
909 i_syslog=''
910 i_sysmman=''
911 i_sysmode=''
912 i_sysmount=''
913 i_sysndir=''
914 i_sysparam=''
915 i_sysresrc=''
916 i_syssecrt=''
917 i_sysselct=''
918 i_sysstat=''
919 i_sysstatfs=''
920 i_sysstatvfs=''
921 i_systimes=''
922 i_systypes=''
923 i_sysuio=''
924 i_sysun=''
925 i_sysutsname=''
926 i_sysvfs=''
927 i_syswait=''
928 i_sgtty=''
929 i_termio=''
930 i_termios=''
931 d_tm_tm_gmtoff=''
932 d_tm_tm_zone=''
933 i_systime=''
934 i_systimek=''
935 i_time=''
936 timeincl=''
937 i_unistd=''
938 i_ustat=''
939 i_utime=''
940 i_values=''
941 i_stdarg=''
942 i_varargs=''
943 i_varhdr=''
944 i_vfork=''
945 d_inc_version_list=''
946 inc_version_list=''
947 inc_version_list_init=''
948 installprefix=''
949 installprefixexp=''
950 installstyle=''
951 installusrbinperl=''
952 intsize=''
953 longsize=''
954 shortsize=''
955 issymlink=''
956 libc=''
957 ldlibpthname=''
958 libperl=''
959 shrpenv=''
960 useshrplib=''
961 glibpth=''
962 libpth=''
963 loclibpth=''
964 plibpth=''
965 xlibpth=''
966 ignore_versioned_solibs=''
967 libs=''
968 libsdirs=''
969 libsfiles=''
970 libsfound=''
971 libspath=''
972 lns=''
973 d_PRIEUldbl=''
974 d_PRIFUldbl=''
975 d_PRIGUldbl=''
976 d_PRIeldbl=''
977 d_PRIfldbl=''
978 d_PRIgldbl=''
979 d_SCNfldbl=''
980 sPRIEUldbl=''
981 sPRIFUldbl=''
982 sPRIGUldbl=''
983 sPRIeldbl=''
984 sPRIfldbl=''
985 sPRIgldbl=''
986 sSCNfldbl=''
987 lseeksize=''
988 lseektype=''
989 mad=''
990 madlyh=''
991 madlyobj=''
992 madlysrc=''
993 make_set_make=''
994 d_mymalloc=''
995 freetype=''
996 mallocobj=''
997 mallocsrc=''
998 malloctype=''
999 usemallocwrap=''
1000 usemymalloc=''
1001 installman1dir=''
1002 man1dir=''
1003 man1direxp=''
1004 man1ext=''
1005 installman3dir=''
1006 man3dir=''
1007 man3direxp=''
1008 man3ext=''
1009 modetype=''
1010 multiarch=''
1011 mydomain=''
1012 myhostname=''
1013 phostname=''
1014 c=''
1015 n=''
1016 d_eofnblk=''
1017 eagain=''
1018 o_nonblock=''
1019 rd_nodata=''
1020 need_va_copy=''
1021 netdb_hlen_type=''
1022 netdb_host_type=''
1023 netdb_name_type=''
1024 netdb_net_type=''
1025 groupcat=''
1026 hostcat=''
1027 passcat=''
1028 orderlib=''
1029 ranlib=''
1030 d_perl_otherlibdirs=''
1031 otherlibdirs=''
1032 package=''
1033 spackage=''
1034 pager=''
1035 api_revision=''
1036 api_subversion=''
1037 api_version=''
1038 api_versionstring=''
1039 patchlevel=''
1040 perl_patchlevel=''
1041 revision=''
1042 subversion=''
1043 version=''
1044 version_patchlevel_string=''
1045 perl5=''
1046 perladmin=''
1047 perlpath=''
1048 d_nv_preserves_uv=''
1049 d_nv_zero_is_allbits_zero=''
1050 i16size=''
1051 i16type=''
1052 i32size=''
1053 i32type=''
1054 i64size=''
1055 i64type=''
1056 i8size=''
1057 i8type=''
1058 ivsize=''
1059 ivtype=''
1060 nv_preserves_uv_bits=''
1061 nvsize=''
1062 nvtype=''
1063 u16size=''
1064 u16type=''
1065 u32size=''
1066 u32type=''
1067 u64size=''
1068 u64type=''
1069 u8size=''
1070 u8type=''
1071 uvsize=''
1072 uvtype=''
1073 ivdformat=''
1074 nvEUformat=''
1075 nvFUformat=''
1076 nvGUformat=''
1077 nveformat=''
1078 nvfformat=''
1079 nvgformat=''
1080 uvXUformat=''
1081 uvoformat=''
1082 uvuformat=''
1083 uvxformat=''
1084 pidtype=''
1085 prefix=''
1086 prefixexp=''
1087 installprivlib=''
1088 privlib=''
1089 privlibexp=''
1090 prototype=''
1091 ptrsize=''
1092 d_PRIXU64=''
1093 d_PRId64=''
1094 d_PRIi64=''
1095 d_PRIo64=''
1096 d_PRIu64=''
1097 d_PRIx64=''
1098 sPRIXU64=''
1099 sPRId64=''
1100 sPRIi64=''
1101 sPRIo64=''
1102 sPRIu64=''
1103 sPRIx64=''
1104 d_quad=''
1105 quadkind=''
1106 quadtype=''
1107 uquadtype=''
1108 drand01=''
1109 randbits=''
1110 randfunc=''
1111 randseedtype=''
1112 seedfunc=''
1113 installscript=''
1114 scriptdir=''
1115 scriptdirexp=''
1116 selectminbits=''
1117 selecttype=''
1118 sh=''
1119 sig_count=''
1120 sig_name=''
1121 sig_name_init=''
1122 sig_num=''
1123 sig_num_init=''
1124 sig_size=''
1125 d_sitearch=''
1126 installsitearch=''
1127 sitearch=''
1128 sitearchexp=''
1129 installsitebin=''
1130 sitebin=''
1131 sitebinexp=''
1132 installsitehtml1dir=''
1133 sitehtml1dir=''
1134 sitehtml1direxp=''
1135 installsitehtml3dir=''
1136 sitehtml3dir=''
1137 sitehtml3direxp=''
1138 installsitelib=''
1139 sitelib=''
1140 sitelib_stem=''
1141 sitelibexp=''
1142 installsiteman1dir=''
1143 siteman1dir=''
1144 siteman1direxp=''
1145 installsiteman3dir=''
1146 siteman3dir=''
1147 siteman3direxp=''
1148 siteprefix=''
1149 siteprefixexp=''
1150 installsitescript=''
1151 sitescript=''
1152 sitescriptexp=''
1153 sizesize=''
1154 sizetype=''
1155 so=''
1156 socksizetype=''
1157 sharpbang=''
1158 shsharp=''
1159 spitshell=''
1160 src=''
1161 ssizetype=''
1162 startperl=''
1163 startsh=''
1164 stdchar=''
1165 d_stdio_stream_array=''
1166 stdio_stream_array=''
1167 sysman=''
1168 trnl=''
1169 uidformat=''
1170 uidsign=''
1171 uidsize=''
1172 uidtype=''
1173 archname64=''
1174 use64bitall=''
1175 use64bitint=''
1176 usefaststdio=''
1177 ccflags_uselargefiles=''
1178 ldflags_uselargefiles=''
1179 libswanted_uselargefiles=''
1180 uselargefiles=''
1181 uselongdouble=''
1182 usemorebits=''
1183 usemultiplicity=''
1184 nm_opt=''
1185 nm_so_opt=''
1186 runnm=''
1187 usenm=''
1188 useperlio=''
1189 usesocks=''
1190 d_oldpthreads=''
1191 use5005threads=''
1192 useithreads=''
1193 usereentrant=''
1194 usethreads=''
1195 incpath=''
1196 mips_type=''
1197 usrinc=''
1198 d_vendorarch=''
1199 installvendorarch=''
1200 vendorarch=''
1201 vendorarchexp=''
1202 d_vendorbin=''
1203 installvendorbin=''
1204 vendorbin=''
1205 vendorbinexp=''
1206 installvendorhtml1dir=''
1207 vendorhtml1dir=''
1208 vendorhtml1direxp=''
1209 installvendorhtml3dir=''
1210 vendorhtml3dir=''
1211 vendorhtml3direxp=''
1212 d_vendorlib=''
1213 installvendorlib=''
1214 vendorlib=''
1215 vendorlib_stem=''
1216 vendorlibexp=''
1217 installvendorman1dir=''
1218 vendorman1dir=''
1219 vendorman1direxp=''
1220 installvendorman3dir=''
1221 vendorman3dir=''
1222 vendorman3direxp=''
1223 usevendorprefix=''
1224 vendorprefix=''
1225 vendorprefixexp=''
1226 d_vendorscript=''
1227 installvendorscript=''
1228 vendorscript=''
1229 vendorscriptexp=''
1230 versiononly=''
1231 defvoidused=''
1232 voidflags=''
1233 yacc=''
1234 yaccflags=''
1235 CONFIG=''
1236
1237 define='define'
1238 undef='undef'
1239 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1240 rmlist=''
1241
1242 : We must find out about Eunice early
1243 eunicefix=':'
1244 if test -f /etc/unixtovms; then
1245         eunicefix=/etc/unixtovms
1246 fi
1247 if test -f /etc/unixtovms.exe; then
1248         eunicefix=/etc/unixtovms.exe
1249 fi
1250
1251 : Set executable suffix now -- needed before hints available
1252 if test -f "/libs/version.library"; then
1253 : Amiga OS
1254     _exe=""
1255 elif test -f "/system/gnu_library/bin/ar.pm"; then
1256 : Stratus VOS
1257     _exe=".pm"
1258 elif test -n "$DJGPP"; then
1259 : DOS DJGPP
1260     _exe=".exe"
1261 elif test -d c:/. -o -n "$is_os2" ; then
1262 : OS/2 or cygwin
1263     _exe=".exe"
1264 fi
1265
1266 i_whoami=''
1267 : Trailing extension.  Override this in a hint file, if needed.
1268 : Extra object files, if any, needed on this platform.
1269 archobjs=''
1270 archname=''
1271 groupstype=''
1272 libnames=''
1273 : change the next line if compiling for Xenix/286 on Xenix/386
1274 xlibpth='/usr/lib/386 /lib/386'
1275 : Possible local library directories to search.
1276 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1277 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1278
1279 : general looking path for locating libraries
1280 glibpth="/lib /usr/lib $xlibpth"
1281 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1282 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1283 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1284 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1285
1286 : Private path used by Configure to find libraries.  Its value
1287 : is prepended to libpth. This variable takes care of special
1288 : machines, like the mips.  Usually, it should be empty.
1289 plibpth=''
1290
1291 : default library list
1292 libswanted=''
1293 : some systems want to use only the non-versioned libso:s
1294 ignore_versioned_solibs=''
1295 siteman1dir=''
1296 siteman3dir=''
1297 sitescript=''
1298 : set usethreads on the Configure command line to enable threads.
1299 usereentrant='undef'
1300 : full support for void wanted by default
1301 defvoidused=15
1302
1303 : Possible local include directories to search.
1304 : Set locincpth to "" in a hint file to defeat local include searches.
1305 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1306 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1307 :
1308 : no include file wanted by default
1309 inclwanted=''
1310
1311 : Enable -DEBUGGING and -DDEBUGGING from the command line
1312 EBUGGING=''
1313 DEBUGGING=old
1314
1315 ccname=''
1316 ccversion=''
1317 perllibs=''
1318 : set useposix=false in your hint file to disable the POSIX extension.
1319 useposix=true
1320 : set useopcode=false in your hint file to disable the Opcode extension.
1321 useopcode=true
1322 archname64=''
1323 ccflags_uselargefiles=''
1324 ldflags_uselargefiles=''
1325 libswanted_uselargefiles=''
1326 : set usemultiplicity on the Configure command line to enable multiplicity.
1327 : set usesocks on the Configure command line to enable socks.
1328 : List of libraries we want.
1329 : If anyone needs extra -lxxx, put those in a hint file.
1330 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1331 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1332 : We probably want to search /usr/shlib before most other libraries.
1333 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1334 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1335 glibpth="/usr/shlib $glibpth"
1336 : Do not use vfork unless overridden by a hint file.
1337 usevfork=false
1338
1339 : Find the basic shell for Bourne shell scripts
1340 case "$sh" in
1341 '')
1342         case "$SYSTYPE" in
1343         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1344         *) xxx='/bin/sh';;
1345         esac
1346         if test -f "$xxx"; then
1347                 sh="$xxx"
1348         else
1349                 : Build up a list and do a single loop so we can 'break' out.
1350                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1351                 for xxx in sh bash ksh pdksh ash; do
1352                         for p in $pth; do
1353                                 try="$try ${p}/${xxx}"
1354                         done
1355                 done
1356                 for xxx in $try; do
1357                         if test -f "$xxx"; then
1358                                 sh="$xxx";
1359                                 break
1360                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1361                                 sh="$xxx";
1362                                 break
1363                         elif test -f "$xxx.exe"; then
1364                                 sh="$xxx";
1365                                 break
1366                         fi
1367                 done
1368         fi
1369         ;;
1370 esac
1371
1372 case "$sh" in
1373 '')     cat >&2 <<EOM
1374 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1375
1376 Usually it's in /bin/sh.  How did you even get this far?
1377 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1378 we'll try to straighten this all out.
1379 EOM
1380         exit 1
1381         ;;
1382 esac
1383
1384 : see if sh knows # comments
1385 if `$sh -c '#' >/dev/null 2>&1`; then
1386         shsharp=true
1387         spitshell=cat
1388         xcat=/bin/cat
1389         test -f $xcat$_exe || xcat=/usr/bin/cat
1390         if test ! -f $xcat$_exe; then
1391                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1392                         if test -f $p/cat$_exe; then
1393                                 xcat=$p/cat
1394                                 break
1395                         fi
1396                 done
1397                 if test ! -f $xcat$_exe; then
1398                         echo "Can't find cat anywhere!"
1399                         exit 1
1400                 fi
1401         fi
1402         echo "#!$xcat" >sharp
1403         $eunicefix sharp
1404         chmod +x sharp
1405         ./sharp > today
1406         if test -s today; then
1407                 sharpbang='#!'
1408         else
1409                 echo "#! $xcat" > sharp
1410                 $eunicefix sharp
1411                 chmod +x sharp
1412                 ./sharp > today
1413                 if test -s today; then
1414                         sharpbang='#! '
1415                 else
1416                         sharpbang=': use '
1417                 fi
1418         fi
1419 else
1420         echo " "
1421         echo "Your $sh doesn't grok # comments--I will strip them later on."
1422         shsharp=false
1423         cd ..
1424         echo "exec grep -v '^[  ]*#'" >spitshell
1425         chmod +x spitshell
1426         $eunicefix spitshell
1427         spitshell=`pwd`/spitshell
1428         cd UU
1429         echo "I presume that if # doesn't work, #! won't work either!"
1430         sharpbang=': use '
1431 fi
1432 rm -f sharp today
1433
1434 : figure out how to guarantee sh startup
1435 case "$startsh" in
1436 '') startsh=${sharpbang}${sh} ;;
1437 *)
1438 esac
1439 cat >sharp <<EOSS
1440 $startsh
1441 set abc
1442 test "$?abc" != 1
1443 EOSS
1444
1445 chmod +x sharp
1446 $eunicefix sharp
1447 if ./sharp; then
1448         : echo "Yup, it does."
1449 else
1450         echo "Hmm... '$startsh' does not guarantee sh startup..."
1451         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1452 fi
1453 rm -f sharp
1454
1455
1456 : Save command line options in file UU/cmdline.opt for later use in
1457 : generating config.sh.
1458 cat > cmdline.opt <<EOSH
1459 # Configure command line arguments.
1460 config_arg0='$0'
1461 config_args='$*'
1462 config_argc=$#
1463 EOSH
1464 argn=1
1465 args_exp=''
1466 args_sep=''
1467 for arg in "$@"; do
1468         cat >>cmdline.opt <<EOSH
1469 config_arg$argn='$arg'
1470 EOSH
1471         # Extreme backslashitis: replace each ' by '"'"'
1472         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1473 $arg
1474 EOC
1475         arg_exp=`cat cmdl.opt`
1476         args_exp="$args_exp$args_sep'$arg_exp'"
1477         argn=`expr $argn + 1`
1478         args_sep=' '
1479 done
1480 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1481 # used by ./hints/os2.sh
1482 rm -f cmdl.opt
1483
1484 : produce awk script to parse command line options
1485 cat >options.awk <<'EOF'
1486 BEGIN {
1487         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1488
1489         len = length(optstr);
1490         for (i = 1; i <= len; i++) {
1491                 c = substr(optstr, i, 1);
1492                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1493                 if (a == ":") {
1494                         arg[c] = 1;
1495                         i++;
1496                 }
1497                 opt[c] = 1;
1498         }
1499 }
1500 {
1501         expect = 0;
1502         str = $0;
1503         if (substr(str, 1, 1) != "-") {
1504                 printf("'%s'\n", str);
1505                 next;
1506         }
1507         len = length($0);
1508         for (i = 2; i <= len; i++) {
1509                 c = substr(str, i, 1);
1510                 if (!opt[c]) {
1511                         printf("-%s\n", substr(str, i));
1512                         next;
1513                 }
1514                 printf("-%s\n", c);
1515                 if (arg[c]) {
1516                         if (i < len)
1517                                 printf("'%s'\n", substr(str, i + 1));
1518                         else
1519                                 expect = 1;
1520                         next;
1521                 }
1522         }
1523 }
1524 END {
1525         if (expect)
1526                 print "?";
1527 }
1528 EOF
1529
1530 : process the command line options
1531 set X `for arg in "$@"; do echo "X$arg"; done |
1532         sed -e s/X// | awk -f options.awk`
1533 eval "set $*"
1534 shift
1535 rm -f options.awk
1536
1537 : set up default values
1538 fastread=''
1539 reuseval=false
1540 config_sh=''
1541 alldone=''
1542 error=''
1543 silent=''
1544 extractsh=''
1545 override=''
1546 knowitall=''
1547 rm -f optdef.sh posthint.sh
1548 cat >optdef.sh <<EOS
1549 $startsh
1550 EOS
1551
1552
1553 : option parsing
1554 while test $# -gt 0; do
1555         case "$1" in
1556         -d) shift; fastread=yes;;
1557         -e) shift; alldone=cont;;
1558         -f)
1559                 shift
1560                 cd ..
1561                 if test -r "$1"; then
1562                         config_sh="$1"
1563                 else
1564                         echo "$me: cannot read config file $1." >&2
1565                         error=true
1566                 fi
1567                 cd UU
1568                 shift;;
1569         --help|\
1570         -h) shift; error=true;;
1571         -r) shift; reuseval=true;;
1572         -s) shift; silent=true; realsilent=true;;
1573         -E) shift; alldone=exit;;
1574         -K) shift; knowitall=true;;
1575         -O) shift; override=true;;
1576         -S) shift; silent=true; extractsh=true;;
1577         -D)
1578                 shift
1579                 case "$1" in
1580                 *=)
1581                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1582                         echo "$me: ignoring -D $1" >&2
1583                         ;;
1584                 *=*) echo "$1" | \
1585                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1586                 *) echo "$1='define'" >> optdef.sh;;
1587                 esac
1588                 shift
1589                 ;;
1590         -U)
1591                 shift
1592                 case "$1" in
1593                 *=) echo "$1" >> optdef.sh;;
1594                 *=*)
1595                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1596                         echo "$me: ignoring -U $1" >&2
1597                         ;;
1598                 *) echo "$1='undef'" >> optdef.sh;;
1599                 esac
1600                 shift
1601                 ;;
1602         -A)
1603             shift
1604             xxx=''
1605             yyy="$1"
1606             zzz=''
1607             uuu=undef
1608             case "$yyy" in
1609             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1610                  case "$zzz" in
1611                  *:*) zzz='' ;;
1612                  *)   xxx=append
1613                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1614                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1615                  esac
1616                  ;;
1617             esac
1618             case "$xxx" in
1619             '')  case "$yyy" in
1620                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1621                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1622                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1623                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1624                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1625                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1626                  esac
1627                  ;;       
1628             esac
1629             case "$xxx" in
1630             append)
1631                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1632             clear)
1633                 echo "$yyy=''"                  >> posthint.sh ;;
1634             define)
1635                 case "$zzz" in
1636                 '') zzz=define ;;
1637                 esac
1638                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1639             eval)
1640                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1641             prepend)
1642                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1643             undef)
1644                 case "$zzz" in
1645                 '') zzz="$uuu" ;;
1646                 esac
1647                 echo "$yyy=$zzz"                >> posthint.sh ;;
1648             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1649             esac
1650             shift
1651             ;;
1652         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1653             exit 0;;
1654         --) break;;
1655         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1656         *) break;;
1657         esac
1658 done
1659
1660 case "$error" in
1661 true)
1662         cat >&2 <<EOM
1663 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1664                  [-U symbol] [-U symbol=] [-A command:symbol...]
1665   -d : use defaults for all answers.
1666   -e : go on without questioning past the production of config.sh.
1667   -f : specify an alternate default configuration file.
1668   -h : print this help message and exit (with an error status).
1669   -r : reuse C symbols value if possible (skips costly nm extraction).
1670   -s : silent mode, only echoes questions and essential information.
1671   -D : define symbol to have some value:
1672          -D symbol         symbol gets the value 'define'
1673          -D symbol=value   symbol gets the value 'value'
1674        common used examples (see INSTALL for more info):
1675          -Duse64bitint            use 64bit integers
1676          -Duse64bitall            use 64bit integers and pointers
1677          -Dusethreads             use thread support
1678          -Dinc_version_list=none  do not include older perl trees in @INC
1679          -DEBUGGING=none          DEBUGGING options
1680          -Dcc=gcc                 choose your compiler
1681          -Dprefix=/opt/perl5      choose your destination
1682   -E : stop at the end of questions, after having produced config.sh.
1683   -K : do not use unless you know what you are doing.
1684   -O : let -D and -U override definitions from loaded configuration file.
1685   -S : perform variable substitutions on all .SH files (can mix with -f)
1686   -U : undefine symbol:
1687          -U symbol    symbol gets the value 'undef'
1688          -U symbol=   symbol gets completely empty
1689        e.g.:  -Uversiononly
1690   -A : manipulate symbol after the platform specific hints have been applied:
1691          -A symbol=value                append " "value to symbol
1692          -A append:symbol=value         append value to symbol
1693          -A define:symbol=value         define symbol to have value
1694          -A clear:symbol                define symbol to be ''
1695          -A define:symbol               define symbol to be 'define'
1696          -A eval:symbol=value           define symbol to be eval of value
1697          -A prepend:symbol=value        prepend value to symbol
1698          -A undef:symbol                define symbol to be 'undef'
1699          -A undef:symbol=               define symbol to be ''
1700        e.g.:  -A prepend:libswanted='cl pthread '
1701   -V : print version number and exit (with a zero status).
1702 EOM
1703         exit 1
1704         ;;
1705 esac
1706
1707 : Sanity checks
1708 case "$fastread$alldone" in
1709 yescont|yesexit) ;;
1710 *)
1711         case "$extractsh" in
1712         true) ;;
1713         *)
1714                 if test ! -t 0; then
1715                         echo "Say 'sh Configure', not 'sh <Configure'"
1716                         exit 1
1717                 fi
1718                 ;;
1719         esac
1720         ;;
1721 esac
1722
1723 exec 4>&1
1724 case "$silent" in
1725 true) exec 1>/dev/null;;
1726 esac
1727
1728 : run the defines and the undefines, if any, but leave the file out there...
1729 touch optdef.sh
1730 . ./optdef.sh
1731 : create the posthint manipulation script and leave the file out there...
1732 touch posthint.sh
1733
1734 : set package name
1735 package=perl5
1736 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1737 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1738 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1739 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1740 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1741 esac
1742
1743 : Some greps do not return status, grrr.
1744 echo "grimblepritz" >grimble
1745 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1746         contains=contains
1747 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1748         contains=grep
1749 else
1750         contains=contains
1751 fi
1752 rm -f grimble
1753 : the following should work in any shell
1754 case "$contains" in
1755 contains*)
1756         echo " "
1757         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1758         cat >contains <<'EOSS'
1759 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1760 EOSS
1761 chmod +x contains
1762 esac
1763
1764 : Find the path to the source tree
1765 case "$src" in
1766 '') case "$0" in
1767     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1768          case "$src" in
1769          /*)    ;;
1770          .)     ;;
1771          *)     src=`cd ../$src && pwd` ;;
1772          esac
1773          ;;
1774     *)   src='.';;
1775     esac;;
1776 esac
1777 case "$src" in
1778 '')     src=/
1779         rsrc=/
1780         ;;
1781 /*) rsrc="$src";;
1782 *) rsrc="../$src";;
1783 esac
1784 if test -f $rsrc/Configure && \
1785         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1786 then
1787    : found it, so we are ok.
1788 else
1789         rsrc=''
1790         for src in . .. ../.. ../../.. ../../../..; do
1791                 if test -f ../$src/Configure && \
1792                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1793                 then
1794                         rsrc=../$src
1795                         break
1796                 fi
1797         done
1798 fi
1799 case "$rsrc" in
1800 '')
1801         cat <<EOM >&4
1802
1803 Sorry, I can't seem to locate the source dir for $package.  Please start
1804 Configure with an explicit path -- i.e. /some/path/Configure.
1805
1806 EOM
1807         exit 1
1808         ;;
1809 ../.)   rsrc='..';;
1810 *)
1811         echo " "
1812         echo "Sources for $package found in \"$src\"." >&4
1813         ;;
1814 esac
1815
1816 : script used to extract .SH files with variable substitutions
1817 cat >extract <<'EOS'
1818 PERL_CONFIG_SH=true
1819 echo "Doing variable substitutions on .SH files..."
1820 if test -f MANIFEST; then
1821         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1822 else
1823         echo "(Looking for .SH files under the source directory.)"
1824         set x `(cd "$src"; find . -name "*.SH" -print)`
1825 fi
1826 shift
1827 case $# in
1828 0) set x `(cd "$src"; echo *.SH)`; shift;;
1829 esac
1830 if test ! -f "$src/$1"; then
1831         shift
1832 fi
1833 mkdir_p='
1834 name=$1;
1835 create="";
1836 while test $name; do
1837         if test ! -d "$name"; then
1838                 create="$name $create";
1839                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1840                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1841         else
1842                 name="";
1843         fi;
1844 done;
1845 for file in $create; do
1846         mkdir $file;
1847 done
1848 '
1849 for file in $*; do
1850         case "$src" in
1851         ".")
1852                 case "$file" in
1853                 */*)
1854                         dir=`expr X$file : 'X\(.*\)/'`
1855                         file=`expr X$file : 'X.*/\(.*\)'`
1856                         (cd "$dir" && . ./$file)
1857                         ;;
1858                 *)
1859                         . ./$file
1860                         ;;
1861                 esac
1862                 ;;
1863         *)
1864                 case "$file" in
1865                 */*)
1866                         dir=`expr X$file : 'X\(.*\)/'`
1867                         file=`expr X$file : 'X.*/\(.*\)'`
1868                         (set x $dir; shift; eval $mkdir_p)
1869                         sh <"$src/$dir/$file"
1870                         ;;
1871                 *)
1872                         sh <"$src/$file"
1873                         ;;
1874                 esac
1875                 ;;
1876         esac
1877 done
1878 if test -f "$src/config_h.SH"; then
1879         if test ! -f config.h; then
1880         : oops, they left it out of MANIFEST, probably, so do it anyway.
1881         . "$src/config_h.SH"
1882         fi
1883 fi
1884 EOS
1885
1886 : extract files and exit if asked to do so
1887 case "$extractsh" in
1888 true)
1889         case "$realsilent" in
1890         true) ;;
1891         *) exec 1>&4;;
1892         esac
1893         case "$config_sh" in
1894         '') config_sh='config.sh';;
1895         esac
1896         echo " "
1897         echo "Fetching answers from $config_sh..."
1898         cd ..
1899         . $config_sh
1900         test "$override" && . ./optdef.sh
1901         echo " "
1902         . UU/extract
1903         rm -rf UU
1904         echo "Extraction done."
1905         exit 0
1906         ;;
1907 esac
1908
1909 : Eunice requires " " instead of "", can you believe it
1910 echo " "
1911 : Here we go...
1912 echo "Beginning of configuration questions for $package."
1913
1914 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1915
1916 : first determine how to suppress newline on echo command
1917 echo " "
1918 echo "Checking echo to see how to suppress newlines..."
1919 (echo "hi there\c" ; echo " ") >.echotmp
1920 if $contains c .echotmp >/dev/null 2>&1 ; then
1921         echo "...using -n."
1922         n='-n'
1923         c=''
1924 else
1925         cat <<'EOM'
1926 ...using \c
1927 EOM
1928         n=''
1929         c='\c'
1930 fi
1931 echo $n "The star should be here-->$c"
1932 echo '*'
1933 rm -f .echotmp
1934
1935 : Now test for existence of everything in MANIFEST
1936 echo " "
1937 if test -f "$rsrc/MANIFEST"; then
1938         echo "First let's make sure your kit is complete.  Checking..." >&4
1939         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1940         rm -f missing
1941         tmppwd=`pwd`
1942         for filelist in x??; do
1943                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1944         done
1945         if test -s missing; then
1946                 cat missing >&4
1947                 cat >&4 <<'EOM'
1948
1949 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1950
1951 You have the option of continuing the configuration process, despite the
1952 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1953 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1954 and contact the author (perlbug@perl.org).
1955
1956 EOM
1957                 echo $n "Continue? [n] $c" >&4
1958                 read ans
1959                 case "$ans" in
1960                 y*)
1961                         echo "Continuing..." >&4
1962                         rm -f missing
1963                         ;;
1964                 *)
1965                         echo "ABORTING..." >&4
1966                         kill $$
1967                         ;;
1968                 esac
1969         else
1970                 echo "Looks good..."
1971         fi
1972 else
1973         echo "There is no MANIFEST file.  I hope your kit is complete !"
1974 fi
1975 rm -f missing x??
1976
1977 echo " "
1978 : Find the appropriate value for a newline for tr
1979 if test -n "$DJGPP"; then
1980        trnl='\012'
1981 fi
1982 if test X"$trnl" = X; then
1983         case "`echo foo|tr '\n' x 2>/dev/null`" in
1984         foox) trnl='\n' ;;
1985         esac
1986 fi
1987 if test X"$trnl" = X; then
1988         case "`echo foo|tr '\012' x 2>/dev/null`" in
1989         foox) trnl='\012' ;;
1990         esac
1991 fi
1992 if test X"$trnl" = X; then
1993        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1994        fooxy) trnl='\n\r' ;;
1995        esac
1996 fi
1997 if test X"$trnl" = X; then
1998         cat <<EOM >&2
1999
2000 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2001
2002 EOM
2003         exit 1
2004 fi
2005
2006 : compute the number of columns on the terminal for proper question formatting
2007 case "$COLUMNS" in
2008 '') COLUMNS='80';;
2009 esac
2010
2011 : set up the echo used in my read
2012 myecho="case \"\$xxxm\" in
2013 '') echo $n \"\$rp $c\" >&4;;
2014 *) case \"\$rp\" in
2015         '') echo $n \"[\$xxxm] $c\";;
2016         *)
2017                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2018                         echo \"\$rp\" >&4
2019                         echo $n \"[\$xxxm] $c\" >&4
2020                 else
2021                         echo $n \"\$rp [\$xxxm] $c\" >&4
2022                 fi
2023                 ;;
2024         esac;;
2025 esac"
2026
2027 : now set up to do reads with possible shell escape and default assignment
2028 cat <<EOSC >myread
2029 $startsh
2030 xxxm=\$dflt
2031 $myecho
2032 ans='!'
2033 case "\$fastread" in
2034 yes) case "\$dflt" in
2035         '') ;;
2036         *) ans='';
2037                 case "\$silent-\$rp" in
2038                 true-) ;;
2039                 *) echo " " >&4;;
2040                 esac;;
2041         esac;;
2042 *) case "\$silent" in
2043         true) case "\$rp" in
2044                 '') ans='';;
2045                 esac;;
2046         esac;;
2047 esac
2048 while expr "X\$ans" : "X!" >/dev/null; do
2049         read answ
2050         set x \$xxxm
2051         shift
2052         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2053         case  "\$answ" in
2054         "!")
2055                 sh 1>&4
2056                 echo " "
2057                 $myecho
2058                 ;;
2059         !*)
2060                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2061                 shift
2062                 sh 1>&4 -c "\$*"
2063                 echo " "
2064                 $myecho
2065                 ;;
2066         "\$ans")
2067                 case "\$ans" in
2068                 \\&*)
2069                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2070                         shift
2071                         case "\$1" in
2072                         -d)
2073                                 fastread=yes
2074                                 echo "(OK, I'll run with -d after this question.)" >&4
2075                                 ;;
2076                         -*)
2077                                 echo "*** Sorry, \$1 not supported yet." >&4
2078                                 ;;
2079                         esac
2080                         $myecho
2081                         ans=!
2082                         ;;
2083                 esac;;
2084         *)
2085                 case "\$aok" in
2086                 y)
2087                         echo "*** Substitution done -- please confirm."
2088                         xxxm="\$ans"
2089                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2090                         xxxm="\$ans"
2091                         ans=!
2092                         ;;
2093                 *)
2094                         echo "*** Error -- try again."
2095                         ans=!
2096                         ;;
2097                 esac
2098                 $myecho
2099                 ;;
2100         esac
2101         case "\$ans\$xxxm\$nostick" in
2102         '')
2103                 ans=!
2104                 $myecho
2105                 ;;
2106         esac
2107 done
2108 case "\$ans" in
2109 '') ans="\$xxxm";;
2110 esac
2111 EOSC
2112
2113 : create .config dir to save info across Configure sessions
2114 test -d ../.config || mkdir ../.config
2115 cat >../.config/README <<EOF
2116 This directory created by Configure to save information that should
2117 persist across sessions for $package.
2118
2119 You may safely delete it if you wish.
2120 EOF
2121
2122 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2123 case "$usedevel" in
2124 $define|true|[yY]*) ;;
2125 *) case "$xversion" in
2126    *[13579])
2127         cat >&4 <<EOH
2128 *** WHOA THERE!!! ***
2129
2130     This is an UNSTABLE DEVELOPMENT release.
2131     The version of this $package distribution is $xversion, that is, odd,
2132     (as opposed to even) and that signifies a development release.
2133     If you want a maintenance release, you want an even-numbered version.
2134
2135     Do ***NOT*** install this into production use.
2136     Data corruption and crashes are possible.
2137
2138     It is most seriously suggested that you do not continue any further
2139     unless you want to help in developing and debugging Perl.
2140
2141     If you *still* want to build perl, you can answer 'y' now,
2142     or pass -Dusedevel to Configure.
2143
2144 EOH
2145         rp='Do you really want to continue?'
2146         dflt='n'
2147         . ./myread
2148         case "$ans" in
2149         [yY]) echo >&4 "Okay, continuing."
2150               usedevel="$define" ;;
2151         *) echo >&4 "Okay, bye."
2152            exit 1
2153            ;;
2154         esac
2155         ;;
2156     esac
2157     ;;
2158 esac
2159 case "$usedevel" in
2160 $define|true|[yY]*)
2161         case "$versiononly" in
2162         '') versiononly="$define" ;;
2163         esac
2164         case "$installusrbinperl" in
2165         '') installusrbinperl="$undef" ;;
2166         esac
2167         ;;
2168 esac
2169
2170 : general instructions
2171 needman=true
2172 firsttime=true
2173 user=`(logname) 2>/dev/null`
2174 case "$user" in
2175 '') user=`whoami 2>&1`;;
2176 esac
2177 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2178         firsttime=false
2179         echo " "
2180         rp='Would you like to see the instructions?'
2181         dflt=n
2182         . ./myread
2183         case "$ans" in
2184         [yY]*) ;;
2185         *) needman=false;;
2186         esac
2187 fi
2188 if $needman; then
2189         cat <<EOH
2190
2191 This installation shell script will examine your system and ask you questions
2192 to determine how the perl5 package should be installed. If you get
2193 stuck on a question, you may use a ! shell escape to start a subshell or
2194 execute a command.  Many of the questions will have default answers in square
2195 brackets; typing carriage return will give you the default.
2196
2197 On some of the questions which ask for file or directory names you are allowed
2198 to use the ~name construct to specify the login directory belonging to "name",
2199 even if you don't have a shell which knows about that.  Questions where this is
2200 allowed will be marked "(~name ok)".
2201
2202 EOH
2203         rp=''
2204         dflt='Type carriage return to continue'
2205         . ./myread
2206         cat <<'EOH'
2207
2208 The prompter used in this script allows you to use shell variables and
2209 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2210 in the default answer, as if the default line was a set of arguments given to a
2211 script shell.  This means you may also use $* to repeat the whole default line,
2212 so you do not have to re-type everything to add something to the default.
2213
2214 Everytime there is a substitution, you will have to confirm.  If there is an
2215 error (e.g. an unmatched backtick), the default answer will remain unchanged
2216 and you will be prompted again.
2217
2218 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2219 the questions and use the computed defaults (or the previous answers if there
2220 was already a config.sh file). Type 'Configure -h' for a list of options.
2221 You may also start interactively and then answer '& -d' at any prompt to turn
2222 on the non-interactive behaviour for the remainder of the execution.
2223
2224 EOH
2225         . ./myread
2226         cat <<EOH
2227
2228 Much effort has been expended to ensure that this shell script will run on any
2229 Unix system.  If despite that it blows up on yours, your best bet is to edit
2230 Configure and run it again.  If you can't run Configure for some reason,
2231 you'll have to generate a config.sh file by hand.  Whatever problems you
2232 have, let me (perlbug@perl.org) know how I blew it.
2233
2234 This installation script affects things in two ways:
2235
2236 1) it may do direct variable substitutions on some of the files included
2237    in this kit.
2238 2) it builds a config.h file for inclusion in C programs.  You may edit
2239    any of these files as the need arises after running this script.
2240
2241 If you make a mistake on a question, there is no easy way to back up to it
2242 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2243 files.  Configure will offer to let you do this before it runs the SH files.
2244
2245 EOH
2246         dflt='Type carriage return to continue'
2247         . ./myread
2248         case "$firsttime" in
2249         true) echo $user >>../.config/instruct;;
2250         esac
2251 fi
2252
2253 : find out where common programs are
2254 echo " "
2255 echo "Locating common programs..." >&4
2256 cat <<EOSC >loc
2257 $startsh
2258 case \$# in
2259 0) exit 1;;
2260 esac
2261 thing=\$1
2262 shift
2263 dflt=\$1
2264 shift
2265 for dir in \$*; do
2266         case "\$thing" in
2267         .)
2268         if test -d \$dir/\$thing; then
2269                 echo \$dir
2270                 exit 0
2271         fi
2272         ;;
2273         *)
2274         for thisthing in \$dir/\$thing; do
2275                 : just loop through to pick last item
2276         done
2277         if test -f \$thisthing; then
2278                 echo \$thisthing
2279                 exit 0
2280         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2281                 echo \$thisthing
2282                 exit 0
2283         elif test -f \$dir/\$thing.exe; then
2284                 if test -n "$DJGPP"; then
2285                         echo \$dir/\$thing.exe
2286                 elif test "$eunicefix" != ":"; then
2287                         : on Eunice apparently
2288                         echo \$dir/\$thing
2289                         exit 0
2290                 fi
2291                 exit 0
2292         fi
2293         ;;
2294         esac
2295 done
2296 echo \$dflt
2297 exit 1
2298 EOSC
2299 chmod +x loc
2300 $eunicefix loc
2301 loclist="
2302 awk
2303 cat
2304 chmod
2305 comm
2306 cp
2307 echo
2308 expr
2309 grep
2310 ls
2311 mkdir
2312 rm
2313 sed
2314 sort
2315 touch
2316 tr
2317 uniq
2318 "
2319 trylist="
2320 Mcc
2321 ar
2322 bison
2323 byacc
2324 cpp
2325 csh
2326 date
2327 egrep
2328 gmake
2329 gzip
2330 less
2331 ln
2332 make
2333 more
2334 nm
2335 nroff
2336 pg
2337 test
2338 uname
2339 zip
2340 "
2341 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2342 pth="$pth /lib /usr/lib"
2343 for file in $loclist; do
2344         eval xxx=\$$file
2345         case "$xxx" in
2346         /*|?:[\\/]*)
2347                 if test -f "$xxx"; then
2348                         : ok
2349                 else
2350                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2351                         xxx=`./loc $file $file $pth`
2352                 fi
2353                 ;;
2354         '') xxx=`./loc $file $file $pth`;;
2355         *) xxx=`./loc $xxx $xxx $pth`;;
2356         esac
2357         eval $file=$xxx$_exe
2358         eval _$file=$xxx
2359         case "$xxx" in
2360         /*)
2361                 echo $file is in $xxx.
2362                 ;;
2363         ?:[\\/]*)
2364                 echo $file is in $xxx.
2365                 ;;
2366         *)
2367                 echo "I don't know where '$file' is, and my life depends on it." >&4
2368                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2369                 exit 1
2370                 ;;
2371         esac
2372 done
2373 echo " "
2374 echo "Don't worry if any of the following aren't found..."
2375 say=offhand
2376 for file in $trylist; do
2377         eval xxx=\$$file
2378         case "$xxx" in
2379         /*|?:[\\/]*)
2380                 if test -f "$xxx"; then
2381                         : ok
2382                 else
2383                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2384                         xxx=`./loc $file $file $pth`
2385                 fi
2386                 ;;
2387         '') xxx=`./loc $file $file $pth`;;
2388         *) xxx=`./loc $xxx $xxx $pth`;;
2389         esac
2390         eval $file=$xxx$_exe
2391         eval _$file=$xxx
2392         case "$xxx" in
2393         /*)
2394                 echo $file is in $xxx.
2395                 ;;
2396         ?:[\\/]*)
2397                 echo $file is in $xxx.
2398                 ;;
2399         *)
2400                 echo "I don't see $file out there, $say."
2401                 say=either
2402                 ;;
2403         esac
2404 done
2405 case "$egrep" in
2406 egrep)
2407         echo "Substituting grep for egrep."
2408         egrep=$grep
2409         _egrep=$grep
2410         ;;
2411 esac
2412 case "$ln" in
2413 ln)
2414         echo "Substituting cp for ln."
2415         ln=$cp
2416         _ln=$cp
2417         ;;
2418 esac
2419 case "$make" in
2420 make)   
2421         case "$gmake" in
2422         gmake)
2423         echo "I can't find make or gmake, and my life depends on it." >&4
2424         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2425         exit 1
2426         ;;
2427         esac
2428         ;;
2429 esac    
2430 case "$gmake" in
2431 gmake)  ;;
2432 *)      # We can't have osname yet.
2433         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2434                 # Assume that gmake, if found, is definitely GNU make
2435                 # and prefer it over the system make.
2436                 echo "Substituting gmake for make."
2437                 make=$gmake
2438                 _make=$gmake
2439         fi
2440         ;;
2441 esac
2442 case "$test" in
2443 test)
2444         echo "Hopefully test is built into your sh."
2445         ;;
2446 *)
2447         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2448                 echo "Using the test built into your sh."
2449                 test=test
2450                 _test=test
2451         fi
2452         ;;
2453 esac
2454 case "$echo" in
2455 echo)
2456         echo "Hopefully echo is built into your sh."
2457         ;;
2458 '') ;;
2459 *)
2460         echo " "
2461 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2462         $echo $n "hi there$c" >foo1
2463         echo $n "hi there$c" >foo2
2464         if cmp foo1 foo2 >/dev/null 2>&1; then
2465                 echo "They are compatible.  In fact, they may be identical."
2466         else
2467                 case "$n" in
2468                 '-n') n='' c='\c';;
2469                 *) n='-n' c='';;
2470                 esac
2471                 cat <<FOO
2472 They are not compatible!  You are probably running ksh on a non-USG system.
2473 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2474 have echo built in and we may have to run some Bourne shell scripts.  That
2475 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2476
2477 FOO
2478                 $echo $n "The star should be here-->$c"
2479                 $echo "*"
2480         fi
2481         $rm -f foo1 foo2
2482         ;;
2483 esac
2484
2485 cat <<EOS >trygcc
2486 $startsh
2487 EOS
2488 cat <<'EOSC' >>trygcc
2489 case "$cc" in
2490 '') ;;
2491 *)  $rm -f try try.*
2492     $cat >try.c <<EOM
2493 int main(int argc, char *argv[]) {
2494   return 0;
2495 }
2496 EOM
2497     if $cc -o try $ccflags $ldflags try.c; then
2498        :
2499     else
2500         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2501         despair=yes
2502         trygcc=yes
2503         case "$cc" in
2504         *gcc*) trygcc=no ;;
2505         esac
2506         # Skip this test because it gives a false match on output like:
2507         #    ./trygcc: line 23: cc: command not found
2508         # case "`$cc -v -c try.c 2>&1`" in
2509         # *gcc*) trygcc=no ;;
2510         # esac
2511         if $test X"$trygcc" = Xyes; then
2512             if gcc -o try -c try.c; then
2513                 echo " "
2514                 echo "You seem to have a working gcc, though." >&4
2515                 # Switching compilers may undo the work of hints files.
2516                 # The most common problem is -D_REENTRANT for threads.
2517                 # This heuristic catches that case, but gets false positives
2518                 # if -Dusethreads was not actually specified.  Better to
2519                 # bail out here with a useful message than fail 
2520                 # mysteriously later. Should we perhaps just try to
2521                 # re-invoke Configure -Dcc=gcc config_args ?
2522                 if $test -f usethreads.cbu; then
2523                         $cat >&4 <<EOM 
2524
2525 *** However, any setting of the C compiler flags (e.g. for thread support)
2526 *** will be lost.  It may be necessary for you to restart Configure and
2527 *** add -Dcc=gcc to your Configure command line.
2528
2529 EOM
2530                         rp="Would you like to go ahead and try gcc anyway?"
2531                         dflt=n
2532                 else
2533                         rp="Would you like to use it?"
2534                         dflt=y
2535                 fi
2536                 if $test -f myread; then
2537                     . ./myread
2538                 else
2539                     if $test -f UU/myread; then
2540                         . ./UU/myread
2541                     else
2542                         echo "Cannot find myread, sorry.  Aborting." >&2
2543                         exit 1
2544                     fi
2545                 fi  
2546                 case "$ans" in
2547                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2548                 esac
2549             fi
2550         fi
2551     fi
2552     $rm -f try try.*
2553     ;;
2554 esac
2555 EOSC
2556
2557 cat <<EOS >checkcc
2558 $startsh
2559 EOS
2560 cat <<'EOSC' >>checkcc
2561 case "$cc" in        
2562 '') ;;
2563 *)  $rm -f try try.*              
2564     $cat >try.c <<EOM
2565 int main(int argc, char *argv[]) {
2566   return 0;
2567 }
2568 EOM
2569     if $cc -o try $ccflags $ldflags try.c; then
2570        :
2571     else
2572         if $test X"$despair" = Xyes; then
2573            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2574         fi
2575         $cat >&4 <<EOM         
2576 You need to find a working C compiler.
2577 Either (purchase and) install the C compiler supplied by your OS vendor,
2578 or for a free C compiler try http://gcc.gnu.org/
2579 I cannot continue any further, aborting.
2580 EOM
2581         exit 1
2582     fi
2583     $rm -f try try.*
2584     ;;
2585 esac
2586 EOSC
2587
2588 : determine whether symbolic links are supported
2589 echo " "
2590 $touch blurfl
2591 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2592         echo "Symbolic links are supported." >&4
2593         lns="$ln -s"
2594 else
2595         echo "Symbolic links are NOT supported." >&4
2596         lns="$ln"
2597 fi
2598 $rm -f blurfl sym
2599
2600 : determine whether symbolic links are supported
2601 echo " "
2602 case "$lns" in
2603 *"ln"*" -s")
2604         echo "Checking how to test for symbolic links..." >&4
2605         $lns blurfl sym
2606         if $test "X$issymlink" = X; then
2607                 case "$newsh" in
2608                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2609                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2610                 esac
2611                 if test $? = 0; then
2612                         issymlink="test -h"
2613                 else
2614                         echo "Your builtin 'test -h' may be broken." >&4
2615                         case "$test" in
2616                         /*)     ;;
2617                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2618                                 for p in $pth
2619                                 do
2620                                         if test -f "$p/$test"; then
2621                                                 test="$p/$test"
2622                                                 break
2623                                         fi
2624                                 done
2625                                 ;;
2626                         esac
2627                         case "$test" in
2628                         /*)
2629                                 echo "Trying external '$test -h'." >&4
2630                                 issymlink="$test -h"
2631                                 if $test ! -h sym >/dev/null 2>&1; then
2632                                         echo "External '$test -h' is broken, too." >&4
2633                                         issymlink=''
2634                                 fi
2635                                 ;;
2636                         *)      issymlink='' ;;
2637                         esac
2638                 fi              
2639         fi
2640         if $test "X$issymlink" = X; then
2641                 if $test -L sym 2>/dev/null; then
2642                         issymlink="$test -L"
2643                         echo "The builtin '$test -L' worked." >&4
2644                 fi
2645         fi
2646         if $test "X$issymlink" != X; then
2647                 echo "You can test for symbolic links with '$issymlink'." >&4
2648         else
2649                 echo "I do not know how you can test for symbolic links." >&4
2650         fi
2651         $rm -f blurfl sym
2652         ;;
2653 *)      echo "No symbolic links, so not testing for their testing..." >&4
2654         ;;
2655 esac
2656 echo " "
2657
2658
2659 case "$mksymlinks" in
2660 $define|true|[yY]*)
2661         case "$src" in
2662         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2663                 exit 1
2664                 ;;
2665         *)      case "$lns:$issymlink" in
2666                 *"ln"*" -s:"*"test -"?)
2667                         echo "Creating the symbolic links..." >&4
2668                         echo "(First creating the subdirectories...)" >&4
2669                         cd ..
2670                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2671                                 read directory
2672                                 test -z "$directory" && break
2673                                 mkdir -p $directory
2674                         done
2675                         # Sanity check 1.
2676                         if test ! -d t/base; then
2677                                 echo "Failed to create the subdirectories.  Aborting." >&4
2678                                 exit 1
2679                         fi
2680                         echo "(Then creating the symlinks...)" >&4
2681                         awk '{print $1}' $src/MANIFEST | while true; do
2682                                 read filename
2683                                 test -z "$filename" && break
2684                                 if test -f $filename; then
2685                                         if $issymlink $filename; then
2686                                                 rm -f $filename
2687                                         fi
2688                                 fi
2689                                 if test -f $filename; then
2690                                         echo "$filename already exists, not symlinking."
2691                                 else
2692                                         ln -s $src/$filename $filename
2693                                 fi
2694                         done
2695                         # Sanity check 2.
2696                         if test ! -f t/base/lex.t; then
2697                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2698                                 exit 1
2699                         fi
2700                         cd UU
2701                         ;;
2702                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2703                         ;;
2704                 esac
2705                 ;;
2706         esac
2707         ;;
2708 esac
2709
2710
2711 case "$usecrosscompile" in
2712 $define|true|[yY]*)
2713         $echo "Cross-compiling..."
2714         croak=''
2715         case "$cc" in
2716         *-*-gcc) # A cross-compiling gcc, probably.
2717             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2718             ar=$targetarch-ar
2719             # leave out ld, choosing it is more complex
2720             nm=$targetarch-nm
2721             ranlib=$targetarch-ranlib
2722             $echo 'extern int foo;' > try.c
2723             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2724             shift
2725             if $test $# -gt 0; then
2726                 incpth="$incpth $*"
2727                 incpth="`$echo $incpth|$sed 's/^ //'`"
2728                 echo "Guessing incpth '$incpth'." >&4
2729                 for i in $*; do
2730                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2731                     if $test -d $j; then
2732                         libpth="$libpth $j"
2733                     fi
2734                 done   
2735                 libpth="`$echo $libpth|$sed 's/^ //'`"
2736                 echo "Guessing libpth '$libpth'." >&4
2737             fi
2738             $rm -f try.c
2739             ;;
2740         esac
2741         case "$targetarch" in
2742         '') echo "Targetarch not defined." >&4; croak=y ;;
2743         *)  echo "Using targetarch $targetarch." >&4 ;;
2744         esac
2745         case "$incpth" in
2746         '') echo "Incpth not defined." >&4; croak=y ;;
2747         *)  echo "Using incpth '$incpth'." >&4 ;;
2748         esac
2749         case "$libpth" in
2750         '') echo "Libpth not defined." >&4; croak=y ;;
2751         *)  echo "Using libpth '$libpth'." >&4 ;;
2752         esac
2753         case "$usrinc" in
2754         '') for i in $incpth; do
2755                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2756                     usrinc=$i
2757                     echo "Guessing usrinc $usrinc." >&4
2758                     break
2759                 fi
2760             done
2761             case "$usrinc" in
2762             '') echo "Usrinc not defined." >&4; croak=y ;;
2763             esac
2764             ;;
2765         *)  echo "Using usrinc $usrinc." >&4 ;;
2766         esac
2767         case "$targethost" in
2768         '') echo "Targethost not defined." >&4; croak=y ;;
2769         *)  echo "Using targethost $targethost." >&4
2770         esac
2771         locincpth=' '
2772         loclibpth=' '
2773         case "$croak" in
2774         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2775         esac
2776         case "$src" in
2777         /*) run=$src/Cross/run
2778             targetmkdir=$src/Cross/mkdir
2779             to=$src/Cross/to
2780             from=$src/Cross/from
2781             ;;
2782         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2783             run=$pwd/Cross/run
2784             targetmkdir=$pwd/Cross/mkdir
2785             to=$pwd/Cross/to
2786             from=$pwd/Cross/from
2787             ;;
2788         esac
2789         case "$targetrun" in
2790         '') targetrun=ssh ;;
2791         esac
2792         case "$targetto" in
2793         '') targetto=scp ;;
2794         esac
2795         case "$targetfrom" in
2796         '') targetfrom=scp ;;
2797         esac
2798         run=$run-$targetrun
2799         to=$to-$targetto
2800         from=$from-$targetfrom
2801         case "$targetdir" in
2802         '')  targetdir=/tmp
2803              echo "Guessing targetdir $targetdir." >&4
2804              ;;
2805         esac
2806         case "$targetuser" in
2807         '')  targetuser=root
2808              echo "Guessing targetuser $targetuser." >&4
2809              ;;
2810         esac
2811         case "$targetfrom" in
2812         scp)    q=-q ;;
2813         *)      q='' ;;
2814         esac
2815         case "$targetrun" in
2816         ssh|rsh)
2817             cat >$run <<EOF
2818 #!/bin/sh
2819 case "\$1" in
2820 -cwd)
2821   shift
2822   cwd=\$1
2823   shift
2824   ;;
2825 esac
2826 case "\$cwd" in
2827 '') cwd=$targetdir ;;
2828 esac
2829 exe=\$1
2830 shift
2831 if $test ! -f \$exe.xok; then
2832   $to \$exe
2833   $touch \$exe.xok
2834 fi
2835 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2836 EOF
2837             ;;
2838         *)  echo "Unknown targetrun '$targetrun'" >&4
2839             exit 1
2840             ;;
2841         esac
2842         case "$targetmkdir" in
2843         */Cross/mkdir)
2844             cat >$targetmkdir <<EOF
2845 #!/bin/sh
2846 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2847 EOF
2848             $chmod a+rx $targetmkdir
2849             ;;
2850         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2851             exit 1
2852             ;;
2853         esac
2854         case "$targetto" in
2855         scp|rcp)
2856             cat >$to <<EOF
2857 #!/bin/sh
2858 for f in \$@
2859 do
2860   case "\$f" in
2861   /*)
2862     $targetmkdir \`dirname \$f\`
2863     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2864     ;;
2865   *)
2866     $targetmkdir $targetdir/\`dirname \$f\`
2867     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2868     ;;
2869   esac
2870 done
2871 exit 0
2872 EOF
2873             ;;
2874         cp) cat >$to <<EOF
2875 #!/bin/sh
2876 for f in \$@
2877 do
2878   case "\$f" in
2879   /*)
2880     $mkdir -p $targetdir/\`dirname \$f\`
2881     $cp \$f $targetdir/\$f || exit 1
2882     ;;
2883   *)
2884     $targetmkdir $targetdir/\`dirname \$f\`
2885     $cp \$f $targetdir/\$f || exit 1
2886     ;;
2887   esac
2888 done
2889 exit 0
2890 EOF
2891             ;;
2892         *)  echo "Unknown targetto '$targetto'" >&4
2893             exit 1
2894             ;;
2895         esac
2896         case "$targetfrom" in
2897         scp|rcp)
2898           cat >$from <<EOF
2899 #!/bin/sh
2900 for f in \$@
2901 do
2902   $rm -f \$f
2903   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2904 done
2905 exit 0
2906 EOF
2907             ;;
2908         cp) cat >$from <<EOF
2909 #!/bin/sh
2910 for f in \$@
2911 do
2912   $rm -f \$f
2913   cp $targetdir/\$f . || exit 1
2914 done
2915 exit 0
2916 EOF
2917             ;;
2918         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2919             exit 1
2920             ;;
2921         esac
2922         if $test ! -f $run; then
2923             echo "Target 'run' script '$run' not found." >&4
2924         else
2925             $chmod a+rx $run
2926         fi
2927         if $test ! -f $to; then
2928             echo "Target 'to' script '$to' not found." >&4
2929         else
2930             $chmod a+rx $to
2931         fi
2932         if $test ! -f $from; then
2933             echo "Target 'from' script '$from' not found." >&4
2934         else
2935             $chmod a+rx $from
2936         fi
2937         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2938             exit 1
2939         fi
2940         cat >&4 <<EOF
2941 Using '$run' for remote execution,
2942 and '$from' and '$to'
2943 for remote file transfer.
2944 EOF
2945         ;;
2946 *)      run=''
2947         to=:
2948         from=:
2949         usecrosscompile='undef'
2950         targetarch=''
2951         ;;
2952 esac
2953
2954 : see whether [:lower:] and [:upper:] are supported character classes
2955 echo " "
2956 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2957 ABYZ)
2958         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2959         up='[:upper:]'
2960         low='[:lower:]'
2961         ;;
2962 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2963         # (0xd9 and 0xe2), therefore that is a nice testing point.
2964         if test "X$up" = X -o "X$low" = X; then
2965             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2966             rs) up='[A-Z]'
2967                 low='[a-z]'
2968                 ;;
2969             esac
2970         fi
2971         if test "X$up" = X -o "X$low" = X; then
2972             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2973             rs) up='A-Z'
2974                 low='a-z'
2975                 ;;
2976             esac
2977         fi
2978         if test "X$up" = X -o "X$low" = X; then
2979             case "`echo RS | od -x 2>/dev/null`" in
2980             *D9E2*|*d9e2*)
2981                 echo "Hey, this might be EBCDIC." >&4
2982                 if test "X$up" = X -o "X$low" = X; then
2983                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2984                     rs) up='[A-IJ-RS-Z]'
2985                         low='[a-ij-rs-z]'
2986                         ;;
2987                     esac
2988                 fi
2989                 if test "X$up" = X -o "X$low" = X; then
2990                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2991                     rs) up='A-IJ-RS-Z'
2992                         low='a-ij-rs-z'
2993                         ;;
2994                     esac
2995                 fi
2996                 ;;
2997             esac
2998         fi
2999 esac
3000 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3001 rs)
3002     echo "Using $up and $low to convert case." >&4
3003     ;;
3004 *)
3005     echo "I don't know how to translate letters from upper to lower case." >&4
3006     echo "Your tr is not acting any way I know of." >&4
3007     exit 1
3008     ;;
3009 esac
3010 : set up the translation script tr, must be called with ./tr of course
3011 cat >tr <<EOSC
3012 $startsh
3013 case "\$1\$2" in
3014 '[A-Z][a-z]') exec $tr '$up' '$low';;
3015 '[a-z][A-Z]') exec $tr '$low' '$up';;
3016 esac
3017 exec $tr "\$@"
3018 EOSC
3019 chmod +x tr
3020 $eunicefix tr
3021
3022 : Try to determine whether config.sh was made on this system
3023 case "$config_sh" in
3024 '')
3025 myuname=`$uname -a 2>/dev/null`
3026 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3027 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3028 # because the A-Z/a-z are not consecutive.
3029 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3030         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3031 newmyuname="$myuname"
3032 dflt=n
3033 case "$knowitall" in
3034 '')
3035         if test -f ../config.sh; then
3036                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3037                         eval "`grep myuname= ../config.sh`"
3038                 fi
3039                 if test "X$myuname" = "X$newmyuname"; then
3040                         dflt=y
3041                 fi
3042         fi
3043         ;;
3044 *) dflt=y;;
3045 esac
3046
3047 : Get old answers from old config file if Configure was run on the
3048 : same system, otherwise use the hints.
3049 hint=default
3050 cd ..
3051 if test -f config.sh; then
3052         echo " "
3053         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3054         . UU/myread
3055         case "$ans" in
3056         n*|N*) echo "OK, I'll ignore it."
3057                 mv config.sh config.sh.old
3058                 myuname="$newmyuname"
3059                 ;;
3060         *)  echo "Fetching default answers from your old config.sh file..." >&4
3061                 tmp_n="$n"
3062                 tmp_c="$c"
3063                 tmp_sh="$sh"
3064                 . ./config.sh
3065                 cp config.sh UU
3066                 n="$tmp_n"
3067                 c="$tmp_c"
3068                 : Older versions did not always set $sh.  Catch re-use of such
3069                 : an old config.sh.
3070                 case "$sh" in
3071                 '') sh="$tmp_sh" ;;
3072                 esac
3073                 hint=previous
3074                 ;;
3075         esac
3076 fi
3077 . ./UU/checkcc
3078 if test ! -f config.sh; then
3079         $cat <<EOM
3080
3081 First time through, eh?  I have some defaults handy for some systems
3082 that need some extra help getting the Configure answers right:
3083
3084 EOM
3085         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3086         dflt=''
3087         : Half the following guesses are probably wrong... If you have better
3088         : tests or hints, please send them to perlbug@perl.org
3089         : The metaconfig authors would also appreciate a copy...
3090         $test -f /irix && osname=irix
3091         $test -f /xenix && osname=sco_xenix
3092         $test -f /dynix && osname=dynix
3093         $test -f /dnix && osname=dnix
3094         $test -f /lynx.os && osname=lynxos
3095         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3096         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3097         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3098         $test -f /bin/mips && /bin/mips && osname=mips
3099         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3100                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3101         $test -d /usr/apollo/bin && osname=apollo
3102         $test -f /etc/saf/_sactab && osname=svr4
3103         $test -d /usr/include/minix && osname=minix
3104         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3105         if $test -d /MachTen -o -d /MachTen_Folder; then
3106                 osname=machten
3107                 if $test -x /sbin/version; then
3108                         osvers=`/sbin/version | $awk '{print $2}' |
3109                         $sed -e 's/[A-Za-z]$//'`
3110                 elif $test -x /usr/etc/version; then
3111                         osvers=`/usr/etc/version | $awk '{print $2}' |
3112                         $sed -e 's/[A-Za-z]$//'`
3113                 else
3114                         osvers="$2.$3"
3115                 fi
3116         fi
3117
3118         $test -f /sys/posix.dll &&
3119                 $test -f /usr/bin/what &&
3120                 set X `/usr/bin/what /sys/posix.dll` &&
3121                 $test "$3" = UWIN &&
3122                 osname=uwin &&
3123                 osvers="$5"
3124
3125         if $test -f $uname; then
3126                 set X $myuname
3127                 shift
3128
3129                 case "$5" in
3130                 fps*) osname=fps ;;
3131                 mips*)
3132                         case "$4" in
3133                         umips) osname=umips ;;
3134                         *) osname=mips ;;
3135                         esac;;
3136                 [23]100) osname=mips ;;
3137                 next*) osname=next ;;
3138                 i386*)
3139                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3140                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3141                                 osname='sco'
3142                                 osvers=$tmp
3143                         elif $test -f /etc/kconfig; then
3144                                 osname=isc
3145                                 if test "$lns" = "$ln -s"; then
3146                                         osvers=4
3147                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3148                                         osvers=3
3149                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3150                                         osvers=2
3151                                 fi
3152                         fi
3153                         tmp=''
3154                         ;;
3155                 pc*)
3156                         if test -n "$DJGPP"; then
3157                                 osname=dos
3158                                 osvers=djgpp
3159                         fi
3160                         ;;
3161                 esac
3162
3163                 case "$1" in
3164                 aix) osname=aix
3165                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3166                         case "$tmp" in
3167                         # oslevel can fail with:
3168                         # oslevel: Unable to acquire lock.
3169                         *not\ found) osvers="$4"."$3" ;;
3170                         '<3240'|'<>3240') osvers=3.2.0 ;;
3171                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3172                         '=3250'|'>3250') osvers=3.2.5 ;;
3173                         *) osvers=$tmp;;
3174                         esac
3175                         ;;
3176                 bsd386) osname=bsd386
3177                         osvers=`$uname -r`
3178                         ;;
3179                 cygwin*) osname=cygwin
3180                         osvers="$3"
3181                         ;;
3182                 *dc.osx) osname=dcosx
3183                         osvers="$3"
3184                         ;;
3185                 dnix) osname=dnix
3186                         osvers="$3"
3187                         ;;
3188                 domainos) osname=apollo
3189                         osvers="$3"
3190                         ;;
3191                 dgux)   osname=dgux
3192                         osvers="$3"
3193                         ;;
3194                 dragonfly) osname=dragonfly
3195                         osvers="$3"
3196                         ;;
3197                 dynixptx*) osname=dynixptx
3198                         osvers=`echo "$4"|sed 's/^v//'`
3199                         ;;
3200                 freebsd) osname=freebsd
3201                         osvers="$3" ;;
3202                 genix)  osname=genix ;;
3203                 gnu)    osname=gnu
3204                         osvers="$3" ;;
3205                 hp*)    osname=hpux
3206                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3207                         ;;
3208                 irix*)  osname=irix
3209                         case "$3" in
3210                         4*) osvers=4 ;;
3211                         5*) osvers=5 ;;
3212                         *)      osvers="$3" ;;
3213                         esac
3214                         ;;
3215                 linux)  osname=linux
3216                         case "$3" in
3217                         *)      osvers="$3" ;;
3218                         esac
3219                         ;;
3220                 MiNT)   osname=mint
3221                         ;;
3222                 netbsd*) osname=netbsd
3223                         osvers="$3"
3224                         ;;
3225                 news-os) osvers="$3"
3226                         case "$3" in
3227                         4*) osname=newsos4 ;;
3228                         *) osname=newsos ;;
3229                         esac
3230                         ;;
3231                 next*) osname=next ;;
3232                 nonstop-ux) osname=nonstopux ;;
3233                 openbsd) osname=openbsd
3234                         osvers="$3"
3235                         ;;
3236                 os2)    osname=os2
3237                         osvers="$4"
3238                         ;;
3239                 POSIX-BC | posix-bc ) osname=posix-bc
3240                         osvers="$3"
3241                         ;;
3242                 powerux | power_ux | powermax_os | powermaxos | \
3243                 powerunix | power_unix) osname=powerux
3244                         osvers="$3"
3245                         ;;
3246                 qnx) osname=qnx
3247                         osvers="$4"
3248                         ;;
3249                 solaris) osname=solaris
3250                         case "$3" in
3251                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3252                         *)      osvers="$3" ;;
3253                         esac
3254                         ;;
3255                 sunos) osname=sunos
3256                         case "$3" in
3257                         5*) osname=solaris
3258                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3259                         *)      osvers="$3" ;;
3260                         esac
3261                         ;;
3262                 titanos) osname=titanos
3263                         case "$3" in
3264                         1*) osvers=1 ;;
3265                         2*) osvers=2 ;;
3266                         3*) osvers=3 ;;
3267                         4*) osvers=4 ;;
3268                         *)      osvers="$3" ;;
3269                         esac
3270                         ;;
3271                 ultrix) osname=ultrix
3272                         osvers="$3"
3273                         ;;
3274                 osf1|mls+)      case "$5" in
3275                                 alpha)
3276                                         osname=dec_osf
3277                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3278                                         case "$osvers" in
3279                                         [1-9].[0-9]*) ;;
3280                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3281                                         esac
3282                                         ;;
3283                         hp*)    osname=hp_osf1  ;;
3284                         mips)   osname=mips_osf1 ;;
3285                         esac
3286                         ;;
3287                 # UnixWare 7.1.2 is known as Open UNIX 8
3288                 openunix|unixware) osname=svr5
3289                         osvers="$4"
3290                         ;;
3291                 uts)    osname=uts
3292                         osvers="$3"
3293                         ;;
3294                 vos) osvers="$3"
3295                         ;;
3296                 $2) case "$osname" in
3297                         *isc*) ;;
3298                         *freebsd*) ;;
3299                         svr*)
3300                                 : svr4.x or possibly later
3301                                 case "svr$3" in
3302                                 ${osname}*)
3303                                         osname=svr$3
3304                                         osvers=$4
3305                                         ;;
3306                                 esac
3307                                 case "$osname" in
3308                                 svr4.0)
3309                                         : Check for ESIX
3310                                         if test -f /stand/boot ; then
3311                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3312                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3313                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3314                                                         if test -n "$isesix"; then
3315                                                                 osname=esix4
3316                                                         fi
3317                                                 fi
3318                                         fi
3319                                         ;;
3320                                 esac
3321                                 ;;
3322                         *)      if test -f /etc/systemid; then
3323                                         osname=sco
3324                                         set `echo $3 | $sed 's/\./ /g'` $4
3325                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3326                                                 osvers=$1.$2.$3
3327                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3328                                                 osvers=$1.$2
3329                                         elif $test -f $src/hints/sco_$1.sh; then
3330                                                 osvers=$1
3331                                         fi
3332                                 else
3333                                         case "$osname" in
3334                                         '') : Still unknown.  Probably a generic Sys V.
3335                                                 osname="sysv"
3336                                                 osvers="$3"
3337                                                 ;;
3338                                         esac
3339                                 fi
3340                                 ;;
3341                         esac
3342                         ;;
3343                 *)      case "$osname" in
3344                         '') : Still unknown.  Probably a generic BSD.
3345                                 osname="$1"
3346                                 osvers="$3"
3347                                 ;;
3348                         esac
3349                         ;;
3350                 esac
3351         else
3352                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3353                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3354                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3355                                 osname=news_os
3356                         fi
3357                         $rm -f UU/kernel.what
3358                 elif test -d c:/. -o -n "$is_os2" ; then
3359                         set X $myuname
3360                         osname=os2
3361                         osvers="$5"
3362                 fi
3363         fi
3364
3365         case "$targetarch" in
3366         '') ;;
3367         *)  hostarch=$osname
3368             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3369             osvers=''
3370             ;;
3371         esac
3372
3373         : Now look for a hint file osname_osvers, unless one has been
3374         : specified already.
3375         case "$hintfile" in
3376         ''|' ')
3377                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3378                 : Also try without trailing minor version numbers.
3379                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3380                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3381                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3382                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3383                 case "$file" in
3384                 '') dflt=none ;;
3385                 *)  case "$osvers" in
3386                         '') dflt=$file
3387                                 ;;
3388                         *)  if $test -f $src/hints/$file.sh ; then
3389                                         dflt=$file
3390                                 elif $test -f $src/hints/$xfile.sh ; then
3391                                         dflt=$xfile
3392                                 elif $test -f $src/hints/$xxfile.sh ; then
3393                                         dflt=$xxfile
3394                                 elif $test -f $src/hints/$xxxfile.sh ; then
3395                                         dflt=$xxxfile
3396                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3397                                         dflt=$xxxxfile
3398                                 elif $test -f "$src/hints/${osname}.sh" ; then
3399                                         dflt="${osname}"
3400                                 else
3401                                         dflt=none
3402                                 fi
3403                                 ;;
3404                         esac
3405                         ;;
3406                 esac
3407                 if $test -f Policy.sh ; then
3408                         case "$dflt" in
3409                         *Policy*) ;;
3410                         none) dflt="Policy" ;;
3411                         *) dflt="Policy $dflt" ;;
3412                         esac
3413                 fi
3414                 ;;
3415         *)
3416                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3417                 ;;
3418         esac
3419
3420         if $test -f Policy.sh ; then
3421                 $cat <<EOM
3422
3423 There's also a Policy hint file available, which should make the
3424 site-specific (policy) questions easier to answer.
3425 EOM
3426
3427         fi
3428
3429         $cat <<EOM
3430
3431 You may give one or more space-separated answers, or "none" if appropriate.
3432 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3433 previous run of Configure, you may specify it as well as or instead of
3434 OS-specific hints.  If hints are provided for your OS, you should use them:
3435 although Perl can probably be built without hints on many platforms, using
3436 hints often improve performance and may enable features that Configure can't
3437 set up on its own. If there are no hints that match your OS, specify "none";
3438 DO NOT give a wrong version or a wrong OS.
3439
3440 EOM
3441
3442         rp="Which of these apply, if any?"
3443         . UU/myread
3444         tans=$ans
3445         for file in $tans; do
3446                 if $test X$file = XPolicy -a -f Policy.sh; then
3447                         . Policy.sh
3448                         $cat Policy.sh >> UU/config.sh
3449                 elif $test -f $src/hints/$file.sh; then
3450                         . $src/hints/$file.sh
3451                         $cat $src/hints/$file.sh >> UU/config.sh
3452                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3453                         : nothing
3454                 else
3455                         : Give one chance to correct a possible typo.
3456                         echo "$file.sh does not exist"
3457                         dflt=$file
3458                         rp="hint to use instead?"
3459                         . UU/myread
3460                         for file in $ans; do
3461                                 if $test -f "$src/hints/$file.sh"; then
3462                                         . $src/hints/$file.sh
3463                                         $cat $src/hints/$file.sh >> UU/config.sh
3464                                 elif $test X$ans = X -o X$ans = Xnone ; then
3465                                         : nothing
3466                                 else
3467                                         echo "$file.sh does not exist -- ignored."
3468                                 fi
3469                         done
3470                 fi
3471         done
3472
3473         hint=recommended
3474         : Remember our hint file for later.
3475         if $test -f "$src/hints/$file.sh" ; then
3476                 hintfile="$file"
3477         else
3478                 hintfile=''
3479         fi
3480 fi
3481 cd UU
3482 ;;
3483 *)
3484         echo " "
3485         echo "Fetching default answers from $config_sh..." >&4
3486         tmp_n="$n"
3487         tmp_c="$c"
3488         cd ..
3489         cp $config_sh config.sh 2>/dev/null
3490         chmod +w config.sh
3491         . ./config.sh
3492         cd UU
3493         cp ../config.sh .
3494         n="$tmp_n"
3495         c="$tmp_c"
3496         hint=previous
3497         ;;
3498 esac
3499 test "$override" && . ./optdef.sh
3500
3501 : Restore computed paths
3502 for file in $loclist $trylist; do
3503         eval $file="\$_$file"
3504 done
3505
3506 cat << EOM
3507
3508 Configure uses the operating system name and version to set some defaults.
3509 The default value is probably right if the name rings a bell. Otherwise,
3510 since spelling matters for me, either accept the default or answer "none"
3511 to leave it blank.
3512
3513 EOM
3514 case "$osname" in
3515         ''|' ')
3516                 case "$hintfile" in
3517                 ''|' '|none) dflt=none ;;
3518                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3519                 esac
3520                 ;;
3521         *) dflt="$osname" ;;
3522 esac
3523 rp="Operating system name?"
3524 . ./myread
3525 case "$ans" in
3526 none)  osname='' ;;
3527 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3528 esac
3529 echo " "
3530 case "$osvers" in
3531         ''|' ')
3532                 case "$hintfile" in
3533                 ''|' '|none) dflt=none ;;
3534                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3535                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3536                         case "$dflt" in
3537                         ''|' ') dflt=none ;;
3538                         esac
3539                         ;;
3540                 esac
3541                 ;;
3542         *) dflt="$osvers" ;;
3543 esac
3544 rp="Operating system version?"
3545 . ./myread
3546 case "$ans" in
3547 none)  osvers='' ;;
3548 *) osvers="$ans" ;;
3549 esac
3550
3551
3552 . ./posthint.sh
3553
3554 : who configured the system
3555 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3556 case "$cf_by" in
3557 "")
3558         cf_by=`(logname) 2>/dev/null`
3559         case "$cf_by" in
3560         "")
3561                 cf_by=`(whoami) 2>/dev/null`
3562                 case "$cf_by" in
3563                 "") cf_by=unknown ;;
3564                 esac ;;
3565         esac ;;
3566 esac
3567
3568 : decide how portable to be.  Allow command line overrides.
3569 case "$d_portable" in
3570 "$undef") ;;
3571 *)      d_portable="$define" ;;
3572 esac
3573
3574 : set up shell script to do ~ expansion
3575 cat >filexp <<EOSS
3576 $startsh
3577 : expand filename
3578 case "\$1" in
3579  ~/*|~)
3580         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3581         ;;
3582  ~*)
3583         if $test -f /bin/csh; then
3584                 /bin/csh -f -c "glob \$1"
3585                 failed=\$?
3586                 echo ""
3587                 exit \$failed
3588         else
3589                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3590                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3591                 if $test ! -d "\$dir"; then
3592                         me=\`basename \$0\`
3593                         echo "\$me: can't locate home directory for: \$name" >&2
3594                         exit 1
3595                 fi
3596                 case "\$1" in
3597                 */*)
3598                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3599                         ;;
3600                 *)
3601                         echo \$dir
3602                         ;;
3603                 esac
3604         fi
3605         ;;
3606 *)
3607         echo \$1
3608         ;;
3609 esac
3610 EOSS
3611 chmod +x filexp
3612 $eunicefix filexp
3613
3614 : now set up to get a file name
3615 cat <<EOS >getfile
3616 $startsh
3617 EOS
3618 cat <<'EOSC' >>getfile
3619 tilde=''
3620 fullpath=''
3621 already=''
3622 skip=''
3623 none_ok=''
3624 exp_file=''
3625 nopath_ok=''
3626 orig_rp="$rp"
3627 orig_dflt="$dflt"
3628 case "$gfpth" in
3629 '') gfpth='.' ;;
3630 esac
3631
3632 case "$fn" in
3633 *\(*)
3634         : getfile will accept an answer from the comma-separated list
3635         : enclosed in parentheses even if it does not meet other criteria.
3636         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3637         fn=`echo $fn | sed 's/(.*)//'`
3638         ;;
3639 esac
3640
3641 case "$fn" in
3642 *:*)
3643         loc_file=`expr $fn : '.*:\(.*\)'`
3644         fn=`expr $fn : '\(.*\):.*'`
3645         ;;
3646 esac
3647
3648 case "$fn" in
3649 *~*) tilde=true;;
3650 esac
3651 case "$fn" in
3652 */*) fullpath=true;;
3653 esac
3654 case "$fn" in
3655 *+*) skip=true;;
3656 esac
3657 case "$fn" in
3658 *n*) none_ok=true;;
3659 esac
3660 case "$fn" in
3661 *e*) exp_file=true;;
3662 esac
3663 case "$fn" in
3664 *p*) nopath_ok=true;;
3665 esac
3666
3667 case "$fn" in
3668 *f*) type='File';;
3669 *d*) type='Directory';;
3670 *l*) type='Locate';;
3671 esac
3672
3673 what="$type"
3674 case "$what" in
3675 Locate) what='File';;
3676 esac
3677
3678 case "$exp_file" in
3679 '')
3680         case "$d_portable" in
3681         "$define") ;;
3682         *) exp_file=true;;
3683         esac
3684         ;;
3685 esac
3686
3687 cd ..
3688 while test "$type"; do
3689         redo=''
3690         rp="$orig_rp"
3691         dflt="$orig_dflt"
3692         case "$tilde" in
3693         true) rp="$rp (~name ok)";;
3694         esac
3695         . UU/myread
3696         if test -f UU/getfile.ok && \
3697                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3698         then
3699                 value="$ans"
3700                 ansexp="$ans"
3701                 break
3702         fi
3703         case "$ans" in
3704         none)
3705                 value=''
3706                 ansexp=''
3707                 case "$none_ok" in
3708                 true) type='';;
3709                 esac
3710                 ;;
3711         *)
3712                 case "$tilde" in
3713                 '') value="$ans"
3714                         ansexp="$ans";;
3715                 *)
3716                         value=`UU/filexp $ans`
3717                         case $? in
3718                         0)
3719                                 if test "$ans" != "$value"; then
3720                                         echo "(That expands to $value on this system.)"
3721                                 fi
3722                                 ;;
3723                         *) value="$ans";;
3724                         esac
3725                         ansexp="$value"
3726                         case "$exp_file" in
3727                         '') value="$ans";;
3728                         esac
3729                         ;;
3730                 esac
3731                 case "$fullpath" in
3732                 true)
3733                         case "$ansexp" in
3734                         /*) value="$ansexp" ;;
3735                         [a-zA-Z]:/*) value="$ansexp" ;;
3736                         *)
3737                                 redo=true
3738                                 case "$already" in
3739                                 true)
3740                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3741                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3742                                         ;;
3743                                 *)
3744                                 echo "Please give a full path name, starting with slash." >&4
3745                                         case "$tilde" in
3746                                         true)
3747                                 echo "Note that using ~name is ok provided it expands well." >&4
3748                                                 already=true
3749                                                 ;;
3750                                         esac
3751                                 esac
3752                                 ;;
3753                         esac
3754                         ;;
3755                 esac
3756                 case "$redo" in
3757                 '')
3758                         case "$type" in
3759                         File)
3760                                 for fp in $gfpth; do
3761                                         if test "X$fp" = X.; then
3762                                             pf="$ansexp"
3763                                         else    
3764                                             pf="$fp/$ansexp"
3765                                         fi
3766                                         if test -f "$pf"; then
3767                                                 type=''
3768                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3769                                         then
3770                                                 echo "($value is not a plain file, but that's ok.)"
3771                                                 type=''
3772                                         fi
3773                                         if test X"$type" = X; then
3774                                             value="$pf"
3775                                             break
3776                                         fi
3777                                 done
3778                                 ;;
3779                         Directory)
3780                                 for fp in $gfpth; do
3781                                         if test "X$fp" = X.; then
3782                                             dir="$ans"
3783                                             direxp="$ansexp"
3784                                         else    
3785                                             dir="$fp/$ansexp"
3786                                             direxp="$fp/$ansexp"
3787                                         fi
3788                                         if test -d "$direxp"; then
3789                                                 type=''
3790                                                 value="$dir"
3791                                                 break
3792                                         fi
3793                                 done
3794                                 ;;
3795                         Locate)
3796                                 if test -d "$ansexp"; then
3797                                         echo "(Looking for $loc_file in directory $value.)"
3798                                         value="$value/$loc_file"
3799                                         ansexp="$ansexp/$loc_file"
3800                                 fi
3801                                 if test -f "$ansexp"; then
3802                                         type=''
3803                                 fi
3804                                 case "$nopath_ok" in
3805                                 true)   case "$value" in
3806                                         */*) ;;
3807                                         *)      echo "Assuming $value will be in people's path."
3808                                                 type=''
3809                                                 ;;
3810                                         esac
3811                                         ;;
3812                                 esac
3813                                 ;;
3814                         esac
3815
3816                         case "$skip" in
3817                         true) type='';
3818                         esac
3819
3820                         case "$type" in
3821                         '') ;;
3822                         *)
3823                                 if test "$fastread" = yes; then
3824                                         dflt=y
3825                                 else
3826                                         dflt=n
3827                                 fi
3828                                 rp="$what $value doesn't exist.  Use that name anyway?"
3829                                 . UU/myread
3830                                 dflt=''
3831                                 case "$ans" in
3832                                 y*) type='';;
3833                                 *) echo " ";;
3834                                 esac
3835                                 ;;
3836                         esac
3837                         ;;
3838                 esac
3839                 ;;
3840         esac
3841 done
3842 cd UU
3843 ans="$value"
3844 rp="$orig_rp"
3845 dflt="$orig_dflt"
3846 rm -f getfile.ok
3847 test "X$gfpthkeep" != Xy && gfpth=""
3848 EOSC
3849
3850 : determine root of directory hierarchy where package will be installed.
3851 case "$prefix" in
3852 '')
3853         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3854         ;;
3855 *?/)
3856         dflt=`echo "$prefix" | sed 's/.$//'`
3857         ;;
3858 *)
3859         dflt="$prefix"
3860         ;;
3861 esac
3862 $cat <<EOM
3863
3864 By default, $package will be installed in $dflt/bin, manual pages
3865 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3866 installation directories. Typically this is something like /usr/local.
3867 If you wish to have binaries under /usr/bin but other parts of the
3868 installation under /usr/local, that's ok: you will be prompted
3869 separately for each of the installation directories, the prefix being
3870 only used to set the defaults.
3871
3872 EOM
3873 fn=d~
3874 rp='Installation prefix to use?'
3875 . ./getfile
3876 oldprefix=''
3877 case "$prefix" in
3878 '') ;;
3879 *)
3880         case "$ans" in
3881         "$prefix") ;;
3882         *) oldprefix="$prefix";;
3883         esac
3884         ;;
3885 esac
3886 prefix="$ans"
3887 prefixexp="$ansexp"
3888
3889 case "$afsroot" in
3890 '')     afsroot=/afs ;;
3891 *)      afsroot=$afsroot ;;
3892 esac
3893
3894 : is AFS running?
3895 echo " "
3896 case "$afs" in
3897 $define|true)   afs=true ;;
3898 $undef|false)   afs=false ;;
3899 *)      if test -d $afsroot; then
3900                 afs=true
3901         else
3902                 afs=false
3903         fi
3904         ;;
3905 esac
3906 if $afs; then
3907         echo "AFS may be running... I'll be extra cautious then..." >&4
3908 else
3909         echo "AFS does not seem to be running..." >&4
3910 fi
3911
3912 : determine installation prefix for where package is to be installed.
3913 if $afs; then 
3914 $cat <<EOM
3915
3916 Since you are running AFS, I need to distinguish the directory in which
3917 files will reside from the directory in which they are installed (and from
3918 which they are presumably copied to the former directory by occult means).
3919
3920 EOM
3921         case "$installprefix" in
3922         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3923         *) dflt="$installprefix";;
3924         esac
3925 else
3926 $cat <<EOM
3927
3928 In some special cases, particularly when building $package for distribution,
3929 it is convenient to distinguish the directory in which files should be
3930 installed from the directory ($prefix) in which they will
3931 eventually reside.  For most users, these two directories are the same.
3932
3933 EOM
3934         case "$installprefix" in
3935         '') dflt=$prefix ;;
3936         *) dflt=$installprefix;;
3937         esac
3938 fi
3939 fn=d~
3940 rp='What installation prefix should I use for installing files?'
3941 . ./getfile
3942 installprefix="$ans"
3943 installprefixexp="$ansexp"
3944
3945 : Perform the prefixexp/installprefixexp correction if necessary
3946 cat <<EOS >installprefix
3947 $startsh
3948 EOS
3949 cat <<'EOSC' >>installprefix
3950 : Change installation prefix, if necessary.
3951 if $test X"$prefix" != X"$installprefix"; then
3952     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3953 else
3954     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3955 fi
3956 EOSC
3957 chmod +x installprefix
3958 $eunicefix installprefix
3959
3960 : Set variables such as privlib and privlibexp from the output of ./getfile
3961 : performing the prefixexp/installprefixexp correction if necessary.
3962 cat <<EOS >setprefixvar
3963 $startsh
3964 EOS
3965 cat <<'EOSC' >>setprefixvar
3966 eval "${prefixvar}=\"\$ans\""
3967 eval "${prefixvar}exp=\"\$ansexp\""
3968 . ./installprefix
3969 EOSC
3970 chmod +x setprefixvar
3971 $eunicefix setprefixvar
3972
3973 : set up the script used to warn in case of inconsistency
3974 cat <<EOS >whoa
3975 $startsh
3976 EOS
3977 cat <<'EOSC' >>whoa
3978 dflt=y
3979 case "$hint" in
3980     recommended)
3981         case "$hintfile" in
3982         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3983                 ;;
3984         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
3985                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
3986                 ;;
3987         esac
3988         ;;
3989     *)  echo " "
3990         echo "*** WHOA THERE!!! ***" >&4
3991         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3992         ;;
3993 esac
3994 rp="    Keep the $hint value?"
3995 . ./myread
3996 case "$ans" in
3997 y) td=$was; tu=$was;;
3998 esac
3999 EOSC
4000
4001 : function used to set $1 to $val
4002 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4003 case "$val$was" in
4004 $define$undef) . ./whoa; eval "$var=\$td";;
4005 $undef$define) . ./whoa; eval "$var=\$tu";;
4006 *) eval "$var=$val";;
4007 esac'
4008
4009 case "$usesocks" in
4010 $define|true|[yY]*)     dflt='y';;
4011 *) dflt='n';;
4012 esac
4013 cat <<EOM
4014
4015 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4016 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4017 to use the PerlIO abstraction layer, this will be implicitly selected.
4018
4019 If this doesn't make any sense to you, just accept the default '$dflt'.
4020 EOM
4021 rp='Build Perl for SOCKS?'
4022 . ./myread
4023 case "$ans" in
4024 y|Y)    val="$define" ;;     
4025 *)      val="$undef" ;;
4026 esac
4027 set usesocks
4028 eval $setvar
4029
4030 case "$usesocks" in
4031 $define|true|[yY]*) useperlio="$define";;
4032 esac
4033
4034 case "$useperlio" in
4035 $define|true|[yY]*|'')  dflt='y';;
4036 *) dflt='n';;
4037 esac
4038 cat <<EOM
4039
4040 Previous version of $package used the standard IO mechanisms as
4041 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4042 alternate IO mechanisms via the PerlIO abstraction layer, but the
4043 stdio mechanism is still available if needed.  The abstraction layer
4044 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4045 Using PerlIO with sfio may cause problems with some extension modules.
4046
4047 If this doesn't make any sense to you, just accept the default '$dflt'.
4048 EOM
4049 rp='Use the PerlIO abstraction layer?'
4050 . ./myread
4051 case "$ans" in
4052 y|Y) 
4053         val="$define"
4054         ;;
4055 *)      
4056         echo "Ok, doing things the stdio way."
4057         val="$undef"
4058         ;;
4059 esac
4060 set useperlio
4061 eval $setvar 
4062
4063 case "$usesocks" in
4064 $define|true|[yY]*)
4065         case "$useperlio" in
4066         $define|true|[yY]*) ;;
4067         *)      cat >&4 <<EOM
4068
4069 You are using the SOCKS proxy protocol library which means that you
4070 should also use the PerlIO layer.  You may be headed for trouble.
4071
4072 EOM
4073                 ;;
4074         esac
4075         ;;
4076 esac
4077
4078         
4079 : get the patchlevel
4080 echo " "
4081 echo "Getting the current patchlevel..." >&4
4082 if $test -r $rsrc/patchlevel.h;then
4083         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4084         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4085         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4086         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4087         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4088         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4089         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
4090 else
4091         revision=0
4092         patchlevel=0
4093         subversion=0
4094         api_revision=0
4095         api_version=0
4096         api_subversion=0
4097         perl_patchlevel=0
4098         $echo "(You do not have patchlevel.h.  Eek.)"
4099 fi
4100 if $test -r $rsrc/.patch ; then
4101         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4102                 perl_patchlevel=`cat $rsrc/.patch`
4103         fi
4104 fi
4105 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4106 version_patchlevel_string="version $patchlevel subversion $subversion"
4107 case "$perl_patchlevel" in
4108 0|'') ;;
4109 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4110 esac
4111
4112 $echo "(You have $package $version_patchlevel_string.)"
4113
4114 case "$osname" in
4115 dos|vms)
4116         : XXX Should be a Configure test for double-dots in filenames.
4117         version=`echo $revision $patchlevel $subversion | \
4118                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4119         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4120                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4121         ;;
4122 *)
4123         version=`echo $revision $patchlevel $subversion | \
4124                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4125         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4126                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4127         ;;
4128 esac
4129 : Special case the 5.005_xx maintenance series, which used 5.005
4130 : without any subversion label as a subdirectory in $sitelib
4131 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4132         api_versionstring='5.005'
4133 fi
4134
4135 case "$usethreads" in
4136 $define|true|[yY]*)     dflt='y';;
4137 *)     # Catch case where user specified ithreads or 5005threads but
4138        # forgot -Dusethreads (A.D. 4/2002)
4139        case "$useithreads$use5005threads" in
4140        *$define*)      
4141                 case "$useperlio" in
4142                 "$define")      dflt='y' ;;
4143                 *)              dflt='n' ;;
4144                 esac
4145                 ;;
4146        *)       dflt='n';;
4147        esac
4148        ;;
4149 esac
4150 cat <<EOM
4151
4152 Perl can be built to take advantage of threads on some systems.
4153 To do so, Configure can be run with -Dusethreads.
4154
4155 Note that Perl built with threading support runs slightly slower
4156 and uses more memory than plain Perl. The current implementation
4157 is believed to be stable, but it is fairly new, and so should be
4158 treated with caution.
4159
4160 If this doesn't make any sense to you, just accept the default '$dflt'.
4161 EOM
4162 rp='Build a threading Perl?'
4163 . ./myread
4164 case "$ans" in
4165 y|Y)    val="$define" ;;
4166 *)      val="$undef" ;;
4167 esac
4168 set usethreads
4169 eval $setvar
4170
4171 if $test $patchlevel -lt 9; then
4172     case "$usethreads" in
4173     $define)
4174         $cat <<EOM
4175
4176 Since release 5.6, Perl has had two different threading implementations,
4177 the newer interpreter-based version (ithreads) with one interpreter per
4178 thread, and the older 5.005 version (5005threads).
4179 The 5005threads version is effectively unmaintained and will probably be
4180 removed in Perl 5.10, so there should be no need to build a Perl using it
4181 unless needed for backwards compatibility with some existing 5.005threads
4182 code.
4183
4184 EOM
4185         : Default to ithreads unless overridden on command line or with
4186         : old config.sh
4187         dflt='y'
4188         case "$use5005threads" in
4189                 $define|true|[yY]*) dflt='n';;
4190         esac
4191         case "$useithreads" in
4192                 $undef|false|[nN]*) dflt='n';;
4193         esac
4194         rp='Use the newer interpreter-based ithreads?'
4195         . ./myread
4196         case "$ans" in
4197         y|Y)    val="$define" ;;
4198         *)      val="$undef" ;;
4199         esac
4200         set useithreads
4201         eval $setvar
4202         : Now set use5005threads to the opposite value.
4203         case "$useithreads" in
4204         $define) val="$undef" ;;
4205         *) val="$define" ;;
4206         esac
4207         set use5005threads
4208         eval $setvar
4209         ;;
4210     *)
4211         useithreads="$undef"
4212         use5005threads="$undef"
4213         ;;
4214     esac
4215
4216     case "$useithreads$use5005threads" in
4217     "$define$define")
4218         $cat >&4 <<EOM
4219
4220 You cannot have both the ithreads and the 5.005 threads enabled
4221 at the same time.  Disabling the 5.005 threads since they are
4222 much less stable than the ithreads.
4223
4224 EOM
4225         use5005threads="$undef"
4226         ;;
4227     esac
4228
4229 else
4230 : perl-5.9.x and later
4231
4232     if test X"$usethreads" = "X$define"; then
4233         case "$use5005threads" in
4234             $define|true|[yY]*)
4235                 $cat >&4 <<EOM
4236
4237 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4238
4239 EOM
4240             ;;
4241         esac
4242     fi
4243
4244     use5005threads="$undef"
4245     useithreads="$usethreads"
4246 fi
4247
4248 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4249         cat >&4 <<EOF
4250 ***
4251 *** To build with ithreads you must also use the PerlIO layer.
4252 *** Cannot continue, aborting.
4253 ***
4254 EOF
4255         exit 1
4256 fi
4257
4258 case "$d_oldpthreads" in
4259 '')     : Configure tests would be welcome here.  For now, assume undef.
4260         val="$undef" ;;
4261 *)      val="$d_oldpthreads" ;;
4262 esac
4263 set d_oldpthreads
4264 eval $setvar
4265
4266
4267 : Look for a hint-file generated 'call-back-unit'.  If the
4268 : user has specified that a threading perl is to be built,
4269 : we may need to set or change some other defaults.
4270 if $test -f usethreads.cbu; then
4271     echo "Your platform has some specific hints regarding threaded builds, using them..."
4272     . ./usethreads.cbu
4273 else
4274     case "$usethreads" in
4275         "$define"|true|[yY]*)
4276                 $cat <<EOM
4277 (Your platform does not have any specific hints for threaded builds.
4278  Assuming POSIX threads, then.)
4279 EOM
4280         ;;
4281     esac
4282 fi
4283
4284 cat <<EOM
4285
4286 Perl can be built so that multiple Perl interpreters can coexist
4287 within the same Perl executable.
4288 EOM
4289
4290 case "$useithreads" in
4291 $define)
4292         cat <<EOM
4293 This multiple interpreter support is required for interpreter-based threads.
4294 EOM
4295         val="$define"
4296         ;;
4297 *)      case "$usemultiplicity" in
4298         $define|true|[yY]*)     dflt='y';;
4299         *) dflt='n';;
4300         esac
4301         echo " "
4302         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4303         rp='Build Perl for multiplicity?'
4304         . ./myread
4305         case "$ans" in
4306         y|Y)    val="$define" ;;
4307         *)      val="$undef" ;;
4308         esac
4309         ;;
4310 esac
4311 set usemultiplicity
4312 eval $setvar
4313
4314
4315 case "$usemorebits" in
4316 "$define"|true|[yY]*)
4317         use64bitint="$define"
4318         uselongdouble="$define"
4319         usemorebits="$define"
4320         ;;
4321 *)      usemorebits="$undef"
4322         ;;
4323 esac
4324
4325 : make some quick guesses about what we are up against
4326 echo " "
4327 $echo $n "Hmm...  $c"
4328 echo exit 1 >bsd
4329 echo exit 1 >usg
4330 echo exit 1 >v7
4331 echo exit 1 >osf1
4332 echo exit 1 >eunice
4333 echo exit 1 >xenix
4334 echo exit 1 >venix
4335 echo exit 1 >os2
4336 d_bsd="$undef"
4337 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4338 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4339 then
4340         echo "Looks kind of like an OSF/1 system, but we'll see..."
4341         echo exit 0 >osf1
4342 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4343         xxx=`./loc addbib blurfl $pth`
4344         if $test -f $xxx; then
4345         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4346                 echo exit 0 >bsd
4347                 echo exit 0 >usg
4348         else
4349                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4350                         echo "Looks kind of like an extended USG system, but we'll see..."
4351                 else
4352                         echo "Looks kind of like a USG system, but we'll see..."
4353                 fi
4354                 echo exit 0 >usg
4355         fi
4356 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4357         echo "Looks kind of like a BSD system, but we'll see..."
4358         d_bsd="$define"
4359         echo exit 0 >bsd
4360 else
4361         echo "Looks kind of like a Version 7 system, but we'll see..."
4362         echo exit 0 >v7
4363 fi
4364 case "$eunicefix" in
4365 *unixtovms*)
4366         $cat <<'EOI'
4367 There is, however, a strange, musty smell in the air that reminds me of
4368 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4369 EOI
4370         echo exit 0 >eunice
4371         d_eunice="$define"
4372 : it so happens the Eunice I know will not run shell scripts in Unix format
4373         ;;
4374 *)
4375         echo " "
4376         echo "Congratulations.  You aren't running Eunice."
4377         d_eunice="$undef"
4378         ;;
4379 esac
4380 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4381 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4382 : semicolon as a patch separator
4383 case "$p_" in
4384 :) ;;
4385 *)
4386         $cat <<'EOI'
4387 I have the feeling something is not exactly right, however...don't tell me...
4388 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4389 (Or you may be running DOS with DJGPP.)
4390 EOI
4391         echo exit 0 >os2
4392         ;;
4393 esac
4394 if test -f /xenix; then
4395         echo "Actually, this looks more like a XENIX system..."
4396         echo exit 0 >xenix
4397         d_xenix="$define"
4398 else
4399         echo " "
4400         echo "It's not Xenix..."
4401         d_xenix="$undef"
4402 fi
4403 chmod +x xenix
4404 $eunicefix xenix
4405 if test -f /venix; then
4406         echo "Actually, this looks more like a VENIX system..."
4407         echo exit 0 >venix
4408 else
4409         echo " "
4410         if ./xenix; then
4411                 : null
4412         else
4413                 echo "Nor is it Venix..."
4414         fi
4415 fi
4416 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4417 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4418 $rm -f foo
4419
4420 case "$cc" in
4421 '') dflt=cc;;
4422 *) dflt="$cc";;
4423 esac
4424 rp="Use which C compiler?"
4425 . ./myread
4426 cc="$ans"
4427
4428 : See if they have not cc but they do have gcc
4429 . ./trygcc
4430 : Look for a hint-file generated 'call-back-unit'.  Now that the
4431 : user has specified the compiler, we may need to set or change some
4432 : other defaults.
4433 if $test -f cc.cbu; then
4434     . ./cc.cbu
4435 fi
4436 . ./checkcc
4437
4438 echo " "
4439 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4440 $cat >try.c <<EOM
4441 #include <stdio.h>
4442 int main() {
4443 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4444 #ifdef __VERSION__
4445         printf("%s\n", __VERSION__);
4446 #else
4447         printf("%s\n", "1");
4448 #endif
4449 #endif
4450         return(0);
4451 }
4452 EOM
4453 if $cc -o try $ccflags $ldflags try.c; then
4454         gccversion=`$run ./try`
4455         case "$gccversion" in
4456         '') echo "You are not using GNU cc." ;;
4457         *)  echo "You are using GNU cc $gccversion."
4458             ccname=gcc
4459             ;;
4460         esac
4461 else
4462         echo " "
4463         echo "*** WHOA THERE!!! ***" >&4
4464         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4465         case "$knowitall" in
4466         '')
4467         echo "    You'd better start hunting for one and let me know about it." >&4
4468                 exit 1
4469                 ;;
4470         esac
4471 fi
4472 $rm -f try try.*
4473 case "$gccversion" in
4474 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4475 esac
4476 case "$gccversion" in
4477 '') gccosandvers='' ;;
4478 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4479    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4480    gccshortvers=''
4481    case "$gccosandvers" in
4482    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4483    $osname$osvers) ;; # looking good
4484    $osname*) cat <<EOM >&4
4485
4486 *** WHOA THERE!!! ***
4487
4488     Your gcc has not been compiled for the exact release of
4489     your operating system ($gccosandvers versus $osname$osvers).
4490
4491     In general it is a good idea to keep gcc synchronized with
4492     the operating system because otherwise serious problems
4493     may ensue when trying to compile software, like Perl.
4494
4495     I'm trying to be optimistic here, though, and will continue.
4496     If later during the configuration and build icky compilation
4497     problems appear (headerfile conflicts being the most common
4498     manifestation), I suggest reinstalling the gcc to match
4499     your operating system release.
4500
4501 EOM
4502       ;;
4503    *) gccosandvers='' ;; # failed to parse, better be silent
4504    esac
4505    ;;
4506 esac
4507 case "$ccname" in
4508 '') ccname="$cc" ;;
4509 esac
4510
4511 # gcc 3.* complain about adding -Idirectories that they already know about,
4512 # so we will take those off from locincpth.
4513 case "$gccversion" in
4514 3*)
4515     echo "main(){}">try.c
4516     for incdir in $locincpth; do
4517        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4518              grep '^c[cp]p*[01]: warning: changing search order '`
4519        if test "X$warn" != X; then
4520            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4521        fi
4522     done
4523     $rm -f try try.*
4524 esac
4525
4526 : What should the include directory be ?
4527 echo " "
4528 $echo $n "Hmm...  $c"
4529 dflt='/usr/include'
4530 incpath=''
4531 mips_type=''
4532 if $test -f /bin/mips && /bin/mips; then
4533         echo "Looks like a MIPS system..."
4534         $cat >usr.c <<'EOCP'
4535 #ifdef SYSTYPE_BSD43
4536 /bsd43
4537 #endif
4538 EOCP
4539         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4540                 dflt='/bsd43/usr/include'
4541                 incpath='/bsd43'
4542                 mips_type='BSD 4.3'
4543         else
4544                 mips_type='System V'
4545         fi
4546         $rm -f usr.c usr.out
4547         echo "and you're compiling with the $mips_type compiler and libraries."
4548         xxx_prompt=y
4549         echo "exit 0" >mips
4550 else
4551         echo "Doesn't look like a MIPS system."
4552         xxx_prompt=n
4553         echo "exit 1" >mips
4554 fi
4555 chmod +x mips
4556 $eunicefix mips
4557 case "$usrinc" in
4558 '') ;;
4559 *) dflt="$usrinc";;
4560 esac
4561 case "$xxx_prompt" in
4562 y)      fn=d/
4563         echo " "
4564         rp='Where are the include files you want to use?'
4565         . ./getfile
4566         usrinc="$ans"
4567         ;;
4568 *)      usrinc="$dflt"
4569         ;;
4570 esac
4571
4572 : see how we invoke the C preprocessor
4573 echo " "
4574 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4575 cat <<'EOT' >testcpp.c
4576 #define ABC abc
4577 #define XYZ xyz
4578 ABC.XYZ
4579 EOT
4580 cd ..
4581 if test ! -f cppstdin; then
4582         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4583                 # AIX cc -E doesn't show the absolute headerfile
4584                 # locations but we'll cheat by using the -M flag.
4585                 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
4586         else
4587                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4588         fi
4589 else
4590         echo "Keeping your $hint cppstdin wrapper."
4591 fi
4592 chmod 755 cppstdin
4593 wrapper=`pwd`/cppstdin
4594 ok='false'
4595 cd UU
4596
4597 if $test "X$cppstdin" != "X" && \
4598         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4599         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4600 then
4601         echo "You used to use $cppstdin $cppminus so we'll use that again."
4602         case "$cpprun" in
4603         '') echo "But let's see if we can live without a wrapper..." ;;
4604         *)
4605                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4606                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4607                 then
4608                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4609                         ok='true'
4610                 else
4611                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4612                 fi
4613                 ;;
4614         esac
4615 else
4616         case "$cppstdin" in
4617         '') ;;
4618         *)
4619                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4620                 ;;
4621         esac
4622 fi
4623
4624 if $ok; then
4625         : nothing
4626 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4627         $cc -E <testcpp.c >testcpp.out 2>&1; \
4628         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4629         echo "Yup, it does."
4630         x_cpp="$cc -E"
4631         x_minus='';
4632 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4633         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4634         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4635         echo "Yup, it does."
4636         x_cpp="$cc -E"
4637         x_minus='-';
4638 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4639         $cc -P <testcpp.c >testcpp.out 2>&1; \
4640         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4641         echo "Yipee, that works!"
4642         x_cpp="$cc -P"
4643         x_minus='';
4644 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4645         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4646         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4647         echo "At long last!"
4648         x_cpp="$cc -P"
4649         x_minus='-';
4650 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4651         $cpp <testcpp.c >testcpp.out 2>&1; \
4652         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4653         echo "It works!"
4654         x_cpp="$cpp"
4655         x_minus='';
4656 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4657         $cpp - <testcpp.c >testcpp.out 2>&1; \
4658         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4659         echo "Hooray, it works!  I was beginning to wonder."
4660         x_cpp="$cpp"
4661         x_minus='-';
4662 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4663         $wrapper <testcpp.c >testcpp.out 2>&1; \
4664         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4665         x_cpp="$wrapper"
4666         x_minus=''
4667         echo "Eureka!"
4668 else
4669         dflt=''
4670         rp="No dice.  I can't find a C preprocessor.  Name one:"
4671         . ./myread
4672         x_cpp="$ans"
4673         x_minus=''
4674         $x_cpp <testcpp.c >testcpp.out 2>&1
4675         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4676                 echo "OK, that will do." >&4
4677         else
4678 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4679                 exit 1
4680         fi
4681 fi
4682
4683 case "$ok" in
4684 false)
4685         cppstdin="$x_cpp"
4686         cppminus="$x_minus"
4687         cpprun="$x_cpp"
4688         cpplast="$x_minus"
4689         set X $x_cpp
4690         shift
4691         case "$1" in
4692         "$cpp")
4693                 echo "Perhaps can we force $cc -E using a wrapper..."
4694                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4695                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4696                 then
4697                         echo "Yup, we can."
4698                         cppstdin="$wrapper"
4699                         cppminus='';
4700                 else
4701                         echo "Nope, we'll have to live without it..."
4702                 fi
4703                 ;;
4704         esac
4705         case "$cpprun" in
4706         "$wrapper")
4707                 cpprun=''
4708                 cpplast=''
4709                 ;;
4710         esac
4711         ;;
4712 esac
4713
4714 case "$cppstdin" in
4715 "$wrapper"|'cppstdin') ;;
4716 *) $rm -f $wrapper;;
4717 esac
4718 $rm -f testcpp.c testcpp.out
4719
4720 : Set private lib path
4721 case "$plibpth" in
4722 '') if ./mips; then
4723                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4724         fi;;
4725 esac
4726 case "$libpth" in
4727 ' ') dlist='';;
4728 '') dlist="$loclibpth $plibpth $glibpth";;
4729 *) dlist="$libpth";;
4730 esac
4731
4732 : Now check and see which directories actually exist, avoiding duplicates
4733 libpth=''
4734 for xxx in $dlist
4735 do
4736     if $test -d $xxx; then
4737                 case " $libpth " in
4738                 *" $xxx "*) ;;
4739                 *) libpth="$libpth $xxx";;
4740                 esac
4741     fi
4742 done
4743 $cat <<'EOM'
4744
4745 Some systems have incompatible or broken versions of libraries.  Among
4746 the directories listed in the question below, please remove any you
4747 know not to be holding relevant libraries, and add any that are needed.
4748 Say "none" for none.
4749
4750 EOM
4751 case "$libpth" in
4752 '') dflt='none';;
4753 *)
4754         set X $libpth
4755         shift
4756         dflt=${1+"$@"}
4757         ;;
4758 esac
4759 rp="Directories to use for library searches?"
4760 . ./myread
4761 case "$ans" in
4762 none) libpth=' ';;
4763 *) libpth="$ans";;
4764 esac
4765
4766 : compute shared library extension
4767 case "$so" in
4768 '')
4769         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4770                 dflt='sl'
4771         else
4772                 dflt='so'
4773         fi
4774         ;;
4775 *) dflt="$so";;
4776 esac
4777 $cat <<EOM
4778
4779 On some systems, shared libraries may be available.  Answer 'none' if
4780 you want to suppress searching of shared libraries for the remainder
4781 of this configuration.
4782
4783 EOM
4784 rp='What is the file extension used for shared libraries?'
4785 . ./myread
4786 so="$ans"
4787
4788 : Define several unixisms.
4789 : Hints files or command line option can be used to override them.
4790 : The convoluted testing is in case hints files set either the old
4791 : or the new name.
4792 case "$_exe" in
4793 '')     case "$exe_ext" in
4794         '')     ;;
4795         *)      _exe="$exe_ext" ;;
4796         esac
4797         ;;
4798 esac
4799 case "$_a" in
4800 '')     case "$lib_ext" in
4801     '') _a='.a';;
4802         *)      _a="$lib_ext" ;;
4803         esac
4804         ;;
4805 esac
4806 case "$_o" in
4807 '') case "$obj_ext" in
4808         '')     _o='.o';;
4809         *)      _o="$obj_ext";;
4810         esac
4811         ;;
4812 esac
4813 case "$p_" in
4814 '') case "$path_sep" in
4815         '')     p_=':';;
4816         *)      p_="$path_sep";;
4817         esac
4818         ;;
4819 esac
4820 exe_ext=$_exe
4821 lib_ext=$_a
4822 obj_ext=$_o
4823 path_sep=$p_
4824
4825 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4826
4827 : Which makefile gets called first.  This is used by make depend.
4828 case "$firstmakefile" in
4829 '') firstmakefile='makefile';;
4830 esac
4831
4832 case "$ccflags" in
4833 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4834 esac
4835
4836 case "$uselongdouble" in
4837 $define|true|[yY]*)     dflt='y';;
4838 *) dflt='n';;
4839 esac
4840 cat <<EOM
4841
4842 Perl can be built to take advantage of long doubles which
4843 (if available) may give more accuracy and range for floating point numbers.
4844
4845 If this doesn't make any sense to you, just accept the default '$dflt'.
4846 EOM
4847 rp='Try to use long doubles if available?'
4848 . ./myread
4849 case "$ans" in
4850 y|Y)    val="$define"   ;;
4851 *)      val="$undef"    ;;
4852 esac
4853 set uselongdouble
4854 eval $setvar
4855
4856 case "$uselongdouble" in
4857 true|[yY]*) uselongdouble="$define" ;;
4858 esac
4859
4860 : Look for a hint-file generated 'call-back-unit'.  If the
4861 : user has specified that long doubles should be used,
4862 : we may need to set or change some other defaults.
4863 if $test -f uselongdouble.cbu; then
4864     echo "Your platform has some specific hints regarding long doubles, using them..."
4865     . ./uselongdouble.cbu
4866 else
4867     case "$uselongdouble" in
4868         $define)
4869                 $cat <<EOM
4870 (Your platform does not have any specific hints for long doubles.)
4871 EOM
4872         ;;
4873     esac
4874 fi
4875
4876 : Looking for optional libraries
4877 echo " "
4878 echo "Checking for optional libraries..." >&4
4879 case "$libs" in
4880 ' '|'') dflt='';;
4881 *) dflt="$libs";;
4882 esac
4883 case "$libswanted" in
4884 '') libswanted='c_s';;
4885 esac
4886 case "$usesocks" in
4887 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4888 esac
4889 libsfound=''
4890 libsfiles=''
4891 libsdirs=''
4892 libspath=''
4893 for thisdir in $libpth $xlibpth; do
4894   test -d $thisdir && libspath="$libspath $thisdir"
4895 done
4896 for thislib in $libswanted; do
4897         for thisdir in $libspath; do
4898             xxx=''
4899             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4900                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4901                 $test -f "$xxx" && eval $libscheck
4902                 $test -f "$xxx" && libstyle=shared
4903             fi
4904             if test ! -f "$xxx"; then
4905                 xxx=$thisdir/lib$thislib.$so
4906                 $test -f "$xxx" && eval $libscheck
4907                 $test -f "$xxx" && libstyle=shared
4908             fi  
4909             if test ! -f "$xxx"; then
4910                 xxx=$thisdir/lib$thislib$_a
4911                 $test -f "$xxx" && eval $libscheck
4912                 $test -f "$xxx" && libstyle=static
4913             fi
4914             if test ! -f "$xxx"; then
4915                 xxx=$thisdir/$thislib$_a
4916                 $test -f "$xxx" && eval $libscheck
4917                 $test -f "$xxx" && libstyle=static
4918             fi
4919             if test ! -f "$xxx"; then
4920                 xxx=$thisdir/lib${thislib}_s$_a
4921                 $test -f "$xxx" && eval $libscheck
4922                 $test -f "$xxx" && libstyle=static
4923                 $test -f "$xxx" && thislib=${thislib}_s
4924             fi
4925             if test ! -f "$xxx"; then
4926                 xxx=$thisdir/Slib$thislib$_a
4927                 $test -f "$xxx" && eval $libscheck
4928                 $test -f "$xxx" && libstyle=static
4929             fi
4930             if $test -f "$xxx"; then
4931                 case "$libstyle" in
4932                 shared) echo "Found -l$thislib (shared)." ;;
4933                 static) echo "Found -l$thislib." ;;
4934                 *)      echo "Found -l$thislib ($libstyle)." ;;
4935                 esac
4936                 case " $dflt " in
4937                 *"-l$thislib "*);;
4938                 *) dflt="$dflt -l$thislib"
4939                    libsfound="$libsfound $xxx"
4940                    yyy=`basename $xxx`
4941                    libsfiles="$libsfiles $yyy"
4942                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4943                    case " $libsdirs " in
4944                    *" $yyy "*) ;;
4945                    *) libsdirs="$libsdirs $yyy" ;;
4946                    esac
4947                    ;;
4948                 esac
4949                 break
4950             fi  
4951         done
4952         if $test ! -f "$xxx"; then
4953             echo "No -l$thislib."
4954         fi
4955 done
4956 set X $dflt
4957 shift
4958 dflt="$*"
4959 case "$libs" in
4960 '') dflt="$dflt";;
4961 *) dflt="$libs";;
4962 esac
4963 case "$dflt" in
4964 ' '|'') dflt='none';;
4965 esac
4966
4967 $cat <<EOM
4968
4969 In order to compile $package on your machine, a number of libraries
4970 are usually needed.  Include any other special libraries here as well.
4971 Say "none" for none.  The default list is almost always right.
4972 EOM
4973
4974 echo " "
4975 rp="What libraries to use?"
4976 . ./myread
4977 case "$ans" in
4978 none) libs=' ';;
4979 *) libs="$ans";;
4980 esac
4981
4982 : determine optimization, if desired, or use for debug flag also
4983 case "$optimize" in
4984 ' '|$undef) dflt='none';;
4985 '') dflt='-O';;
4986 *) dflt="$optimize";;
4987 esac
4988 $cat <<EOH
4989
4990 By default, $package compiles with the -O flag to use the optimizer.
4991 Alternately, you might want to use the symbolic debugger, which uses
4992 the -g flag (on traditional Unix systems).  Either flag can be
4993 specified here.  To use neither flag, specify the word "none".
4994
4995 EOH
4996 rp="What optimizer/debugger flag should be used?"
4997 . ./myread
4998 optimize="$ans"
4999 case "$optimize" in
5000 'none') optimize=" ";;
5001 esac
5002
5003 : Check what DEBUGGING is required from the command line
5004 : -DEBUGGING      or -DDEBUGGING or
5005 : -DEBUGGING=both                       = -g + -DDEBUGGING
5006 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5007 : -DEBUGGING=none or -UDEBUGGING        =
5008 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5009 case "$EBUGGING" in
5010 '')     ;;
5011 *)      DEBUGGING=$EBUGGING ;;
5012 esac
5013
5014 case "$DEBUGGING" in
5015 -g|both|$define)
5016     case "$optimize" in
5017         *-g*) ;;
5018         *)    optimize="$optimize -g" ;;
5019     esac ;;
5020 none|$undef)
5021     case "$optimize" in
5022         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5023                 shift
5024                 optimize="$*"
5025                 ;;
5026     esac ;;
5027 esac
5028
5029 dflt=''
5030 case "$DEBUGGING" in
5031 both|$define) dflt='-DDEBUGGING'
5032 esac
5033
5034 : We will not override a previous value, but we might want to
5035 : augment a hint file
5036 case "$hint" in
5037 default|recommended)
5038         case "$gccversion" in
5039         1*) dflt="$dflt -fpcc-struct-return" ;;
5040         esac
5041         case "$optimize:$DEBUGGING" in
5042         *-g*:old) dflt="$dflt -DDEBUGGING";;
5043         esac
5044         case "$gccversion" in
5045         2*) if test -d /etc/conf/kconfig.d &&
5046                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5047                 then
5048                         # Interactive Systems (ISC) POSIX mode.
5049                         dflt="$dflt -posix"
5050                 fi
5051                 ;;
5052         esac
5053         case "$gccversion" in
5054         1*) ;;
5055         2.[0-8]*) ;;
5056         ?*)     echo " "
5057                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
5058                 echo 'int main(void) { return 0; }' > gcctest.c
5059                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
5060                         echo "Yes, it does." 2>&1
5061                         case "$ccflags" in
5062                         *strict-aliasing*)
5063                                 echo "Leaving current flags $ccflags alone." 2>&1
5064                                 ;;
5065                         *) dflt="$dflt -fno-strict-aliasing" ;;
5066                         esac
5067                 else
5068                         echo "Nope, it doesn't, but that's ok." 2>&1
5069                 fi
5070                 ;;
5071         esac
5072         # For gcc, adding -pipe speeds up compilations for some, but apparently
5073         # some assemblers can't read from stdin.  (It also slows down compilations
5074         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5075         case "$gccversion" in
5076         ?*)     echo " "
5077                 echo "Checking if your compiler accepts -pipe" 2>&1
5078                 echo 'int main(void) { return 0; }' > gcctest.c
5079                 if $cc -pipe -o gcctest gcctest.c; then
5080                         echo "Yes, it does." 2>&1
5081                         case "$ccflags" in
5082                         *-pipe*)
5083                                 echo "Leaving current flags $ccflags alone." 2>&1
5084                                 ;;
5085                         *) dflt="$dflt -pipe" ;;
5086                         esac
5087                 else
5088                         echo "Nope, it doesn't, but that's ok." 2>&1
5089                 fi
5090                 ;;
5091         esac
5092         ;;
5093 esac
5094
5095 case "$mips_type" in
5096 *BSD*|'') inclwanted="$locincpth $usrinc";;
5097 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5098 esac
5099 for thisincl in $inclwanted; do
5100         if $test -d $thisincl; then
5101                 if $test x$thisincl != x$usrinc; then
5102                         case "$dflt" in
5103                         *" -I$thisincl "*);;
5104                         *) dflt="$dflt -I$thisincl ";;
5105                         esac
5106                 fi
5107         fi
5108 done
5109
5110 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5111         xxx=true;
5112 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5113         xxx=true;
5114 else
5115         xxx=false;
5116 fi;
5117 if $xxx; then
5118         case "$dflt" in
5119         *$2*);;
5120         *) dflt="$dflt -D$2";;
5121         esac;
5122 fi'
5123
5124 set signal.h LANGUAGE_C; eval $inctest
5125
5126 case "$usesocks" in
5127 $define)
5128         ccflags="$ccflags -DSOCKS"
5129         ;;
5130 esac
5131
5132 case "$hint" in
5133 default|recommended) dflt="$ccflags $dflt" ;;
5134 *) dflt="$ccflags";;
5135 esac
5136
5137 case "$dflt" in
5138 ''|' ') dflt=none;;
5139 esac
5140
5141 $cat <<EOH
5142
5143 Your C compiler may want other flags.  For this question you should include
5144 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5145 but you should NOT include libraries or ld flags like -lwhatever.  If you
5146 want $package to honor its debug switch, you should include -DDEBUGGING here.
5147 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5148
5149 To use no flags, specify the word "none".
5150
5151 EOH
5152 set X $dflt
5153 shift
5154 dflt=${1+"$@"}
5155 rp="Any additional cc flags?"
5156 . ./myread
5157 case "$ans" in
5158 none) ccflags='';;
5159 *) ccflags="$ans";;
5160 esac
5161
5162 : the following weeds options from ccflags that are of no interest to cpp
5163 case "$cppflags" in
5164 '') cppflags="$ccflags" ;;
5165 *)  cppflags="$cppflags $ccflags" ;;
5166 esac
5167 case "$gccversion" in
5168 1*) cppflags="$cppflags -D__GNUC__"
5169 esac
5170 case "$mips_type" in
5171 '');;
5172 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5173 esac
5174 case "$cppflags" in
5175 '');;
5176 *)
5177         echo " "
5178         echo "Let me guess what the preprocessor flags are..." >&4
5179         set X $cppflags
5180         shift
5181         cppflags=''
5182         $cat >cpp.c <<'EOM'
5183 #define BLURFL foo
5184
5185 BLURFL xx LFRULB
5186 EOM
5187         previous=''
5188         for flag in $*
5189         do
5190                 case "$flag" in
5191                 -*) ftry="$flag";;
5192                 *) ftry="$previous $flag";;
5193                 esac
5194                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5195                         >cpp1.out 2>/dev/null && \
5196                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5197                         >cpp2.out 2>/dev/null && \
5198                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5199                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5200                 then
5201                         cppflags="$cppflags $ftry"
5202                         previous=''
5203                 else
5204                         previous="$flag"
5205                 fi
5206         done
5207         set X $cppflags
5208         shift
5209         cppflags=${1+"$@"}
5210         case "$cppflags" in
5211         *-*)  echo "They appear to be: $cppflags";;
5212         esac
5213         $rm -f cpp.c cpp?.out
5214         ;;
5215 esac
5216
5217 : flags used in final linking phase
5218 case "$ldflags" in
5219 '') if ./venix; then
5220                 dflt='-i -z'
5221         else
5222                 dflt=''
5223         fi
5224         case "$ccflags" in
5225         *-posix*) dflt="$dflt -posix" ;;
5226         esac
5227         ;;
5228 *) dflt="$ldflags";;
5229 esac
5230
5231 : Try to guess additional flags to pick up local libraries.
5232 for thislibdir in $libpth; do
5233         case " $loclibpth " in
5234         *" $thislibdir "*)
5235                 case "$dflt " in
5236                 *"-L$thislibdir "*) ;;
5237                 *)  dflt="$dflt -L$thislibdir" ;;
5238                 esac
5239                 ;;
5240         esac
5241 done
5242
5243 case "$dflt" in
5244 '') dflt='none' ;;
5245 esac
5246
5247 $cat <<EOH
5248
5249 Your C linker may need flags.  For this question you should
5250 include -L/whatever and any other flags used by the C linker, but you
5251 should NOT include libraries like -lwhatever.
5252
5253 Make sure you include the appropriate -L/path flags if your C linker
5254 does not normally search all of the directories you specified above,
5255 namely
5256         $libpth
5257 To use no flags, specify the word "none".
5258
5259 EOH
5260
5261 rp="Any additional ld flags (NOT including libraries)?"
5262 . ./myread
5263 case "$ans" in
5264 none) ldflags='';;
5265 *) ldflags="$ans";;
5266 esac
5267 rmlist="$rmlist pdp11"
5268
5269 : coherency check
5270 echo " "
5271 echo "Checking your choice of C compiler and flags for coherency..." >&4
5272 $cat > try.c <<'EOF'
5273 #include <stdio.h>
5274 int main() { printf("Ok\n"); return(0); }
5275 EOF
5276 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5277 shift
5278 $cat >try.msg <<'EOM'
5279 I've tried to compile and run the following simple program:
5280
5281 EOM
5282 $cat try.c >> try.msg
5283
5284 $cat >> try.msg <<EOM
5285
5286 I used the command:
5287
5288         $*
5289         $run ./try
5290
5291 and I got the following output:
5292
5293 EOM
5294 dflt=y
5295 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5296         if $sh -c "$run ./try" >>try.msg 2>&1; then
5297                 xxx=`$run ./try`
5298                 case "$xxx" in
5299                 "Ok") dflt=n ;;
5300                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5301                         case " $libs " in
5302                         *" -lsfio "*)
5303                                 cat >> try.msg <<'EOQS'
5304 If $libs contains -lsfio, and sfio is mis-configured, then it
5305 sometimes (apparently) runs and exits with a 0 status, but with no
5306 output!  It may have to do with sfio's use of _exit vs. exit.
5307
5308 EOQS
5309                                 rp="You have a big problem.  Shall I abort Configure"
5310                                 dflt=y
5311                                 ;;
5312                         esac
5313                         ;;
5314                 esac
5315         else
5316                 echo "The program compiled OK, but exited with status $?." >>try.msg
5317                 rp="You have a problem.  Shall I abort Configure"
5318                 dflt=y
5319         fi
5320 else
5321         echo "I can't compile the test program." >>try.msg
5322         rp="You have a BIG problem.  Shall I abort Configure"
5323         dflt=y
5324 fi
5325 case "$dflt" in
5326 y)
5327         $cat try.msg >&4
5328         case "$knowitall" in
5329         '')
5330                 echo "(The supplied flags or libraries might be incorrect.)"
5331                 ;;
5332         *) dflt=n;;
5333         esac
5334         echo " "
5335         . ./myread
5336         case "$ans" in
5337         n*|N*) ;;
5338         *)      echo "Ok.  Stopping Configure." >&4
5339                 exit 1
5340                 ;;
5341         esac
5342         ;;
5343 n) echo "OK, that should do.";;
5344 esac
5345 $rm_try
5346
5347 : define a shorthand compile call
5348 compile='
5349 mc_file=$1;
5350 shift;
5351 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5352 : define a shorthand compile call for compilations that should be ok.
5353 compile_ok='
5354 mc_file=$1;
5355 shift;
5356 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5357
5358 : determine filename position in cpp output
5359 echo " "
5360 echo "Computing filename position in cpp output for #include directives..." >&4
5361 case "$osname" in
5362 vos) testaccess=-e ;;
5363 *)   testaccess=-r ;;
5364 esac
5365 echo '#include <stdio.h>' > foo.c
5366 $cat >fieldn <<EOF
5367 $startsh
5368 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5369 $grep '^[       ]*#.*stdio\.h' | \
5370 while read cline; do
5371         pos=1
5372         set \$cline
5373         while $test \$# -gt 0; do
5374                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5375                         echo "\$pos"
5376                         exit 0
5377                 fi
5378                 shift
5379                 pos=\`expr \$pos + 1\`
5380         done
5381 done
5382 EOF
5383 chmod +x fieldn
5384 fieldn=`./fieldn`
5385 $rm -f foo.c fieldn
5386 case $fieldn in
5387 '') pos='???';;
5388 1) pos=first;;
5389 2) pos=second;;
5390 3) pos=third;;
5391 *) pos="${fieldn}th";;
5392 esac
5393 echo "Your cpp writes the filename in the $pos field of the line."
5394
5395 case "$osname" in
5396 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5397 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5398 *)   cppfilter='' ;;
5399 esac
5400 : locate header file
5401 $cat >findhdr <<EOF
5402 $startsh
5403 wanted=\$1
5404 name=''
5405 for usrincdir in $usrinc
5406 do
5407         if test -f \$usrincdir/\$wanted; then
5408                 echo "\$usrincdir/\$wanted"
5409                 exit 0
5410         fi
5411 done
5412 awkprg='{ print \$$fieldn }'
5413 echo "#include <\$wanted>" > foo\$\$.c
5414 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5415 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5416 while read cline; do
5417         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5418         case "\$name" in
5419         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5420         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5421         *) exit 2;;
5422         esac;
5423 done;
5424 #
5425 # status = 0: grep returned 0 lines, case statement not executed
5426 # status = 1: headerfile found
5427 # status = 2: while loop executed, no headerfile found
5428 #
5429 status=\$?
5430 $rm -f foo\$\$.c;
5431 if test \$status -eq 1; then
5432         exit 0;
5433 fi
5434 exit 1
5435 EOF
5436 chmod +x findhdr
5437
5438 : define an alternate in-header-list? function
5439 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5440 cont=true; xxf="echo \"<\$1> found.\" >&4";
5441 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5442 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5443 esac;
5444 case $# in 4) instead=instead;; *) instead="at last";; esac;
5445 while $test "$cont"; do
5446         xxx=`./findhdr $1`
5447         var=$2; eval "was=\$$2";
5448         if $test "$xxx" && $test -r "$xxx";
5449         then eval $xxf;
5450         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5451                 cont="";
5452         else eval $xxnf;
5453         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5454         set $yyy; shift; shift; yyy=$@;
5455         case $# in 0) cont="";;
5456         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5457                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5458         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5459                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5460         esac;
5461 done;
5462 while $test "$yyy";
5463 do set $yyy; var=$2; eval "was=\$$2";
5464         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5465         set $yyy; shift; shift; yyy=$@;
5466 done'
5467
5468 : see if stdlib is available
5469 set stdlib.h i_stdlib
5470 eval $inhdr
5471
5472 : check for lengths of integral types
5473 echo " "
5474 case "$intsize" in
5475 '')
5476         echo "Checking to see how big your integers are..." >&4
5477         $cat >try.c <<EOCP
5478 #include <stdio.h>
5479 #$i_stdlib I_STDLIB
5480 #ifdef I_STDLIB
5481 #include <stdlib.h>
5482 #endif
5483 int main()
5484 {
5485         printf("intsize=%d;\n", (int)sizeof(int));
5486         printf("longsize=%d;\n", (int)sizeof(long));
5487         printf("shortsize=%d;\n", (int)sizeof(short));
5488         exit(0);
5489 }
5490 EOCP
5491         set try
5492         if eval $compile_ok && $run ./try > /dev/null; then
5493                 eval `$run ./try`
5494                 echo "Your integers are $intsize bytes long."
5495                 echo "Your long integers are $longsize bytes long."
5496                 echo "Your short integers are $shortsize bytes long."
5497         else
5498                 $cat >&4 <<EOM
5499 !
5500 Help! I can't compile and run the intsize test program: please enlighten me!
5501 (This is probably a misconfiguration in your system or libraries, and
5502 you really ought to fix it.  Still, I'll try anyway.)
5503 !
5504 EOM
5505                 dflt=4
5506                 rp="What is the size of an integer (in bytes)?"
5507                 . ./myread
5508                 intsize="$ans"
5509                 dflt=$intsize
5510                 rp="What is the size of a long integer (in bytes)?"
5511                 . ./myread
5512                 longsize="$ans"
5513                 dflt=2
5514                 rp="What is the size of a short integer (in bytes)?"
5515                 . ./myread
5516                 shortsize="$ans"
5517         fi
5518         ;;
5519 esac
5520 $rm_try
5521
5522 : check for long long
5523 echo " "
5524 echo "Checking to see if you have long long..." >&4
5525 echo 'int main() { long long x = 7; return 0; }' > try.c
5526 set try
5527 if eval $compile; then
5528         val="$define"
5529         echo "You have long long."
5530 else
5531         val="$undef"
5532         echo "You do not have long long."
5533 fi
5534 $rm_try
5535 set d_longlong
5536 eval $setvar
5537
5538 : check for length of long long
5539 case "${d_longlong}${longlongsize}" in
5540 $define)
5541         echo " "
5542         echo "Checking to see how big your long longs are..." >&4
5543         $cat >try.c <<'EOCP'
5544 #include <stdio.h>
5545 int main()
5546 {
5547     printf("%d\n", (int)sizeof(long long));
5548     return(0);
5549 }
5550 EOCP
5551         set try
5552         if eval $compile_ok; then
5553                 longlongsize=`$run ./try`
5554                 echo "Your long longs are $longlongsize bytes long."
5555         else
5556                 dflt='8'
5557                 echo " "
5558                 echo "(I can't seem to compile the test program.  Guessing...)"
5559                 rp="What is the size of a long long (in bytes)?"
5560                 . ./myread
5561                 longlongsize="$ans"
5562         fi
5563         if $test "X$longsize" = "X$longlongsize"; then
5564                 echo "(That isn't any different from an ordinary long.)"
5565         fi
5566         ;;
5567 esac
5568 $rm_try
5569
5570 : see if inttypes.h is available
5571 : we want a real compile instead of Inhdr because some systems
5572 : have an inttypes.h which includes non-existent headers
5573 echo " "
5574 $cat >try.c <<EOCP
5575 #include <inttypes.h>
5576 int main() {
5577         static int32_t foo32 = 0x12345678;
5578 }
5579 EOCP
5580 set try
5581 if eval $compile; then
5582         echo "<inttypes.h> found." >&4
5583         val="$define"
5584 else
5585         echo "<inttypes.h> NOT found." >&4
5586         val="$undef"
5587 fi
5588 $rm_try
5589 set i_inttypes
5590 eval $setvar
5591
5592 : check for int64_t
5593 echo " "
5594 echo "Checking to see if you have int64_t..." >&4
5595 $cat >try.c <<EOCP
5596 #include <sys/types.h>
5597 #$i_inttypes I_INTTYPES
5598 #ifdef I_INTTYPES
5599 #include <inttypes.h>
5600 #endif
5601 int main() { int64_t x = 7; }
5602 EOCP
5603 set try
5604 if eval $compile; then
5605         val="$define"
5606         echo "You have int64_t."
5607 else
5608         val="$undef"
5609         echo "You do not have int64_t."
5610 fi
5611 $rm_try
5612 set d_int64_t
5613 eval $setvar
5614
5615
5616 echo " "
5617 echo "Checking which 64-bit integer type we could use..." >&4
5618
5619 case "$intsize" in
5620 8) val=int
5621    set quadtype
5622    eval $setvar
5623    val='"unsigned int"'
5624    set uquadtype
5625    eval $setvar
5626    quadkind=1
5627    ;;
5628 *) case "$longsize" in
5629    8) val=long
5630       set quadtype
5631       eval $setvar
5632       val='"unsigned long"'
5633       set uquadtype
5634       eval $setvar
5635       quadkind=2
5636       ;;
5637    *) case "$d_longlong:$longlongsize" in
5638       define:8)
5639         val='"long long"'
5640         set quadtype
5641         eval $setvar
5642         val='"unsigned long long"'
5643         set uquadtype
5644         eval $setvar
5645         quadkind=3
5646         ;;
5647       *) case "$d_int64_t" in
5648          define)
5649            val=int64_t
5650            set quadtype
5651            eval $setvar
5652            val=uint64_t
5653            set uquadtype
5654            eval $setvar
5655            quadkind=4
5656            ;;
5657          esac
5658          ;;
5659       esac
5660       ;;
5661    esac
5662    ;;
5663 esac
5664
5665 case "$quadtype" in
5666 '')     echo "Alas, no 64-bit integer types in sight." >&4
5667         d_quad="$undef"
5668         ;;
5669 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5670         d_quad="$define"
5671         ;;
5672 esac
5673
5674
5675 case "$uselonglong" in
5676 "$define"|true|[yY]*)
5677         cat <<EOM >&4
5678
5679 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5680 EOM
5681         use64bitint="$define"
5682         ;;
5683 esac                          
5684 case "$use64bits" in
5685 "$define"|true|[yY]*)
5686         cat <<EOM >&4
5687
5688 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5689 EOM
5690         use64bitint="$define"
5691         ;;
5692 esac                          
5693 case "$use64bitints" in
5694 "$define"|true|[yY]*)
5695         cat <<EOM >&4
5696
5697 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5698 EOM
5699         use64bitint="$define"
5700         ;;
5701 esac                          
5702 case "$use64bitsint" in
5703 "$define"|true|[yY]*)
5704         cat <<EOM >&4
5705
5706 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5707 EOM
5708         use64bitint="$define"
5709         ;;
5710 esac                          
5711 case "$uselonglongs" in
5712 "$define"|true|[yY]*)
5713         cat <<EOM >&4
5714
5715 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5716 EOM
5717         use64bitint="$define"
5718         ;;
5719 esac                          
5720 case "$use64bitsall" in
5721 "$define"|true|[yY]*)
5722         cat <<EOM >&4
5723
5724 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5725 EOM
5726         use64bitall="$define"
5727         ;;
5728 esac                          
5729
5730 case "$ccflags" in
5731 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5732 esac
5733 case "$use64bitall" in
5734 "$define"|true|[yY]*) use64bitint="$define" ;;
5735 esac
5736
5737 case "$longsize" in
5738 8) cat <<EOM
5739
5740 You have natively 64-bit long integers.
5741 EOM
5742    val="$define"
5743    ;;
5744 *) case "$use64bitint" in
5745    "$define"|true|[yY]*) dflt='y';;
5746    *) dflt='n';;
5747    esac
5748    case "$d_quad" in
5749    "$define") ;;
5750    *) dflt='n' ;;
5751    esac
5752    cat <<EOM
5753
5754 Perl can be built to take advantage of 64-bit integer types
5755 on some systems.  To do so, Configure can be run with -Duse64bitint.
5756 Choosing this option will most probably introduce binary incompatibilities.
5757
5758 If this doesn't make any sense to you, just accept the default '$dflt'.
5759 (The default has been chosen based on your configuration.)
5760 EOM
5761    rp='Try to use 64-bit integers, if available?'
5762    . ./myread
5763    case "$ans" in
5764    [yY]*) val="$define" ;;
5765    *)     val="$undef"  ;;
5766    esac
5767    ;;
5768 esac
5769 set use64bitint
5770 eval $setvar
5771
5772 case "$use64bitall" in
5773 "$define"|true|[yY]*) dflt='y' ;;
5774 *) case "$longsize" in
5775    8) dflt='y' ;;
5776    *) dflt='n' ;;
5777    esac
5778    ;;
5779 esac    
5780 cat <<EOM
5781
5782 You may also choose to try maximal 64-bitness.  It means using as much
5783 64-bitness as possible on the platform.  This in turn means even more
5784 binary incompatibilities.  On the other hand, your platform may not
5785 have any more 64-bitness available than what you already have chosen.
5786
5787 If this doesn't make any sense to you, just accept the default '$dflt'.
5788 (The default has been chosen based on your configuration.)
5789 EOM
5790 rp='Try to use maximal 64-bit support, if available?'
5791 . ./myread
5792 case "$ans" in
5793 [yY]*) val="$define" ;;
5794 *)     val="$undef"  ;;
5795 esac
5796 set use64bitall
5797 eval $setvar
5798 case "$use64bitall" in
5799 "$define")
5800         case "$use64bitint" in
5801         "$undef")
5802                 cat <<EOM
5803
5804 Since you have chosen a maximally 64-bit build, I'm also turning on
5805 the use of 64-bit integers.
5806 EOM
5807                 use64bitint="$define" ;;
5808         esac
5809         ;;
5810 esac
5811
5812 : Look for a hint-file generated 'call-back-unit'.  If the
5813 : user has specified that a 64-bit perl is to be built,
5814 : we may need to set or change some other defaults.
5815 if $test -f use64bitint.cbu; then
5816         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5817         . ./use64bitint.cbu
5818 fi
5819 case "$use64bitint" in
5820 "$define"|true|[yY]*)
5821         case "$longsize" in
5822         4) case "$archname64" in
5823            '') archname64=64int ;;
5824            esac
5825            ;;
5826         esac
5827         ;;
5828 esac
5829
5830 : Look for a hint-file generated 'call-back-unit'.  If the
5831 : user has specified that a maximally 64-bit perl is to be built,
5832 : we may need to set or change some other defaults.
5833 if $test -f use64bitall.cbu; then
5834         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5835         . ./use64bitall.cbu
5836 fi
5837 case "$use64bitall" in
5838 "$define"|true|[yY]*)
5839         case "$longsize" in
5840         4) case "$archname64" in
5841            ''|64int) archname64=64all ;;
5842            esac
5843            ;;
5844         esac
5845         ;;
5846 esac
5847
5848 case "$d_quad:$use64bitint" in
5849 $undef:$define)
5850         cat >&4 <<EOF
5851
5852 *** You have chosen to use 64-bit integers,
5853 *** but none can be found.
5854 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5855 *** Cannot continue, aborting.
5856
5857 EOF
5858         exit 1
5859         ;;
5860 esac
5861
5862 : check for length of double
5863 echo " "
5864 case "$doublesize" in
5865 '')
5866         echo "Checking to see how big your double precision numbers are..." >&4
5867         $cat >try.c <<EOCP
5868 #include <stdio.h>
5869 #$i_stdlib I_STDLIB
5870 #ifdef I_STDLIB
5871 #include <stdlib.h>
5872 #endif
5873 int main()
5874 {
5875     printf("%d\n", (int)sizeof(double));
5876     exit(0);
5877 }
5878 EOCP
5879         set try
5880         if eval $compile_ok; then
5881                 doublesize=`$run ./try`
5882                 echo "Your double is $doublesize bytes long."
5883         else
5884                 dflt='8'
5885                 echo "(I can't seem to compile the test program.  Guessing...)"
5886                 rp="What is the size of a double precision number (in bytes)?"
5887                 . ./myread
5888                 doublesize="$ans"
5889         fi
5890         ;;
5891 esac
5892 $rm_try
5893
5894 : check for long doubles
5895 echo " "
5896 echo "Checking to see if you have long double..." >&4
5897 echo 'int main() { long double x = 7.0; }' > try.c
5898 set try
5899 if eval $compile; then
5900         val="$define"
5901         echo "You have long double."
5902 else
5903         val="$undef"
5904         echo "You do not have long double."
5905 fi
5906 $rm_try
5907 set d_longdbl
5908 eval $setvar
5909
5910 : check for length of long double
5911 case "${d_longdbl}${longdblsize}" in
5912 $define)
5913         echo " "
5914         echo "Checking to see how big your long doubles are..." >&4
5915         $cat >try.c <<'EOCP'
5916 #include <stdio.h>
5917 int main()
5918 {
5919         printf("%d\n", sizeof(long double));
5920 }
5921 EOCP
5922         set try
5923         set try
5924         if eval $compile; then
5925                 longdblsize=`$run ./try`
5926                 echo "Your long doubles are $longdblsize bytes long."
5927         else
5928                 dflt='8'
5929                 echo " "
5930                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5931                 rp="What is the size of a long double (in bytes)?"
5932                 . ./myread
5933                 longdblsize="$ans"
5934         fi
5935         if $test "X$doublesize" = "X$longdblsize"; then
5936                 echo "That isn't any different from an ordinary double."
5937                 echo "I'll keep your setting anyway, but you may see some"
5938                 echo "harmless compilation warnings."
5939         fi
5940         ;;
5941 esac
5942 $rm_try
5943
5944 : determine the architecture name
5945 echo " "
5946 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5947         tarch=`arch`"-$osname"
5948 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5949         if uname -m > tmparch 2>&1 ; then
5950                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5951                         -e 's/$/'"-$osname/" tmparch`
5952         else
5953                 tarch="$osname"
5954         fi
5955         $rm -f tmparch
5956 else
5957         tarch="$osname"
5958 fi
5959 case "$myarchname" in
5960 ''|"$tarch") ;;
5961 *)
5962         echo "(Your architecture name used to be $myarchname.)"
5963         archname=''
5964         ;;
5965 esac
5966 case "$targetarch" in
5967 '') ;;
5968 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5969 esac
5970 myarchname="$tarch"
5971 case "$archname" in
5972 '') dflt="$tarch";;
5973 *) dflt="$archname";;
5974 esac
5975 rp='What is your architecture name'
5976 . ./myread
5977 archname="$ans"
5978 case "$usethreads" in
5979 $define)
5980         echo "Threads selected." >&4
5981         case "$archname" in
5982         *-thread*) echo "...and architecture name already has -thread." >&4
5983                 ;;
5984         *)      archname="$archname-thread"
5985                 echo "...setting architecture name to $archname." >&4
5986                 ;;
5987         esac
5988         ;;
5989 esac
5990 case "$usemultiplicity" in
5991 $define)
5992         echo "Multiplicity selected." >&4
5993         case "$archname" in
5994         *-multi*) echo "...and architecture name already has -multi." >&4
5995                 ;;
5996         *)      archname="$archname-multi"
5997                 echo "...setting architecture name to $archname." >&4
5998                 ;;
5999         esac
6000         ;;
6001 esac
6002 case "$use64bitint$use64bitall" in
6003 *"$define"*)
6004         case "$archname64" in
6005         '')
6006                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6007                 ;;
6008         *)
6009                 case "$use64bitint" in
6010                 "$define") echo "64 bit integers selected." >&4 ;;
6011                 esac
6012                 case "$use64bitall" in
6013                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6014                 esac
6015                 case "$archname" in
6016                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6017                         ;;
6018                 *)      archname="$archname-$archname64"
6019                         echo "...setting architecture name to $archname." >&4
6020                         ;;
6021                 esac
6022                 ;;
6023         esac
6024 esac
6025 case "$uselongdouble" in
6026 $define)
6027         echo "Long doubles selected." >&4
6028         case "$longdblsize" in
6029         $doublesize)
6030                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6031                 ;;
6032         *)
6033                 case "$archname" in
6034                 *-ld*) echo "...and architecture name already has -ld." >&4
6035                         ;;
6036                 *)      archname="$archname-ld"
6037                         echo "...setting architecture name to $archname." >&4
6038                         ;;
6039                 esac
6040                 ;;
6041         esac
6042         ;;
6043 esac
6044 case "$useperlio" in
6045 $define)
6046         echo "Perlio selected." >&4
6047         ;;
6048 *)
6049         echo "Perlio not selected, using stdio." >&4
6050         case "$archname" in
6051         *-stdio*) echo "...and architecture name already has -stdio." >&4
6052                 ;;
6053         *)      archname="$archname-stdio"
6054                 echo "...setting architecture name to $archname." >&4
6055                 ;;
6056         esac
6057         ;;
6058 esac
6059 if $test -f archname.cbu; then
6060         echo "Your platform has some specific hints for architecture name, using them..."
6061         . ./archname.cbu
6062 fi
6063
6064 : set the prefixit variable, to compute a suitable default value
6065 prefixit='case "$3" in
6066 ""|none)
6067         case "$oldprefix" in
6068         "") eval "$1=\"\$$2\"";;
6069         *)
6070                 case "$3" in
6071                 "") eval "$1=";;
6072                 none)
6073                         eval "tp=\"\$$2\"";
6074                         case "$tp" in
6075                         ""|" ") eval "$1=\"\$$2\"";;
6076                         *) eval "$1=";;
6077                         esac;;
6078                 esac;;
6079         esac;;
6080 *)
6081         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6082         case "$tp" in
6083         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6084         /*-$oldprefix/*|\~*-$oldprefix/*)
6085                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6086         *) eval "$1=\"\$$2\"";;
6087         esac;;
6088 esac'
6089
6090 : determine installation style
6091 : For now, try to deduce it from prefix unless it is already set.
6092 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6093 case "$installstyle" in
6094 '')     case "$prefix" in
6095                 *perl*) dflt='lib';;
6096                 *) dflt='lib/perl5' ;;
6097         esac
6098         ;;
6099 *)      dflt="$installstyle" ;;
6100 esac
6101 : Probably not worth prompting for this since we prompt for all
6102 : the directories individually, and the prompt would be too long and
6103 : confusing anyway.
6104 installstyle=$dflt
6105
6106 : determine where public executables go
6107 echo " "
6108 set dflt bin bin
6109 eval $prefixit
6110 fn=d~
6111 rp='Pathname where the public executables will reside?'
6112 . ./getfile
6113 if $test "X$ansexp" != "X$binexp"; then
6114         installbin=''
6115 fi
6116 prefixvar=bin
6117 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6118 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6119 :     this via initialinstalllocation
6120 . ./setprefixvar
6121
6122 case "$userelocatableinc" in
6123 $define|true|[yY]*)     dflt='y' ;;
6124 *)                      dflt='n' ;;
6125 esac
6126 cat <<EOM
6127
6128 Would you like to build Perl so that the installation is relocatable, so that
6129 library paths in @INC are determined relative to the path of the perl binary?
6130 This is not advised for system Perl installs, or if you need to run setid
6131 scripts or scripts under taint mode.
6132
6133 If this doesn't make any sense to you, just accept the default '$dflt'.
6134 EOM
6135 rp='Use relocatable @INC?'
6136 . ./myread
6137 case "$ans" in
6138 y|Y)    val="$define" ;;
6139 *)      val="$undef"  ;;
6140 esac
6141 set userelocatableinc
6142 eval $setvar
6143
6144 initialinstalllocation="$binexp"
6145 : Default prefix is now "up one level from where the binaries are"
6146 case "$userelocatableinc" in
6147 $define|true|[yY]*)
6148     bin=".../"
6149     binexp=".../"
6150     prefix=".../.."
6151     prefixexp=".../.."
6152     installprefixexp=".../.."
6153     ;;
6154 esac
6155
6156 : determine where private library files go
6157 : Usual default is /usr/local/lib/perl5/$version.
6158 : Also allow things like /opt/perl/lib/$version, since
6159 : /opt/perl/lib/perl5... would be redundant.
6160 : The default "style" setting is made in installstyle.U
6161 case "$installstyle" in
6162 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6163 *)       set dflt privlib lib/$version ;;
6164 esac
6165 eval $prefixit
6166 $cat <<EOM
6167
6168 There are some auxiliary files for $package that need to be put into a
6169 private library directory that is accessible by everyone.
6170
6171 EOM
6172 fn=$binexp
6173 fn=d~+
6174 rp='Pathname where the private library files will reside?'
6175 . ./getfile
6176 prefixvar=privlib
6177 . ./setprefixvar
6178
6179 : set the prefixup variable, to restore leading tilda escape
6180 prefixup='case "$prefixexp" in
6181 "$prefix") ;;
6182 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6183 esac'
6184
6185 : determine where public architecture dependent libraries go
6186 set archlib archlib
6187 eval $prefixit
6188 : privlib default is /usr/local/lib/$package/$version
6189 : archlib default is /usr/local/lib/$package/$version/$archname
6190 : privlib may have an optional trailing /share.
6191 tdflt=`echo $privlib | $sed 's,/share$,,'`
6192 tdflt=$tdflt/$archname
6193 case "$archlib" in
6194 '')     dflt=$tdflt
6195         ;;
6196 *)      dflt="$archlib"
6197     ;;
6198 esac
6199 $cat <<EOM
6200
6201 $spackage contains architecture-dependent library files.  If you are
6202 sharing libraries in a heterogeneous environment, you might store
6203 these files in a separate location.  Otherwise, you can just include
6204 them with the rest of the public library files.
6205
6206 EOM
6207 fn=$binexp
6208 fn=d+~
6209 rp='Where do you want to put the public architecture-dependent libraries?'
6210 . ./getfile
6211 prefixvar=archlib
6212 . ./setprefixvar
6213 if $test X"$archlib" = X"$privlib"; then
6214         d_archlib="$undef"
6215 else
6216         d_archlib="$define"
6217 fi
6218
6219 : see if setuid scripts can be secure
6220 $cat <<EOM
6221
6222 Some kernels have a bug that prevents setuid #! scripts from being
6223 secure.  Some sites have disabled setuid #! scripts because of this.
6224
6225 First let's decide if your kernel supports secure setuid #! scripts.
6226 (If setuid #! scripts would be secure but have been disabled anyway,
6227 don't say that they are secure if asked.)
6228
6229 EOM
6230
6231 val="$undef"
6232 if $test -d /dev/fd; then
6233         echo "#!$ls" >reflect
6234         chmod +x,u+s reflect
6235         ./reflect >flect 2>&1
6236         if $contains "/dev/fd" flect >/dev/null; then
6237                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6238                 val="$define"
6239         else
6240                 $cat <<EOM
6241 If you are not sure if they are secure, I can check but I'll need a
6242 username and password different from the one you are using right now.
6243 If you don't have such a username or don't want me to test, simply
6244 enter 'none'.
6245
6246 EOM
6247                 rp='Other username to test security of setuid scripts with?'
6248                 dflt='none'
6249                 . ./myread
6250                 case "$ans" in
6251                 n|none)
6252                         case "$d_suidsafe" in
6253                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6254                                 dflt=n;;
6255                         "$undef")
6256                                 echo "Well, the $hint value is *not* secure." >&4
6257                                 dflt=n;;
6258                         *)      echo "Well, the $hint value *is* secure." >&4
6259                                 dflt=y;;
6260                         esac
6261                         ;;
6262                 *)
6263                         $rm -f reflect flect
6264                         echo "#!$ls" >reflect
6265                         chmod +x,u+s reflect
6266                         echo >flect
6267                         chmod a+w flect
6268                         echo '"su" will (probably) prompt you for '"$ans's password."
6269                         su $ans -c './reflect >flect'
6270                         if $contains "/dev/fd" flect >/dev/null; then
6271                                 echo "Okay, it looks like setuid scripts are secure." >&4
6272                                 dflt=y
6273                         else
6274                                 echo "I don't think setuid scripts are secure." >&4
6275                                 dflt=n
6276                         fi
6277                         ;;
6278                 esac
6279                 rp='Does your kernel have *secure* setuid scripts?'
6280                 . ./myread
6281                 case "$ans" in
6282                 [yY]*)  val="$define";;
6283                 *)      val="$undef";;
6284                 esac
6285         fi
6286 else
6287         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6288         echo "(That's for file descriptors, not floppy disks.)"
6289         val="$undef"
6290 fi
6291 set d_suidsafe
6292 eval $setvar
6293
6294 $rm -f reflect flect
6295
6296 : now see if they want to do setuid emulation
6297 echo " "
6298 val="$undef"
6299 case "$d_suidsafe" in
6300 "$define")
6301         val="$undef"
6302         echo "No need to emulate SUID scripts since they are secure here." >&4
6303         ;;
6304 *)
6305         $cat <<EOM
6306 Some systems have disabled setuid scripts, especially systems where
6307 setuid scripts cannot be secure.  On systems where setuid scripts have
6308 been disabled, the setuid/setgid bits on scripts are currently
6309 useless.  It is possible for $package to detect those bits and emulate
6310 setuid/setgid in a secure fashion.  This emulation will only work if
6311 setuid scripts have been disabled in your kernel.
6312
6313 EOM
6314         case "$d_dosuid" in
6315         "$define") dflt=y ;;
6316         *) dflt=n ;;
6317         esac
6318         rp="Do you want to do setuid/setgid emulation?"
6319         . ./myread
6320         case "$ans" in
6321         [yY]*)  val="$define";;
6322         *)      val="$undef";;
6323         esac
6324         ;;
6325 esac
6326 set d_dosuid
6327 eval $setvar
6328
6329 : Find perl5.005 or later.
6330 echo "Looking for a previously installed perl5.005 or later... "
6331 case "$perl5" in
6332 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6333                 : Check if this perl is recent and can load a simple module
6334                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6335                         perl5=$tdir/perl
6336                         break;
6337                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6338                         perl5=$tdir/perl5
6339                         break;
6340                 fi
6341         done
6342         ;;
6343 *)      perl5="$perl5"
6344         ;;
6345 esac
6346 case "$perl5" in
6347 '')     echo "None found.  That's ok.";;
6348 *)      echo "Using $perl5." ;;
6349 esac
6350
6351 $cat <<EOM
6352
6353 After $package is installed, you may wish to install various
6354 add-on modules and utilities.  Typically, these add-ons will
6355 be installed under $prefix with the rest
6356 of this package.  However, you may wish to install such add-ons
6357 elsewhere under a different prefix.
6358
6359 If you do not wish to put everything under a single prefix, that's
6360 ok.  You will be prompted for the individual locations; this siteprefix
6361 is only used to suggest the defaults.
6362
6363 The default should be fine for most people.
6364
6365 EOM
6366 fn=d~+
6367 rp='Installation prefix to use for add-on modules and utilities?'
6368 : XXX Here might be another good place for an installstyle setting.
6369 case "$siteprefix" in
6370 '') dflt=$prefix ;;
6371 *)  dflt=$siteprefix ;;
6372 esac
6373 . ./getfile
6374 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6375 oldsiteprefix=''
6376 case "$siteprefix" in
6377 '') ;;
6378 *)      case "$ans" in
6379         "$prefix") ;;
6380         *) oldsiteprefix="$prefix";;
6381         esac
6382         ;;
6383 esac
6384 siteprefix="$ans"
6385 siteprefixexp="$ansexp"
6386
6387 : determine where site specific libraries go.
6388 : Usual default is /usr/local/lib/perl5/site_perl/$version
6389 : The default "style" setting is made in installstyle.U
6390 : XXX No longer works with Prefixit stuff.
6391 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6392 case "$sitelib" in
6393 '') case "$installstyle" in
6394         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6395         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6396         esac
6397         ;;
6398 *)      dflt="$sitelib"
6399         ;;
6400 esac
6401 $cat <<EOM
6402
6403 The installation process will create a directory for
6404 site-specific extensions and modules.  Most users find it convenient
6405 to place all site-specific files in this directory rather than in the
6406 main distribution directory.
6407
6408 EOM
6409 fn=d~+
6410 rp='Pathname for the site-specific library files?'
6411 . ./getfile
6412 prefixvar=sitelib
6413 . ./setprefixvar
6414 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6415
6416 : Determine list of previous versions to include in @INC
6417 $cat > getverlist <<EOPL
6418 #!$perl5 -w
6419 use File::Basename;
6420 \$api_versionstring = "$api_versionstring";
6421 \$version = "$version";
6422 \$stem = "$sitelib_stem";
6423 \$archname = "$archname";
6424 EOPL
6425         $cat >> getverlist <<'EOPL'
6426 # The list found is store twice for each entry: the original name, and
6427 # the binary broken down version as pack "sss", so sorting is easy and
6428 # unambiguous. This will work for all versions that have a maximum of
6429 # three digit groups, separate by '.'s or '_'s. Names are extended with
6430 # ".0.0" to ensure at least three elements for the pack.
6431 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6432
6433 # Can't have leading @ because metaconfig interprets it as a command!
6434 ;@inc_version_list=();
6435 # XXX Redo to do opendir/readdir?
6436 if (-d $stem) {
6437     chdir($stem);
6438     ;@candidates = map {
6439         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6440 }
6441 else {
6442     ;@candidates = ();
6443 }
6444
6445 ($pversion, $aversion, $vsn5005) = map {
6446     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6447 foreach $d (@candidates) {
6448     if ($d->[1] lt $pversion) {
6449         if ($d->[1] ge $aversion) {
6450             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6451         }
6452         elsif ($d->[1] ge $vsn5005) {
6453             unshift(@inc_version_list, grep { -d } $d->[0]);
6454         }
6455     }
6456     else {
6457         # Skip newer version.  I.e. don't look in
6458         # 5.7.0 if we're installing 5.6.1.
6459     }
6460 }
6461
6462 if (@inc_version_list) {
6463     print join(' ', @inc_version_list);
6464 }
6465 else {
6466     # Blank space to preserve value for next Configure run.
6467     print " ";
6468 }
6469 EOPL
6470 chmod +x getverlist
6471 case "$inc_version_list" in
6472 '')     if test -x "$perl5$exe_ext"; then
6473                 dflt=`$perl5 getverlist`
6474         else
6475                 dflt='none'
6476         fi
6477         ;;
6478 $undef) dflt='none' ;;
6479 *)  eval dflt=\"$inc_version_list\" ;;
6480 esac
6481 case "$dflt" in
6482 ''|' ') dflt=none ;;
6483 esac
6484 case "$dflt" in
6485 5.005) dflt=none ;;
6486 esac
6487 $cat <<EOM
6488
6489 In order to ease the process of upgrading, this version of perl
6490 can be configured to use modules built and installed with earlier
6491 versions of perl that were installed under $prefix.  Specify here
6492 the list of earlier versions that this version of perl should check.
6493 If Configure detected no earlier versions of perl installed under
6494 $prefix, then the list will be empty.  Answer 'none' to tell perl
6495 to not search earlier versions.
6496
6497 The default should almost always be sensible, so if you're not sure,
6498 just accept the default.
6499 EOM
6500
6501 rp='List of earlier versions to include in @INC?'
6502 . ./myread
6503 case "$ans" in
6504 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6505 *) inc_version_list="$ans" ;;
6506 esac
6507 case "$inc_version_list" in
6508 ''|' ')
6509         inc_version_list_init='0'
6510         d_inc_version_list="$undef"
6511         ;;
6512 *)      inc_version_list_init=`echo $inc_version_list |
6513                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6514         d_inc_version_list="$define"
6515         ;;
6516 esac
6517 $rm -f getverlist
6518
6519 : see if this is a malloc.h system
6520 : we want a real compile instead of Inhdr because some systems have a
6521 : malloc.h that just gives a compile error saying to use stdlib.h instead
6522 echo " "
6523 $cat >try.c <<EOCP
6524 #include <stdlib.h>
6525 #include <malloc.h>
6526 int main () { return 0; }
6527 EOCP
6528 set try
6529 if eval $compile; then
6530     echo "<malloc.h> found." >&4
6531     val="$define"
6532 else
6533     echo "<malloc.h> NOT found." >&4
6534     val="$undef"
6535 fi
6536 $rm_try
6537 set i_malloc
6538 eval $setvar
6539
6540 : check for void type
6541 echo " "
6542 echo "Checking to see how well your C compiler groks the void type..." >&4
6543 case "$voidflags" in
6544 '')
6545         $cat >try.c <<EOCP
6546 #$i_stdlib I_STDLIB
6547 #ifdef I_STDLIB
6548 #include <stdlib.h>
6549 #endif
6550 #if TRY & 1
6551 void sub() {
6552 #else
6553 sub() {
6554 #endif
6555         extern void moo();      /* function returning void */
6556         void (*goo)();          /* ptr to func returning void */
6557 #if TRY & 8
6558         void *hue;              /* generic ptr */
6559 #endif
6560 #if TRY & 2
6561         void (*foo[10])();
6562 #endif
6563
6564 #if TRY & 4
6565         if(goo == moo) {
6566                 exit(0);
6567         }
6568 #endif
6569         exit(0);
6570 }
6571 int main() { sub(); }
6572 EOCP
6573         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6574                 voidflags=$defvoidused
6575         echo "Good.  It appears to support void to the level $package wants.">&4
6576                 if $contains warning .out >/dev/null 2>&1; then
6577                         echo "However, you might get some warnings that look like this:"
6578                         $cat .out
6579                 fi
6580         else
6581 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6582                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6583                         echo "It supports 1..."
6584                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6585                                 echo "It also supports 2..."
6586                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6587                                         voidflags=7
6588                                         echo "And it supports 4 but not 8 definitely."
6589                                 else
6590                                         echo "It doesn't support 4..."
6591                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6592                                                 voidflags=11
6593                                                 echo "But it supports 8."
6594                                         else
6595                                                 voidflags=3
6596                                                 echo "Neither does it support 8."
6597                                         fi
6598                                 fi
6599                         else
6600                                 echo "It does not support 2..."
6601                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6602                                         voidflags=13
6603                                         echo "But it supports 4 and 8."
6604                                 else
6605                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6606                                                 voidflags=5
6607                                                 echo "And it supports 4 but has not heard about 8."
6608                                         else
6609                                                 echo "However it supports 8 but not 4."
6610                                         fi
6611                                 fi
6612                         fi
6613                 else
6614                         echo "There is no support at all for void."
6615                         voidflags=0
6616                 fi
6617         fi
6618 esac
6619 case "$voidflags" in
6620 "$defvoidused") ;;
6621 *)      $cat >&4 <<'EOM'
6622   Support flag bits are:
6623     1: basic void declarations.
6624     2: arrays of pointers to functions returning void.
6625     4: operations between pointers to and addresses of void functions.
6626     8: generic void pointers.
6627 EOM
6628         dflt="$voidflags";
6629         rp="Your void support flags add up to what?"
6630         . ./myread
6631         voidflags="$ans"
6632         ;;
6633 esac
6634 $rm_try
6635
6636 : check for length of pointer
6637 echo " "
6638 case "$ptrsize" in
6639 '')
6640         echo "Checking to see how big your pointers are..." >&4
6641         if test "$voidflags" -gt 7; then
6642                 echo '#define VOID_PTR char *' > try.c
6643         else
6644                 echo '#define VOID_PTR void *' > try.c
6645         fi
6646         $cat >>try.c <<EOCP
6647 #include <stdio.h>
6648 #$i_stdlib I_STDLIB
6649 #ifdef I_STDLIB
6650 #include <stdlib.h>
6651 #endif
6652 int main()
6653 {
6654     printf("%d\n", (int)sizeof(VOID_PTR));
6655     exit(0);
6656 }
6657 EOCP
6658         set try
6659         if eval $compile_ok; then
6660                 ptrsize=`$run ./try`
6661                 echo "Your pointers are $ptrsize bytes long."
6662         else
6663                 dflt='4'
6664                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6665                 rp="What is the size of a pointer (in bytes)?"
6666                 . ./myread
6667                 ptrsize="$ans"
6668         fi
6669         ;;
6670 esac
6671 $rm_try
6672 case "$use64bitall" in
6673 "$define"|true|[yY]*)
6674         case "$ptrsize" in
6675         4)      cat <<EOM >&4
6676
6677 *** You have chosen a maximally 64-bit build,
6678 *** but your pointers are only 4 bytes wide.
6679 *** Please rerun Configure without -Duse64bitall.
6680 EOM
6681                 case "$d_quad" in
6682                 define)
6683                         cat <<EOM >&4
6684 *** Since you have quads, you could possibly try with -Duse64bitint.
6685 EOM
6686                         ;;
6687                 esac
6688                 cat <<EOM >&4
6689 *** Cannot continue, aborting.
6690
6691 EOM
6692
6693                 exit 1
6694                 ;;
6695         esac
6696         ;;
6697 esac
6698
6699
6700 : determine whether to use malloc wrapping
6701 echo " "
6702 case "$usemallocwrap" in
6703 [yY]*|true|$define)     dflt='y' ;;
6704 [nN]*|false|$undef)     dflt='n' ;;
6705 *)      case "$usedevel" in
6706         [yY]*|true|$define)     dflt='y' ;;
6707         *) dflt='n' ;;
6708         esac
6709         ;;
6710 esac
6711 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6712 . ./myread
6713 usemallocwrap="$ans"
6714 case "$ans" in
6715 y*|true)
6716         usemallocwrap="$define" ;;
6717 *)
6718         usemallocwrap="$undef" ;;
6719 esac
6720
6721 : determine which malloc to compile in
6722 echo " "
6723 case "$usemymalloc" in
6724 [yY]*|true|$define)     dflt='y' ;;
6725 [nN]*|false|$undef)     dflt='n' ;;
6726 *)      case "$ptrsize" in
6727         4) dflt='y' ;;
6728         *) dflt='n' ;;
6729         esac
6730         ;;
6731 esac
6732 rp="Do you wish to attempt to use the malloc that comes with $package?"
6733 . ./myread
6734 usemymalloc="$ans"
6735 case "$ans" in
6736 y*|true)
6737         usemymalloc='y'
6738         mallocsrc='malloc.c'
6739         mallocobj="malloc$_o"
6740         d_mymalloc="$define"
6741         case "$libs" in
6742         *-lmalloc*)
6743                 : Remove malloc from list of libraries to use
6744                 echo "Removing unneeded -lmalloc from library list" >&4
6745                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6746                 shift
6747                 libs="$*"
6748                 echo "libs = $libs" >&4
6749                 ;;
6750         esac
6751         ;;
6752 *)
6753         usemymalloc='n'
6754         mallocsrc=''
6755         mallocobj=''
6756         d_mymalloc="$undef"
6757         ;;
6758 esac
6759
6760 : compute the return types of malloc and free
6761 echo " "
6762 $cat >malloc.c <<END
6763 #$i_malloc I_MALLOC
6764 #$i_stdlib I_STDLIB
6765 #include <stdio.h>
6766 #include <sys/types.h>
6767 #ifdef I_MALLOC
6768 #include <malloc.h>
6769 #endif
6770 #ifdef I_STDLIB
6771 #include <stdlib.h>
6772 #endif
6773 #ifdef TRY_MALLOC
6774 void *malloc();
6775 #endif
6776 #ifdef TRY_FREE
6777 void free();
6778 #endif
6779 END
6780 case "$malloctype" in
6781 '')
6782         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6783                 malloctype='void *'
6784         else
6785                 malloctype='char *'
6786         fi
6787         ;;
6788 esac
6789 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6790
6791 case "$freetype" in
6792 '')
6793         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6794                 freetype='void'
6795         else
6796                 freetype='int'
6797         fi
6798         ;;
6799 esac
6800 echo "Your system uses $freetype free(), it would seem." >&4
6801 $rm -f malloc.[co]
6802 : determine where site specific architecture-dependent libraries go.
6803 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6804 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6805 : sitelib may have an optional trailing /share.
6806 case "$sitearch" in
6807 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6808         dflt="$dflt/$archname"
6809         ;;
6810 *)      dflt="$sitearch"
6811         ;;
6812 esac
6813 set sitearch sitearch none
6814 eval $prefixit
6815 $cat <<EOM
6816
6817 The installation process will also create a directory for
6818 architecture-dependent site-specific extensions and modules.
6819
6820 EOM
6821 fn=d~+
6822 rp='Pathname for the site-specific architecture-dependent library files?'
6823 . ./getfile
6824 prefixvar=sitearch
6825 . ./setprefixvar
6826 if $test X"$sitearch" = X"$sitelib"; then
6827         d_sitearch="$undef"
6828 else
6829         d_sitearch="$define"
6830 fi
6831
6832 $cat <<EOM
6833
6834 The installation process will also create a directory for
6835 vendor-supplied add-ons.  Vendors who supply perl with their system
6836 may find it convenient to place all vendor-supplied files in this
6837 directory rather than in the main distribution directory.  This will
6838 ease upgrades between binary-compatible maintenance versions of perl.
6839
6840 Of course you may also use these directories in whatever way you see
6841 fit.  For example, you might use them to access modules shared over a
6842 company-wide network.
6843
6844 The default answer should be fine for most people.
6845 This causes further questions about vendor add-ons to be skipped
6846 and no vendor-specific directories will be configured for perl.
6847
6848 EOM
6849 rp='Do you want to configure vendor-specific add-on directories?'
6850 case "$usevendorprefix" in
6851 define|true|[yY]*) dflt=y ;;
6852 *)      : User may have set vendorprefix directly on Configure command line.
6853         case "$vendorprefix" in
6854         ''|' ') dflt=n ;;
6855         *)      dflt=y ;;
6856         esac
6857         ;;
6858 esac
6859 . ./myread
6860 case "$ans" in
6861 [yY]*)  fn=d~+
6862         rp='Installation prefix to use for vendor-supplied add-ons?'
6863         case "$vendorprefix" in
6864         '') dflt='' ;;
6865         *)  dflt=$vendorprefix ;;
6866         esac
6867         . ./getfile
6868         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6869         oldvendorprefix=''
6870         case "$vendorprefix" in
6871         '') ;;
6872         *)      case "$ans" in
6873                 "$prefix") ;;
6874                 *) oldvendorprefix="$prefix";;
6875                 esac
6876                 ;;
6877         esac
6878         usevendorprefix="$define"
6879         vendorprefix="$ans"
6880         vendorprefixexp="$ansexp"
6881         ;;
6882 *)      usevendorprefix="$undef"
6883         vendorprefix=''
6884         vendorprefixexp=''
6885         ;;
6886 esac
6887
6888 case "$vendorprefix" in
6889 '')     d_vendorlib="$undef"
6890         vendorlib=''
6891         vendorlibexp=''
6892         ;;
6893 *)      d_vendorlib="$define"
6894         : determine where vendor-supplied modules go.
6895         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6896         case "$vendorlib" in
6897         '')
6898                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6899                 case "$installstyle" in
6900                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6901                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6902                 esac
6903                 ;;
6904         *)      dflt="$vendorlib"
6905                 ;;
6906         esac
6907         fn=d~+
6908         rp='Pathname for the vendor-supplied library files?'
6909         . ./getfile
6910         vendorlib="$ans"
6911         vendorlibexp="$ansexp"
6912         ;;
6913 esac
6914 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6915 prefixvar=vendorlib
6916 . ./installprefix
6917
6918 case "$vendorprefix" in
6919 '')     d_vendorarch="$undef"
6920         vendorarch=''
6921         vendorarchexp=''
6922         ;;
6923 *)      d_vendorarch="$define"
6924         : determine where vendor-supplied architecture-dependent libraries go.
6925         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6926         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6927         : vendorlib may have an optional trailing /share.
6928         case "$vendorarch" in
6929         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6930                 dflt="$dflt/$archname"
6931                 ;;
6932         *)      dflt="$vendorarch" ;;
6933         esac
6934         fn=d~+
6935         rp='Pathname for vendor-supplied architecture-dependent files?'
6936         . ./getfile
6937         vendorarch="$ans"
6938         vendorarchexp="$ansexp"
6939         ;;
6940 esac
6941 prefixvar=vendorarch
6942 . ./installprefix
6943
6944 : Final catch-all directories to search
6945 $cat <<EOM
6946
6947 Lastly, you can have perl look in other directories for extensions and
6948 modules in addition to those already specified.
6949 These directories will be searched after 
6950         $sitearch 
6951         $sitelib 
6952 EOM
6953 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6954 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6955 echo ' '
6956 case "$otherlibdirs" in
6957 ''|' ') dflt='none' ;;
6958 *)      dflt="$otherlibdirs" ;;
6959 esac
6960 $cat <<EOM
6961 Enter a colon-separated set of extra paths to include in perl's @INC
6962 search path, or enter 'none' for no extra paths.
6963
6964 EOM
6965
6966 rp='Colon-separated list of additional directories for perl to search?'
6967 . ./myread
6968 case "$ans" in
6969 ' '|''|none)    otherlibdirs=' ' ;;     
6970 *)      otherlibdirs="$ans" ;;
6971 esac
6972 case "$otherlibdirs" in
6973 ' ') val=$undef ;;
6974 *)      val=$define ;;
6975 esac
6976 set d_perl_otherlibdirs
6977 eval $setvar
6978
6979 : Cruising for prototypes
6980 echo " "
6981 echo "Checking out function prototypes..." >&4
6982 $cat >prototype.c <<EOCP
6983 #$i_stdlib I_STDLIB
6984 #ifdef I_STDLIB
6985 #include <stdlib.h>
6986 #endif
6987 int main(int argc, char *argv[]) {
6988         exit(0);}
6989 EOCP
6990 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6991         echo "Your C compiler appears to support function prototypes."
6992         val="$define"
6993 else
6994         echo "Your C compiler doesn't seem to understand function prototypes."
6995         val="$undef"
6996 fi
6997 set prototype
6998 eval $setvar
6999 $rm -f prototype*
7000
7001 case "$prototype" in
7002 "$define") ;;
7003 *)      ansi2knr='ansi2knr'
7004         echo " "
7005         cat <<EOM >&4
7006
7007 $me:  FATAL ERROR:
7008 This version of $package can only be compiled by a compiler that 
7009 understands function prototypes.  Unfortunately, your C compiler 
7010         $cc $ccflags
7011 doesn't seem to understand them.  Sorry about that.
7012
7013 If GNU cc is available for your system, perhaps you could try that instead.  
7014
7015 Eventually, we hope to support building Perl with pre-ANSI compilers.
7016 If you would like to help in that effort, please contact <perlbug@perl.org>.
7017
7018 Aborting Configure now.
7019 EOM
7020         exit 2
7021         ;;
7022 esac
7023
7024 echo " "
7025 case "$extras" in
7026 '') dflt='n';;
7027 *) dflt='y';;
7028 esac
7029 cat <<EOM
7030 Perl can be built with extra modules or bundles of modules which
7031 will be fetched from the CPAN and installed alongside Perl.
7032
7033 Notice that you will need access to the CPAN; either via the Internet,
7034 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7035 be asked later to configure the CPAN.pm module which will in turn do
7036 the installation of the rest of the extra modules or bundles.)
7037
7038 Notice also that if the modules require any external software such as
7039 libraries and headers (the libz library and the zlib.h header for the
7040 Compress::Zlib module, for example) you MUST have any such software
7041 already installed, this configuration process will NOT install such
7042 things for you.
7043
7044 If this doesn't make any sense to you, just accept the default '$dflt'.
7045 EOM
7046 rp='Install any extra modules (y or n)?'
7047 . ./myread
7048 case "$ans" in
7049 y|Y)
7050         cat <<EOM
7051
7052 Please list any extra modules or bundles to be installed from CPAN,
7053 with spaces between the names.  The names can be in any format the
7054 'install' command of CPAN.pm will understand.  (Answer 'none',
7055 without the quotes, to install no extra modules or bundles.)
7056 EOM
7057         rp='Extras?'
7058         dflt="$extras"
7059         . ./myread
7060         extras="$ans"
7061 esac
7062 case "$extras" in
7063 ''|'none')
7064         val=''
7065         $rm -f ../extras.lst
7066         ;;
7067 *)      echo "(Saving the list of extras for later...)"
7068         echo "$extras" > ../extras.lst
7069         val="'$extras'"
7070         ;;
7071 esac
7072 set extras
7073 eval $setvar
7074 echo " "
7075
7076 : determine where html pages for programs go
7077 set html1dir html1dir none
7078 eval $prefixit
7079 $cat <<EOM
7080
7081 If you wish to install html files for programs in $spackage, indicate
7082 the appropriate directory here.  To skip installing html files,
7083 answer "none".
7084 EOM
7085 case "$html1dir" in
7086 ''|none|$undef|' ') dflt=none ;;
7087 *) dflt=$html1dir ;;
7088 esac
7089 fn=dn+~
7090 rp="Directory for the main $spackage html pages?"
7091 . ./getfile
7092 prefixvar=html1dir
7093 . ./setprefixvar
7094 : Use ' ' for none so value is preserved next time through Configure
7095 $test X"$html1dir" = "X" && html1dir=' '
7096
7097 : determine where html pages for libraries and modules go
7098 set html3dir html3dir none
7099 eval $prefixit
7100 $cat <<EOM
7101
7102 If you wish to install html files for modules associated with $spackage,
7103 indicate the appropriate directory here.  To skip installing html files,
7104 answer "none".
7105 EOM
7106 : There is no obvious default.  If they have specified html1dir, then
7107 : try to key off that, possibly changing .../html1 into .../html3.
7108 case "$html3dir" in
7109 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7110 *) dflt=$html3dir ;;
7111 esac
7112 fn=dn+~
7113 rp="Directory for the $spackage module html pages?"
7114 . ./getfile
7115 prefixvar=html3dir
7116 . ./setprefixvar
7117 : Use ' ' for none so value is preserved next time through Configure
7118 $test X"$html3dir" = "X" && html3dir=' '
7119
7120 : determine whether to install perl also as /usr/bin/perl
7121
7122 echo " "
7123 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7124         $cat <<EOM
7125 Many scripts expect perl to be installed as /usr/bin/perl.
7126
7127 If you want to, I can install the perl you are about to compile
7128 as /usr/bin/perl (in addition to $bin/perl).
7129 EOM
7130         if test -f /usr/bin/perl; then
7131             $cat <<EOM
7132
7133 However, please note that because you already have a /usr/bin/perl,
7134 overwriting that with a new Perl would very probably cause problems.
7135 Therefore I'm assuming you don't want to do that (unless you insist).
7136
7137 EOM
7138             case "$installusrbinperl" in
7139             "$define"|[yY]*)    dflt='y';;
7140             *)                  dflt='n';;
7141             esac
7142         else
7143             $cat <<EOM
7144
7145 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7146
7147 EOM
7148             case "$installusrbinperl" in
7149             "$undef"|[nN]*)     dflt='n';;
7150             *)                  dflt='y';;
7151             esac
7152         fi
7153         rp="Do you want to install perl as /usr/bin/perl?"
7154         . ./myread
7155         case "$ans" in
7156         [yY]*)  val="$define";;
7157         *)      val="$undef" ;;
7158         esac
7159 else
7160         val="$undef"
7161 fi
7162 set installusrbinperl
7163 eval $setvar
7164
7165 echo " "
7166 echo "Checking for GNU C Library..." >&4
7167 cat >try.c <<'EOCP'
7168 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7169    alone are insufficient to distinguish different versions, such as
7170    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7171    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7172 */
7173 #include <stdio.h>
7174 int main(void)
7175 {
7176 #ifdef __GLIBC__
7177 #   ifdef __GLIBC_MINOR__
7178 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7179 #           include <gnu/libc-version.h>
7180             printf("%s\n",  gnu_get_libc_version());
7181 #       else
7182             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7183 #       endif
7184 #   else
7185         printf("%d\n",  __GLIBC__);
7186 #   endif
7187     return 0;
7188 #else
7189     return 1;
7190 #endif
7191 }
7192 EOCP
7193 set try
7194 if eval $compile_ok && $run ./try > glibc.ver; then
7195         val="$define"
7196         gnulibc_version=`$cat glibc.ver`
7197         echo "You are using the GNU C Library version $gnulibc_version"
7198 else
7199         val="$undef"
7200         gnulibc_version=''
7201         echo "You are not using the GNU C Library"
7202 fi
7203 $rm_try glibc.ver
7204 set d_gnulibc
7205 eval $setvar
7206
7207 : see if nm is to be used to determine whether a symbol is defined or not
7208 case "$usenm" in
7209 '')
7210         dflt=''
7211         case "$d_gnulibc" in
7212         "$define")
7213                 echo " "
7214                 echo "nm probably won't work on the GNU C Library." >&4
7215                 dflt=n
7216                 ;;
7217         esac
7218         case "$dflt" in
7219         '') 
7220                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7221                         echo " "
7222                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7223                         echo "'nm' won't be sufficient on this sytem." >&4
7224                         dflt=n
7225                 fi
7226                 ;;
7227         esac
7228         case "$dflt" in
7229         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7230                 if $test $dflt -gt 20; then
7231                         dflt=y
7232                 else
7233                         dflt=n
7234                 fi
7235                 ;;
7236         esac
7237         ;;
7238 *)
7239         case "$usenm" in
7240         true|$define) dflt=y;;
7241         *) dflt=n;;
7242         esac
7243         ;;
7244 esac
7245 $cat <<EOM
7246
7247 I can use $nm to extract the symbols from your C libraries. This
7248 is a time consuming task which may generate huge output on the disk (up
7249 to 3 megabytes) but that should make the symbols extraction faster. The
7250 alternative is to skip the 'nm' extraction part and to compile a small
7251 test program instead to determine whether each symbol is present. If
7252 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7253 this may be the best solution.
7254
7255 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7256
7257 EOM
7258 rp="Shall I use $nm to extract C symbols from the libraries?"
7259 . ./myread
7260 case "$ans" in
7261 [Nn]*) usenm=false;;
7262 *) usenm=true;;
7263 esac
7264
7265 runnm=$usenm
7266 case "$reuseval" in
7267 true) runnm=false;;
7268 esac
7269
7270 : nm options which may be necessary
7271 case "$nm_opt" in
7272 '') if $test -f /mach_boot; then
7273                 nm_opt=''       # Mach
7274         elif $test -d /usr/ccs/lib; then
7275                 nm_opt='-p'     # Solaris (and SunOS?)
7276         elif $test -f /dgux; then
7277                 nm_opt='-p'     # DG-UX
7278         elif $test -f /lib64/rld; then
7279                 nm_opt='-p'     # 64-bit Irix
7280         else
7281                 nm_opt=''
7282         fi;;
7283 esac
7284
7285 : nm options which may be necessary for shared libraries but illegal
7286 : for archive libraries.  Thank you, Linux.
7287 case "$nm_so_opt" in
7288 '')     case "$myuname" in
7289         *linux*|gnu*)
7290                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7291                         nm_so_opt='--dynamic'
7292                 fi
7293                 ;;
7294         esac
7295         ;;
7296 esac
7297
7298 case "$runnm" in
7299 true)
7300 : get list of predefined functions in a handy place
7301 echo " "
7302 case "$libc" in
7303 '') libc=unknown
7304         case "$libs" in
7305         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7306         esac
7307         ;;
7308 esac
7309 case "$libs" in
7310 '') ;;
7311 *)  for thislib in $libs; do
7312         case "$thislib" in
7313         -lc|-lc_s)
7314                 : Handle C library specially below.
7315                 ;;
7316         -l*)
7317                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7318                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7319                         :
7320                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7321                         :
7322                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7323                         :
7324                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7325                         :
7326                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7327                         :
7328                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7329                         :
7330                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7331                         :
7332                 else
7333                         try=''
7334                 fi
7335                 libnames="$libnames $try"
7336                 ;;
7337         *) libnames="$libnames $thislib" ;;
7338         esac
7339         done
7340         ;;
7341 esac
7342 xxx=normal
7343 case "$libc" in
7344 unknown)
7345         set /lib/libc.$so
7346         for xxx in $libpth; do
7347                 $test -r $1 || set $xxx/libc.$so
7348                 : The messy sed command sorts on library version numbers.
7349                 $test -r $1 || \
7350                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7351                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7352                                 h
7353                                 s/[0-9][0-9]*/0000&/g
7354                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7355                                 G
7356                                 s/\n/ /' | \
7357                          $sort | $sed -e 's/^.* //'`
7358                 eval set \$$#
7359         done
7360         $test -r $1 || set /usr/ccs/lib/libc.$so
7361         $test -r $1 || set /lib/libsys_s$_a
7362         ;;
7363 *)
7364         set blurfl
7365         ;;
7366 esac
7367 if $test -r "$1"; then
7368         echo "Your (shared) C library seems to be in $1."
7369         libc="$1"
7370 elif $test -r /lib/libc && $test -r /lib/clib; then
7371         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7372         xxx=apollo
7373         libc='/lib/clib /lib/libc'
7374         if $test -r /lib/syslib; then
7375                 echo "(Your math library is in /lib/syslib.)"
7376                 libc="$libc /lib/syslib"
7377         fi
7378 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7379         echo "Your C library seems to be in $libc, as you said before."
7380 elif $test -r $incpath/usr/lib/libc$_a; then
7381         libc=$incpath/usr/lib/libc$_a;
7382         echo "Your C library seems to be in $libc.  That's fine."
7383 elif $test -r /lib/libc$_a; then
7384         libc=/lib/libc$_a;
7385         echo "Your C library seems to be in $libc.  You're normal."
7386 else
7387         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7388                 :
7389         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7390                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7391         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7392                 :
7393         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7394                 :
7395         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7396                 :
7397         else
7398                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7399         fi
7400         if $test -r "$tans"; then
7401                 echo "Your C library seems to be in $tans, of all places."
7402                 libc=$tans
7403         else
7404                 libc='blurfl'
7405         fi
7406 fi
7407 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7408         dflt="$libc"
7409         cat <<EOM
7410
7411 If the guess above is wrong (which it might be if you're using a strange
7412 compiler, or your machine supports multiple models), you can override it here.
7413
7414 EOM
7415 else
7416         dflt=''
7417         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7418         cat >&4 <<EOM
7419 I can't seem to find your C library.  I've looked in the following places:
7420
7421 EOM
7422         $sed 's/^/      /' libpath
7423         cat <<EOM
7424
7425 None of these seems to contain your C library. I need to get its name...
7426
7427 EOM
7428 fi
7429 fn=f
7430 rp='Where is your C library?'
7431 . ./getfile
7432 libc="$ans"
7433
7434 echo " "
7435 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7436 set X `cat libnames`
7437 shift
7438 xxx=files
7439 case $# in 1) xxx=file; esac
7440 echo "Extracting names from the following $xxx for later perusal:" >&4
7441 echo " "
7442 $sed 's/^/      /' libnames >&4
7443 echo " "
7444 $echo $n "This may take a while...$c" >&4
7445
7446 for file in $*; do
7447         case $file in
7448         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7449         *) $nm $nm_opt $file 2>/dev/null;;
7450         esac
7451 done >libc.tmp
7452
7453 $echo $n ".$c"
7454 $grep fprintf libc.tmp > libc.ptf
7455 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7456 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7457 xxx='[ADTSIW]'
7458 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7459         eval $xscan;\
7460         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7461                 eval $xrun
7462 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7463         eval $xscan;\
7464         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7465                 eval $xrun
7466 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7467         eval $xscan;\
7468         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7469                 eval $xrun
7470 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //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 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7475         eval $xscan;\
7476         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7477                 eval $xrun
7478 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7479         eval $xscan;\
7480         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7481                 eval $xrun
7482 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7483                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7484         eval $xscan;\
7485         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7486                 eval $xrun
7487 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7488         eval $xscan;\
7489         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7490                 eval $xrun
7491 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7492         eval $xscan;\
7493         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7494                 eval $xrun
7495 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7496         eval $xscan;\
7497         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7498                 eval $xrun
7499 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7500         eval $xscan;\
7501         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7502                 eval $xrun
7503 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7504         eval $xscan;\
7505         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7506                 eval $xrun
7507 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7508         eval $xscan;\
7509         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7510                 eval $xrun
7511 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7512         eval $xscan;\
7513         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7514                 eval $xrun
7515 else
7516         $nm -p $* 2>/dev/null >libc.tmp
7517         $grep fprintf libc.tmp > libc.ptf
7518         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7519                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7520         then
7521                 nm_opt='-p'
7522                 eval $xrun
7523         else
7524                 echo " "
7525                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7526                 com=''
7527                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7528                         for thisname in $libnames $libc; do
7529                                 $ar t $thisname >>libc.tmp
7530                         done
7531                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7532                         echo "Ok." >&4
7533                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7534                         # Repeat libc to extract forwarders to DLL entries too
7535                         for thisname in $libnames $libc; do
7536                                 $ar tv $thisname >>libc.tmp
7537                                 # Revision 50 of EMX has bug in $ar.
7538                                 # it will not extract forwarders to DLL entries
7539                                 # Use emximp which will extract exactly them.
7540                                 emximp -o tmp.imp $thisname \
7541                                     2>/dev/null && \
7542                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7543                                     < tmp.imp >>libc.tmp
7544                                 $rm tmp.imp
7545                         done
7546                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7547                         echo "Ok." >&4
7548                 else
7549                         echo "$ar didn't seem to work right." >&4
7550                         echo "Maybe this is a Cray...trying bld instead..." >&4
7551                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7552                         then
7553                                 for thisname in $libnames; do
7554                                         bld t $libnames | \
7555                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7556                                         $ar t $thisname >>libc.tmp
7557                                 done
7558                                 echo "Ok." >&4
7559                         else
7560                                 echo "That didn't work either.  Giving up." >&4
7561                                 exit 1
7562                         fi
7563                 fi
7564         fi
7565 fi
7566 nm_extract="$com"
7567 case "$PASE" in
7568 define)
7569     echo " "
7570     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7571     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7572     ;;
7573 *)  if $test -f /lib/syscalls.exp; then
7574         echo " "
7575         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7576         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7577     fi
7578     ;;
7579 esac
7580 ;;
7581 esac
7582 $rm -f libnames libpath
7583
7584 : see if dld is available
7585 set dld.h i_dld
7586 eval $inhdr
7587
7588
7589 echo " "
7590 echo "Checking for C++..." >&4
7591 $cat >try.c <<'EOCP'
7592 #include <stdio.h>
7593 int main(void)
7594 {
7595 #ifdef __cplusplus
7596     return 0;
7597 #else
7598     return 1;
7599 #endif
7600 }
7601 EOCP
7602 set try
7603 if eval $compile_ok && $run ./try; then
7604         val="$define"
7605         echo "You are using a C++ compiler."
7606 else
7607         val="$undef"
7608         echo "You are not using a C++ compiler."
7609 fi
7610 $rm_try cplusplus$$
7611 set d_cplusplus
7612 eval $setvar
7613
7614 : is a C symbol defined?
7615 csym='tlook=$1;
7616 case "$3" in
7617 -v) tf=libc.tmp; tdc="";;
7618 -a) tf=libc.tmp; tdc="[]";;
7619 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7620 esac;
7621 tx=yes;
7622 case "$reuseval-$4" in
7623 true-) ;;
7624 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7625 esac;
7626 case "$tx" in
7627 yes)
7628         tval=false;
7629         case "$d_cplusplus" in
7630                 $define) extern_C=\"C\";;
7631         esac;
7632         if $test "$runnm" = true; then
7633                 if $contains $tlook $tf >/dev/null 2>&1; then
7634                         tval=true;
7635                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7636                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7637                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7638                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7639                         $rm_try;
7640                 fi;
7641         else
7642                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7643                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7644                 $rm_try;
7645         fi;
7646         ;;
7647 *)
7648         case "$tval" in
7649         $define) tval=true;;
7650         *) tval=false;;
7651         esac;
7652         ;;
7653 esac;
7654 eval "$2=$tval"'
7655
7656 : define an is-in-libc? function
7657 inlibc='echo " "; td=$define; tu=$undef;
7658 sym=$1; var=$2; eval "was=\$$2";
7659 tx=yes;
7660 case "$reuseval$was" in
7661 true) ;;
7662 true*) tx=no;;
7663 esac;
7664 case "$tx" in
7665 yes)
7666         set $sym tres -f;
7667         eval $csym;
7668         case "$tres" in
7669         true)
7670                 echo "$sym() found." >&4;
7671                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7672         *)
7673                 echo "$sym() NOT found." >&4;
7674                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7675         esac;;
7676 *)
7677         case "$was" in
7678         $define) echo "$sym() found." >&4;;
7679         *) echo "$sym() NOT found." >&4;;
7680         esac;;
7681 esac'
7682
7683 : see if dlopen exists
7684 xxx_runnm="$runnm"
7685 xxx_ccflags="$ccflags"
7686 runnm=false
7687 : with g++ one needs -shared to get is-in-libc to work for dlopen
7688 case "$gccversion" in
7689 '')     ;;
7690 *)      case "$d_cplusplus" in
7691         "$define") ccflags="$ccflags -shared" ;;
7692         esac
7693         ;;
7694 esac
7695 set dlopen d_dlopen
7696 eval $inlibc
7697 runnm="$xxx_runnm"
7698 ccflags="$xxx_ccflags"
7699
7700 : see if this is a unistd.h system
7701 set unistd.h i_unistd
7702 eval $inhdr
7703
7704 : determine which dynamic loading, if any, to compile in
7705 echo " "
7706 dldir="ext/DynaLoader"
7707 case "$usedl" in
7708 $define|y|true)
7709         dflt='y'
7710         usedl="$define"
7711         ;;
7712 $undef|n|false)
7713         dflt='n'
7714         usedl="$undef"
7715         ;;
7716 *)
7717         dflt='n'
7718         case "$d_dlopen" in
7719             $define) dflt='y' ;;
7720         esac
7721         case "$i_dld" in
7722             $define) dflt='y' ;;
7723         esac
7724         : Does a dl_xxx.xs file exist for this operating system
7725         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7726         ;;
7727 esac
7728 rp="Do you wish to use dynamic loading?"
7729 . ./myread
7730 usedl="$ans"
7731 case "$ans" in
7732 y*) usedl="$define"
7733         case "$dlsrc" in
7734         '')
7735                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7736                         dflt="$dldir/dl_${osname}.xs"
7737                 elif $test "$d_dlopen" = "$define" ; then
7738                         dflt="$dldir/dl_dlopen.xs"
7739                 elif $test "$i_dld" = "$define" ; then
7740                         dflt="$dldir/dl_dld.xs"
7741                 else
7742                         dflt=''
7743                 fi
7744                 ;;
7745         *)      dflt="$dldir/$dlsrc"
7746                 ;;
7747         esac
7748     echo "The following dynamic loading files are available:"
7749         : Can not go over to $dldir because getfile has path hard-coded in.
7750         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7751         rp="Source file to use for dynamic loading"
7752         fn="fne"
7753         gfpth="$src"
7754         . ./getfile
7755         usedl="$define"
7756         : emulate basename
7757         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7758
7759         $cat << EOM
7760
7761 Some systems may require passing special flags to $cc -c to
7762 compile modules that will be used to create a shared library.
7763 To use no flags, say "none".
7764
7765 EOM
7766     case "$cccdlflags" in
7767     '') case "$gccversion" in
7768                 '') case "$osname" in
7769                         hpux)   dflt='+z' ;;
7770                         next)   dflt='none' ;;
7771                         irix*)  dflt='-KPIC' ;;
7772                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7773                         sunos)  dflt='-pic' ;;
7774                         *)      dflt='none' ;;
7775                     esac
7776                         ;;
7777                 *)  case "$osname" in
7778                         darwin) dflt='none' ;;
7779                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7780                         *)      dflt='-fpic' ;;
7781                     esac ;;
7782             esac ;;
7783         ' ') dflt='none' ;;
7784     *)  dflt="$cccdlflags" ;;
7785     esac
7786     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7787     . ./myread
7788     case "$ans" in
7789     none) cccdlflags=' ' ;;
7790     *) cccdlflags="$ans" ;;
7791     esac
7792
7793     cat << EOM
7794
7795 Some systems use ld to create libraries that can be dynamically loaded,
7796 while other systems (such as those using ELF) use $cc.
7797
7798 EOM
7799         case "$ld" in
7800         '')     $cat >try.c <<EOM
7801 /* Test for whether ELF binaries are produced */
7802 #include <fcntl.h>
7803 #$i_stdlib I_STDLIB
7804 #ifdef I_STDLIB
7805 #include <stdlib.h>
7806 #endif
7807 #$i_unistd I_UNISTD
7808 #ifdef I_UNISTD
7809 #include <unistd.h>
7810 #endif
7811 int main() {
7812         char b[4];
7813         int i = open("a.out",O_RDONLY);
7814         if(i == -1)
7815                 exit(1); /* fail */
7816         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7817                 exit(0); /* succeed (yes, it's ELF) */
7818         else
7819                 exit(1); /* fail */
7820 }
7821 EOM
7822                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7823                         cat <<EOM
7824 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7825 EOM
7826                         dflt="$cc"
7827                 else
7828                         echo "I'll use ld to build dynamic libraries."
7829                         dflt='ld'
7830                 fi
7831                 $rm_try
7832                 ;;
7833         *)      dflt="$ld"
7834                 ;;
7835         esac
7836
7837     rp="What command should be used to create dynamic libraries?"
7838     . ./myread
7839         ld="$ans"
7840
7841     cat << EOM
7842
7843 Some systems may require passing special flags to $ld to create a
7844 library that can be dynamically loaded.  If your ld flags include
7845 -L/other/path options to locate libraries outside your loader's normal
7846 search path, you may need to specify those -L options here as well.  To
7847 use no flags, say "none".
7848
7849 EOM
7850     case "$lddlflags" in
7851     '') case "$osname" in
7852                         beos) dflt='-nostart' ;;
7853                         hpux) dflt='-b';
7854                               case "$gccversion" in
7855                               '') dflt="$dflt +vnocompatwarnings" ;;
7856                               esac
7857                               ;;
7858                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7859                         next)  dflt='none' ;;
7860                         solaris) dflt='-G' ;;
7861                         sunos) dflt='-assert nodefinitions' ;;
7862                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7863                 *)     dflt='none' ;;
7864                         esac
7865                         ;;
7866     *) dflt="$lddlflags" ;;
7867     esac
7868
7869         : Try to guess additional flags to pick up local libraries.
7870         : Be careful not to append to a plain 'none'
7871         case "$dflt" in
7872         none) dflt='' ;;
7873         esac
7874         for thisflag in $ldflags; do
7875                 case "$thisflag" in
7876                 -L*|-R*|-Wl,-R*)
7877                         case " $dflt " in
7878                         *" $thisflag "*) ;;
7879                         *) dflt="$dflt $thisflag" ;;
7880                         esac
7881                         ;;
7882                 esac
7883         done
7884
7885         case "$dflt" in
7886         ''|' ') dflt='none' ;;
7887         esac
7888
7889     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7890     . ./myread
7891     case "$ans" in
7892     none) lddlflags=' ' ;;
7893     *) lddlflags="$ans" ;;
7894     esac
7895
7896         cat <<EOM
7897
7898 Some systems may require passing special flags to $cc to indicate that
7899 the resulting executable will use dynamic linking.  To use no flags,
7900 say "none".
7901
7902 EOM
7903     case "$ccdlflags" in
7904     '') case "$osname" in
7905             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7906             next|sunos) dflt='none' ;;
7907             *)          dflt='none' ;;
7908             esac ;;
7909     ' ')  dflt='none' ;;
7910     *)  dflt="$ccdlflags" ;;
7911     esac
7912     rp="Any special flags to pass to $cc to use dynamic linking?"
7913     . ./myread
7914     case "$ans" in
7915     none) ccdlflags=' ' ;;
7916     *) ccdlflags="$ans" ;;
7917     esac
7918     ;;
7919 *)  usedl="$undef"
7920         ld='ld'
7921     dlsrc='dl_none.xs'
7922     lddlflags=''
7923     ccdlflags=''
7924     ;;
7925 esac
7926
7927 also=''
7928 case "$usedl" in
7929 $undef)
7930         # No dynamic loading being used, so don't bother even to prompt.
7931         useshrplib='false'
7932         ;;
7933 *)      case "$useshrplib" in
7934         '')     case "$osname" in
7935                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7936                         dflt=y
7937                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7938                         ;;
7939                 next*)
7940                         case "$osvers" in
7941                         4*)     dflt=y
7942                                 also='Building a shared libperl is needed for MAB support.'
7943                                 ;;
7944                         *)      dflt=n
7945                                 ;;
7946                         esac
7947                         ;;
7948                 *)      dflt=n
7949                         ;;
7950                 esac
7951                 ;;
7952         $define|true|[Yy]*)
7953                 dflt=y
7954                 ;;
7955         *)      dflt=n
7956                 ;;
7957         esac
7958         $cat << EOM
7959
7960 The perl executable is normally obtained by linking perlmain.c with
7961 libperl${_a}, any static extensions (usually just DynaLoader), and
7962 any other libraries needed on this system (such as -lm, etc.).  Since
7963 your system supports dynamic loading, it is probably possible to build
7964 a shared libperl.$so.  If you will have more than one executable linked
7965 to libperl.$so, this will significantly reduce the size of each
7966 executable, but it may have a noticeable effect on performance.  The
7967 default is probably sensible for your system.
7968 $also
7969
7970 EOM
7971         rp="Build a shared libperl.$so (y/n)"
7972         . ./myread
7973         case "$ans" in
7974         true|$define|[Yy]*)
7975                 useshrplib='true'  ;;
7976         *)      useshrplib='false' ;;
7977         esac
7978         ;;
7979 esac
7980
7981 case "$useshrplib" in
7982 true)
7983         case "$libperl" in
7984         '')
7985                 # Figure out a good name for libperl.so.  Since it gets stored in
7986                 # a version-specific architecture-dependent library, the version
7987                 # number isn't really that important, except for making cc/ld happy.
7988                 #
7989                 # A name such as libperl.so.3.1
7990                 majmin="libperl.$so.$patchlevel.$subversion"
7991                 # A name such as libperl.so.301
7992                 majonly=`echo $patchlevel $subversion |
7993                         $awk '{printf "%d%02d", $1, $2}'`
7994                 majonly=libperl.$so.$majonly
7995                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7996                 # rely on figuring it out from the naming of libc.
7997                 case "${osname}${osvers}" in
7998                 next4*)
7999                         dflt=libperl.5.$so
8000                         # XXX How handle the --version stuff for MAB?
8001                         ;;
8002                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8003                         dflt=libperl.$so
8004                         ;;
8005                 cygwin*) # ld links against an importlib
8006                         dflt=libperl$lib_ext
8007                         ;;
8008                 *)      # Try to guess based on whether libc has major.minor.
8009                         case "$libc" in
8010                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8011                         *libc.$so.[0-9]*) dflt=$majonly ;;
8012                         *)      dflt=libperl.$so ;;
8013                         esac
8014                         ;;
8015                 esac
8016                 ;;
8017         *)      dflt=$libperl
8018                 ;;
8019         esac
8020         cat << EOM
8021
8022 I need to select a good name for the shared libperl.  If your system uses
8023 library names with major and minor numbers, then you might want something
8024 like $majmin.  Alternatively, if your system uses a single version
8025 number for shared libraries, then you might want to use $majonly.
8026 Or, your system might be quite happy with a simple libperl.$so.
8027
8028 Since the shared libperl will get installed into a version-specific
8029 architecture-dependent directory, the version number of the shared perl
8030 library probably isn't important, so the default should be o.k.
8031
8032 EOM
8033         rp='What name do you want to give to the shared libperl?'
8034         . ./myread
8035         libperl=$ans
8036         echo "Ok, I'll use $libperl"
8037         ;;
8038 *)
8039         libperl="libperl${_a}"
8040         ;;
8041 esac
8042
8043 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8044 case "$shrpdir" in
8045 '') ;;
8046 *)      $cat >&4 <<EOM
8047 WARNING:  Use of the shrpdir variable for the installation location of
8048 the shared $libperl is not supported.  It was never documented and
8049 will not work in this version.  Let me (perlbug@perl.org)
8050 know of any problems this may cause.
8051
8052 EOM
8053         case "$shrpdir" in
8054         "$archlibexp/CORE")
8055                 $cat >&4 <<EOM
8056 But your current setting of $shrpdir is
8057 the default anyway, so it's harmless.
8058 EOM
8059                 ;;
8060         *)
8061                 $cat >&4 <<EOM
8062 Further, your current attempted setting of $shrpdir
8063 conflicts with the value of $archlibexp/CORE
8064 that installperl will use.
8065 EOM
8066                 ;;
8067         esac
8068         ;;
8069 esac
8070
8071 # How will the perl executable find the installed shared $libperl?
8072 # Add $xxx to ccdlflags.
8073 # If we can't figure out a command-line option, use $shrpenv to
8074 # set env LD_RUN_PATH.  The main perl makefile uses this.
8075 shrpdir=$archlibexp/CORE
8076 xxx=''
8077 tmp_shrpenv=''
8078 if "$useshrplib"; then
8079     case "$osname" in 
8080         aix)
8081                 # We'll set it in Makefile.SH...
8082                 ;;
8083         solaris)
8084                 xxx="-R $shrpdir"
8085                 ;;
8086         freebsd|netbsd|openbsd|interix|dragonfly)
8087                 xxx="-Wl,-R$shrpdir"
8088                 ;;
8089         bsdos|linux|irix*|dec_osf|gnu*)
8090                 xxx="-Wl,-rpath,$shrpdir"
8091                 ;;
8092         next)
8093                 # next doesn't like the default...
8094                 ;;
8095         beos)
8096                 # beos doesn't like the default, either.
8097                 ;;
8098         hpux*)
8099                 # hpux doesn't like the default, either.
8100                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8101                 ;;
8102         *)
8103                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8104                 ;;
8105         esac
8106         case "$xxx" in
8107         '') ;;
8108         *)      
8109                 # Only add $xxx if it isn't already in ccdlflags.
8110                 case " $ccdlflags " in
8111                 *" $xxx "*)     ;;
8112                 *)      ccdlflags="$ccdlflags $xxx"
8113                         cat <<EOM >&4
8114
8115 Adding $xxx to the flags
8116 passed to $ld so that the perl executable will find the 
8117 installed shared $libperl.
8118
8119 EOM
8120                         ;;
8121                 esac
8122                 ;;
8123         esac
8124 fi
8125 # Fix ccdlflags in AIX for building external extensions.
8126 # (For building Perl itself bare -bE:perl.exp is needed,
8127 #  Makefile.SH takes care of this.)
8128 case "$osname" in
8129 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8130 esac
8131 # Respect a hint or command-line value.
8132 case "$shrpenv" in
8133 '') shrpenv="$tmp_shrpenv" ;;
8134 esac
8135 case "$ldlibpthname" in
8136 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8137 none)   ldlibpthname='' ;;
8138 esac
8139
8140 : determine where manual pages are on this system
8141 echo " "
8142 case "$sysman" in
8143 '') 
8144         syspath='/usr/share/man/man1 /usr/man/man1'
8145         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8146         syspath="$syspath /usr/man/u_man/man1"
8147         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8148         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8149         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8150         sysman=`./loc . /usr/man/man1 $syspath`
8151         ;;
8152 esac
8153 if $test -d "$sysman"; then
8154         echo "System manual is in $sysman." >&4
8155 else
8156         echo "Could not find manual pages in source form." >&4
8157 fi
8158
8159 : determine where manual pages go
8160 set man1dir man1dir none
8161 eval $prefixit
8162 $cat <<EOM
8163
8164 $spackage has manual pages available in source form.
8165 EOM
8166 case "$nroff" in
8167 nroff)
8168         echo "However, you don't have nroff, so they're probably useless to you."
8169         case "$man1dir" in
8170         '') man1dir="none";;
8171         esac;;
8172 esac
8173 echo "If you don't want the manual sources installed, answer 'none'."
8174 case "$man1dir" in
8175 ' ') dflt=none
8176         ;;
8177 '')
8178         lookpath="$prefixexp/share/man/man1"
8179         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8180         lookpath="$lookpath $prefixexp/man/p_man/man1"
8181         lookpath="$lookpath $prefixexp/man/u_man/man1"
8182         lookpath="$lookpath $prefixexp/man/man.1"
8183         case "$sysman" in
8184         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8185         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8186         esac
8187         set dflt
8188         eval $prefixup
8189         ;;
8190 *)  dflt="$man1dir"
8191         ;;
8192 esac
8193 echo " "
8194 fn=dn+~
8195 rp="Where do the main $spackage manual pages (source) go?"
8196 . ./getfile
8197 if $test "X$man1direxp" != "X$ansexp"; then
8198         installman1dir=''
8199 fi
8200 prefixvar=man1dir
8201 . ./setprefixvar
8202
8203 case "$man1dir" in
8204 '')     man1dir=' '
8205         installman1dir='';;
8206 esac
8207
8208 : What suffix to use on installed man pages
8209
8210 case "$man1dir" in
8211 ' ')
8212         man1ext='0'
8213         ;;
8214 *)
8215         rp="What suffix should be used for the main $spackage man pages?"
8216         case "$man1ext" in
8217         '')     case "$man1dir" in
8218                 *1)  dflt=1 ;;
8219                 *1p) dflt=1p ;;
8220                 *1pm) dflt=1pm ;;
8221                 *l) dflt=l;;
8222                 *n) dflt=n;;
8223                 *o) dflt=o;;
8224                 *p) dflt=p;;
8225                 *C) dflt=C;;
8226                 *L) dflt=L;;
8227                 *L1) dflt=L1;;
8228                 *) dflt=1;;
8229                 esac
8230                 ;;
8231         *)      dflt="$man1ext";;
8232         esac
8233         . ./myread
8234         man1ext="$ans"
8235         ;;
8236 esac
8237
8238 : see if we can have long filenames
8239 echo " "
8240 first=123456789abcdef
8241 $rm -f $first
8242 if (echo hi >$first) 2>/dev/null; then
8243         if $test -f 123456789abcde; then
8244                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8245                 val="$undef"
8246         else
8247                 echo 'You can have filenames longer than 14 characters.'>&4
8248                 val="$define"
8249         fi
8250 else
8251         $cat <<'EOM'
8252 You can't have filenames longer than 14 chars.
8253 You can't even think about them!
8254 EOM
8255         val="$undef"
8256 fi 
8257 set d_flexfnam
8258 eval $setvar
8259 $rm -rf 123456789abcde*
8260
8261 : determine where library module manual pages go
8262 set man3dir man3dir none
8263 eval $prefixit
8264 $cat <<EOM
8265
8266 $spackage has manual pages for many of the library modules.
8267 EOM
8268
8269 case "$nroff" in
8270 nroff)
8271         $cat <<'EOM'
8272 However, you don't have nroff, so they're probably useless to you.
8273 EOM
8274         case "$man3dir" in
8275         '') man3dir="none";;
8276         esac;;
8277 esac
8278
8279 case "$d_flexfnam" in
8280 undef)
8281         $cat <<'EOM'
8282 However, your system can't handle the long file names like File::Basename.3.
8283 EOM
8284         case "$man3dir" in
8285         '') man3dir="none";;
8286         esac;;
8287 esac
8288
8289 echo "If you don't want the manual sources installed, answer 'none'."
8290 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8291 case "$man3dir" in
8292 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8293         if $test -d "$privlib/man/man3"; then
8294                 cat <<EOM >&4
8295
8296 WARNING:  Previous versions of perl installed man3 pages into
8297 $privlib/man/man3.  This version will suggest a
8298 new default of $dflt.
8299 EOM
8300                 tdflt=$dflt
8301                 dflt='n'
8302                 rp='Do you wish to preserve the old behavior?(y/n)'
8303                 . ./myread
8304                 case "$ans" in
8305                 y*) dflt="$privlib/man/man3" ;;
8306                 *)  dflt=$tdflt ;;
8307                 esac
8308     fi
8309         ;;
8310 *)      dflt="$man3dir" ;;
8311 esac
8312 case "$dflt" in
8313 ' ') dflt=none ;;
8314 esac
8315 echo " "
8316 fn=dn+~
8317 rp="Where do the $package library man pages (source) go?"
8318 . ./getfile
8319 prefixvar=man3dir
8320 . ./setprefixvar
8321
8322 case "$man3dir" in
8323 '')     man3dir=' '
8324         installman3dir='';;
8325 esac
8326
8327 : What suffix to use on installed man pages
8328 case "$man3dir" in
8329 ' ')
8330         man3ext='0'
8331         ;;
8332 *)
8333         rp="What suffix should be used for the $package library man pages?"
8334         case "$man3ext" in
8335         '')     case "$man3dir" in
8336                 *3)  dflt=3 ;;
8337                 *3p) dflt=3p ;;
8338                 *3pm) dflt=3pm ;;
8339                 *l) dflt=l;;
8340                 *n) dflt=n;;
8341                 *o) dflt=o;;
8342                 *p) dflt=p;;
8343                 *C) dflt=C;;
8344                 *L) dflt=L;;
8345                 *L3) dflt=L3;;
8346                 *) dflt=3;;
8347                 esac
8348                 ;;
8349         *)      dflt="$man3ext";;
8350         esac
8351         . ./myread
8352         man3ext="$ans"
8353         ;;
8354 esac
8355
8356 : see if we have to deal with yellow pages, now NIS.
8357 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8358         if $test -f /usr/etc/nibindd; then
8359                 echo " "
8360                 echo "I'm fairly confident you're on a NeXT."
8361                 echo " "
8362                 rp='Do you get the hosts file via NetInfo?'
8363                 dflt=y
8364                 case "$hostcat" in
8365                 nidump*) ;;
8366                 '') ;;
8367                 *) dflt=n;;
8368                 esac
8369                 . ./myread
8370                 case "$ans" in
8371                 y*) hostcat='nidump hosts .';;
8372                 *)      case "$hostcat" in
8373                         nidump*) hostcat='';;
8374                         esac
8375                         ;;
8376                 esac
8377         fi
8378         case "$hostcat" in
8379         nidump*) ;;
8380         *)
8381                 case "$hostcat" in
8382                 *ypcat*) dflt=y;;
8383                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8384                                 dflt=y
8385                         else
8386                                 dflt=n
8387                         fi;;
8388                 *) dflt=n;;
8389                 esac
8390                 echo " "
8391                 rp='Are you getting the hosts file via yellow pages?'
8392                 . ./myread
8393                 case "$ans" in
8394                 y*) hostcat='ypcat hosts';;
8395                 *) hostcat='cat /etc/hosts';;
8396                 esac
8397                 ;;
8398         esac
8399 fi
8400 case "$hostcat" in
8401 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8402 esac
8403 case "$groupcat" in
8404 '') test -f /etc/group && groupcat='cat /etc/group';;
8405 esac
8406 case "$passcat" in
8407 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8408 esac
8409
8410 : now get the host name
8411 echo " "
8412 echo "Figuring out host name..." >&4
8413 case "$myhostname" in
8414 '') cont=true
8415         echo 'Maybe "hostname" will work...'
8416         if tans=`sh -c hostname 2>&1` ; then
8417                 myhostname=$tans
8418                 phostname=hostname
8419                 cont=''
8420         fi
8421         ;;
8422 *) cont='';;
8423 esac
8424 if $test "$cont"; then
8425         if ./xenix; then
8426                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8427                 if tans=`cat /etc/systemid 2>&1` ; then
8428                         myhostname=$tans
8429                         phostname='cat /etc/systemid'
8430                         echo "Whadyaknow.  Xenix always was a bit strange..."
8431                         cont=''
8432                 fi
8433         elif $test -r /etc/systemid; then
8434                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8435         fi
8436 fi
8437 if $test "$cont"; then
8438         echo 'No, maybe "uuname -l" will work...'
8439         if tans=`sh -c 'uuname -l' 2>&1` ; then
8440                 myhostname=$tans
8441                 phostname='uuname -l'
8442         else
8443                 echo 'Strange.  Maybe "uname -n" will work...'
8444                 if tans=`sh -c 'uname -n' 2>&1` ; then
8445                         myhostname=$tans
8446                         phostname='uname -n'
8447                 else
8448                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8449                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8450                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8451                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8452                         else
8453                                 case "$myhostname" in
8454                                 '') echo "Does this machine have an identity crisis or something?"
8455                                         phostname='';;
8456                                 *)
8457                                         echo "Well, you said $myhostname before..."
8458                                         phostname='echo $myhostname';;
8459                                 esac
8460                         fi
8461                 fi
8462         fi
8463 fi
8464 case "$myhostname" in
8465 '') myhostname=noname ;;
8466 esac
8467 : you do not want to know about this
8468 set $myhostname
8469 myhostname=$1
8470
8471 : verify guess
8472 if $test "$myhostname" ; then
8473         dflt=y
8474         rp='Your host name appears to be "'$myhostname'".'" Right?"
8475         . ./myread
8476         case "$ans" in
8477         y*) ;;
8478         *) myhostname='';;
8479         esac
8480 fi
8481
8482 : bad guess or no guess
8483 while $test "X$myhostname" = X ; do
8484         dflt=''
8485         rp="Please type the (one word) name of your host:"
8486         . ./myread
8487         myhostname="$ans"
8488 done
8489
8490 : translate upper to lower if necessary
8491 case "$myhostname" in
8492 *[A-Z]*)
8493         echo "(Normalizing case in your host name)"
8494         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8495         ;;
8496 esac
8497
8498 case "$myhostname" in
8499 *.*)
8500         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8501         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8502         echo "(Trimming domain name from host name--host name is now $myhostname)"
8503         ;;
8504 *) case "$mydomain" in
8505         '')
8506                 {
8507                         test "X$hostcat" = "Xypcat hosts" &&
8508                         ypmatch "$myhostname" hosts 2>/dev/null |\
8509                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8510                         $test -s hosts
8511                 } || {
8512                         test "X$hostcat" != "X" &&
8513                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8514                                         /[       ]$myhostname[  . ]/p" > hosts
8515                 }
8516                 tmp_re="[       . ]"
8517                 if $test -f hosts; then
8518                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8519                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8520                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8521                                 hosts | $sort | $uniq | \
8522                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8523                         case `$echo X$dflt` in
8524                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8525                                 dflt=.
8526                                 ;;
8527                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8528                                 ;;
8529                         esac
8530                 else
8531                         echo "(I cannot locate a hosts database anywhere)"
8532                         dflt=.
8533                 fi
8534                 case "$dflt" in
8535                 .)
8536                         tans=`./loc resolv.conf X /etc /usr/etc`
8537                         if $test -f "$tans"; then
8538                                 echo "(Attempting domain name extraction from $tans)"
8539                                 dflt=.`$sed -n -e 's/   / /g' \
8540                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8541                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8542                                 case "$dflt" in
8543                                 .) dflt=.`$sed -n -e 's/        / /g' \
8544                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8545                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8546                                         ;;
8547                                 esac
8548                         fi
8549                         ;;
8550                 esac
8551                 case "$dflt" in
8552                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8553                         dflt=.`sh -c domainname 2>/dev/null`
8554                         case "$dflt" in
8555                         '') dflt='.';;
8556                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8557                         esac
8558                         ;;
8559                 esac
8560                 case "$dflt$osname" in
8561                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8562                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8563                         ;;
8564                 esac
8565                 case "$dflt" in
8566                 .) echo "(Lost all hope -- silly guess then)"
8567                         dflt='.nonet'
8568                         ;;
8569                 esac
8570                 $rm -f hosts
8571                 ;;
8572         *) dflt="$mydomain";;
8573         esac;;
8574 esac
8575 echo " "
8576 rp="What is your domain name?"
8577 . ./myread
8578 tans="$ans"
8579 case "$ans" in
8580 '') ;;
8581 .*) ;;
8582 *) tans=".$tans";;
8583 esac
8584 mydomain="$tans"
8585
8586 : translate upper to lower if necessary
8587 case "$mydomain" in
8588 *[A-Z]*)
8589         echo "(Normalizing case in your domain name)"
8590         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8591         ;;
8592 esac
8593
8594 : a little sanity check here
8595 case "$phostname" in
8596 '') ;;
8597 *)
8598         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8599         $myhostname$mydomain|$myhostname) ;;
8600         *)
8601                 case "$phostname" in
8602                 sed*)
8603                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8604                         ;;
8605                 *)
8606                         echo "(That doesn't agree with your $phostname command, by the way.)"
8607                         ;;
8608                 esac
8609         ;;
8610         esac
8611         ;;
8612 esac
8613
8614 $cat <<EOM
8615
8616 I need to get your e-mail address in Internet format if possible, i.e.
8617 something like user@host.domain. Please answer accurately since I have
8618 no easy means to double check it. The default value provided below
8619 is most probably close to reality but may not be valid from outside
8620 your organization...
8621
8622 EOM
8623 cont=x
8624 while test "$cont"; do
8625         case "$cf_email" in
8626         '') dflt="$cf_by@$myhostname$mydomain";;
8627         *) dflt="$cf_email";;
8628         esac
8629         rp='What is your e-mail address?'
8630         . ./myread
8631         cf_email="$ans"
8632         case "$cf_email" in
8633         *@*.*) cont='' ;;
8634         *)
8635                 rp='Address does not look like an Internet one.  Use it anyway?'
8636                 case "$fastread" in
8637                 yes) dflt=y ;;
8638                 *) dflt=n ;;
8639                 esac
8640                 . ./myread
8641                 case "$ans" in
8642                 y*) cont='' ;;
8643                 *) echo " " ;;
8644                 esac
8645                 ;;
8646         esac
8647 done
8648
8649 $cat <<EOM
8650
8651 If you or somebody else will be maintaining perl at your site, please
8652 fill in the correct e-mail address here so that they may be contacted
8653 if necessary. Currently, the "perlbug" program included with perl
8654 will send mail to this address in addition to perlbug@perl.org. You may
8655 enter "none" for no administrator.
8656
8657 EOM
8658 case "$perladmin" in
8659 '') dflt="$cf_email";;
8660 *) dflt="$perladmin";;
8661 esac
8662 rp='Perl administrator e-mail address'
8663 . ./myread
8664 perladmin="$ans"
8665
8666 : determine whether to only install version-specific parts.
8667 echo " "
8668 $cat <<EOM
8669 Do you want to install only the version-specific parts of the perl
8670 distribution?  Usually you do *not* want to do this.
8671 EOM
8672 case "$versiononly" in
8673 "$define"|[Yy]*|true) dflt='y' ;;
8674 *) dflt='n';
8675 esac
8676 rp="Do you want to install only the version-specific parts of perl?"
8677 . ./myread
8678 case "$ans" in
8679 [yY]*)  val="$define";;
8680 *)      val="$undef" ;;
8681 esac
8682 set versiononly
8683 eval $setvar
8684
8685 case "$versiononly" in
8686 "$define") inc_version_list=''
8687            inc_version_list_init=0
8688            ;;
8689 esac
8690
8691 : figure out how to guarantee perl startup
8692 : XXX Note that this currently takes advantage of the bug that binexp ignores
8693 :     the Configure -Dinstallprefix setting, which in turn means that under
8694 :     relocatable @INC, initialinstalllocation is what binexp started as.
8695 case "$startperl" in
8696 '')
8697         case "$sharpbang" in
8698         *!)
8699                 $cat <<EOH
8700
8701 I can use the #! construct to start perl on your system. This will
8702 make startup of perl scripts faster, but may cause problems if you
8703 want to share those scripts and perl is not in a standard place
8704 ($initialinstalllocation/perl) on all your platforms. The alternative
8705 is to force a shell by starting the script with a single ':' character.
8706
8707 EOH
8708                 case "$versiononly" in
8709                 "$define")      dflt="$initialinstalllocation/perl$version";;
8710                 *)              dflt="$initialinstalllocation/perl";;
8711                 esac
8712                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8713                 . ./myread
8714                 case "$ans" in
8715                 none)   startperl=": # use perl";;
8716                 *)      startperl="#!$ans"
8717                         if $test 30 -lt `echo "$ans" | wc -c`; then
8718                                 $cat >&4 <<EOM
8719
8720 WARNING:  Some systems limit the #! command to 32 characters.
8721 If you experience difficulty running Perl scripts with #!, try
8722 installing Perl in a directory with a shorter pathname.
8723
8724 EOM
8725                         fi ;;
8726                 esac
8727                 ;;
8728         *) startperl=": # use perl"
8729                 ;;
8730         esac
8731         ;;
8732 esac
8733 echo "I'll use $startperl to start perl scripts."
8734
8735 : figure best path for perl in scripts
8736 case "$perlpath" in
8737 '')
8738         case "$versiononly" in
8739         "$define")      perlpath="$initialinstalllocation/perl$version";;
8740         *)              perlpath="$initialinstalllocation/perl";;
8741         esac
8742         case "$startperl" in
8743         *!*) ;;
8744         *)
8745                 $cat <<EOH
8746
8747 I will use the "eval 'exec'" idiom to start Perl on your system.
8748 I can use the full path of your Perl binary for this purpose, but
8749 doing so may cause problems if you want to share those scripts and
8750 Perl is not always in a standard place ($initialinstalllocation/perl).
8751
8752 EOH
8753                 dflt="$initialinstalllocation/perl"
8754                 rp="What path shall I use in \"eval 'exec'\"?"
8755                 . ./myread
8756                 perlpath="$ans"
8757                 ;;
8758         esac
8759         ;;
8760 esac
8761 case "$startperl" in
8762 *!*)    ;;
8763 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8764 esac
8765
8766 : determine where public executable scripts go
8767 set scriptdir scriptdir
8768 eval $prefixit
8769 case "$scriptdir" in
8770 '')
8771         dflt="$bin"
8772         : guess some guesses
8773         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8774         $test -d /usr/share/bin     && dflt=/usr/share/bin
8775         $test -d /usr/local/script  && dflt=/usr/local/script
8776         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8777         $test -d $prefixexp/script  && dflt=$prefixexp/script
8778         set dflt
8779         eval $prefixup
8780         ;;
8781 *)  dflt="$scriptdir"
8782         ;;
8783 esac
8784 $cat <<EOM
8785
8786 Some installations have a separate directory just for executable scripts so
8787 that they can mount it across multiple architectures but keep the scripts in
8788 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8789 Or you might just lump your scripts in with all your other executables.
8790
8791 EOM
8792 fn=d~
8793 rp='Where do you keep publicly executable scripts?'
8794 . ./getfile
8795 if $test "X$ansexp" != "X$scriptdirexp"; then
8796         installscript=''
8797 fi
8798 installscriptdir=''
8799 prefixvar=scriptdir
8800 . ./setprefixvar
8801 : A little fix up for an irregularly named variable.
8802 installscript="$installscriptdir"
8803
8804 : determine where add-on public executables go
8805 case "$sitebin" in
8806 '')     dflt=$siteprefix/bin ;;
8807 *)      dflt=$sitebin ;;
8808 esac
8809 fn=d~
8810 rp='Pathname where the add-on public executables should be installed?'
8811 . ./getfile
8812 prefixvar=sitebin
8813 . ./setprefixvar
8814
8815 : determine where add-on 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 "$sitehtml1dir" in
8819 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8820 *)     dflt=$sitehtml1dir ;;
8821 esac
8822 case "$dflt" in
8823 ''|' ') dflt=none ;;
8824 esac
8825 fn=dn+~
8826 rp='Pathname where the site-specific html pages should be installed?'
8827 . ./getfile
8828 prefixvar=sitehtml1dir
8829 . ./setprefixvar
8830
8831 : determine where add-on library html pages go
8832 : There is no standard location, so try to copy the previously-selected
8833 : directory structure for the core html pages.
8834 case "$sitehtml3dir" in
8835 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8836 *)     dflt=$sitehtml3dir ;;
8837 esac
8838 case "$dflt" in
8839 ''|' ') dflt=none ;;
8840 esac
8841 fn=dn+~
8842 rp='Pathname where the site-specific library html pages should be installed?'
8843 . ./getfile
8844 prefixvar=sitehtml3dir
8845 . ./setprefixvar
8846
8847 : determine where add-on manual pages go
8848 case "$siteman1dir" in
8849 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8850 *)      dflt=$siteman1dir ;;
8851 esac
8852 case "$dflt" in
8853 ''|' ') dflt=none ;;
8854 esac
8855 fn=dn+~
8856 rp='Pathname where the site-specific manual pages should be installed?'
8857 . ./getfile
8858 prefixvar=siteman1dir
8859 . ./setprefixvar
8860
8861 : determine where add-on library man pages go
8862 case "$siteman3dir" in
8863 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8864 *)      dflt=$siteman3dir ;;
8865 esac
8866 case "$dflt" in
8867 ''|' ') dflt=none ;;
8868 esac
8869 fn=dn+~
8870 rp='Pathname where the site-specific library manual pages should be installed?'
8871 . ./getfile
8872 prefixvar=siteman3dir
8873 . ./setprefixvar
8874
8875 : determine where add-on public executable scripts go
8876 case "$sitescript" in
8877 '')     dflt=$siteprefix/script
8878         $test -d $dflt || dflt=$sitebin ;;
8879 *)  dflt="$sitescript" ;;
8880 esac
8881 fn=d~+
8882 rp='Pathname where add-on public executable scripts should be installed?'
8883 . ./getfile
8884 prefixvar=sitescript
8885 . ./setprefixvar
8886
8887 case "$usefaststdio" in
8888 $define|true|[yY]*|'')
8889         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8890         case "$xversion" in
8891         [68])   dflt='y' ;;
8892         *)      dflt='n' ;;
8893         esac
8894         ;;
8895 *) dflt='n';;
8896 esac
8897 cat <<EOM
8898
8899 Perl can be built to use 'fast stdio', which means using the stdio
8900 library but also directly manipulating the stdio buffers to enable
8901 faster I/O.  Using stdio is better for backward compatibility (especially
8902 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8903 interface has been preferred instead of stdio.
8904
8905 If this doesn't make any sense to you, just accept the default '$dflt'.
8906 EOM
8907 rp='Use the "fast stdio" if available?'
8908 . ./myread
8909 case "$ans" in
8910 y|Y)    val="$define" ;;     
8911 *)      val="$undef" ;;
8912 esac
8913 set usefaststdio
8914 eval $setvar
8915
8916
8917 : define an is-a-typedef? function
8918 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8919 case "$inclist" in
8920 "") inclist="sys/types.h";;
8921 esac;
8922 eval "varval=\$$var";
8923 case "$varval" in
8924 "")
8925         $rm -f temp.c;
8926         for inc in $inclist; do
8927                 echo "#include <$inc>" >>temp.c;
8928         done;
8929         echo "#ifdef $type" >> temp.c;
8930         echo "printf(\"We have $type\");" >> temp.c;
8931         echo "#endif" >> temp.c;
8932         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8933         if $contains $type temp.E >/dev/null 2>&1; then
8934                 eval "$var=\$type";
8935         else
8936                 eval "$var=\$def";
8937         fi;
8938         $rm -f temp.?;;
8939 *) eval "$var=\$varval";;
8940 esac'
8941
8942 : define an is-a-typedef? function that prompts if the type is not available.
8943 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8944 case "$inclist" in
8945 "") inclist="sys/types.h";;
8946 esac;
8947 eval "varval=\$$var";
8948 case "$varval" in
8949 "")
8950         $rm -f temp.c;
8951         for inc in $inclist; do
8952                 echo "#include <$inc>" >>temp.c;
8953         done;
8954         echo "#ifdef $type" >> temp.c;
8955         echo "printf(\"We have $type\");" >> temp.c;
8956         echo "#endif" >> temp.c;
8957         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8958         echo " " ;
8959         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8960         if $contains $type temp.E >/dev/null 2>&1; then
8961                 echo "$type found." >&4;
8962                 eval "$var=\$type";
8963         else
8964                 echo "$type NOT found." >&4;
8965                 dflt="$def";
8966                 . ./myread ;
8967                 eval "$var=\$ans";
8968         fi;
8969         $rm -f temp.?;;
8970 *) eval "$var=\$varval";;
8971 esac'
8972
8973 : see what type lseek is declared as in the kernel
8974 rp="What is the type used for lseek's offset on this system?"
8975 set off_t lseektype long stdio.h sys/types.h
8976 eval $typedef_ask
8977
8978 echo " "
8979 echo "Checking to see how big your file offsets are..." >&4
8980 $cat >try.c <<EOCP
8981 #include <sys/types.h>
8982 #include <stdio.h>
8983 int main()
8984 {
8985     printf("%d\n", (int)sizeof($lseektype));
8986     return(0);
8987 }
8988 EOCP
8989 set try
8990 if eval $compile_ok; then
8991         lseeksize=`$run ./try`
8992         echo "Your file offsets are $lseeksize bytes long."
8993 else
8994         dflt=$longsize
8995         echo " "
8996         echo "(I can't seem to compile the test program.  Guessing...)"
8997         rp="What is the size of your file offsets (in bytes)?"
8998         . ./myread
8999         lseeksize="$ans"
9000 fi
9001 $rm_try
9002
9003 : see what type file positions are declared as in the library
9004 rp="What is the type for file position used by fsetpos()?"
9005 set fpos_t fpostype long stdio.h sys/types.h
9006 eval $typedef_ask
9007
9008 echo " "
9009 case "$fpostype" in
9010 *_t) zzz="$fpostype"    ;;
9011 *)   zzz="fpos_t"       ;;
9012 esac
9013 echo "Checking the size of $zzz..." >&4 
9014 cat > try.c <<EOCP
9015 #include <sys/types.h>
9016 #include <stdio.h>
9017 #$i_stdlib I_STDLIB
9018 #ifdef I_STDLIB
9019 #include <stdlib.h>
9020 #endif
9021 int main() {
9022     printf("%d\n", (int)sizeof($fpostype));
9023     exit(0);
9024 }
9025 EOCP
9026 set try
9027 if eval $compile_ok; then
9028         yyy=`$run ./try`
9029         case "$yyy" in
9030         '')     fpossize=4
9031                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9032                 ;;
9033         *)      fpossize=$yyy
9034                 echo "Your $zzz is $fpossize bytes long."
9035                 ;;
9036         esac
9037 else
9038         dflt="$longsize"
9039         echo " " >&4
9040         echo "(I can't compile the test program.  Guessing...)" >&4
9041         rp="What is the size of your file positions (in bytes)?"
9042         . ./myread
9043         fpossize="$ans"
9044 fi
9045
9046 # Backward compatibility (uselfs is deprecated).
9047 case "$uselfs" in
9048 "$define"|true|[yY]*)
9049         cat <<EOM >&4
9050
9051 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9052 EOM
9053         uselargefiles="$define"
9054         ;;
9055 esac
9056
9057 case "$lseeksize:$fpossize" in
9058 8:8) cat <<EOM
9059
9060 You can have files larger than 2 gigabytes.
9061 EOM
9062    val="$define" ;;
9063 *)    case "$uselargefiles" in
9064    "$undef"|false|[nN]*) dflt='n' ;;
9065    *)   dflt='y' ;;
9066    esac
9067    cat <<EOM
9068
9069 Perl can be built to understand large files (files larger than 2 gigabytes)
9070 on some systems.  To do so, Configure can be run with -Duselargefiles.
9071
9072 If this doesn't make any sense to you, just accept the default '$dflt'.
9073 EOM
9074    rp='Try to understand large files, if available?'
9075    . ./myread
9076    case "$ans" in
9077    y|Y)         val="$define" ;;
9078    *)           val="$undef"  ;;
9079    esac
9080    ;;
9081 esac
9082 set uselargefiles
9083 eval $setvar
9084 : Look for a hint-file generated 'call-back-unit'.  If the
9085 : user has specified that a large files perl is to be built,
9086 : we may need to set or change some other defaults.
9087 if $test -f uselargefiles.cbu; then
9088         echo "Your platform has some specific hints regarding large file builds, using them..."
9089         . ./uselargefiles.cbu
9090 fi
9091 case "$uselargefiles" in
9092 "$define")
9093         if $test -f uselargefiles.cbu; then
9094                 echo " "
9095                 echo "Rechecking to see how big your file offsets are..." >&4
9096                 $cat >try.c <<EOCP
9097 #include <sys/types.h>
9098 #include <stdio.h>
9099 int main()
9100 {
9101     printf("%d\n", (int)sizeof($lseektype));
9102     return(0);
9103 }
9104 EOCP
9105                 set try
9106                 if eval $compile_ok; then
9107                         lseeksize=`$run ./try`
9108                         $echo "Your file offsets are now $lseeksize bytes long."
9109                 else
9110                         dflt="$lseeksize"
9111                         echo " "
9112                         echo "(I can't seem to compile the test program.  Guessing...)"
9113                         rp="What is the size of your file offsets (in bytes)?"
9114                         . ./myread
9115                         lseeksize="$ans"
9116                 fi
9117                 case "$fpostype" in
9118                 *_t) zzz="$fpostype"    ;;
9119                 *)   zzz="fpos_t"       ;;
9120                 esac
9121                 $echo $n "Rechecking the size of $zzz...$c" >&4
9122                 $cat > try.c <<EOCP
9123 #include <sys/types.h>
9124 #include <stdio.h>
9125 #$i_stdlib I_STDLIB
9126 #ifdef I_STDLIB
9127 #include <stdlib.h>
9128 #endif
9129 int main() {
9130     printf("%d\n", (int)sizeof($fpostype));
9131     return(0);
9132 }
9133 EOCP
9134                 set try
9135                 if eval $compile_ok; then
9136                         yyy=`$run ./try`
9137                         dflt="$lseeksize"
9138                         case "$yyy" in
9139                         '')     echo " "
9140                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9141                                 ;;
9142                         *)      fpossize=$yyy
9143                                 echo " $fpossize bytes." >&4
9144                                 ;;
9145                         esac
9146                 else
9147                         dflt="$fpossize"
9148                         echo " "
9149                         echo "(I can't compile the test program.  Guessing...)" >&4
9150                         rp="What is the size of your file positions (in bytes)?"
9151                         . ./myread
9152                         fpossize="$ans"
9153                 fi
9154                 $rm_try
9155         fi
9156         ;;
9157 esac
9158
9159 case "$vendorprefix" in
9160 '')     d_vendorbin="$undef"
9161         vendorbin=''
9162         vendorbinexp=''
9163         ;;
9164 *)      d_vendorbin="$define"
9165         : determine where vendor-supplied executables go.
9166         case "$vendorbin" in
9167         '') dflt=$vendorprefix/bin ;;
9168         *)      dflt="$vendorbin" ;;
9169         esac
9170         fn=d~+
9171         rp='Pathname for the vendor-supplied executables directory?'
9172         . ./getfile
9173         vendorbin="$ans"
9174         vendorbinexp="$ansexp"
9175         ;;
9176 esac
9177 prefixvar=vendorbin
9178 . ./installprefix
9179
9180 case "$vendorprefix" in
9181 '')     vendorhtml1dir=''
9182         vendorhtml1direxp=''
9183         ;;
9184 *)      : determine where vendor-supplied html pages go.
9185         : There is no standard location, so try to copy the previously-selected
9186         : directory structure for the core html pages.
9187         : XXX Better default suggestions would be welcome.
9188         case "$vendorhtml1dir" in
9189         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9190         *)      dflt=$vendorhtml1dir ;;
9191         esac
9192         case "$dflt" in
9193         ''|' ') dflt=none ;;
9194         esac
9195         fn=dn+~
9196         rp='Pathname for the vendor-supplied html pages?'
9197         . ./getfile
9198         vendorhtml1dir="$ans"
9199         vendorhtml1direxp="$ansexp"
9200         ;;
9201 esac
9202 : Use ' ' for none so value is preserved next time through Configure
9203 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9204 prefixvar=vendorhtml1dir
9205 . ./installprefix
9206
9207 case "$vendorprefix" in
9208 '')     vendorhtml3dir=''
9209         vendorhtml3direxp=''
9210         ;;
9211 *)      : determine where vendor-supplied module html pages go.
9212         : There is no standard location, so try to copy the previously-selected
9213         : directory structure for the core html pages.
9214         : XXX Better default suggestions would be welcome.
9215         case "$vendorhtml3dir" in
9216         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9217         *)      dflt=$vendorhtml3dir ;;
9218         esac
9219         case "$dflt" in
9220         ''|' ') dflt=none ;;
9221         esac
9222         fn=dn+~
9223         rp='Pathname for the vendor-supplied html pages?'
9224         . ./getfile
9225         vendorhtml3dir="$ans"
9226         vendorhtml3direxp="$ansexp"
9227         ;;
9228 esac
9229 : Use ' ' for none so value is preserved next time through Configure
9230 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9231 prefixvar=vendorhtml3dir
9232 . ./installprefix
9233
9234 case "$vendorprefix" in
9235 '')     vendorman1dir=''
9236         vendorman1direxp=''
9237         ;;
9238 *)      : determine where vendor-supplied manual pages go.
9239         case "$vendorman1dir" in
9240         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9241         *)      dflt=$vendorman1dir ;;
9242         esac
9243         case "$dflt" in
9244         ''|' ') dflt=none ;;
9245         esac
9246         fn=nd~+
9247         rp='Pathname for the vendor-supplied manual section 1 pages?'
9248         . ./getfile
9249         vendorman1dir="$ans"
9250         vendorman1direxp="$ansexp"
9251         ;;
9252 esac
9253 : Use ' ' for none so value is preserved next time through Configure
9254 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9255 prefixvar=vendorman1dir
9256 . ./installprefix
9257
9258 case "$vendorprefix" in
9259 '')     vendorman3dir=''
9260         vendorman3direxp=''
9261         ;;
9262 *)      : determine where vendor-supplied module manual pages go.
9263         case "$vendorman3dir" in
9264         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9265         *)      dflt=$vendorman3dir ;;
9266         esac
9267         case "$dflt" in
9268         ''|' ') dflt=none ;;
9269         esac
9270         fn=nd~+
9271         rp='Pathname for the vendor-supplied manual section 3 pages?'
9272         . ./getfile
9273         vendorman3dir="$ans"
9274         vendorman3direxp="$ansexp"
9275         ;;
9276 esac
9277 : Use ' ' for none so value is preserved next time through Configure
9278 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9279 prefixvar=vendorman3dir
9280 . ./installprefix
9281
9282 case "$vendorprefix" in
9283 '')     d_vendorscript="$undef"
9284         vendorscript=''
9285         vendorscriptexp=''
9286         ;;
9287 *)      d_vendorscript="$define"
9288         : determine where vendor-supplied scripts go.
9289         case "$vendorscript" in
9290         '')     dflt=$vendorprefix/script
9291                 $test -d $dflt || dflt=$vendorbin ;;
9292         *)  dflt="$vendorscript" ;;
9293         esac
9294         $cat <<EOM
9295
9296 The installation process will create a directory for
9297 vendor-supplied scripts.
9298
9299 EOM
9300         fn=d~+
9301         rp='Pathname for the vendor-supplied scripts directory?'
9302         . ./getfile
9303         vendorscript="$ans"
9304         vendorscriptexp="$ansexp"
9305         ;;
9306 esac
9307 prefixvar=vendorscript
9308 . ./installprefix
9309
9310 : see if qgcvt exists
9311 set qgcvt d_qgcvt
9312 eval $inlibc
9313
9314 echo " "
9315
9316 if $test X"$d_longdbl" = X"$define"; then
9317
9318 echo "Checking how to print long doubles..." >&4
9319
9320 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9321         $cat >try.c <<'EOCP'
9322 #include <sys/types.h>
9323 #include <stdio.h>
9324 int main() {
9325   double d = 123.456;
9326   printf("%.3f\n", d);
9327 }
9328 EOCP
9329         set try
9330         if eval $compile; then
9331                 yyy=`$run ./try`
9332                 case "$yyy" in
9333                 123.456)
9334                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9335                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9336                         echo "We will use %f."
9337                         ;;
9338                 esac
9339         fi
9340 fi
9341
9342 if $test X"$sPRIfldbl" = X; then
9343         $cat >try.c <<'EOCP'
9344 #include <sys/types.h>
9345 #include <stdio.h>
9346 int main() {
9347   long double d = 123.456;
9348   printf("%.3Lf\n", d);
9349 }
9350 EOCP
9351         set try
9352         if eval $compile; then
9353                 yyy=`$run ./try`
9354                 case "$yyy" in
9355                 123.456)
9356                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9357                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9358                         echo "We will use %Lf."
9359                         ;;
9360                 esac
9361         fi
9362 fi
9363
9364 if $test X"$sPRIfldbl" = X; then
9365         $cat >try.c <<'EOCP'
9366 #include <sys/types.h>
9367 #include <stdio.h>
9368 int main() {
9369   long double d = 123.456;
9370   printf("%.3llf\n", d);
9371 }
9372 EOCP
9373         set try
9374         if eval $compile; then
9375                 yyy=`$run ./try`
9376                 case "$yyy" in
9377                 123.456)
9378                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9379                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9380                         echo "We will use %llf."
9381                         ;;
9382                 esac
9383         fi
9384 fi
9385
9386 if $test X"$sPRIfldbl" = X; then
9387         $cat >try.c <<'EOCP'
9388 #include <sys/types.h>
9389 #include <stdio.h>
9390 int main() {
9391   long double d = 123.456;
9392   printf("%.3lf\n", d);
9393 }
9394 EOCP
9395         set try
9396         if eval $compile; then
9397                 yyy=`$run ./try`
9398                 case "$yyy" in
9399                 123.456)
9400                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9401                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9402                         echo "We will use %lf."
9403                         ;;
9404                 esac
9405         fi
9406 fi
9407
9408 if $test X"$sPRIfldbl" = X; then
9409         echo "Cannot figure out how to print long doubles." >&4
9410 else
9411         sSCNfldbl=$sPRIfldbl    # expect consistency
9412 fi
9413
9414 $rm_try
9415
9416 fi # d_longdbl
9417
9418 case "$sPRIfldbl" in
9419 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9420         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9421         d_SCNfldbl="$undef";
9422         ;;
9423 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9424         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9425         d_SCNfldbl="$define";
9426         ;;
9427 esac
9428
9429 : Check how to convert floats to strings.
9430
9431 if test "X$d_Gconvert" = X; then
9432
9433 echo " "
9434 echo "Checking for an efficient way to convert floats to strings."
9435 echo " " > try.c
9436 case "$uselongdouble" in
9437 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9438 esac
9439 case "$d_longdbl" in
9440 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9441 esac
9442 case "$d_PRIgldbl" in
9443 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9444 esac
9445 $cat >>try.c <<EOP
9446 #ifdef TRY_gconvert
9447 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9448 char *myname = "gconvert";
9449 #endif
9450 #ifdef TRY_gcvt
9451 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9452 char *myname = "gcvt";
9453 #endif
9454 #ifdef TRY_qgcvt
9455 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9456 char *myname = "qgcvt";
9457 #define DOUBLETYPE long double
9458 #endif
9459 #ifdef TRY_sprintf
9460 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9461 #ifdef HAS_PRIgldbl
9462 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9463 #else
9464 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9465 #endif
9466 #else
9467 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9468 #endif
9469 char *myname = "sprintf";
9470 #endif
9471
9472 #ifndef DOUBLETYPE
9473 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9474 #define DOUBLETYPE long double
9475 #else
9476 #define DOUBLETYPE double
9477 #endif
9478 #endif
9479
9480 #include <stdio.h>
9481
9482 #define I_STDLIB $i_stdlib
9483 #ifdef I_STDLIB
9484 #include <stdlib.h>
9485 #endif
9486
9487 int
9488 checkit(expect, got)
9489 char *expect;
9490 char *got;
9491 {
9492     if (strcmp(expect, got)) {
9493                 printf("%s oddity:  Expected %s, got %s\n",
9494                         myname, expect, got);
9495                 exit(1);
9496         }
9497 }
9498
9499 int main()
9500 {
9501         char buf[64];
9502         buf[63] = '\0';
9503
9504         /* This must be 1st test on (which?) platform */
9505         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9506         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9507         checkit("0.1", buf);
9508
9509         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9510         checkit("0.01", buf);
9511
9512         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9513         checkit("0.001", buf);
9514
9515         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9516         checkit("0.0001", buf);
9517
9518         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9519         if (strlen(buf) > 5)
9520             checkit("9e-005", buf); /* for Microsoft ?? */
9521         else
9522             checkit("9e-05", buf);
9523
9524         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9525         checkit("1", buf);
9526
9527         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9528         checkit("1.1", buf);
9529
9530         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9531         checkit("1.01", buf);
9532
9533         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9534         checkit("1.001", buf);
9535
9536         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9537         checkit("1.0001", buf);
9538
9539         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9540         checkit("1.00001", buf);
9541
9542         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9543         checkit("1.000001", buf);
9544
9545         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9546         checkit("0", buf);
9547
9548         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9549         checkit("-1", buf);
9550
9551         /* Some Linux gcvt's give 1.e+5 here. */
9552         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9553         checkit("100000", buf);
9554
9555         /* Some Linux gcvt's give -1.e+5 here. */
9556         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9557         checkit("-100000", buf);
9558
9559         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9560         checkit("123.456", buf);
9561
9562         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9563         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9564         /* 34 should be enough to scare even long double
9565          * places into using the e notation. */
9566         if (strlen(buf) > 5)
9567             checkit("1e+034", buf); /* for Microsoft */
9568         else
9569             checkit("1e+34", buf);
9570
9571         /* For Perl, if you add additional tests here, also add them to
9572          * t/base/num.t for benefit of platforms not using Configure or
9573          * overriding d_Gconvert */
9574
9575         exit(0);
9576 }
9577 EOP
9578 : first add preferred functions to our list
9579 xxx_list=""
9580 for xxx_convert in $gconvert_preference; do
9581     case $xxx_convert in
9582     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9583     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9584     esac
9585 done
9586 : then add any others
9587 for xxx_convert in gconvert gcvt sprintf; do
9588     case "$xxx_list" in
9589     *$xxx_convert*) ;;
9590     *) xxx_list="$xxx_list $xxx_convert" ;;
9591     esac
9592 done
9593
9594 case "$d_longdbl$uselongdouble" in
9595 "$define$define")
9596     : again, add prefered functions to our list first
9597     xxx_ld_list=""
9598     for xxx_convert in $gconvert_ld_preference; do
9599         case $xxx_convert in
9600         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9601         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9602         esac
9603     done
9604     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9605     for xxx_convert in qgcvt sprintf $xxx_list; do
9606         case "$xxx_ld_list" in
9607         $xxx_convert*|*" $xxx_convert"*) ;;
9608         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9609         esac
9610     done
9611     : if sprintf cannot do long doubles, move it to the end
9612     if test "$d_PRIgldbl" != "$define"; then
9613         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9614     fi
9615     : if no qgcvt, remove it
9616     if test "$d_qgcvt" != "$define"; then
9617         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9618     fi
9619     : use the ld_list
9620     xxx_list="$xxx_ld_list"
9621     ;;
9622 esac
9623
9624 for xxx_convert in $xxx_list; do
9625         echo "Trying $xxx_convert..."
9626         $rm -f try try$_o core
9627         set try -DTRY_$xxx_convert
9628         if eval $compile; then
9629                 echo "$xxx_convert() found." >&4
9630                 if $run ./try; then
9631                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9632                         break;
9633                 else
9634                         echo "...But $xxx_convert didn't work as I expected."
9635                         xxx_convert=''
9636                 fi
9637         else
9638                 echo "$xxx_convert NOT found." >&4
9639         fi
9640 done
9641
9642 if test X$xxx_convert = X; then
9643     echo "*** WHOA THERE!!! ***" >&4
9644     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9645     xxx_convert=sprintf
9646 fi
9647
9648 case "$xxx_convert" in
9649 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9650 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9651 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9652 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9653    "$define$define$define")
9654       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9655    "$define$define$undef")
9656       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9657    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9658    esac
9659    ;;
9660 esac
9661
9662 fi
9663 $rm_try
9664
9665 : see if _fwalk exists
9666 set fwalk d__fwalk
9667 eval $inlibc
9668
9669 : Initialize h_fcntl
9670 h_fcntl=false
9671
9672 : Initialize h_sysfile
9673 h_sysfile=false
9674
9675 : access call always available on UNIX
9676 set access d_access
9677 eval $inlibc
9678
9679 : locate the flags for 'access()'
9680 case "$d_access" in
9681 "$define")
9682         echo " "
9683         $cat >access.c <<EOCP
9684 #include <sys/types.h>
9685 #ifdef I_FCNTL
9686 #include <fcntl.h>
9687 #endif
9688 #ifdef I_SYS_FILE
9689 #include <sys/file.h>
9690 #endif
9691 #ifdef I_UNISTD
9692 #include <unistd.h>
9693 #endif
9694 #$i_stdlib I_STDLIB
9695 #ifdef I_STDLIB
9696 #include <stdlib.h>
9697 #endif
9698 int main() {
9699         exit(R_OK);
9700 }
9701 EOCP
9702         : check sys/file.h first, no particular reason here
9703         if $test `./findhdr sys/file.h` && \
9704                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9705                 h_sysfile=true;
9706                 echo "<sys/file.h> defines the *_OK access constants." >&4
9707         elif $test `./findhdr fcntl.h` && \
9708                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9709                 h_fcntl=true;
9710                 echo "<fcntl.h> defines the *_OK access constants." >&4
9711         elif $test `./findhdr unistd.h` && \
9712                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9713                 echo "<unistd.h> defines the *_OK access constants." >&4
9714         else
9715                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9716         fi
9717         ;;
9718 esac
9719 $rm -f access*
9720
9721 : see if accessx exists
9722 set accessx d_accessx
9723 eval $inlibc
9724
9725 : see if aintl exists
9726 set aintl d_aintl
9727 eval $inlibc
9728
9729 : see if alarm exists
9730 set alarm d_alarm
9731 eval $inlibc
9732
9733 : see if POSIX threads are available
9734 set pthread.h i_pthread
9735 eval $inhdr
9736
9737 : define a fucntion to check prototypes
9738 $cat > protochk <<EOSH
9739 $startsh
9740 cc="$cc"
9741 optimize="$optimize"
9742 ccflags="$ccflags"
9743 prototype="$prototype"
9744 define="$define"
9745 rm_try="$rm_try"
9746 usethreads=$usethreads
9747 i_pthread=$i_pthread
9748 pthread_h_first=$pthread_h_first
9749 EOSH
9750
9751 $cat >> protochk <<'EOSH'
9752
9753 $rm_try
9754 foo="$1"
9755 shift
9756 while test $# -ge 2; do
9757         case "$1" in
9758                 $define) echo "#include <$2>" >> try.c ;;
9759                 literal) echo "$2" >> try.c ;;
9760         esac
9761     # Extra magic for the benefit of systems that need pthread.h
9762     # to be included early to correctly detect threadsafe functions.
9763     # Such functions must guarantee themselves, though, that the usethreads
9764     # and i_pthread have been defined, before calling protochk.
9765     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9766         echo "#include <pthread.h>" >> try.c
9767         pthread_h_done=yes
9768     fi
9769     shift 2
9770 done
9771 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9772 cat >> try.c <<'EOCP'
9773 #ifdef CAN_PROTOTYPE
9774 #define _(args) args
9775 #else
9776 #define _(args) ()
9777 #endif
9778 EOCP
9779 echo "$foo" >> try.c
9780 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9781 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9782 status=$?
9783 $rm_try
9784 exit $status
9785 EOSH
9786 chmod +x protochk
9787 $eunicefix protochk
9788
9789 hasproto='varname=$1; func=$2; shift; shift;
9790 while $test $# -ge 2; do
9791         case "$1" in
9792         $define) echo "#include <$2>";;
9793         esac ;
9794     shift 2;
9795 done > try.c;
9796 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9797 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9798         echo "$func() prototype found.";
9799         val="$define";
9800 else
9801         echo "$func() prototype NOT found.";
9802         val="$undef";
9803 fi;
9804 set $varname;
9805 eval $setvar;
9806 $rm_try tryout.c'
9807
9808 : see if sys/types.h has to be included
9809 set sys/types.h i_systypes
9810 eval $inhdr
9811
9812 : see if sys/select.h has to be included
9813 set sys/select.h i_sysselct
9814 eval $inhdr
9815
9816 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9817 while $test $# -ge 2; do
9818         case "$1" in
9819         $define) echo "#include <$2>";;
9820         esac ;
9821     shift 2;
9822 done > try.c;
9823 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9824 set try;
9825 if eval $compile; then
9826         val="$define";
9827 else
9828         val="$undef";
9829 fi;
9830 set $varname;
9831 eval $setvar;
9832 $rm_try'
9833
9834 : see if we should include time.h, sys/time.h, or both
9835 echo " "
9836 if test "X$timeincl" = X; then
9837         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9838         $echo $n "I'm now running the test program...$c"
9839         $cat >try.c <<EOCP
9840 #include <sys/types.h>
9841 #ifdef I_TIME
9842 #include <time.h>
9843 #endif
9844 #ifdef I_SYSTIME
9845 #ifdef SYSTIMEKERNEL
9846 #define KERNEL
9847 #endif
9848 #include <sys/time.h>
9849 #endif
9850 #ifdef I_SYSSELECT
9851 #include <sys/select.h>
9852 #endif
9853 #$i_stdlib I_STDLIB
9854 #ifdef I_STDLIB
9855 #include <stdlib.h>
9856 #endif
9857 int main()
9858 {
9859         struct tm foo;
9860 #ifdef S_TIMEVAL
9861         struct timeval bar;
9862 #endif
9863 #ifdef S_TIMEZONE
9864         struct timezone tzp;
9865 #endif
9866         if (foo.tm_sec == foo.tm_sec)
9867                 exit(0);
9868 #ifdef S_TIMEVAL
9869         if (bar.tv_sec == bar.tv_sec)
9870                 exit(0);
9871 #endif
9872         exit(1);
9873 }
9874 EOCP
9875         flags=''
9876         for s_timezone in '-DS_TIMEZONE' ''; do
9877         sysselect=''
9878         for s_timeval in '-DS_TIMEVAL' ''; do
9879         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9880         for i_time in '' '-DI_TIME'; do
9881         for i_systime in '-DI_SYSTIME' ''; do
9882                 case "$flags" in
9883                 '') $echo $n ".$c"
9884                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9885                         if eval $compile; then
9886                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9887                                 shift
9888                                 flags="$*"
9889                                 echo " "
9890                                 $echo $n "Succeeded with $flags$c"
9891                         fi
9892                         ;;
9893                 esac
9894         done
9895         done
9896         done
9897         done
9898         done
9899         timeincl=''
9900         echo " "
9901         case "$flags" in
9902         *SYSTIMEKERNEL*) i_systimek="$define"
9903                 timeincl=`./findhdr sys/time.h`
9904                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9905         *) i_systimek="$undef";;
9906         esac
9907         case "$flags" in
9908         *I_TIME*) i_time="$define"
9909                 timeincl=`./findhdr time.h`" $timeincl"
9910                 echo "We'll include <time.h>." >&4;;
9911         *) i_time="$undef";;
9912         esac
9913         case "$flags" in
9914         *I_SYSTIME*) i_systime="$define"
9915                 timeincl=`./findhdr sys/time.h`" $timeincl"
9916                 echo "We'll include <sys/time.h>." >&4;;
9917         *) i_systime="$undef";;
9918         esac
9919         $rm_try
9920 fi
9921 : see if struct tm knows about tm_zone
9922 case "$i_systime$i_time" in
9923 *$define*)
9924         echo " "
9925         echo "Checking to see if your struct tm has tm_zone field..." >&4
9926         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9927         eval $hasfield
9928         ;;
9929 *)      val="$undef"
9930         set d_tm_tm_zone
9931         eval $setvar
9932         ;;
9933 esac
9934 case "$d_tm_tm_zone" in
9935 "$define")      echo "Yes, it does."   ;;
9936 *)              echo "No, it doesn't." ;;
9937 esac
9938 : see if struct tm knows about tm_gmtoff
9939 case "$i_systime$i_time" in
9940 *$define*)
9941         echo " "
9942         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9943         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9944         eval $hasfield
9945         ;;
9946 *)      val="$undef"
9947         set d_tm_tm_gmtoff
9948         eval $setvar
9949         ;;
9950 esac
9951 case "$d_tm_tm_gmtoff" in
9952 "$define")      echo "Yes, it does."   ;;
9953 *)              echo "No, it doesn't." ;;
9954 esac
9955
9956 : see if asctime_r exists
9957 set asctime_r d_asctime_r
9958 eval $inlibc
9959 case "$d_asctime_r" in
9960 "$define")
9961         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9962         case "$d_asctime_r_proto:$usethreads" in
9963         ":define")      d_asctime_r_proto=define
9964                 set d_asctime_r_proto asctime_r $hdrs
9965                 eval $hasproto ;;
9966         *)      ;;
9967         esac
9968         case "$d_asctime_r_proto" in
9969         define)
9970         case "$asctime_r_proto" in
9971         ''|0) try='char* asctime_r(const struct tm*, char*);'
9972         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9973         esac
9974         case "$asctime_r_proto" in
9975         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9976         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9977         esac
9978         case "$asctime_r_proto" in
9979         ''|0) try='int asctime_r(const struct tm*, char*);'
9980         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9981         esac
9982         case "$asctime_r_proto" in
9983         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9984         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9985         esac
9986         case "$asctime_r_proto" in
9987         ''|0)   d_asctime_r=undef
9988                 asctime_r_proto=0
9989                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9990         * )     case "$asctime_r_proto" in
9991                 REENTRANT_PROTO*) ;;
9992                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9993                 esac
9994                 echo "Prototype: $try" ;;
9995         esac
9996         ;;
9997         *)      case "$usethreads" in
9998                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9999                 esac
10000                 d_asctime_r=undef
10001                 asctime_r_proto=0
10002                 ;;
10003         esac
10004         ;;
10005 *)      asctime_r_proto=0
10006         ;;
10007 esac
10008
10009 : see if atolf exists
10010 set atolf d_atolf
10011 eval $inlibc
10012
10013 : see if atoll exists
10014 set atoll d_atoll
10015 eval $inlibc
10016
10017 : Look for GCC-style attribute format
10018 case "$d_attribute_format" in
10019 '')
10020 echo " "
10021 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10022 $cat >attrib.c <<'EOCP'
10023 #include <stdio.h>
10024 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10025 EOCP
10026 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10027         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10028                 echo "Your C compiler doesn't support __attribute__((format))."
10029                 val="$undef"
10030         else
10031                 echo "Your C compiler supports __attribute__((format))."
10032                 val="$define"
10033         fi
10034 else
10035         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10036         val="$undef"
10037 fi
10038 ;;
10039 *) val="$d_attribute_format" ;;
10040 esac
10041 set d_attribute_format
10042 eval $setvar
10043 $rm -f attrib*
10044
10045 : Look for GCC-style attribute format with null format allowed
10046 case "$d_printf_format_null" in
10047 '') case "$d_attribute_format" in
10048     $define)
10049         echo " "
10050         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10051 $cat >attrib.c <<EOCP
10052 #include <stdio.h>
10053 #$i_stdlib I_STDLIB
10054 #ifdef I_STDLIB
10055 #include <stdlib.h>
10056 #endif
10057 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10058 int null_printf (char* pat,...) { return (int)pat; }
10059 int main () { exit(null_printf(NULL)); }
10060 EOCP
10061         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10062             : run the executable in case it produces a run-time warning
10063             if $run ./attrib >>attrib.out 2>&1; then
10064                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10065                     echo "Your C compiler doesn't allow __printf__ format to be null."
10066                     val="$undef"
10067                 else
10068                     echo "Your C compiler allows __printf__ format to be null."
10069                     val="$define"
10070                 fi
10071             else
10072             echo "Your C compiler executable failed with __printf__ format null."
10073             val="$undef"
10074         fi
10075     else
10076         echo "Your C compiler fails with __printf__ format null."
10077         val="$undef"
10078     fi
10079     ;;
10080     *)  val="$undef" ;;
10081     esac
10082 ;;
10083 *)  val="$d_printf_format_null" ;;
10084 esac
10085 set d_printf_format_null
10086 eval $setvar
10087 $rm -f attrib*
10088
10089 : Look for GCC-style attribute malloc
10090 case "$d_attribute_malloc" in
10091 '')
10092 echo " "
10093 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10094 $cat >attrib.c <<'EOCP'
10095 #include <stdio.h>
10096 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10097 EOCP
10098 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10099         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10100                 echo "Your C compiler doesn't support __attribute__((malloc))."
10101                 val="$undef"
10102         else
10103                 echo "Your C compiler supports __attribute__((malloc))."
10104                 val="$define"
10105         fi
10106 else
10107         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10108         val="$undef"
10109 fi
10110 ;;
10111 *) val="$d_attribute_malloc" ;;
10112 esac
10113 set d_attribute_malloc
10114 eval $setvar
10115 $rm -f attrib*
10116
10117 : Look for GCC-style attribute nonnull
10118 case "$d_attribute_nonnull" in
10119 '')
10120 echo " "
10121 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10122 $cat >attrib.c <<'EOCP'
10123 #include <stdio.h>
10124 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10125 EOCP
10126 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10127         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10128                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10129                 val="$undef"
10130         else
10131                 echo "Your C compiler supports __attribute__((nonnull))."
10132                 val="$define"
10133         fi
10134 else
10135         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10136         val="$undef"
10137 fi
10138 ;;
10139 *) val="$d_attribute_nonnull" ;;
10140 esac
10141 set d_attribute_nonnull
10142 eval $setvar
10143 $rm -f attrib*
10144
10145 : Look for GCC-style attribute noreturn
10146 case "$d_attribute_noreturn" in
10147 '')
10148 echo " "
10149 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10150 $cat >attrib.c <<'EOCP'
10151 #include <stdio.h>
10152 void fall_over_dead( void ) __attribute__((noreturn));
10153 EOCP
10154 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10155         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10156                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10157                 val="$undef"
10158         else
10159                 echo "Your C compiler supports __attribute__((noreturn))."
10160                 val="$define"
10161         fi
10162 else
10163         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10164         val="$undef"
10165 fi
10166 ;;
10167 *) val="$d_attribute_noreturn" ;;
10168 esac
10169 set d_attribute_noreturn
10170 eval $setvar
10171 $rm -f attrib*
10172
10173 : Look for GCC-style attribute pure
10174 case "$d_attribute_pure" in
10175 '')
10176 echo " "
10177 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10178 $cat >attrib.c <<'EOCP'
10179 #include <stdio.h>
10180 int square( int n ) __attribute__((pure));
10181 EOCP
10182 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10183         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10184                 echo "Your C compiler doesn't support __attribute__((pure))."
10185                 val="$undef"
10186         else
10187                 echo "Your C compiler supports __attribute__((pure))."
10188                 val="$define"
10189         fi
10190 else
10191         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10192         val="$undef"
10193 fi
10194 ;;
10195 *) val="$d_attribute_pure" ;;
10196 esac
10197 set d_attribute_pure
10198 eval $setvar
10199 $rm -f attrib*
10200
10201 : Look for GCC-style attribute unused
10202 case "$d_attribute_unused" in
10203 '')
10204 echo " "
10205 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10206 $cat >attrib.c <<'EOCP'
10207 #include <stdio.h>
10208 int do_something( int dummy __attribute__((unused)), int n );
10209 EOCP
10210 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10211         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10212                 echo "Your C compiler doesn't support __attribute__((unused))."
10213                 val="$undef"
10214         else
10215                 echo "Your C compiler supports __attribute__((unused))."
10216                 val="$define"
10217         fi
10218 else
10219         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10220         val="$undef"
10221 fi
10222 ;;
10223 *) val="$d_attribute_unused" ;;
10224 esac
10225 set d_attribute_unused
10226 eval $setvar
10227 $rm -f attrib*
10228
10229 : Look for GCC-style attribute warn_unused_result
10230 case "$d_attribute_warn_unused_result" in
10231 '')
10232 echo " "
10233 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10234 $cat >attrib.c <<'EOCP'
10235 #include <stdio.h>
10236 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10237 EOCP
10238 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10239         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10240                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10241                 val="$undef"
10242         else
10243                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10244                 val="$define"
10245         fi
10246 else
10247         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10248         val="$undef"
10249 fi
10250 ;;
10251 *) val="$d_attribute_warn_unused_result" ;;
10252 esac
10253 set d_attribute_warn_unused_result
10254 eval $setvar
10255 $rm -f attrib*
10256
10257 : see if bcmp exists
10258 set bcmp d_bcmp
10259 eval $inlibc
10260
10261 : see if bcopy exists
10262 set bcopy d_bcopy
10263 eval $inlibc
10264
10265 : see if getpgrp exists
10266 set getpgrp d_getpgrp
10267 eval $inlibc
10268
10269 case "$d_getpgrp" in
10270 "$define")
10271         echo " "
10272         echo "Checking to see which flavor of getpgrp is in use..."
10273         $cat >try.c <<EOP
10274 #$i_unistd I_UNISTD
10275 #include <sys/types.h>
10276 #ifdef I_UNISTD
10277 #  include <unistd.h>
10278 #endif
10279 #$i_stdlib I_STDLIB
10280 #ifdef I_STDLIB
10281 #include <stdlib.h>
10282 #endif
10283 int main()
10284 {
10285         if (getuid() == 0) {
10286                 printf("(I see you are running Configure as super-user...)\n");
10287                 setuid(1);
10288         }
10289 #ifdef TRY_BSD_PGRP
10290         if (getpgrp(1) == 0)
10291                 exit(0);
10292 #else
10293         if (getpgrp() > 0)
10294                 exit(0);
10295 #endif
10296         exit(1);
10297 }
10298 EOP
10299         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10300                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10301                 val="$define"
10302         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10303                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10304                 val="$undef"
10305         else
10306                 echo "I can't seem to compile and run the test program."
10307                 if ./usg; then
10308                         xxx="a USG one, i.e. you use getpgrp()."
10309                 else
10310                         # SVR4 systems can appear rather BSD-ish.
10311                         case "$i_unistd" in
10312                         $undef)
10313                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10314                                 val="$define"
10315                                 ;;
10316                         $define)
10317                                 xxx="probably a USG one, i.e. you use getpgrp()."
10318                                 val="$undef"
10319                                 ;;
10320                         esac
10321                 fi
10322                 echo "Assuming your getpgrp is $xxx" >&4
10323         fi
10324         ;;
10325 *) val="$undef";;
10326 esac
10327 set d_bsdgetpgrp
10328 eval $setvar
10329 $rm_try
10330
10331 : see if setpgrp exists
10332 set setpgrp d_setpgrp
10333 eval $inlibc
10334
10335 case "$d_setpgrp" in
10336 "$define")
10337         echo " "
10338         echo "Checking to see which flavor of setpgrp is in use..."
10339         $cat >try.c <<EOP
10340 #$i_unistd I_UNISTD
10341 #include <sys/types.h>
10342 #ifdef I_UNISTD
10343 #  include <unistd.h>
10344 #endif
10345 #$i_stdlib I_STDLIB
10346 #ifdef I_STDLIB
10347 #include <stdlib.h>
10348 #endif
10349 int main()
10350 {
10351         if (getuid() == 0) {
10352                 printf("(I see you are running Configure as super-user...)\n");
10353                 setuid(1);
10354         }
10355 #ifdef TRY_BSD_PGRP
10356         if (-1 == setpgrp(1, 1))
10357                 exit(0);
10358 #else
10359         if (setpgrp() != -1)
10360                 exit(0);
10361 #endif
10362         exit(1);
10363 }
10364 EOP
10365         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10366                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10367                 val="$define"
10368         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10369                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10370                 val="$undef"
10371         else
10372                 echo "(I can't seem to compile and run the test program.)"
10373                 if ./usg; then
10374                         xxx="a USG one, i.e. you use setpgrp()."
10375                 else
10376                         # SVR4 systems can appear rather BSD-ish.
10377                         case "$i_unistd" in
10378                         $undef)
10379                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10380                                 val="$define"
10381                                 ;;
10382                         $define)
10383                                 xxx="probably a USG one, i.e. you use setpgrp()."
10384                                 val="$undef"
10385                                 ;;
10386                         esac
10387                 fi
10388                 echo "Assuming your setpgrp is $xxx" >&4
10389         fi
10390         ;;
10391 *) val="$undef";;
10392 esac
10393 set d_bsdsetpgrp
10394 eval $setvar
10395 $rm_try
10396
10397 : Look for GCC-style __builtin_choose_expr
10398 case "$d_builtin_choose_expr" in
10399 '')
10400     echo " "
10401     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10402     $cat >try.c <<'EOCP'
10403 #include <assert.h>
10404 #include <stdlib.h>
10405 #include <stdio.h>
10406
10407 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10408
10409 int main(void) {
10410     assert( SYRINX(1) == 2112 );
10411     assert( SYRINX(1) != 5150 );
10412     assert( SYRINX(0) == 5150 );
10413     assert( SYRINX(0) != 2112 );
10414     puts( "All good!" );
10415     exit(0);
10416 }
10417
10418 EOCP
10419     set try
10420     if eval $compile; then
10421         echo "Your C compiler supports __builtin_choose_expr."
10422         val="$define"
10423     else
10424         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10425         val="$undef"
10426     fi
10427 ;;
10428 *) val="$d_builtin_choose_expr" ;;
10429 esac
10430
10431 set d_builtin_choose_expr
10432 eval $setvar
10433 $rm_try
10434
10435 : Look for GCC-style __builtin_expect
10436 case "$d_builtin_expect" in
10437 '')
10438     echo " "
10439     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10440     $cat >builtin.c <<'EOCP'
10441 int main(void) {
10442     int n = 50;
10443     if ( __builtin_expect(n, 0) ) n = 1;
10444 }
10445 EOCP
10446     set try
10447     if eval $compile; then
10448         echo "Your C compiler supports __builtin_choose_expr."
10449         val="$define"
10450     else
10451         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10452         val="$undef"
10453     fi
10454     ;;
10455 *) val="$d_builtin_expect" ;;
10456 esac
10457
10458 set d_builtin_expect
10459 eval $setvar
10460 $rm_try
10461
10462 : see if bzero exists
10463 set bzero d_bzero
10464 eval $inlibc
10465
10466 : see if stdarg is available
10467 echo " "
10468 if $test `./findhdr stdarg.h`; then
10469         echo "<stdarg.h> found." >&4
10470         valstd="$define"
10471 else
10472         echo "<stdarg.h> NOT found." >&4
10473         valstd="$undef"
10474 fi
10475
10476 : see if varags is available
10477 echo " "
10478 if $test `./findhdr varargs.h`; then
10479         echo "<varargs.h> found." >&4
10480 else
10481         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10482 fi
10483
10484 : set up the varargs testing programs
10485 $cat > varargs.c <<EOP
10486 #ifdef I_STDARG
10487 #include <stdarg.h>
10488 #endif
10489 #ifdef I_VARARGS
10490 #include <varargs.h>
10491 #endif
10492
10493 #ifdef I_STDARG
10494 int f(char *p, ...)
10495 #else
10496 int f(va_alist)
10497 va_dcl
10498 #endif
10499 {
10500         va_list ap;
10501 #ifndef I_STDARG
10502         char *p;
10503 #endif
10504 #ifdef I_STDARG
10505         va_start(ap,p);
10506 #else
10507         va_start(ap);
10508         p = va_arg(ap, char *);
10509 #endif
10510         va_end(ap);
10511         return 0;
10512 }
10513 EOP
10514 $cat > varargs <<EOP
10515 $startsh
10516 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10517         echo "true"
10518 else
10519         echo "false"
10520 fi
10521 $rm -f varargs$_o
10522 EOP
10523 chmod +x varargs
10524
10525 : now check which varargs header should be included
10526 echo " "
10527 i_varhdr=''
10528 case "$valstd" in
10529 "$define")
10530         if `./varargs I_STDARG`; then
10531                 val='stdarg.h'
10532         elif `./varargs I_VARARGS`; then
10533                 val='varargs.h'
10534         fi
10535         ;;
10536 *)
10537         if `./varargs I_VARARGS`; then
10538                 val='varargs.h'
10539         fi
10540         ;;
10541 esac
10542 case "$val" in
10543 '')
10544 echo "I could not find the definition for va_dcl... You have problems..." >&4
10545         val="$undef"; set i_stdarg; eval $setvar
10546         val="$undef"; set i_varargs; eval $setvar
10547         ;;
10548 *) 
10549         set i_varhdr
10550         eval $setvar
10551         case "$i_varhdr" in
10552         stdarg.h)
10553                 val="$define"; set i_stdarg; eval $setvar
10554                 val="$undef"; set i_varargs; eval $setvar
10555                 ;;
10556         varargs.h)
10557                 val="$undef"; set i_stdarg; eval $setvar
10558                 val="$define"; set i_varargs; eval $setvar
10559                 ;;
10560         esac
10561         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10562 esac
10563 $rm -f varargs*
10564
10565 : see if the Compiler supports C99 variadic macros
10566 case "$i_stdarg$i_stdlib" in
10567     "$define$define")
10568     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10569     $cat >try.c <<EOCP
10570 #include <stdio.h>
10571 #include <stdarg.h>
10572
10573 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10574
10575 int main() {
10576   char buf[20];
10577   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10578   puts(buf);
10579   return 0;
10580 }
10581 EOCP
10582     set try
10583     if eval $compile && $run ./try 2>&1 >/dev/null; then
10584         case "`$run ./try`" in
10585             "123 456 789")
10586             echo "You have C99 variadic macros." >&4
10587             d_c99_variadic_macros="$define"
10588             ;;
10589             *)
10590             echo "You don't have functional C99 variadic macros." >&4
10591             d_c99_variadic_macros="$undef"
10592             ;;
10593         esac
10594     else
10595         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10596         d_c99_variadic_macros="$undef"
10597     fi
10598     $rm_try
10599     ;;
10600     *)
10601     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10602     d_c99_variadic_macros="$undef"
10603     ;;
10604 esac
10605
10606 : see if signal is declared as pointer to function returning int or void
10607 echo " "
10608 xxx=`./findhdr signal.h`
10609 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10610 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10611         echo "You have int (*signal())() instead of void." >&4
10612         val="$undef"
10613 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10614         echo "You have void (*signal())()." >&4
10615         val="$define"
10616 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10617         echo "You have int (*signal())() instead of void." >&4
10618         val="$undef"
10619 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10620         echo "You have void (*signal())()." >&4
10621         val="$define"
10622 else
10623         case "$d_voidsig" in
10624         '')
10625         echo "I can't determine whether signal handler returns void or int..." >&4
10626                 dflt=void
10627                 rp="What type does your signal handler return?"
10628                 . ./myread
10629                 case "$ans" in
10630                 v*) val="$define";;
10631                 *) val="$undef";;
10632                 esac;;
10633         "$define")
10634                 echo "As you already told me, signal handler returns void." >&4
10635                 val="$define"
10636                 ;;
10637         *)      echo "As you already told me, signal handler returns int." >&4
10638                 val="$undef"
10639                 ;;
10640         esac
10641 fi
10642 set d_voidsig
10643 eval $setvar
10644 case "$d_voidsig" in
10645 "$define") signal_t="void";;
10646 *) signal_t="int";;
10647 esac
10648 $rm -f $$.tmp
10649
10650 : check for ability to cast large floats to 32-bit ints.
10651 echo " "
10652 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10653 if $test "$intsize" -ge 4; then
10654         xxx=int
10655 else
10656         xxx=long
10657 fi
10658 $cat >try.c <<EOCP
10659 #include <stdio.h>
10660 #$i_stdlib I_STDLIB
10661 #ifdef I_STDLIB
10662 #include <stdlib.h>
10663 #endif
10664 #include <sys/types.h>
10665 #include <signal.h>
10666 $signal_t blech(int s) { exit(3); }
10667 int main()
10668 {
10669         $xxx i32;
10670         double f, g;
10671         int result = 0;
10672         char str[16];
10673         signal(SIGFPE, blech);
10674
10675         /* Don't let compiler optimize the test away.  Store the number
10676            in a writable string for gcc to pass to sscanf under HP/UX.
10677         */
10678         sprintf(str, "2147483647");
10679         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10680         g = 10 * f;
10681         i32  = ($xxx) g;
10682
10683         /* x86 processors will probably give 0x8000 0000, which is a
10684            sign change.  We don't want that.  We want to mimic SPARC
10685            behavior here, which is to preserve the sign and give
10686            back 0x7fff ffff.
10687         */
10688         if (i32 != ($xxx) f)
10689                 result |= 1;
10690         exit(result);
10691 }
10692 EOCP
10693 set try
10694 if eval $compile_ok; then
10695         $run ./try
10696         yyy=$?
10697 else
10698         echo "(I can't seem to compile the test program--assuming it can't)"
10699         yyy=1
10700 fi
10701 case "$yyy" in
10702 0)      val="$define"
10703         echo "Yup, it can."
10704         ;;
10705 *)      val="$undef"
10706         echo "Nope, it can't."
10707         ;;
10708 esac
10709 set d_casti32
10710 eval $setvar
10711 $rm_try
10712
10713 : check for ability to cast negative floats to unsigned
10714 echo " "
10715 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10716 $cat >try.c <<EOCP
10717 #include <stdio.h>
10718 #$i_stdlib I_STDLIB
10719 #ifdef I_STDLIB
10720 #include <stdlib.h>
10721 #endif
10722 #include <sys/types.h>
10723 #include <signal.h>
10724 $signal_t blech(int s) { exit(7); }
10725 $signal_t blech_in_list(int s) { exit(4); }
10726 unsigned long dummy_long(unsigned long p) { return p; }
10727 unsigned int dummy_int(unsigned int p) { return p; }
10728 unsigned short dummy_short(unsigned short p) { return p; }
10729 int main()
10730 {
10731         double f;
10732         unsigned long along;
10733         unsigned int aint;
10734         unsigned short ashort;
10735         int result = 0;
10736         char str[16];
10737
10738         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10739            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10740            optimized the whole file away
10741         */
10742         /* Store the number in a writable string for gcc to pass to
10743            sscanf under HP/UX.
10744         */
10745         sprintf(str, "-123");
10746         sscanf(str, "%lf", &f);  /* f = -123.; */
10747
10748         signal(SIGFPE, blech);
10749         along = (unsigned long)f;
10750         aint = (unsigned int)f;
10751         ashort = (unsigned short)f;
10752         if (along != (unsigned long)-123)
10753                 result |= 1;
10754         if (aint != (unsigned int)-123)
10755                 result |= 1;
10756         if (ashort != (unsigned short)-123)
10757                 result |= 1;
10758         sprintf(str, "1073741824.");
10759         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10760         f = f + f;
10761         along = 0;
10762         along = (unsigned long)f;
10763         if (along != 0x80000000)
10764                 result |= 2;
10765         f -= 1.;
10766         along = 0;
10767         along = (unsigned long)f;
10768         if (along != 0x7fffffff)
10769                 result |= 1;
10770         f += 2.;
10771         along = 0;
10772         along = (unsigned long)f;
10773         if (along != 0x80000001)
10774                 result |= 2;
10775         if (result)
10776                 exit(result);
10777         signal(SIGFPE, blech_in_list);
10778         sprintf(str, "123.");
10779         sscanf(str, "%lf", &f);  /* f = 123.; */
10780         along = dummy_long((unsigned long)f);
10781         aint = dummy_int((unsigned int)f);
10782         ashort = dummy_short((unsigned short)f);
10783         if (along != (unsigned long)123)
10784                 result |= 4;
10785         if (aint != (unsigned int)123)
10786                 result |= 4;
10787         if (ashort != (unsigned short)123)
10788                 result |= 4;
10789         exit(result);
10790
10791 }
10792 EOCP
10793 set try
10794 if eval $compile_ok; then
10795         $run ./try
10796         castflags=$?
10797 else
10798         echo "(I can't seem to compile the test program--assuming it can't)"
10799         castflags=7
10800 fi
10801 case "$castflags" in
10802 0)      val="$define"
10803         echo "Yup, it can."
10804         ;;
10805 *)      val="$undef"
10806         echo "Nope, it can't."
10807         ;;
10808 esac
10809 set d_castneg
10810 eval $setvar
10811 $rm_try
10812
10813 : see if vprintf exists
10814 echo " "
10815 if set vprintf val -f d_vprintf; eval $csym; $val; then
10816         echo 'vprintf() found.' >&4
10817         val="$define"
10818         $cat >try.c <<EOF
10819 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10820 #$i_varargs I_VARARGS
10821
10822 #$i_stdlib I_STDLIB
10823 #$i_unistd I_UNISTD
10824
10825 #ifdef I_STDARG
10826 #  include <stdarg.h>
10827 #else /* I_VARARGS */
10828 #  include <varargs.h>
10829 #endif
10830
10831 #ifdef I_UNISTD
10832 #  include <unistd.h>
10833 #endif
10834
10835 #ifdef I_STDLIB
10836 #  include <stdlib.h>
10837 #endif
10838
10839 #include <stdio.h> /* vsprintf prototype */
10840
10841 #ifdef I_STDARG
10842 void xxx(int n, ...)
10843 {
10844     va_list args;
10845     char buf[10];
10846     va_start(args, n);
10847     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10848 }
10849 int main() { xxx(1, "foo"); }
10850
10851 #else /* I_VARARGS */
10852
10853 xxx(va_alist)
10854 va_dcl
10855 {
10856     va_list args;
10857     char buf[10];
10858     va_start(args);
10859     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10860 }
10861 int main() { xxx("foo"); }
10862
10863 #endif
10864
10865 EOF
10866         set try
10867         if eval $compile_ok; then
10868                 if $run ./try; then
10869                         echo "Your vsprintf() returns (int)." >&4
10870                         val2="$undef"
10871                 else
10872                         echo "Your vsprintf() returns (char*)." >&4
10873                         val2="$define"
10874                 fi
10875         else
10876                 echo 'I am unable to compile the vsprintf() test program.' >&4
10877                 # We shouldn't get here.  If we do, assume the standard signature,
10878                 # not the old BSD one.
10879                 echo 'Guessing that vsprintf() returns (int).' >&4
10880                 val2="$undef"
10881         fi
10882 else
10883         echo 'vprintf() NOT found.' >&4
10884         val="$undef"
10885         val2="$undef"
10886 fi
10887 $rm_try
10888 set d_vprintf
10889 eval $setvar
10890 val=$val2
10891 set d_charvspr
10892 eval $setvar
10893
10894 : see if chown exists
10895 set chown d_chown
10896 eval $inlibc
10897
10898 : see if chroot exists
10899 set chroot d_chroot
10900 eval $inlibc
10901
10902 : see if chsize exists
10903 set chsize d_chsize
10904 eval $inlibc
10905
10906 : see if class exists
10907 set class d_class
10908 eval $inlibc
10909
10910 : see if clearenv exists
10911 set clearenv d_clearenv
10912 eval $inlibc
10913
10914 hasstruct='varname=$1; struct=$2; shift; shift;
10915 while $test $# -ge 2; do
10916         case "$1" in
10917         $define) echo "#include <$2>";;
10918         esac ;
10919     shift 2;
10920 done > try.c;
10921 echo "int main () { struct $struct foo; }" >> try.c;
10922 set try;
10923 if eval $compile; then
10924         val="$define";
10925 else
10926         val="$undef";
10927 fi;
10928 set $varname;
10929 eval $setvar;
10930 $rm_try'
10931
10932 socketlib=''
10933 sockethdr=''
10934 : see whether socket exists
10935 echo " "
10936 $echo $n "Hmm... $c" >&4
10937 if set socket val -f d_socket; eval $csym; $val; then
10938         echo "Looks like you have Berkeley networking support." >&4
10939         d_socket="$define"
10940         if set setsockopt val -f; eval $csym; $val; then
10941                 d_oldsock="$undef"
10942         else
10943                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10944                 d_oldsock="$define"
10945         fi
10946 else
10947         if $contains socklib libc.list >/dev/null 2>&1; then
10948                 echo "Looks like you have Berkeley networking support." >&4
10949                 d_socket="$define"
10950                 : we will have to assume that it supports the 4.2 BSD interface
10951                 d_oldsock="$undef"
10952         else
10953                 echo "You don't have Berkeley networking in libc$_a..." >&4
10954                 if test "X$d_socket" = "X$define"; then
10955                    echo "...but you seem to believe that you have sockets." >&4
10956                 else
10957                         for net in net socket
10958                         do
10959                                 if test -f /usr/lib/lib$net$_a; then
10960                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10961                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10962                                         if $contains socket libc.list >/dev/null 2>&1; then
10963                                                 d_socket="$define"
10964                                                 socketlib="-l$net"
10965                                                 case "$net" in
10966                                                 net)
10967                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10968                                                         sockethdr="-I/usr/netinclude"
10969                                                         ;;
10970                                                 esac
10971                                                 echo "Found Berkeley sockets interface in lib$net." >&4
10972                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10973                                                         d_oldsock="$undef"
10974                                                 else
10975                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10976                                                         d_oldsock="$define"
10977                                                 fi
10978                                                 break
10979                                         fi
10980                                 fi
10981                         done
10982                         if test "X$d_socket" != "X$define"; then
10983                            echo "or anywhere else I see." >&4
10984                            d_socket="$undef"
10985                            d_oldsock="$undef"
10986                         fi
10987                 fi
10988         fi
10989 fi
10990
10991 : see if socketpair exists
10992 set socketpair d_sockpair
10993 eval $inlibc
10994
10995
10996 echo " "
10997 echo "Checking the availability of certain socket constants..." >&4
10998 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10999         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11000         $cat >try.c <<EOF
11001 #include <sys/types.h>
11002 #include <sys/socket.h>
11003 int main() {
11004     int i = $ENUM;
11005 }
11006 EOF
11007         val="$undef"
11008         set try; if eval $compile; then
11009                 val="$define"
11010         fi
11011         set d_${enum}; eval $setvar
11012         $rm_try
11013 done
11014
11015 : see if this is a sys/uio.h system
11016 set sys/uio.h i_sysuio
11017 eval $inhdr
11018
11019
11020 echo " "
11021 echo "Checking to see if your system supports struct cmsghdr..." >&4
11022 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11023 eval $hasstruct
11024 case "$d_cmsghdr_s" in
11025 "$define")      echo "Yes, it does."   ;;
11026 *)              echo "No, it doesn't." ;;
11027 esac
11028
11029
11030 : check for const keyword
11031 echo " "
11032 echo 'Checking to see if your C compiler knows about "const"...' >&4
11033 $cat >const.c <<'EOCP'
11034 typedef struct spug { int drokk; } spug;
11035 int main()
11036 {
11037         const char *foo;
11038         const spug y = { 0 };
11039 }
11040 EOCP
11041 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11042         val="$define"
11043         echo "Yup, it does."
11044 else
11045         val="$undef"
11046         echo "Nope, it doesn't."
11047 fi
11048 set d_const
11049 eval $setvar
11050
11051 : see if copysignl exists
11052 set copysignl d_copysignl
11053 eval $inlibc
11054
11055 : see if crypt exists
11056 echo " "
11057 set crypt d_crypt
11058 eval $inlibc
11059 case "$d_crypt" in
11060 $define) cryptlib='' ;;
11061 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11062                 echo 'crypt() found.' >&4
11063                 val="$define"
11064                 cryptlib=''
11065         else
11066                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11067                 if $test -z "$cryptlib"; then
11068                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11069                 else
11070                         cryptlib=-lcrypt
11071                 fi
11072                 if $test -z "$cryptlib"; then
11073                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11074                 else
11075                         cryptlib=-lcrypt
11076                 fi
11077                 if $test -z "$cryptlib"; then
11078                         cryptlib=`./loc libcrypt$_a "" $libpth`
11079                 else
11080                         cryptlib=-lcrypt
11081                 fi
11082                 if $test -z "$cryptlib"; then
11083                         echo 'crypt() NOT found.' >&4
11084                         val="$undef"
11085                 else
11086                         val="$define"
11087                 fi
11088         fi
11089         set d_crypt
11090         eval $setvar
11091         ;;
11092 esac
11093
11094 : see if this is a crypt.h system
11095 set crypt.h i_crypt
11096 eval $inhdr
11097
11098 : see if crypt_r exists
11099 set crypt_r d_crypt_r
11100 eval $inlibc
11101 case "$d_crypt_r" in
11102 "$define")
11103         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11104         case "$d_crypt_r_proto:$usethreads" in
11105         ":define")      d_crypt_r_proto=define
11106                 set d_crypt_r_proto crypt_r $hdrs
11107                 eval $hasproto ;;
11108         *)      ;;
11109         esac
11110         case "$d_crypt_r_proto" in
11111         define)
11112         case "$crypt_r_proto" in
11113         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11114         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11115         esac
11116         case "$crypt_r_proto" in
11117         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11118         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11119         esac
11120         case "$crypt_r_proto" in
11121         ''|0)   d_crypt_r=undef
11122                 crypt_r_proto=0
11123                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11124         * )     case "$crypt_r_proto" in
11125                 REENTRANT_PROTO*) ;;
11126                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11127                 esac
11128                 echo "Prototype: $try" ;;
11129         esac
11130         ;;
11131         *)      case "$usethreads" in
11132                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11133                 esac
11134                 d_crypt_r=undef
11135                 crypt_r_proto=0
11136                 ;;
11137         esac
11138         ;;
11139 *)      crypt_r_proto=0
11140         ;;
11141 esac
11142
11143 : get csh whereabouts
11144 case "$csh" in
11145 'csh') val="$undef" ;;
11146 *) val="$define" ;;
11147 esac
11148 set d_csh
11149 eval $setvar
11150 : Respect a hint or command line value for full_csh.
11151 case "$full_csh" in
11152 '') full_csh=$csh ;;
11153 esac
11154
11155 : see if ctermid exists
11156 set ctermid d_ctermid
11157 eval $inlibc
11158
11159 : see if ctermid_r exists
11160 set ctermid_r d_ctermid_r
11161 eval $inlibc
11162 case "$d_ctermid_r" in
11163 "$define")
11164         hdrs="$i_systypes sys/types.h define stdio.h "
11165         case "$d_ctermid_r_proto:$usethreads" in
11166         ":define")      d_ctermid_r_proto=define
11167                 set d_ctermid_r_proto ctermid_r $hdrs
11168                 eval $hasproto ;;
11169         *)      ;;
11170         esac
11171         case "$d_ctermid_r_proto" in
11172         define)
11173         case "$ctermid_r_proto" in
11174         ''|0) try='char* ctermid_r(char*);'
11175         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11176         esac
11177         case "$ctermid_r_proto" in
11178         ''|0)   d_ctermid_r=undef
11179                 ctermid_r_proto=0
11180                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11181         * )     case "$ctermid_r_proto" in
11182                 REENTRANT_PROTO*) ;;
11183                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11184                 esac
11185                 echo "Prototype: $try" ;;
11186         esac
11187         ;;
11188         *)      case "$usethreads" in
11189                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11190                 esac
11191                 d_ctermid_r=undef
11192                 ctermid_r_proto=0
11193                 ;;
11194         esac
11195         ;;
11196 *)      ctermid_r_proto=0
11197         ;;
11198 esac
11199
11200 : see if ctime_r exists
11201 set ctime_r d_ctime_r
11202 eval $inlibc
11203 case "$d_ctime_r" in
11204 "$define")
11205         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11206         case "$d_ctime_r_proto:$usethreads" in
11207         ":define")      d_ctime_r_proto=define
11208                 set d_ctime_r_proto ctime_r $hdrs
11209                 eval $hasproto ;;
11210         *)      ;;
11211         esac
11212         case "$d_ctime_r_proto" in
11213         define)
11214         case "$ctime_r_proto" in
11215         ''|0) try='char* ctime_r(const time_t*, char*);'
11216         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11217         esac
11218         case "$ctime_r_proto" in
11219         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11220         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11221         esac
11222         case "$ctime_r_proto" in
11223         ''|0) try='int ctime_r(const time_t*, char*);'
11224         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11225         esac
11226         case "$ctime_r_proto" in
11227         ''|0) try='int ctime_r(const time_t*, char*, int);'
11228         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11229         esac
11230         case "$ctime_r_proto" in
11231         ''|0)   d_ctime_r=undef
11232                 ctime_r_proto=0
11233                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11234         * )     case "$ctime_r_proto" in
11235                 REENTRANT_PROTO*) ;;
11236                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11237                 esac
11238                 echo "Prototype: $try" ;;
11239         esac
11240         ;;
11241         *)      case "$usethreads" in
11242                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11243                 esac
11244                 d_ctime_r=undef
11245                 ctime_r_proto=0
11246                 ;;
11247         esac
11248         ;;
11249 *)      ctime_r_proto=0
11250         ;;
11251 esac
11252
11253 : see if cuserid exists
11254 set cuserid d_cuserid
11255 eval $inlibc
11256
11257 : see if this is a limits.h system
11258 set limits.h i_limits
11259 eval $inhdr
11260
11261 : see if this is a float.h system
11262 set float.h i_float
11263 eval $inhdr
11264
11265 : See if number of significant digits in a double precision number is known
11266 echo " "
11267 $cat >dbl_dig.c <<EOM
11268 #$i_limits I_LIMITS
11269 #$i_float I_FLOAT
11270 #ifdef I_LIMITS
11271 #include <limits.h>
11272 #endif
11273 #ifdef I_FLOAT
11274 #include <float.h>
11275 #endif
11276 #ifdef DBL_DIG
11277 printf("Contains DBL_DIG");
11278 #endif
11279 EOM
11280 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11281 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11282         echo "DBL_DIG found." >&4
11283         val="$define"
11284 else
11285         echo "DBL_DIG NOT found." >&4
11286         val="$undef"
11287 fi
11288 $rm -f dbl_dig.?
11289 set d_dbl_dig
11290 eval $setvar
11291
11292 : see if dbm.h is available
11293 : see if dbmclose exists
11294 set dbmclose d_dbmclose
11295 eval $inlibc
11296
11297 case "$d_dbmclose" in
11298 $define)
11299         set dbm.h i_dbm
11300         eval $inhdr
11301         case "$i_dbm" in
11302         $define)
11303                 val="$undef"
11304                 set i_rpcsvcdbm
11305                 eval $setvar
11306                 ;;
11307         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11308                 eval $inhdr
11309                 ;;
11310         esac
11311         ;;
11312 *)      echo "We won't be including <dbm.h>"
11313         val="$undef"
11314         set i_dbm
11315         eval $setvar
11316         val="$undef"
11317         set i_rpcsvcdbm
11318         eval $setvar
11319         ;;
11320 esac
11321
11322 : see if prototype for dbminit is available
11323 echo " "
11324 set d_dbminitproto dbminit $i_dbm dbm.h
11325 eval $hasproto
11326
11327 : see if difftime exists
11328 set difftime d_difftime
11329 eval $inlibc
11330
11331 : see if this is a dirent system
11332 echo " "
11333 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11334         val="$define"
11335         echo "<dirent.h> found." >&4
11336 else
11337         val="$undef"
11338         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11339                 echo "<sys/dir.h> found." >&4
11340                 echo " "
11341         else
11342                 xinc=`./findhdr sys/ndir.h`
11343         fi
11344         echo "<dirent.h> NOT found." >&4
11345 fi
11346 set i_dirent
11347 eval $setvar
11348
11349 : Look for type of directory structure.
11350 echo " "
11351 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11352
11353 case "$direntrytype" in
11354 ''|' ')
11355         case "$i_dirent" in
11356         $define) guess1='struct dirent' ;;
11357         *) guess1='struct direct'  ;;
11358         esac
11359         ;;
11360 *)      guess1="$direntrytype"
11361         ;;
11362 esac
11363
11364 case "$guess1" in
11365 'struct dirent') guess2='struct direct' ;;
11366 *) guess2='struct dirent' ;;
11367 esac
11368
11369 if $contains "$guess1" try.c >/dev/null 2>&1; then
11370         direntrytype="$guess1"
11371         echo "Your directory entries are $direntrytype." >&4
11372 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11373         direntrytype="$guess2"
11374         echo "Your directory entries seem to be $direntrytype." >&4
11375 else
11376         echo "I don't recognize your system's directory entries." >&4
11377         rp="What type is used for directory entries on this system?"
11378         dflt="$guess1"
11379         . ./myread
11380         direntrytype="$ans"
11381 fi
11382 $rm_try
11383
11384 : see if the directory entry stores field length
11385 echo " "
11386 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11387 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11388         echo "Good, your directory entry keeps length information in d_namlen." >&4
11389         val="$define"
11390 else
11391         echo "Your directory entry does not know about the d_namlen field." >&4
11392         val="$undef"
11393 fi
11394 set d_dirnamlen
11395 eval $setvar
11396 $rm_try
11397
11398 : Look for DIR.dd_fd
11399 case "$i_dirent" in
11400 "$define")
11401     echo "Checking to see if DIR has a dd_fd member variable" >&4
11402     $cat >try.c <<EOCP
11403 #$i_stdlib I_STDLIB
11404 #ifdef I_STDLIB
11405 #include <stdlib.h>
11406 #endif
11407 #include <dirent.h>
11408
11409 int main() {
11410     DIR dir;
11411     dir.dd_fd = 1;
11412     return 0;
11413 }
11414 EOCP
11415     val=$undef
11416     set try
11417     if eval $compile; then
11418         echo "Yes, it does."
11419         val="$define"
11420     else
11421         echo "No, it does not."
11422         val="$undef"
11423     fi
11424     ;;
11425 *)
11426     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11427     val="$undef"
11428     ;;
11429 esac
11430 set d_dir_dd_fd
11431 eval $setvar
11432 $rm_try
11433
11434 : see if this is an sysdir system
11435 set sys/dir.h i_sysdir
11436 eval $inhdr
11437
11438 : see if this is an sysndir system
11439 set sys/ndir.h i_sysndir
11440 eval $inhdr
11441
11442 : Look for dirfd
11443 echo " "
11444 $cat >dirfd.c <<EOM
11445 #include <stdio.h>
11446 #$i_stdlib I_STDLIB
11447 #ifdef I_STDLIB
11448 #include <stdlib.h>
11449 #endif
11450 #$i_dirent I_DIRENT             /**/
11451 #$i_sysdir I_SYS_DIR            /**/
11452 #$i_sysndir I_SYS_NDIR          /**/
11453 #$i_systypes I_SYS_TYPES        /**/
11454 #if defined(I_SYS_TYPES)
11455 #include <sys/types.h>
11456 #endif
11457 #if defined(I_DIRENT)
11458 #include <dirent.h>
11459 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11460 #include <sys/dir.h>
11461 #endif
11462 #else
11463 #ifdef I_SYS_NDIR
11464 #include <sys/ndir.h>
11465 #else
11466 #ifdef I_SYS_DIR
11467 #ifdef hp9000s500
11468 #include <ndir.h>       /* may be wrong in the future */
11469 #else
11470 #include <sys/dir.h>
11471 #endif
11472 #endif
11473 #endif
11474 #endif 
11475 int main() {
11476         DIR *dirp = opendir(".");
11477         if (dirfd(dirp) >= 0)
11478                 exit(0);
11479         else
11480                 exit(1);
11481 }
11482 EOM
11483 val=$undef
11484 set dirfd
11485 if eval $compile; then
11486         val="$define"
11487 fi
11488 case "$val" in
11489 $define)        echo "dirfd() found." >&4       ;;
11490 *)              echo "dirfd() NOT found." >&4   ;;
11491 esac
11492 set d_dirfd
11493 eval $setvar
11494 $rm -f dirfd*
11495
11496 : see if dlerror exists
11497 xxx_runnm="$runnm"
11498 runnm=false
11499 set dlerror d_dlerror
11500 eval $inlibc
11501 runnm="$xxx_runnm"
11502
11503 : see if dlfcn is available
11504 set dlfcn.h i_dlfcn
11505 eval $inhdr
11506
11507 case "$usedl" in
11508 $define|y|true)
11509         $cat << EOM
11510
11511 On a few systems, the dynamically loaded modules that perl generates and uses
11512 will need a different extension than shared libs. The default will probably
11513 be appropriate.
11514
11515 EOM
11516         case "$dlext" in
11517         '')     dflt="$so" ;;
11518         *)      dflt="$dlext" ;;
11519         esac
11520         rp='What is the extension of dynamically loaded modules'
11521         . ./myread
11522         dlext="$ans"
11523         ;;
11524 *)
11525         dlext="none"
11526         ;;
11527 esac
11528
11529 : Check if dlsym need a leading underscore
11530 echo " "
11531 val="$undef"
11532
11533 case "$dlsrc" in
11534 dl_dlopen.xs)
11535         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11536         $cat >dyna.c <<'EOM'
11537 fred () { }
11538 EOM
11539
11540 $cat >fred.c<<EOM
11541
11542 #include <stdio.h>
11543 #$i_stdlib I_STDLIB
11544 #ifdef I_STDLIB
11545 #include <stdlib.h>
11546 #endif
11547 #$i_dlfcn I_DLFCN
11548 #ifdef I_DLFCN
11549 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11550 #else
11551 #include <sys/types.h>
11552 #include <nlist.h>
11553 #include <link.h>
11554 #endif
11555
11556 extern int fred() ;
11557
11558 int main()
11559 {
11560     void * handle ;
11561     void * symbol ;
11562 #ifndef RTLD_LAZY
11563     int mode = 1 ;
11564 #else
11565     int mode = RTLD_LAZY ;
11566 #endif
11567     handle = dlopen("./dyna.$dlext", mode) ;
11568     if (handle == NULL) {
11569         printf ("1\n") ;
11570         fflush (stdout) ;
11571         exit(0);
11572     }
11573     symbol = dlsym(handle, "fred") ;
11574     if (symbol == NULL) {
11575         /* try putting a leading underscore */
11576         symbol = dlsym(handle, "_fred") ;
11577         if (symbol == NULL) {
11578             printf ("2\n") ;
11579             fflush (stdout) ;
11580             exit(0);
11581         }
11582         printf ("3\n") ;
11583     }
11584     else
11585         printf ("4\n") ;
11586     fflush (stdout) ;
11587     exit(0);
11588 }
11589 EOM
11590         : Call the object file tmp-dyna.o in case dlext=o.
11591         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11592                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11593                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11594                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11595                 xxx=`$run ./fred`
11596                 case $xxx in
11597                 1)      echo "Test program failed using dlopen." >&4
11598                         echo "Perhaps you should not use dynamic loading." >&4;;
11599                 2)      echo "Test program failed using dlsym." >&4
11600                         echo "Perhaps you should not use dynamic loading." >&4;;
11601                 3)      echo "dlsym needs a leading underscore" >&4
11602                         val="$define" ;;
11603                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11604                 esac
11605         else
11606                 echo "I can't compile and run the test program." >&4
11607                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11608         fi
11609         ;;
11610 esac
11611                 
11612 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11613
11614 set d_dlsymun
11615 eval $setvar
11616
11617 : see if drand48_r exists
11618 set drand48_r d_drand48_r
11619 eval $inlibc
11620 case "$d_drand48_r" in
11621 "$define")
11622         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11623         case "$d_drand48_r_proto:$usethreads" in
11624         ":define")      d_drand48_r_proto=define
11625                 set d_drand48_r_proto drand48_r $hdrs
11626                 eval $hasproto ;;
11627         *)      ;;
11628         esac
11629         case "$d_drand48_r_proto" in
11630         define)
11631         case "$drand48_r_proto" in
11632         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11633         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11634         esac
11635         case "$drand48_r_proto" in
11636         ''|0)   d_drand48_r=undef
11637                 drand48_r_proto=0
11638                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11639         * )     case "$drand48_r_proto" in
11640                 REENTRANT_PROTO*) ;;
11641                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11642                 esac
11643                 echo "Prototype: $try" ;;
11644         esac
11645         ;;
11646         *)      case "$usethreads" in
11647                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11648                 esac
11649                 d_drand48_r=undef
11650                 drand48_r_proto=0
11651                 ;;
11652         esac
11653         ;;
11654 *)      drand48_r_proto=0
11655         ;;
11656 esac
11657
11658 : see if prototype for drand48 is available
11659 echo " "
11660 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11661 eval $hasproto
11662
11663 : see if dup2 exists
11664 set dup2 d_dup2
11665 eval $inlibc
11666
11667 : see if eaccess exists
11668 set eaccess d_eaccess
11669 eval $inlibc
11670
11671 : see if endgrent exists
11672 set endgrent d_endgrent
11673 eval $inlibc
11674
11675 : see if this is an grp system
11676 set grp.h i_grp
11677 eval $inhdr
11678
11679 case "$i_grp" in
11680 $define)
11681         xxx=`./findhdr grp.h`
11682         $cppstdin $cppflags $cppminus < $xxx >$$.h
11683
11684         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11685                 val="$define"
11686         else
11687                 val="$undef"
11688         fi
11689         set d_grpasswd
11690         eval $setvar
11691
11692         $rm -f $$.h
11693         ;;
11694 *)
11695         val="$undef";
11696         set d_grpasswd; eval $setvar
11697         ;;
11698 esac
11699
11700 : see if endgrent_r exists
11701 set endgrent_r d_endgrent_r
11702 eval $inlibc
11703 case "$d_endgrent_r" in
11704 "$define")
11705         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11706         case "$d_endgrent_r_proto:$usethreads" in
11707         ":define")      d_endgrent_r_proto=define
11708                 set d_endgrent_r_proto endgrent_r $hdrs
11709                 eval $hasproto ;;
11710         *)      ;;
11711         esac
11712         case "$d_endgrent_r_proto" in
11713         define)
11714         case "$endgrent_r_proto" in
11715         ''|0) try='int endgrent_r(FILE**);'
11716         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11717         esac
11718         case "$endgrent_r_proto" in
11719         ''|0) try='void endgrent_r(FILE**);'
11720         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11721         esac
11722         case "$endgrent_r_proto" in
11723         ''|0)   d_endgrent_r=undef
11724                 endgrent_r_proto=0
11725                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11726         * )     case "$endgrent_r_proto" in
11727                 REENTRANT_PROTO*) ;;
11728                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11729                 esac
11730                 echo "Prototype: $try" ;;
11731         esac
11732         ;;
11733         *)      case "$usethreads" in
11734                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11735                 esac
11736                 d_endgrent_r=undef
11737                 endgrent_r_proto=0
11738                 ;;
11739         esac
11740         ;;
11741 *)      endgrent_r_proto=0
11742         ;;
11743 esac
11744
11745 : see if endhostent exists
11746 set endhostent d_endhent
11747 eval $inlibc
11748
11749 : see if this is a netdb.h system
11750 set netdb.h i_netdb
11751 eval $inhdr
11752
11753 : see if endhostent_r exists
11754 set endhostent_r d_endhostent_r
11755 eval $inlibc
11756 case "$d_endhostent_r" in
11757 "$define")
11758         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11759         case "$d_endhostent_r_proto:$usethreads" in
11760         ":define")      d_endhostent_r_proto=define
11761                 set d_endhostent_r_proto endhostent_r $hdrs
11762                 eval $hasproto ;;
11763         *)      ;;
11764         esac
11765         case "$d_endhostent_r_proto" in
11766         define)
11767         case "$endhostent_r_proto" in
11768         ''|0) try='int endhostent_r(struct hostent_data*);'
11769         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11770         esac
11771         case "$endhostent_r_proto" in
11772         ''|0) try='void endhostent_r(struct hostent_data*);'
11773         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11774         esac
11775         case "$endhostent_r_proto" in
11776         ''|0)   d_endhostent_r=undef
11777                 endhostent_r_proto=0
11778                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11779         * )     case "$endhostent_r_proto" in
11780                 REENTRANT_PROTO*) ;;
11781                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11782                 esac
11783                 echo "Prototype: $try" ;;
11784         esac
11785         ;;
11786         *)      case "$usethreads" in
11787                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11788                 esac
11789                 d_endhostent_r=undef
11790                 endhostent_r_proto=0
11791                 ;;
11792         esac
11793         ;;
11794 *)      endhostent_r_proto=0
11795         ;;
11796 esac
11797
11798 : see if endnetent exists
11799 set endnetent d_endnent
11800 eval $inlibc
11801
11802 : see if endnetent_r exists
11803 set endnetent_r d_endnetent_r
11804 eval $inlibc
11805 case "$d_endnetent_r" in
11806 "$define")
11807         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11808         case "$d_endnetent_r_proto:$usethreads" in
11809         ":define")      d_endnetent_r_proto=define
11810                 set d_endnetent_r_proto endnetent_r $hdrs
11811                 eval $hasproto ;;
11812         *)      ;;
11813         esac
11814         case "$d_endnetent_r_proto" in
11815         define)
11816         case "$endnetent_r_proto" in
11817         ''|0) try='int endnetent_r(struct netent_data*);'
11818         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11819         esac
11820         case "$endnetent_r_proto" in
11821         ''|0) try='void endnetent_r(struct netent_data*);'
11822         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11823         esac
11824         case "$endnetent_r_proto" in
11825         ''|0)   d_endnetent_r=undef
11826                 endnetent_r_proto=0
11827                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11828         * )     case "$endnetent_r_proto" in
11829                 REENTRANT_PROTO*) ;;
11830                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11831                 esac
11832                 echo "Prototype: $try" ;;
11833         esac
11834         ;;
11835         *)      case "$usethreads" in
11836                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11837                 esac
11838                 d_endnetent_r=undef
11839                 endnetent_r_proto=0
11840                 ;;
11841         esac
11842         ;;
11843 *)      endnetent_r_proto=0
11844         ;;
11845 esac
11846
11847 : see if endprotoent exists
11848 set endprotoent d_endpent
11849 eval $inlibc
11850
11851 : see if endprotoent_r exists
11852 set endprotoent_r d_endprotoent_r
11853 eval $inlibc
11854 case "$d_endprotoent_r" in
11855 "$define")
11856         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11857         case "$d_endprotoent_r_proto:$usethreads" in
11858         ":define")      d_endprotoent_r_proto=define
11859                 set d_endprotoent_r_proto endprotoent_r $hdrs
11860                 eval $hasproto ;;
11861         *)      ;;
11862         esac
11863         case "$d_endprotoent_r_proto" in
11864         define)
11865         case "$endprotoent_r_proto" in
11866         ''|0) try='int endprotoent_r(struct protoent_data*);'
11867         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11868         esac
11869         case "$endprotoent_r_proto" in
11870         ''|0) try='void endprotoent_r(struct protoent_data*);'
11871         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11872         esac
11873         case "$endprotoent_r_proto" in
11874         ''|0)   d_endprotoent_r=undef
11875                 endprotoent_r_proto=0
11876                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11877         * )     case "$endprotoent_r_proto" in
11878                 REENTRANT_PROTO*) ;;
11879                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11880                 esac
11881                 echo "Prototype: $try" ;;
11882         esac
11883         ;;
11884         *)      case "$usethreads" in
11885                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11886                 esac
11887                 d_endprotoent_r=undef
11888                 endprotoent_r_proto=0
11889                 ;;
11890         esac
11891         ;;
11892 *)      endprotoent_r_proto=0
11893         ;;
11894 esac
11895
11896 : see if endpwent exists
11897 set endpwent d_endpwent
11898 eval $inlibc
11899
11900 : see if this is a pwd.h system
11901 set pwd.h i_pwd
11902 eval $inhdr
11903
11904 case "$i_pwd" in
11905 $define)
11906         xxx=`./findhdr pwd.h`
11907         $cppstdin $cppflags $cppminus < $xxx >$$.h
11908
11909         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11910                 val="$define"
11911         else
11912                 val="$undef"
11913         fi
11914         set d_pwquota
11915         eval $setvar
11916
11917         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11918                 val="$define"
11919         else
11920                 val="$undef"
11921         fi
11922         set d_pwage
11923         eval $setvar
11924
11925         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11926                 val="$define"
11927         else
11928                 val="$undef"
11929         fi
11930         set d_pwchange
11931         eval $setvar
11932
11933         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11934                 val="$define"
11935         else
11936                 val="$undef"
11937         fi
11938         set d_pwclass
11939         eval $setvar
11940
11941         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11942                 val="$define"
11943         else
11944                 val="$undef"
11945         fi
11946         set d_pwexpire
11947         eval $setvar
11948
11949         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11950                 val="$define"
11951         else
11952                 val="$undef"
11953         fi
11954         set d_pwcomment
11955         eval $setvar
11956
11957         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11958                 val="$define"
11959         else
11960                 val="$undef"
11961         fi
11962         set d_pwgecos
11963         eval $setvar
11964
11965         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11966                 val="$define"
11967         else
11968                 val="$undef"
11969         fi
11970         set d_pwpasswd
11971         eval $setvar
11972
11973         $rm -f $$.h
11974         ;;
11975 *)
11976         val="$undef"; 
11977         set d_pwquota; eval $setvar
11978         set d_pwage; eval $setvar
11979         set d_pwchange; eval $setvar
11980         set d_pwclass; eval $setvar
11981         set d_pwexpire; eval $setvar
11982         set d_pwcomment; eval $setvar
11983         set d_pwgecos; eval $setvar
11984         set d_pwpasswd; eval $setvar
11985         ;;
11986 esac
11987
11988 : see if endpwent_r exists
11989 set endpwent_r d_endpwent_r
11990 eval $inlibc
11991 case "$d_endpwent_r" in
11992 "$define")
11993         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11994         case "$d_endpwent_r_proto:$usethreads" in
11995         ":define")      d_endpwent_r_proto=define
11996                 set d_endpwent_r_proto endpwent_r $hdrs
11997                 eval $hasproto ;;
11998         *)      ;;
11999         esac
12000         case "$d_endpwent_r_proto" in
12001         define)
12002         case "$endpwent_r_proto" in
12003         ''|0) try='int endpwent_r(FILE**);'
12004         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12005         esac
12006         case "$endpwent_r_proto" in
12007         ''|0) try='void endpwent_r(FILE**);'
12008         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12009         esac
12010         case "$endpwent_r_proto" in
12011         ''|0)   d_endpwent_r=undef
12012                 endpwent_r_proto=0
12013                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12014         * )     case "$endpwent_r_proto" in
12015                 REENTRANT_PROTO*) ;;
12016                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12017                 esac
12018                 echo "Prototype: $try" ;;
12019         esac
12020         ;;
12021         *)      case "$usethreads" in
12022                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12023                 esac
12024                 d_endpwent_r=undef
12025                 endpwent_r_proto=0
12026                 ;;
12027         esac
12028         ;;
12029 *)      endpwent_r_proto=0
12030         ;;
12031 esac
12032
12033 : see if endservent exists
12034 set endservent d_endsent
12035 eval $inlibc
12036
12037 : see if endservent_r exists
12038 set endservent_r d_endservent_r
12039 eval $inlibc
12040 case "$d_endservent_r" in
12041 "$define")
12042         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12043         case "$d_endservent_r_proto:$usethreads" in
12044         ":define")      d_endservent_r_proto=define
12045                 set d_endservent_r_proto endservent_r $hdrs
12046                 eval $hasproto ;;
12047         *)      ;;
12048         esac
12049         case "$d_endservent_r_proto" in
12050         define)
12051         case "$endservent_r_proto" in
12052         ''|0) try='int endservent_r(struct servent_data*);'
12053         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12054         esac
12055         case "$endservent_r_proto" in
12056         ''|0) try='void endservent_r(struct servent_data*);'
12057         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12058         esac
12059         case "$endservent_r_proto" in
12060         ''|0)   d_endservent_r=undef
12061                 endservent_r_proto=0
12062                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12063         * )     case "$endservent_r_proto" in
12064                 REENTRANT_PROTO*) ;;
12065                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12066                 esac
12067                 echo "Prototype: $try" ;;
12068         esac
12069         ;;
12070         *)      case "$usethreads" in
12071                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12072                 esac
12073                 d_endservent_r=undef
12074                 endservent_r_proto=0
12075                 ;;
12076         esac
12077         ;;
12078 *)      endservent_r_proto=0
12079         ;;
12080 esac
12081
12082 : Locate the flags for 'open()'
12083 echo " "
12084 $cat >try.c <<EOCP
12085 #include <sys/types.h>
12086 #ifdef I_FCNTL
12087 #include <fcntl.h>
12088 #endif
12089 #ifdef I_SYS_FILE
12090 #include <sys/file.h>
12091 #endif
12092 #$i_stdlib I_STDLIB
12093 #ifdef I_STDLIB
12094 #include <stdlib.h>
12095 #endif
12096 int main() {
12097         if(O_RDONLY);
12098 #ifdef O_TRUNC
12099         exit(0);
12100 #else
12101         exit(1);
12102 #endif
12103 }
12104 EOCP
12105 : check sys/file.h first to get FREAD on Sun
12106 if $test `./findhdr sys/file.h` && \
12107                 set try -DI_SYS_FILE && eval $compile; then
12108         h_sysfile=true;
12109         echo "<sys/file.h> defines the O_* constants..." >&4
12110         if $run ./try; then
12111                 echo "and you have the 3 argument form of open()." >&4
12112                 val="$define"
12113         else
12114                 echo "but not the 3 argument form of open().  Oh, well." >&4
12115                 val="$undef"
12116         fi
12117 elif $test `./findhdr fcntl.h` && \
12118                 set try -DI_FCNTL && eval $compile; then
12119         h_fcntl=true;
12120         echo "<fcntl.h> defines the O_* constants..." >&4
12121         if $run ./try; then
12122                 echo "and you have the 3 argument form of open()." >&4
12123                 val="$define"
12124         else
12125                 echo "but not the 3 argument form of open().  Oh, well." >&4
12126                 val="$undef"
12127         fi
12128 else
12129         val="$undef"
12130         echo "I can't find the O_* constant definitions!  You got problems." >&4
12131 fi
12132 set d_open3
12133 eval $setvar
12134 $rm_try
12135
12136 : see which of string.h or strings.h is needed
12137 echo " "
12138 strings=`./findhdr string.h`
12139 if $test "$strings" && $test -r "$strings"; then
12140         echo "Using <string.h> instead of <strings.h>." >&4
12141         val="$define"
12142 else
12143         val="$undef"
12144         strings=`./findhdr strings.h`
12145         if $test "$strings" && $test -r "$strings"; then
12146                 echo "Using <strings.h> instead of <string.h>." >&4
12147         else
12148                 echo "No string header found -- You'll surely have problems." >&4
12149         fi
12150 fi
12151 set i_string
12152 eval $setvar
12153 case "$i_string" in
12154 "$undef") strings=`./findhdr strings.h`;;
12155 *)        strings=`./findhdr string.h`;;
12156 esac
12157
12158 : see if this is a sys/file.h system
12159 val=''
12160 set sys/file.h val
12161 eval $inhdr
12162
12163 : do we need to include sys/file.h ?
12164 case "$val" in
12165 "$define")
12166         echo " "
12167         if $h_sysfile; then
12168                 val="$define"
12169                 echo "We'll be including <sys/file.h>." >&4
12170         else
12171                 val="$undef"
12172                 echo "We won't be including <sys/file.h>." >&4
12173         fi
12174         ;;
12175 *)
12176         h_sysfile=false
12177         ;;
12178 esac
12179 set i_sysfile
12180 eval $setvar
12181
12182 : see if fcntl.h is there
12183 val=''
12184 set fcntl.h val
12185 eval $inhdr
12186
12187 : see if we can include fcntl.h
12188 case "$val" in
12189 "$define")
12190         echo " "
12191         if $h_fcntl; then
12192                 val="$define"
12193                 echo "We'll be including <fcntl.h>." >&4
12194         else
12195                 val="$undef"
12196                 if $h_sysfile; then
12197         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12198                 else
12199                         echo "We won't be including <fcntl.h>." >&4
12200                 fi
12201         fi
12202         ;;
12203 *)
12204         h_fcntl=false
12205         val="$undef"
12206         ;;
12207 esac
12208 set i_fcntl
12209 eval $setvar
12210
12211 : see if fork exists
12212 set fork d_fork
12213 eval $inlibc
12214
12215 : see if pipe exists
12216 set pipe d_pipe
12217 eval $inlibc
12218
12219 : check for non-blocking I/O stuff
12220 case "$h_sysfile" in
12221 true) echo "#include <sys/file.h>" > head.c;;
12222 *)
12223        case "$h_fcntl" in
12224        true) echo "#include <fcntl.h>" > head.c;;
12225        *) echo "#include <sys/fcntl.h>" > head.c;;
12226        esac
12227        ;;
12228 esac
12229 echo " "
12230 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12231 case "$o_nonblock" in
12232 '')
12233         $cat head.c > try.c
12234         $cat >>try.c <<EOCP
12235 #include <stdio.h>
12236 #$i_stdlib I_STDLIB
12237 #ifdef I_STDLIB
12238 #include <stdlib.h>
12239 #endif
12240 #$i_fcntl I_FCNTL
12241 #ifdef I_FCNTL
12242 #include <fcntl.h>
12243 #endif
12244 int main() {
12245 #ifdef O_NONBLOCK
12246         printf("O_NONBLOCK\n");
12247         exit(0);
12248 #endif
12249 #ifdef O_NDELAY
12250         printf("O_NDELAY\n");
12251         exit(0);
12252 #endif
12253 #ifdef FNDELAY
12254         printf("FNDELAY\n");
12255         exit(0);
12256 #endif
12257         exit(0);
12258 }
12259 EOCP
12260         set try
12261         if eval $compile_ok; then
12262                 o_nonblock=`$run ./try`
12263                 case "$o_nonblock" in
12264                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12265                 *) echo "Seems like we can use $o_nonblock.";;
12266                 esac
12267         else
12268                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12269         fi
12270         ;;
12271 *) echo "Using $hint value $o_nonblock.";;
12272 esac
12273 $rm_try
12274
12275 echo " "
12276 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12277 case "$eagain" in
12278 '')
12279         case "$d_fork:$d_pipe" in
12280         define:define)
12281         $cat head.c > try.c
12282         $cat >>try.c <<EOCP
12283 #include <errno.h>
12284 #include <sys/types.h>
12285 #include <signal.h>
12286 #include <stdio.h>
12287 #$i_stdlib I_STDLIB
12288 #ifdef I_STDLIB
12289 #include <stdlib.h>
12290 #endif
12291 #$i_fcntl I_FCNTL
12292 #ifdef I_FCNTL
12293 #include <fcntl.h>
12294 #endif
12295 #define MY_O_NONBLOCK $o_nonblock
12296 #ifndef errno  /* XXX need better Configure test */
12297 extern int errno;
12298 #endif
12299 #$i_unistd I_UNISTD
12300 #ifdef I_UNISTD
12301 #include <unistd.h>
12302 #endif
12303 #$i_string I_STRING
12304 #ifdef I_STRING
12305 #include <string.h>
12306 #else
12307 #include <strings.h>
12308 #endif
12309 $signal_t blech(int x) { exit(3); }
12310 EOCP
12311         $cat >> try.c <<'EOCP'
12312 int main()
12313 {
12314         int pd[2];
12315         int pu[2];
12316         char buf[1];
12317         char string[100];
12318
12319         pipe(pd);       /* Down: child -> parent */
12320         pipe(pu);       /* Up: parent -> child */
12321         if (0 != fork()) {
12322                 int ret;
12323                 close(pd[1]);   /* Parent reads from pd[0] */
12324                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12325 #ifdef F_SETFL
12326                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12327                         exit(1);
12328 #else
12329                 exit(4);
12330 #endif
12331                 signal(SIGALRM, blech);
12332                 alarm(5);
12333                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12334                         exit(2);
12335                 sprintf(string, "%d\n", ret);
12336                 write(2, string, strlen(string));
12337                 alarm(0);
12338 #ifdef EAGAIN
12339                 if (errno == EAGAIN) {
12340                         printf("EAGAIN\n");
12341                         goto ok;
12342                 }
12343 #endif
12344 #ifdef EWOULDBLOCK
12345                 if (errno == EWOULDBLOCK)
12346                         printf("EWOULDBLOCK\n");
12347 #endif
12348         ok:
12349                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12350                 sleep(2);                               /* Give it time to close our pipe */
12351                 alarm(5);
12352                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12353                 alarm(0);
12354                 sprintf(string, "%d\n", ret);
12355                 write(4, string, strlen(string));
12356                 exit(0);
12357         }
12358
12359         close(pd[0]);                   /* We write to pd[1] */
12360         close(pu[1]);                   /* We read from pu[0] */
12361         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12362         close(pd[1]);                   /* Pipe pd is now fully closed! */
12363         exit(0);                                /* Bye bye, thank you for playing! */
12364 }
12365 EOCP
12366         set try
12367         if eval $compile_ok; then
12368                 echo "$startsh" >mtry
12369                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12370                 chmod +x mtry
12371                 ./mtry >/dev/null 2>&1
12372                 case $? in
12373                 0) eagain=`$cat try.out`;;
12374                 1) echo "Could not perform non-blocking setting!";;
12375                 2) echo "I did a successful read() for something that was not there!";;
12376                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12377                 4) echo "Could not find F_SETFL!";;
12378                 *) echo "Something terribly wrong happened during testing.";;
12379                 esac
12380                 rd_nodata=`$cat try.ret`
12381                 echo "A read() system call with no data present returns $rd_nodata."
12382                 case "$rd_nodata" in
12383                 0|-1) ;;
12384                 *)
12385                         echo "(That's peculiar, fixing that to be -1.)"
12386                         rd_nodata=-1
12387                         ;;
12388                 esac
12389                 case "$eagain" in
12390                 '')
12391                         echo "Forcing errno EAGAIN on read() with no data available."
12392                         eagain=EAGAIN
12393                         ;;
12394                 *)
12395                         echo "Your read() sets errno to $eagain when no data is available."
12396                         ;;
12397                 esac
12398                 status=`$cat try.err`
12399                 case "$status" in
12400                 0) echo "And it correctly returns 0 to signal EOF.";;
12401                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12402                 *) echo "However, your read() returns '$status' on EOF??";;
12403                 esac
12404                 val="$define"
12405                 if test "$status" = "$rd_nodata"; then
12406                         echo "WARNING: you can't distinguish between EOF and no data!"
12407                         val="$undef"
12408                 fi
12409         else
12410                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12411                 eagain=EAGAIN
12412         fi
12413         ;;
12414         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12415                 eagain=EAGAIN
12416                 val="$define"
12417                 ;;
12418         esac
12419         set d_eofnblk
12420         eval $setvar
12421         ;;
12422 *)
12423         echo "Using $hint value $eagain."
12424         echo "Your read() returns $rd_nodata when no data is present."
12425         case "$d_eofnblk" in
12426         "$define") echo "And you can see EOF because read() returns 0.";;
12427         "$undef") echo "But you can't see EOF status from read() returned value.";;
12428         *)
12429                 echo "(Assuming you can't see EOF status from read anyway.)"
12430                 d_eofnblk=$undef
12431                 ;;
12432         esac
12433         ;;
12434 esac
12435 $rm_try head.c mtry
12436
12437 : see if _ptr and _cnt from stdio act std
12438 echo " "
12439
12440 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12441         echo "(Looks like you have stdio.h from BSD.)"
12442         case "$stdio_ptr" in
12443         '') stdio_ptr='((fp)->_p)'
12444                 ptr_lval=$define
12445                 ;;
12446         *)      ptr_lval=$d_stdio_ptr_lval;;
12447         esac
12448         case "$stdio_cnt" in
12449         '') stdio_cnt='((fp)->_r)'
12450                 cnt_lval=$define
12451                 ;;
12452         *)      cnt_lval=$d_stdio_cnt_lval;;
12453         esac
12454         case "$stdio_base" in
12455         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12456         esac
12457         case "$stdio_bufsiz" in
12458         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12459         esac
12460 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12461         echo "(Looks like you have stdio.h from Linux.)"
12462         case "$stdio_ptr" in
12463         '') stdio_ptr='((fp)->_IO_read_ptr)'
12464                 ptr_lval=$define
12465                 ;;
12466         *)      ptr_lval=$d_stdio_ptr_lval;;
12467         esac
12468         case "$stdio_cnt" in
12469         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12470                 cnt_lval=$undef
12471                 ;;
12472         *)      cnt_lval=$d_stdio_cnt_lval;;
12473         esac
12474         case "$stdio_base" in
12475         '') stdio_base='((fp)->_IO_read_base)';;
12476         esac
12477         case "$stdio_bufsiz" in
12478         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12479         esac
12480 else
12481         case "$stdio_ptr" in
12482         '') stdio_ptr='((fp)->_ptr)'
12483                 ptr_lval=$define
12484                 ;;
12485         *)      ptr_lval=$d_stdio_ptr_lval;;
12486         esac
12487         case "$stdio_cnt" in
12488         '') stdio_cnt='((fp)->_cnt)'
12489                 cnt_lval=$define
12490                 ;;
12491         *)      cnt_lval=$d_stdio_cnt_lval;;
12492         esac
12493         case "$stdio_base" in
12494         '') stdio_base='((fp)->_base)';;
12495         esac
12496         case "$stdio_bufsiz" in
12497         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12498         esac
12499 fi
12500
12501 : test whether _ptr and _cnt really work
12502 echo "Checking how std your stdio is..." >&4
12503 $cat >try.c <<EOP
12504 #include <stdio.h>
12505 #$i_stdlib I_STDLIB
12506 #ifdef I_STDLIB
12507 #include <stdlib.h>
12508 #endif
12509 #define FILE_ptr(fp)    $stdio_ptr
12510 #define FILE_cnt(fp)    $stdio_cnt
12511 int main() {
12512         FILE *fp = fopen("try.c", "r");
12513         char c = getc(fp);
12514         if (
12515                 18 <= FILE_cnt(fp) &&
12516                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12517         )
12518                 exit(0);
12519         exit(1);
12520 }
12521 EOP
12522 val="$undef"
12523 set try
12524 if eval $compile && $to try.c; then
12525         if $run ./try; then
12526                 echo "Your stdio acts pretty std."
12527                 val="$define"
12528         else
12529                 echo "Your stdio isn't very std."
12530         fi
12531 else
12532         echo "Your stdio doesn't appear very std."
12533 fi
12534 $rm_try
12535
12536 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12537 # direct buffer manipulation no longer works.  The Configure tests
12538 # should be changed to correctly detect this, but until then,
12539 # the following check should at least let perl compile and run.
12540 # (This quick fix should be updated before 5.8.1.)
12541 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12542 # A. Dougherty, June 3, 2002.
12543 case "$d_gnulibc" in
12544 $define)
12545         case "$gnulibc_version" in
12546         2.[01]*)  ;;
12547         2.2) ;;
12548         2.2.[0-9]) ;;
12549         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12550                 val="$undef"
12551                 ;;
12552         esac
12553         ;;
12554 esac
12555 set d_stdstdio
12556 eval $setvar
12557
12558 : Can _ptr be used as an lvalue?
12559 case "$d_stdstdio$ptr_lval" in
12560 $define$define) val=$define ;;
12561 *) val=$undef ;;
12562 esac
12563 set d_stdio_ptr_lval
12564 eval $setvar
12565
12566 : Can _cnt be used as an lvalue?
12567 case "$d_stdstdio$cnt_lval" in
12568 $define$define) val=$define ;;
12569 *) val=$undef ;;
12570 esac
12571 set d_stdio_cnt_lval
12572 eval $setvar
12573
12574
12575 : test whether setting _ptr sets _cnt as a side effect
12576 d_stdio_ptr_lval_sets_cnt="$undef"
12577 d_stdio_ptr_lval_nochange_cnt="$undef"
12578 case "$d_stdio_ptr_lval$d_stdstdio" in
12579 $define$define)
12580         echo "Checking to see what happens if we set the stdio ptr..." >&4
12581 $cat >try.c <<EOP
12582 #include <stdio.h>
12583 /* Can we scream? */
12584 /* Eat dust sed :-) */
12585 /* In the buffer space, no one can hear you scream. */
12586 #$i_stdlib I_STDLIB
12587 #ifdef I_STDLIB
12588 #include <stdlib.h>
12589 #endif
12590 #define FILE_ptr(fp)    $stdio_ptr
12591 #define FILE_cnt(fp)    $stdio_cnt
12592 #include <sys/types.h>
12593 int main() {
12594         FILE *fp = fopen("try.c", "r");
12595         int c;
12596         char *ptr;
12597         size_t cnt;
12598         if (!fp) {
12599             puts("Fail even to read");
12600             exit(1);
12601         }
12602         c = getc(fp); /* Read away the first # */
12603         if (c == EOF) {
12604             puts("Fail even to read");
12605             exit(1);
12606         }
12607         if (!(
12608                 18 <= FILE_cnt(fp) &&
12609                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12610         )) {
12611                 puts("Fail even to read");
12612                 exit (1);
12613         }
12614         ptr = (char*) FILE_ptr(fp);
12615         cnt = (size_t)FILE_cnt(fp);
12616
12617         FILE_ptr(fp) += 42;
12618
12619         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12620                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12621                 exit (1);
12622         }
12623         if (FILE_cnt(fp) <= 20) {
12624                 printf ("Fail (<20 chars to test)");
12625                 exit (1);
12626         }
12627         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12628                 puts("Fail compare");
12629                 exit (1);
12630         }
12631         if (cnt == FILE_cnt(fp)) {
12632                 puts("Pass_unchanged");
12633                 exit (0);
12634         }
12635         if (FILE_cnt(fp) == (cnt - 42)) {
12636                 puts("Pass_changed");
12637                 exit (0);
12638         }
12639         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12640         return 1;
12641
12642 }
12643 EOP
12644         set try
12645         if eval $compile && $to try.c; then
12646                 case `$run ./try` in
12647                 Pass_changed)
12648                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12649                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12650                 Pass_unchanged)
12651                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12652                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12653                 Fail*)
12654                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12655                 *)
12656                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12657         esac
12658         else
12659                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12660         fi
12661         $rm_try
12662         ;;
12663 esac
12664
12665 : see if _base is also standard
12666 val="$undef"
12667 case "$d_stdstdio" in
12668 $define)
12669         $cat >try.c <<EOP
12670 #include <stdio.h>
12671 #$i_stdlib I_STDLIB
12672 #ifdef I_STDLIB
12673 #include <stdlib.h>
12674 #endif
12675 #define FILE_base(fp)   $stdio_base
12676 #define FILE_bufsiz(fp) $stdio_bufsiz
12677 int main() {
12678         FILE *fp = fopen("try.c", "r");
12679         char c = getc(fp);
12680         if (
12681                 19 <= FILE_bufsiz(fp) &&
12682                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12683         )
12684                 exit(0);
12685         exit(1);
12686 }
12687 EOP
12688         set try
12689         if eval $compile && $to try.c; then
12690                 if $run ./try; then
12691                         echo "And its _base field acts std."
12692                         val="$define"
12693                 else
12694                         echo "But its _base field isn't std."
12695                 fi
12696         else
12697                 echo "However, it seems to be lacking the _base field."
12698         fi
12699         $rm_try
12700         ;;
12701 esac
12702 set d_stdiobase
12703 eval $setvar
12704
12705 : see if fast_stdio exists
12706 val="$undef"
12707 case "$d_stdstdio:$d_stdio_ptr_lval" in
12708 "$define:$define")
12709         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12710         *$define*)
12711                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12712                 val="$define"
12713                 ;;
12714         esac
12715         ;;
12716 esac
12717 set d_faststdio
12718 eval $setvar
12719
12720
12721
12722 : see if fchdir exists
12723 set fchdir d_fchdir
12724 eval $inlibc
12725
12726 : see if fchmod exists
12727 set fchmod d_fchmod
12728 eval $inlibc
12729
12730 : see if fchown exists
12731 set fchown d_fchown
12732 eval $inlibc
12733
12734 : see if this is an fcntl system
12735 set fcntl d_fcntl
12736 eval $inlibc
12737
12738 echo " "
12739 : See if fcntl-based locking works.
12740 $cat >try.c <<EOCP
12741 #$i_stdlib I_STDLIB
12742 #ifdef I_STDLIB
12743 #include <stdlib.h>
12744 #endif
12745 #include <unistd.h>
12746 #include <fcntl.h>
12747 #include <signal.h>
12748 $signal_t blech(int x) { exit(3); }
12749 int main() {
12750 #if defined(F_SETLK) && defined(F_SETLKW)
12751      struct flock flock;
12752      int retval, fd;
12753      fd = open("try.c", O_RDONLY);
12754      flock.l_type = F_RDLCK;
12755      flock.l_whence = SEEK_SET;
12756      flock.l_start = flock.l_len = 0;
12757      signal(SIGALRM, blech);
12758      alarm(10);
12759      retval = fcntl(fd, F_SETLK, &flock);
12760      close(fd);
12761      (retval < 0 ? exit(2) : exit(0));
12762 #else
12763      exit(2);
12764 #endif
12765 }
12766 EOCP
12767 echo "Checking if fcntl-based file locking works... "
12768 case "$d_fcntl" in
12769 "$define")
12770         set try
12771         if eval $compile_ok; then
12772                 if $run ./try; then
12773                         echo "Yes, it seems to work."
12774                         val="$define"
12775                 else
12776                         echo "Nope, it didn't work."
12777                         val="$undef"
12778                         case "$?" in
12779                         3) $cat >&4 <<EOM
12780 ***
12781 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12782 *** This is (almost) impossible.
12783 *** If your NFS lock daemons are not feeling well, something like
12784 *** this may happen, please investigate.  Cannot continue, aborting.
12785 ***
12786 EOM
12787                                 exit 1
12788                                 ;;
12789                         esac
12790                 fi
12791         else
12792                 echo "I'm unable to compile the test program, so I'll assume not."
12793                 val="$undef"
12794         fi
12795         ;;
12796 *) val="$undef";
12797         echo "Nope, since you don't even have fcntl()."
12798         ;;
12799 esac
12800 set d_fcntl_can_lock
12801 eval $setvar
12802 $rm_try
12803
12804 : check for fd_set items
12805 $cat <<EOM
12806
12807 Checking to see how well your C compiler handles fd_set and friends ...
12808 EOM
12809 $cat >try.c <<EOCP
12810 #$i_stdlib I_STDLIB
12811 #ifdef I_STDLIB
12812 #include <stdlib.h>
12813 #endif
12814 #$i_systime I_SYS_TIME
12815 #$i_sysselct I_SYS_SELECT
12816 #$d_socket HAS_SOCKET
12817 #include <sys/types.h>
12818 #ifdef HAS_SOCKET
12819 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12820 #endif
12821 #ifdef I_SYS_TIME
12822 #include <sys/time.h>
12823 #endif
12824 #ifdef I_SYS_SELECT
12825 #include <sys/select.h>
12826 #endif
12827 int main() {
12828         fd_set fds;
12829
12830 #ifdef TRYBITS
12831         if(fds.fds_bits);
12832 #endif
12833
12834 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12835         exit(0);
12836 #else
12837         exit(1);
12838 #endif
12839 }
12840 EOCP
12841 set try -DTRYBITS
12842 if eval $compile; then
12843         d_fds_bits="$define"
12844         d_fd_set="$define"
12845         echo "Well, your system knows about the normal fd_set typedef..." >&4
12846         if $run ./try; then
12847                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12848                 d_fd_macros="$define"
12849         else
12850                 $cat >&4 <<'EOM'
12851 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12852 EOM
12853                 d_fd_macros="$undef"
12854         fi
12855 else
12856         $cat <<'EOM'
12857 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12858 EOM
12859         set try
12860         if eval $compile; then
12861                 d_fds_bits="$undef"
12862                 d_fd_set="$define"
12863                 echo "Well, your system has some sort of fd_set available..." >&4
12864                 if $run ./try; then
12865                         echo "and you have the normal fd_set macros." >&4
12866                         d_fd_macros="$define"
12867                 else
12868                         $cat <<'EOM'
12869 but not the normal fd_set macros!  Gross!  More work for me...
12870 EOM
12871                         d_fd_macros="$undef"
12872                 fi
12873         else
12874         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12875                 d_fd_set="$undef"
12876                 d_fds_bits="$undef"
12877                 d_fd_macros="$undef"
12878         fi
12879 fi
12880 $rm_try
12881
12882 : see if fgetpos exists
12883 set fgetpos d_fgetpos
12884 eval $inlibc
12885
12886 : see if finite exists
12887 set finite d_finite
12888 eval $inlibc
12889
12890 : see if finitel exists
12891 set finitel d_finitel
12892 eval $inlibc
12893
12894 : see if flock exists
12895 set flock d_flock
12896 eval $inlibc
12897
12898 : see if prototype for flock is available
12899 echo " "
12900 set d_flockproto flock $i_sysfile sys/file.h
12901 eval $hasproto
12902
12903 : see if fp_class exists
12904 set fp_class d_fp_class
12905 eval $inlibc
12906
12907 : see if pathconf exists
12908 set pathconf d_pathconf
12909 eval $inlibc
12910
12911 : see if fpathconf exists
12912 set fpathconf d_fpathconf
12913 eval $inlibc
12914
12915 : see if fpclass exists
12916 set fpclass d_fpclass
12917 eval $inlibc
12918
12919 : see if fpclassify exists
12920 set fpclassify d_fpclassify
12921 eval $inlibc
12922
12923 : see if fpclassl exists
12924 set fpclassl d_fpclassl
12925 eval $inlibc
12926
12927
12928 : check for fpos64_t
12929 echo " "
12930 echo "Checking to see if you have fpos64_t..." >&4
12931 $cat >try.c <<EOCP
12932 #include <stdio.h>
12933 int main() { fpos64_t x = 7; }
12934 EOCP
12935 set try
12936 if eval $compile; then
12937         val="$define"
12938         echo "You have fpos64_t."
12939 else
12940         val="$undef"
12941         echo "You do not have fpos64_t."
12942         case "$fpossize" in
12943         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12944         esac
12945 fi
12946 $rm_try
12947 set d_fpos64_t
12948 eval $setvar
12949
12950 : see if frexpl exists
12951 set frexpl d_frexpl
12952 eval $inlibc
12953
12954 : see if this is a sys/param system
12955 set sys/param.h i_sysparam
12956 eval $inhdr
12957
12958 : see if this is a sys/mount.h system
12959 set sys/mount.h i_sysmount
12960 eval $inhdr
12961
12962
12963 echo " "
12964 echo "Checking to see if your system supports struct fs_data..." >&4
12965 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12966 eval $hasstruct
12967 case "$d_fs_data_s" in
12968 "$define")      echo "Yes, it does."   ;;
12969 *)              echo "No, it doesn't." ;;
12970 esac
12971
12972 : see if fseeko exists
12973 set fseeko d_fseeko
12974 eval $inlibc
12975 case "$longsize" in
12976 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12977 esac
12978
12979 : see if fsetpos exists
12980 set fsetpos d_fsetpos
12981 eval $inlibc
12982
12983
12984 : see if fstatfs exists
12985 set fstatfs d_fstatfs
12986 eval $inlibc
12987
12988
12989 : see if statvfs exists
12990 set statvfs d_statvfs
12991 eval $inlibc
12992
12993 : see if fstatvfs exists
12994 set fstatvfs d_fstatvfs
12995 eval $inlibc
12996
12997
12998 : see if fsync exists
12999 set fsync d_fsync
13000 eval $inlibc
13001
13002 : see if ftello exists
13003 set ftello d_ftello
13004 eval $inlibc
13005 case "$longsize" in
13006 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13007 esac
13008
13009 d_futimes="$undef"
13010 : check for a working futimes
13011 echo " "
13012 echo "Checking if you have a working futimes()" >&4
13013 $cat >try.c <<EOCP
13014 #include <stdio.h>
13015 #include <sys/time.h>
13016 #include <errno.h>
13017 #include <fcntl.h>
13018
13019 int main ()
13020 {
13021     int fd, rv;
13022     fd = open ("try.c", O_RDWR);
13023     if (-1 == fd) exit (1);
13024     rv = futimes (fd, NULL);
13025     exit (rv == -1 ? errno : 0);
13026 }
13027 EOCP
13028 set try
13029 if eval $compile; then
13030     `$run ./try`
13031     rc=$?
13032     case "$rc" in
13033         0)  echo "Yes, you have" >&4
13034             d_futimes="$define"
13035             ;;
13036         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13037             ;;
13038     esac
13039 else
13040     echo "No, it does not (probably harmless)" >&4
13041 fi
13042 $rm_try
13043
13044 : see if getcwd exists
13045 set getcwd d_getcwd
13046 eval $inlibc
13047
13048 : see if getespwnam exists
13049 set getespwnam d_getespwnam
13050 eval $inlibc
13051
13052
13053 : see if getfsstat exists
13054 set getfsstat d_getfsstat
13055 eval $inlibc
13056
13057 : see if getgrent exists
13058 set getgrent d_getgrent
13059 eval $inlibc
13060
13061 : see if getgrent_r exists
13062 set getgrent_r d_getgrent_r
13063 eval $inlibc
13064 case "$d_getgrent_r" in
13065 "$define")
13066         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13067         case "$d_getgrent_r_proto:$usethreads" in
13068         ":define")      d_getgrent_r_proto=define
13069                 set d_getgrent_r_proto getgrent_r $hdrs
13070                 eval $hasproto ;;
13071         *)      ;;
13072         esac
13073         case "$d_getgrent_r_proto" in
13074         define)
13075         case "$getgrent_r_proto" in
13076         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13077         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13078         esac
13079         case "$getgrent_r_proto" in
13080         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13081         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13082         esac
13083         case "$getgrent_r_proto" in
13084         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13085         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13086         esac
13087         case "$getgrent_r_proto" in
13088         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13089         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13090         esac
13091         case "$getgrent_r_proto" in
13092         ''|0) try='int getgrent_r(struct group*, char*, int);'
13093         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13094         esac
13095         case "$getgrent_r_proto" in
13096         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13097         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13098         esac
13099         case "$getgrent_r_proto" in
13100         ''|0)   d_getgrent_r=undef
13101                 getgrent_r_proto=0
13102                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13103         * )     case "$getgrent_r_proto" in
13104                 REENTRANT_PROTO*) ;;
13105                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13106                 esac
13107                 echo "Prototype: $try" ;;
13108         esac
13109         ;;
13110         *)      case "$usethreads" in
13111                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13112                 esac
13113                 d_getgrent_r=undef
13114                 getgrent_r_proto=0
13115                 ;;
13116         esac
13117         ;;
13118 *)      getgrent_r_proto=0
13119         ;;
13120 esac
13121
13122 : see if getgrgid_r exists
13123 set getgrgid_r d_getgrgid_r
13124 eval $inlibc
13125 case "$d_getgrgid_r" in
13126 "$define")
13127         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13128         case "$d_getgrgid_r_proto:$usethreads" in
13129         ":define")      d_getgrgid_r_proto=define
13130                 set d_getgrgid_r_proto getgrgid_r $hdrs
13131                 eval $hasproto ;;
13132         *)      ;;
13133         esac
13134         case "$d_getgrgid_r_proto" in
13135         define)
13136         case "$getgrgid_r_proto" in
13137         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13138         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13139         esac
13140         case "$getgrgid_r_proto" in
13141         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13142         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13143         esac
13144         case "$getgrgid_r_proto" in
13145         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13146         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13147         esac
13148         case "$getgrgid_r_proto" in
13149         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13150         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13151         esac
13152         case "$getgrgid_r_proto" in
13153         ''|0)   d_getgrgid_r=undef
13154                 getgrgid_r_proto=0
13155                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13156         * )     case "$getgrgid_r_proto" in
13157                 REENTRANT_PROTO*) ;;
13158                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13159                 esac
13160                 echo "Prototype: $try" ;;
13161         esac
13162         ;;
13163         *)      case "$usethreads" in
13164                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13165                 esac
13166                 d_getgrgid_r=undef
13167                 getgrgid_r_proto=0
13168                 ;;
13169         esac
13170         ;;
13171 *)      getgrgid_r_proto=0
13172         ;;
13173 esac
13174
13175 : see if getgrnam_r exists
13176 set getgrnam_r d_getgrnam_r
13177 eval $inlibc
13178 case "$d_getgrnam_r" in
13179 "$define")
13180         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13181         case "$d_getgrnam_r_proto:$usethreads" in
13182         ":define")      d_getgrnam_r_proto=define
13183                 set d_getgrnam_r_proto getgrnam_r $hdrs
13184                 eval $hasproto ;;
13185         *)      ;;
13186         esac
13187         case "$d_getgrnam_r_proto" in
13188         define)
13189         case "$getgrnam_r_proto" in
13190         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13191         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13192         esac
13193         case "$getgrnam_r_proto" in
13194         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13195         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13196         esac
13197         case "$getgrnam_r_proto" in
13198         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13199         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13200         esac
13201         case "$getgrnam_r_proto" in
13202         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13203         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13204         esac
13205         case "$getgrnam_r_proto" in
13206         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13207         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13208         esac
13209         case "$getgrnam_r_proto" in
13210         ''|0)   d_getgrnam_r=undef
13211                 getgrnam_r_proto=0
13212                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13213         * )     case "$getgrnam_r_proto" in
13214                 REENTRANT_PROTO*) ;;
13215                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13216                 esac
13217                 echo "Prototype: $try" ;;
13218         esac
13219         ;;
13220         *)      case "$usethreads" in
13221                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13222                 esac
13223                 d_getgrnam_r=undef
13224                 getgrnam_r_proto=0
13225                 ;;
13226         esac
13227         ;;
13228 *)      getgrnam_r_proto=0
13229         ;;
13230 esac
13231
13232 : see if gethostbyaddr exists
13233 set gethostbyaddr d_gethbyaddr
13234 eval $inlibc
13235
13236 : see if gethostbyname exists
13237 set gethostbyname d_gethbyname
13238 eval $inlibc
13239
13240 : see if gethostent exists
13241 set gethostent d_gethent
13242 eval $inlibc
13243
13244 : see how we will look up host name
13245 echo " "
13246 call=''
13247 if set gethostname val -f d_gethname; eval $csym; $val; then
13248         echo 'gethostname() found.' >&4
13249         d_gethname="$define"
13250         call=gethostname
13251 fi
13252 if set uname val -f d_uname; eval $csym; $val; then
13253         if ./xenix; then
13254                 $cat <<'EOM'
13255 uname() was found, but you're running xenix, and older versions of xenix
13256 have a broken uname(). If you don't really know whether your xenix is old
13257 enough to have a broken system call, use the default answer.
13258
13259 EOM
13260                 dflt=y
13261                 case "$d_uname" in
13262                 "$define") dflt=n;;
13263                 esac
13264                 rp='Is your uname() broken?'
13265                 . ./myread
13266                 case "$ans" in
13267                 n*) d_uname="$define"; call=uname;;
13268                 esac
13269         else
13270                 echo 'uname() found.' >&4
13271                 d_uname="$define"
13272                 case "$call" in
13273                 '') call=uname ;;
13274                 esac
13275         fi
13276 fi
13277 case "$d_gethname" in
13278 '') d_gethname="$undef";;
13279 esac
13280 case "$d_uname" in
13281 '') d_uname="$undef";;
13282 esac
13283 case "$d_uname$d_gethname" in
13284 *define*)
13285         dflt=n
13286         cat <<EOM
13287  
13288 Every now and then someone has a $call() that lies about the hostname
13289 but can't be fixed for political or economic reasons.  If you wish, I can
13290 pretend $call() isn't there and maybe compute hostname at run-time
13291 thanks to the '$phostname' command.
13292
13293 EOM
13294         rp="Shall I ignore $call() from now on?"
13295         . ./myread
13296         case "$ans" in
13297         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13298         esac;;
13299 esac
13300 case "$phostname" in
13301 '') aphostname='';;
13302 *) case "$aphostname" in
13303         /*) ;;
13304         *) set X $phostname
13305                 shift
13306                 file=$1
13307                 shift
13308                 file=`./loc $file $file $pth`
13309                 aphostname=`echo $file $*`
13310                 ;;
13311         esac
13312         ;;
13313 esac
13314 case "$d_uname$d_gethname" in
13315 *define*) ;;
13316 *)
13317         case "$phostname" in
13318         '')
13319                 echo "There will be no way for $package to get your hostname." >&4;;
13320         *)
13321         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13322                 ;;
13323         esac;;
13324 esac
13325 case "$d_phostname" in
13326 '') d_phostname="$undef";;
13327 esac
13328
13329 : see if gethostbyaddr_r exists
13330 set gethostbyaddr_r d_gethostbyaddr_r
13331 eval $inlibc
13332 case "$d_gethostbyaddr_r" in
13333 "$define")
13334         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13335         case "$d_gethostbyaddr_r_proto:$usethreads" in
13336         ":define")      d_gethostbyaddr_r_proto=define
13337                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13338                 eval $hasproto ;;
13339         *)      ;;
13340         esac
13341         case "$d_gethostbyaddr_r_proto" in
13342         define)
13343         case "$gethostbyaddr_r_proto" in
13344         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13345         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13346         esac
13347         case "$gethostbyaddr_r_proto" in
13348         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13349         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13350         esac
13351         case "$gethostbyaddr_r_proto" in
13352         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13353         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13354         esac
13355         case "$gethostbyaddr_r_proto" in
13356         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13357         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13358         esac
13359         case "$gethostbyaddr_r_proto" in
13360         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13361         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13362         esac
13363         case "$gethostbyaddr_r_proto" in
13364         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13365         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13366         esac
13367         case "$gethostbyaddr_r_proto" in
13368         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13369         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13370         esac
13371         case "$gethostbyaddr_r_proto" in
13372         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13373         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13374         esac
13375         case "$gethostbyaddr_r_proto" in
13376         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13377         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13378         esac
13379         case "$gethostbyaddr_r_proto" in
13380         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13381         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13382         esac
13383         case "$gethostbyaddr_r_proto" in
13384         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13385         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13386         esac
13387         case "$gethostbyaddr_r_proto" in
13388         ''|0)   d_gethostbyaddr_r=undef
13389                 gethostbyaddr_r_proto=0
13390                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13391         * )     case "$gethostbyaddr_r_proto" in
13392                 REENTRANT_PROTO*) ;;
13393                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13394                 esac
13395                 echo "Prototype: $try" ;;
13396         esac
13397         ;;
13398         *)      case "$usethreads" in
13399                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13400                 esac
13401                 d_gethostbyaddr_r=undef
13402                 gethostbyaddr_r_proto=0
13403                 ;;
13404         esac
13405         ;;
13406 *)      gethostbyaddr_r_proto=0
13407         ;;
13408 esac
13409
13410 : see if gethostbyname_r exists
13411 set gethostbyname_r d_gethostbyname_r
13412 eval $inlibc
13413 case "$d_gethostbyname_r" in
13414 "$define")
13415         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13416         case "$d_gethostbyname_r_proto:$usethreads" in
13417         ":define")      d_gethostbyname_r_proto=define
13418                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13419                 eval $hasproto ;;
13420         *)      ;;
13421         esac
13422         case "$d_gethostbyname_r_proto" in
13423         define)
13424         case "$gethostbyname_r_proto" in
13425         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13426         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13427         esac
13428         case "$gethostbyname_r_proto" in
13429         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13430         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13431         esac
13432         case "$gethostbyname_r_proto" in
13433         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13434         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13435         esac
13436         case "$gethostbyname_r_proto" in
13437         ''|0)   d_gethostbyname_r=undef
13438                 gethostbyname_r_proto=0
13439                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13440         * )     case "$gethostbyname_r_proto" in
13441                 REENTRANT_PROTO*) ;;
13442                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13443                 esac
13444                 echo "Prototype: $try" ;;
13445         esac
13446         ;;
13447         *)      case "$usethreads" in
13448                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13449                 esac
13450                 d_gethostbyname_r=undef
13451                 gethostbyname_r_proto=0
13452                 ;;
13453         esac
13454         ;;
13455 *)      gethostbyname_r_proto=0
13456         ;;
13457 esac
13458
13459 : see if gethostent_r exists
13460 set gethostent_r d_gethostent_r
13461 eval $inlibc
13462 case "$d_gethostent_r" in
13463 "$define")
13464         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13465         case "$d_gethostent_r_proto:$usethreads" in
13466         ":define")      d_gethostent_r_proto=define
13467                 set d_gethostent_r_proto gethostent_r $hdrs
13468                 eval $hasproto ;;
13469         *)      ;;
13470         esac
13471         case "$d_gethostent_r_proto" in
13472         define)
13473         case "$gethostent_r_proto" in
13474         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13475         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13476         esac
13477         case "$gethostent_r_proto" in
13478         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13479         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13480         esac
13481         case "$gethostent_r_proto" in
13482         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13483         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13484         esac
13485         case "$gethostent_r_proto" in
13486         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13487         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13488         esac
13489         case "$gethostent_r_proto" in
13490         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13491         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13492         esac
13493         case "$gethostent_r_proto" in
13494         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13495         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13496         esac
13497         case "$gethostent_r_proto" in
13498         ''|0)   d_gethostent_r=undef
13499                 gethostent_r_proto=0
13500                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13501         * )     case "$gethostent_r_proto" in
13502                 REENTRANT_PROTO*) ;;
13503                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13504                 esac
13505                 echo "Prototype: $try" ;;
13506         esac
13507         ;;
13508         *)      case "$usethreads" in
13509                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13510                 esac
13511                 d_gethostent_r=undef
13512                 gethostent_r_proto=0
13513                 ;;
13514         esac
13515         ;;
13516 *)      gethostent_r_proto=0
13517         ;;
13518 esac
13519
13520 : see if prototypes for various gethostxxx netdb.h functions are available
13521 echo " "
13522 set d_gethostprotos gethostent $i_netdb netdb.h
13523 eval $hasproto
13524
13525 : see if getitimer exists
13526 set getitimer d_getitimer
13527 eval $inlibc
13528
13529 : see if getlogin exists
13530 set getlogin d_getlogin
13531 eval $inlibc
13532
13533 : see if getlogin_r exists
13534 set getlogin_r d_getlogin_r
13535 eval $inlibc
13536 case "$d_getlogin_r" in
13537 "$define")
13538         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13539         case "$d_getlogin_r_proto:$usethreads" in
13540         ":define")      d_getlogin_r_proto=define
13541                 set d_getlogin_r_proto getlogin_r $hdrs
13542                 eval $hasproto ;;
13543         *)      ;;
13544         esac
13545         case "$d_getlogin_r_proto" in
13546         define)
13547         case "$getlogin_r_proto" in
13548         ''|0) try='int getlogin_r(char*, size_t);'
13549         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13550         esac
13551         case "$getlogin_r_proto" in
13552         ''|0) try='int getlogin_r(char*, int);'
13553         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13554         esac
13555         case "$getlogin_r_proto" in
13556         ''|0) try='char* getlogin_r(char*, size_t);'
13557         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13558         esac
13559         case "$getlogin_r_proto" in
13560         ''|0) try='char* getlogin_r(char*, int);'
13561         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13562         esac
13563         case "$getlogin_r_proto" in
13564         ''|0)   d_getlogin_r=undef
13565                 getlogin_r_proto=0
13566                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13567         * )     case "$getlogin_r_proto" in
13568                 REENTRANT_PROTO*) ;;
13569                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13570                 esac
13571                 echo "Prototype: $try" ;;
13572         esac
13573         ;;
13574         *)      case "$usethreads" in
13575                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13576                 esac
13577                 d_getlogin_r=undef
13578                 getlogin_r_proto=0
13579                 ;;
13580         esac
13581         ;;
13582 *)      getlogin_r_proto=0
13583         ;;
13584 esac
13585
13586 : see if getmnt exists
13587 set getmnt d_getmnt
13588 eval $inlibc
13589
13590 : see if getmntent exists
13591 set getmntent d_getmntent
13592 eval $inlibc
13593
13594 : see if getnetbyaddr exists
13595 set getnetbyaddr d_getnbyaddr
13596 eval $inlibc
13597
13598 : see if getnetbyname exists
13599 set getnetbyname d_getnbyname
13600 eval $inlibc
13601
13602 : see if getnetent exists
13603 set getnetent d_getnent
13604 eval $inlibc
13605
13606 : see if getnetbyaddr_r exists
13607 set getnetbyaddr_r d_getnetbyaddr_r
13608 eval $inlibc
13609 case "$d_getnetbyaddr_r" in
13610 "$define")
13611         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13612         case "$d_getnetbyaddr_r_proto:$usethreads" in
13613         ":define")      d_getnetbyaddr_r_proto=define
13614                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13615                 eval $hasproto ;;
13616         *)      ;;
13617         esac
13618         case "$d_getnetbyaddr_r_proto" in
13619         define)
13620         case "$getnetbyaddr_r_proto" in
13621         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13622         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13623         esac
13624         case "$getnetbyaddr_r_proto" in
13625         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13626         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13627         esac
13628         case "$getnetbyaddr_r_proto" in
13629         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13630         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13631         esac
13632         case "$getnetbyaddr_r_proto" in
13633         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13634         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13635         esac
13636         case "$getnetbyaddr_r_proto" in
13637         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13638         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13639         esac
13640         case "$getnetbyaddr_r_proto" in
13641         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13642         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13643         esac
13644         case "$getnetbyaddr_r_proto" in
13645         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13646         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13647         esac
13648         case "$getnetbyaddr_r_proto" in
13649         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13650         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13651         esac
13652         case "$getnetbyaddr_r_proto" in
13653         ''|0)   d_getnetbyaddr_r=undef
13654                 getnetbyaddr_r_proto=0
13655                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13656         * )     case "$getnetbyaddr_r_proto" in
13657                 REENTRANT_PROTO*) ;;
13658                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13659                 esac
13660                 echo "Prototype: $try" ;;
13661         esac
13662         ;;
13663         *)      case "$usethreads" in
13664                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13665                 esac
13666                 d_getnetbyaddr_r=undef
13667                 getnetbyaddr_r_proto=0
13668                 ;;
13669         esac
13670         ;;
13671 *)      getnetbyaddr_r_proto=0
13672         ;;
13673 esac
13674
13675 : see if getnetbyname_r exists
13676 set getnetbyname_r d_getnetbyname_r
13677 eval $inlibc
13678 case "$d_getnetbyname_r" in
13679 "$define")
13680         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13681         case "$d_getnetbyname_r_proto:$usethreads" in
13682         ":define")      d_getnetbyname_r_proto=define
13683                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13684                 eval $hasproto ;;
13685         *)      ;;
13686         esac
13687         case "$d_getnetbyname_r_proto" in
13688         define)
13689         case "$getnetbyname_r_proto" in
13690         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13691         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13692         esac
13693         case "$getnetbyname_r_proto" in
13694         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13695         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13696         esac
13697         case "$getnetbyname_r_proto" in
13698         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13699         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13700         esac
13701         case "$getnetbyname_r_proto" in
13702         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13703         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13704         esac
13705         case "$getnetbyname_r_proto" in
13706         ''|0)   d_getnetbyname_r=undef
13707                 getnetbyname_r_proto=0
13708                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13709         * )     case "$getnetbyname_r_proto" in
13710                 REENTRANT_PROTO*) ;;
13711                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13712                 esac
13713                 echo "Prototype: $try" ;;
13714         esac
13715         ;;
13716         *)      case "$usethreads" in
13717                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13718                 esac
13719                 d_getnetbyname_r=undef
13720                 getnetbyname_r_proto=0
13721                 ;;
13722         esac
13723         ;;
13724 *)      getnetbyname_r_proto=0
13725         ;;
13726 esac
13727
13728 : see if getnetent_r exists
13729 set getnetent_r d_getnetent_r
13730 eval $inlibc
13731 case "$d_getnetent_r" in
13732 "$define")
13733         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13734         case "$d_getnetent_r_proto:$usethreads" in
13735         ":define")      d_getnetent_r_proto=define
13736                 set d_getnetent_r_proto getnetent_r $hdrs
13737                 eval $hasproto ;;
13738         *)      ;;
13739         esac
13740         case "$d_getnetent_r_proto" in
13741         define)
13742         case "$getnetent_r_proto" in
13743         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13744         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13745         esac
13746         case "$getnetent_r_proto" in
13747         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13748         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13749         esac
13750         case "$getnetent_r_proto" in
13751         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13752         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13753         esac
13754         case "$getnetent_r_proto" in
13755         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13756         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13757         esac
13758         case "$getnetent_r_proto" in
13759         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13760         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13761         esac
13762         case "$getnetent_r_proto" in
13763         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13764         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13765         esac
13766         case "$getnetent_r_proto" in
13767         ''|0)   d_getnetent_r=undef
13768                 getnetent_r_proto=0
13769                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13770         * )     case "$getnetent_r_proto" in
13771                 REENTRANT_PROTO*) ;;
13772                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13773                 esac
13774                 echo "Prototype: $try" ;;
13775         esac
13776         ;;
13777         *)      case "$usethreads" in
13778                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13779                 esac
13780                 d_getnetent_r=undef
13781                 getnetent_r_proto=0
13782                 ;;
13783         esac
13784         ;;
13785 *)      getnetent_r_proto=0
13786         ;;
13787 esac
13788
13789 : see if prototypes for various getnetxxx netdb.h functions are available
13790 echo " "
13791 set d_getnetprotos getnetent $i_netdb netdb.h
13792 eval $hasproto
13793
13794 : see if getpagesize exists
13795 set getpagesize d_getpagsz
13796 eval $inlibc
13797
13798
13799 : see if getprotobyname exists
13800 set getprotobyname d_getpbyname
13801 eval $inlibc
13802
13803 : see if getprotobynumber exists
13804 set getprotobynumber d_getpbynumber
13805 eval $inlibc
13806
13807 : see if getprotoent exists
13808 set getprotoent d_getpent
13809 eval $inlibc
13810
13811 : see if getpgid exists
13812 set getpgid d_getpgid
13813 eval $inlibc
13814
13815 : see if getpgrp2 exists
13816 set getpgrp2 d_getpgrp2
13817 eval $inlibc
13818
13819 : see if getppid exists
13820 set getppid d_getppid
13821 eval $inlibc
13822
13823 : see if getpriority exists
13824 set getpriority d_getprior
13825 eval $inlibc
13826
13827 : see if getprotobyname_r exists
13828 set getprotobyname_r d_getprotobyname_r
13829 eval $inlibc
13830 case "$d_getprotobyname_r" in
13831 "$define")
13832         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13833         case "$d_getprotobyname_r_proto:$usethreads" in
13834         ":define")      d_getprotobyname_r_proto=define
13835                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13836                 eval $hasproto ;;
13837         *)      ;;
13838         esac
13839         case "$d_getprotobyname_r_proto" in
13840         define)
13841         case "$getprotobyname_r_proto" in
13842         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13843         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13844         esac
13845         case "$getprotobyname_r_proto" in
13846         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13847         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13848         esac
13849         case "$getprotobyname_r_proto" in
13850         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13851         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13852         esac
13853         case "$getprotobyname_r_proto" in
13854         ''|0)   d_getprotobyname_r=undef
13855                 getprotobyname_r_proto=0
13856                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13857         * )     case "$getprotobyname_r_proto" in
13858                 REENTRANT_PROTO*) ;;
13859                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13860                 esac
13861                 echo "Prototype: $try" ;;
13862         esac
13863         ;;
13864         *)      case "$usethreads" in
13865                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13866                 esac
13867                 d_getprotobyname_r=undef
13868                 getprotobyname_r_proto=0
13869                 ;;
13870         esac
13871         ;;
13872 *)      getprotobyname_r_proto=0
13873         ;;
13874 esac
13875
13876 : see if getprotobynumber_r exists
13877 set getprotobynumber_r d_getprotobynumber_r
13878 eval $inlibc
13879 case "$d_getprotobynumber_r" in
13880 "$define")
13881         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13882         case "$d_getprotobynumber_r_proto:$usethreads" in
13883         ":define")      d_getprotobynumber_r_proto=define
13884                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13885                 eval $hasproto ;;
13886         *)      ;;
13887         esac
13888         case "$d_getprotobynumber_r_proto" in
13889         define)
13890         case "$getprotobynumber_r_proto" in
13891         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13892         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13893         esac
13894         case "$getprotobynumber_r_proto" in
13895         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13896         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13897         esac
13898         case "$getprotobynumber_r_proto" in
13899         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13900         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13901         esac
13902         case "$getprotobynumber_r_proto" in
13903         ''|0)   d_getprotobynumber_r=undef
13904                 getprotobynumber_r_proto=0
13905                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13906         * )     case "$getprotobynumber_r_proto" in
13907                 REENTRANT_PROTO*) ;;
13908                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13909                 esac
13910                 echo "Prototype: $try" ;;
13911         esac
13912         ;;
13913         *)      case "$usethreads" in
13914                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13915                 esac
13916                 d_getprotobynumber_r=undef
13917                 getprotobynumber_r_proto=0
13918                 ;;
13919         esac
13920         ;;
13921 *)      getprotobynumber_r_proto=0
13922         ;;
13923 esac
13924
13925 : see if getprotoent_r exists
13926 set getprotoent_r d_getprotoent_r
13927 eval $inlibc
13928 case "$d_getprotoent_r" in
13929 "$define")
13930         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13931         case "$d_getprotoent_r_proto:$usethreads" in
13932         ":define")      d_getprotoent_r_proto=define
13933                 set d_getprotoent_r_proto getprotoent_r $hdrs
13934                 eval $hasproto ;;
13935         *)      ;;
13936         esac
13937         case "$d_getprotoent_r_proto" in
13938         define)
13939         case "$getprotoent_r_proto" in
13940         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13941         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13942         esac
13943         case "$getprotoent_r_proto" in
13944         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13945         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13946         esac
13947         case "$getprotoent_r_proto" in
13948         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13949         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13950         esac
13951         case "$getprotoent_r_proto" in
13952         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13953         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13954         esac
13955         case "$getprotoent_r_proto" in
13956         ''|0)   d_getprotoent_r=undef
13957                 getprotoent_r_proto=0
13958                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13959         * )     case "$getprotoent_r_proto" in
13960                 REENTRANT_PROTO*) ;;
13961                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13962                 esac
13963                 echo "Prototype: $try" ;;
13964         esac
13965         ;;
13966         *)      case "$usethreads" in
13967                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13968                 esac
13969                 d_getprotoent_r=undef
13970                 getprotoent_r_proto=0
13971                 ;;
13972         esac
13973         ;;
13974 *)      getprotoent_r_proto=0
13975         ;;
13976 esac
13977
13978 : see if prototypes for various getprotoxxx netdb.h functions are available
13979 echo " "
13980 set d_getprotoprotos getprotoent $i_netdb netdb.h
13981 eval $hasproto
13982
13983 : see if getprpwnam exists
13984 set getprpwnam d_getprpwnam
13985 eval $inlibc
13986
13987 : see if getpwent exists
13988 set getpwent d_getpwent
13989 eval $inlibc
13990
13991 : see if getpwent_r exists
13992 set getpwent_r d_getpwent_r
13993 eval $inlibc
13994 case "$d_getpwent_r" in
13995 "$define")
13996         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13997         case "$d_getpwent_r_proto:$usethreads" in
13998         ":define")      d_getpwent_r_proto=define
13999                 set d_getpwent_r_proto getpwent_r $hdrs
14000                 eval $hasproto ;;
14001         *)      ;;
14002         esac
14003         case "$d_getpwent_r_proto" in
14004         define)
14005         case "$getpwent_r_proto" in
14006         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14007         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14008         esac
14009         case "$getpwent_r_proto" in
14010         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14011         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14012         esac
14013         case "$getpwent_r_proto" in
14014         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14015         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14016         esac
14017         case "$getpwent_r_proto" in
14018         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14019         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14020         esac
14021         case "$getpwent_r_proto" in
14022         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14023         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14024         esac
14025         case "$getpwent_r_proto" in
14026         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14027         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14028         esac
14029         case "$getpwent_r_proto" in
14030         ''|0)   d_getpwent_r=undef
14031                 getpwent_r_proto=0
14032                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14033         * )     case "$getpwent_r_proto" in
14034                 REENTRANT_PROTO*) ;;
14035                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14036                 esac
14037                 echo "Prototype: $try" ;;
14038         esac
14039         ;;
14040         *)      case "$usethreads" in
14041                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14042                 esac
14043                 d_getpwent_r=undef
14044                 getpwent_r_proto=0
14045                 ;;
14046         esac
14047         ;;
14048 *)      getpwent_r_proto=0
14049         ;;
14050 esac
14051
14052 : see if getpwnam_r exists
14053 set getpwnam_r d_getpwnam_r
14054 eval $inlibc
14055 case "$d_getpwnam_r" in
14056 "$define")
14057         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14058         case "$d_getpwnam_r_proto:$usethreads" in
14059         ":define")      d_getpwnam_r_proto=define
14060                 set d_getpwnam_r_proto getpwnam_r $hdrs
14061                 eval $hasproto ;;
14062         *)      ;;
14063         esac
14064         case "$d_getpwnam_r_proto" in
14065         define)
14066         case "$getpwnam_r_proto" in
14067         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14068         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14069         esac
14070         case "$getpwnam_r_proto" in
14071         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14072         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14073         esac
14074         case "$getpwnam_r_proto" in
14075         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14076         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14077         esac
14078         case "$getpwnam_r_proto" in
14079         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14080         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14081         esac
14082         case "$getpwnam_r_proto" in
14083         ''|0)   d_getpwnam_r=undef
14084                 getpwnam_r_proto=0
14085                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14086         * )     case "$getpwnam_r_proto" in
14087                 REENTRANT_PROTO*) ;;
14088                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14089                 esac
14090                 echo "Prototype: $try" ;;
14091         esac
14092         ;;
14093         *)      case "$usethreads" in
14094                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14095                 esac
14096                 d_getpwnam_r=undef
14097                 getpwnam_r_proto=0
14098                 ;;
14099         esac
14100         ;;
14101 *)      getpwnam_r_proto=0
14102         ;;
14103 esac
14104
14105 : see if getpwuid_r exists
14106 set getpwuid_r d_getpwuid_r
14107 eval $inlibc
14108 case "$d_getpwuid_r" in
14109 "$define")
14110         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14111         case "$d_getpwuid_r_proto:$usethreads" in
14112         ":define")      d_getpwuid_r_proto=define
14113                 set d_getpwuid_r_proto getpwuid_r $hdrs
14114                 eval $hasproto ;;
14115         *)      ;;
14116         esac
14117         case "$d_getpwuid_r_proto" in
14118         define)
14119         case "$getpwuid_r_proto" in
14120         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14121         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14122         esac
14123         case "$getpwuid_r_proto" in
14124         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14125         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14126         esac
14127         case "$getpwuid_r_proto" in
14128         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14129         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14130         esac
14131         case "$getpwuid_r_proto" in
14132         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14133         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14134         esac
14135         case "$getpwuid_r_proto" in
14136         ''|0)   d_getpwuid_r=undef
14137                 getpwuid_r_proto=0
14138                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14139         * )     case "$getpwuid_r_proto" in
14140                 REENTRANT_PROTO*) ;;
14141                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14142                 esac
14143                 echo "Prototype: $try" ;;
14144         esac
14145         ;;
14146         *)      case "$usethreads" in
14147                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14148                 esac
14149                 d_getpwuid_r=undef
14150                 getpwuid_r_proto=0
14151                 ;;
14152         esac
14153         ;;
14154 *)      getpwuid_r_proto=0
14155         ;;
14156 esac
14157
14158
14159 : see if getservbyname exists
14160 set getservbyname d_getsbyname
14161 eval $inlibc
14162
14163 : see if getservbyport exists
14164 set getservbyport d_getsbyport
14165 eval $inlibc
14166
14167 : see if getservent exists
14168 set getservent d_getsent
14169 eval $inlibc
14170
14171 : see if getservbyname_r exists
14172 set getservbyname_r d_getservbyname_r
14173 eval $inlibc
14174 case "$d_getservbyname_r" in
14175 "$define")
14176         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14177         case "$d_getservbyname_r_proto:$usethreads" in
14178         ":define")      d_getservbyname_r_proto=define
14179                 set d_getservbyname_r_proto getservbyname_r $hdrs
14180                 eval $hasproto ;;
14181         *)      ;;
14182         esac
14183         case "$d_getservbyname_r_proto" in
14184         define)
14185         case "$getservbyname_r_proto" in
14186         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14187         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14188         esac
14189         case "$getservbyname_r_proto" in
14190         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14191         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14192         esac
14193         case "$getservbyname_r_proto" in
14194         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14195         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14196         esac
14197         case "$getservbyname_r_proto" in
14198         ''|0)   d_getservbyname_r=undef
14199                 getservbyname_r_proto=0
14200                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14201         * )     case "$getservbyname_r_proto" in
14202                 REENTRANT_PROTO*) ;;
14203                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14204                 esac
14205                 echo "Prototype: $try" ;;
14206         esac
14207         ;;
14208         *)      case "$usethreads" in
14209                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14210                 esac
14211                 d_getservbyname_r=undef
14212                 getservbyname_r_proto=0
14213                 ;;
14214         esac
14215         ;;
14216 *)      getservbyname_r_proto=0
14217         ;;
14218 esac
14219
14220 : see if getservbyport_r exists
14221 set getservbyport_r d_getservbyport_r
14222 eval $inlibc
14223 case "$d_getservbyport_r" in
14224 "$define")
14225         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14226         case "$d_getservbyport_r_proto:$usethreads" in
14227         ":define")      d_getservbyport_r_proto=define
14228                 set d_getservbyport_r_proto getservbyport_r $hdrs
14229                 eval $hasproto ;;
14230         *)      ;;
14231         esac
14232         case "$d_getservbyport_r_proto" in
14233         define)
14234         case "$getservbyport_r_proto" in
14235         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14236         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14237         esac
14238         case "$getservbyport_r_proto" in
14239         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14240         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14241         esac
14242         case "$getservbyport_r_proto" in
14243         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14244         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14245         esac
14246         case "$getservbyport_r_proto" in
14247         ''|0)   d_getservbyport_r=undef
14248                 getservbyport_r_proto=0
14249                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14250         * )     case "$getservbyport_r_proto" in
14251                 REENTRANT_PROTO*) ;;
14252                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14253                 esac
14254                 echo "Prototype: $try" ;;
14255         esac
14256         ;;
14257         *)      case "$usethreads" in
14258                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14259                 esac
14260                 d_getservbyport_r=undef
14261                 getservbyport_r_proto=0
14262                 ;;
14263         esac
14264         ;;
14265 *)      getservbyport_r_proto=0
14266         ;;
14267 esac
14268
14269 : see if getservent_r exists
14270 set getservent_r d_getservent_r
14271 eval $inlibc
14272 case "$d_getservent_r" in
14273 "$define")
14274         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14275         case "$d_getservent_r_proto:$usethreads" in
14276         ":define")      d_getservent_r_proto=define
14277                 set d_getservent_r_proto getservent_r $hdrs
14278                 eval $hasproto ;;
14279         *)      ;;
14280         esac
14281         case "$d_getservent_r_proto" in
14282         define)
14283         case "$getservent_r_proto" in
14284         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14285         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14286         esac
14287         case "$getservent_r_proto" in
14288         ''|0) try='int getservent_r(struct servent*, char*, int);'
14289         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14290         esac
14291         case "$getservent_r_proto" in
14292         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14293         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14294         esac
14295         case "$getservent_r_proto" in
14296         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14297         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14298         esac
14299         case "$getservent_r_proto" in
14300         ''|0)   d_getservent_r=undef
14301                 getservent_r_proto=0
14302                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14303         * )     case "$getservent_r_proto" in
14304                 REENTRANT_PROTO*) ;;
14305                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14306                 esac
14307                 echo "Prototype: $try" ;;
14308         esac
14309         ;;
14310         *)      case "$usethreads" in
14311                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14312                 esac
14313                 d_getservent_r=undef
14314                 getservent_r_proto=0
14315                 ;;
14316         esac
14317         ;;
14318 *)      getservent_r_proto=0
14319         ;;
14320 esac
14321
14322 : see if prototypes for various getservxxx netdb.h functions are available
14323 echo " "
14324 set d_getservprotos getservent $i_netdb netdb.h
14325 eval $hasproto
14326
14327 : see if getspnam exists
14328 set getspnam d_getspnam
14329 eval $inlibc
14330
14331 : see if this is a shadow.h system
14332 set shadow.h i_shadow
14333 eval $inhdr
14334
14335 : see if getspnam_r exists
14336 set getspnam_r d_getspnam_r
14337 eval $inlibc
14338 case "$d_getspnam_r" in
14339 "$define")
14340         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14341         case "$d_getspnam_r_proto:$usethreads" in
14342         ":define")      d_getspnam_r_proto=define
14343                 set d_getspnam_r_proto getspnam_r $hdrs
14344                 eval $hasproto ;;
14345         *)      ;;
14346         esac
14347         case "$d_getspnam_r_proto" in
14348         define)
14349         case "$getspnam_r_proto" in
14350         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14351         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14352         esac
14353         case "$getspnam_r_proto" in
14354         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14355         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14356         esac
14357         case "$getspnam_r_proto" in
14358         ''|0)   d_getspnam_r=undef
14359                 getspnam_r_proto=0
14360                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14361         * )     case "$getspnam_r_proto" in
14362                 REENTRANT_PROTO*) ;;
14363                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14364                 esac
14365                 echo "Prototype: $try" ;;
14366         esac
14367         ;;
14368         *)      case "$usethreads" in
14369                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14370                 esac
14371                 d_getspnam_r=undef
14372                 getspnam_r_proto=0
14373                 ;;
14374         esac
14375         ;;
14376 *)      getspnam_r_proto=0
14377         ;;
14378 esac
14379
14380 : see if gettimeofday or ftime exists
14381 set gettimeofday d_gettimeod
14382 eval $inlibc
14383 case "$d_gettimeod" in
14384 "$undef")
14385         set ftime d_ftime 
14386         eval $inlibc
14387         ;;
14388 *)
14389         val="$undef"; set d_ftime; eval $setvar
14390         ;;
14391 esac
14392 case "$d_gettimeod$d_ftime" in
14393 "$undef$undef")
14394         echo " "
14395         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14396         ;;
14397 esac
14398
14399 : see if gmtime_r exists
14400 set gmtime_r d_gmtime_r
14401 eval $inlibc
14402 case "$d_gmtime_r" in
14403 "$define")
14404         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14405         case "$d_gmtime_r_proto:$usethreads" in
14406         ":define")      d_gmtime_r_proto=define
14407                 set d_gmtime_r_proto gmtime_r $hdrs
14408                 eval $hasproto ;;
14409         *)      ;;
14410         esac
14411         case "$d_gmtime_r_proto" in
14412         define)
14413         case "$gmtime_r_proto" in
14414         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14415         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14416         esac
14417         case "$gmtime_r_proto" in
14418         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14419         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14420         esac
14421         case "$gmtime_r_proto" in
14422         ''|0)   d_gmtime_r=undef
14423                 gmtime_r_proto=0
14424                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14425         * )     case "$gmtime_r_proto" in
14426                 REENTRANT_PROTO*) ;;
14427                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14428                 esac
14429                 echo "Prototype: $try" ;;
14430         esac
14431         ;;
14432         *)      case "$usethreads" in
14433                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14434                 esac
14435                 d_gmtime_r=undef
14436                 gmtime_r_proto=0
14437                 ;;
14438         esac
14439         ;;
14440 *)      gmtime_r_proto=0
14441         ;;
14442 esac
14443
14444 : see if hasmntopt exists
14445 set hasmntopt d_hasmntopt
14446 eval $inlibc
14447
14448 : see if this is a netinet/in.h or sys/in.h system
14449 set netinet/in.h i_niin sys/in.h i_sysin
14450 eval $inhdr
14451
14452 : see if arpa/inet.h has to be included
14453 set arpa/inet.h i_arpainet
14454 eval $inhdr
14455
14456 : see if htonl --and friends-- exists
14457 val=''
14458 set htonl val
14459 eval $inlibc
14460
14461 : Maybe they are macros.
14462 case "$val" in
14463 $undef)
14464         $cat >htonl.c <<EOM
14465 #include <stdio.h>
14466 #include <sys/types.h>
14467 #$i_niin I_NETINET_IN
14468 #$i_sysin I_SYS_IN
14469 #$i_arpainet I_ARPA_INET
14470 #ifdef I_NETINET_IN
14471 #include <netinet/in.h>
14472 #endif
14473 #ifdef I_SYS_IN
14474 #include <sys/in.h>
14475 #endif
14476 #ifdef I_ARPA_INET
14477 #include <arpa/inet.h>
14478 #endif
14479 #ifdef htonl
14480 printf("Defined as a macro.");
14481 #endif
14482 EOM
14483         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14484         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14485                 val="$define"
14486                 echo "But it seems to be defined as a macro." >&4
14487         fi
14488         $rm -f htonl.?
14489         ;;
14490 esac
14491 set d_htonl
14492 eval $setvar
14493
14494 : see if ilogbl exists
14495 set ilogbl d_ilogbl
14496 eval $inlibc
14497
14498 : index or strchr
14499 echo " "
14500 if set index val -f; eval $csym; $val; then
14501         if set strchr val -f d_strchr; eval $csym; $val; then
14502                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14503                         val="$define"
14504                         vali="$undef"
14505                         echo "strchr() found." >&4
14506                 else
14507                         val="$undef"
14508                         vali="$define"
14509                         echo "index() found." >&4
14510                 fi
14511         else
14512                 val="$undef"
14513                 vali="$define"
14514                 echo "index() found." >&4
14515         fi
14516 else
14517         if set strchr val -f d_strchr; eval $csym; $val; then
14518                 val="$define"
14519                 vali="$undef"
14520                 echo "strchr() found." >&4
14521         else
14522                 echo "No index() or strchr() found!" >&4
14523                 val="$undef"
14524                 vali="$undef"
14525         fi
14526 fi
14527 set d_strchr; eval $setvar
14528 val="$vali"
14529 set d_index; eval $setvar
14530
14531 : check whether inet_aton exists
14532 set inet_aton d_inetaton
14533 eval $inlibc
14534
14535 : Look for isascii
14536 echo " "
14537 $cat >isascii.c <<EOCP
14538 #include <stdio.h>
14539 #include <ctype.h>
14540 #$i_stdlib I_STDLIB
14541 #ifdef I_STDLIB
14542 #include <stdlib.h>
14543 #endif
14544 int main() {
14545         int c = 'A';
14546         if (isascii(c))
14547                 exit(0);
14548         else
14549                 exit(1);
14550 }
14551 EOCP
14552 set isascii
14553 if eval $compile; then
14554         echo "isascii() found." >&4
14555         val="$define"
14556 else
14557         echo "isascii() NOT found." >&4
14558         val="$undef"
14559 fi
14560 set d_isascii
14561 eval $setvar
14562 $rm -f isascii*
14563
14564 : see if isfinite exists
14565 set isfinite d_isfinite
14566 eval $inlibc
14567
14568 : see if isinf exists
14569 set isinf d_isinf
14570 eval $inlibc
14571
14572 : see if isnan exists
14573 set isnan d_isnan
14574 eval $inlibc
14575
14576 : see if isnanl exists
14577 set isnanl d_isnanl
14578 eval $inlibc
14579
14580 : see if killpg exists
14581 set killpg d_killpg
14582 eval $inlibc
14583
14584 : see if lchown exists
14585 echo " "
14586 $cat > try.c <<'EOCP'
14587 /* System header to define __stub macros and hopefully few prototypes,
14588     which can conflict with char lchown(); below.  */
14589 #include <assert.h>
14590 /* Override any gcc2 internal prototype to avoid an error.  */
14591 /* We use char because int might match the return type of a gcc2
14592    builtin and then its argument prototype would still apply.  */
14593 char lchown();
14594 int main() {
14595     /*  The GNU C library defines this for functions which it implements
14596         to always fail with ENOSYS.  Some functions are actually named
14597         something starting with __ and the normal name is an alias.  */
14598 #if defined (__stub_lchown) || defined (__stub___lchown)
14599 choke me
14600 #else
14601 lchown();
14602 #endif
14603 ; return 0; }
14604 EOCP
14605 set try
14606 if eval $compile; then
14607     $echo "lchown() found." >&4
14608     val="$define"
14609 else
14610     $echo "lchown() NOT found." >&4
14611     val="$undef"
14612 fi
14613 set d_lchown
14614 eval $setvar
14615
14616 : See if number of significant digits in a double precision number is known
14617 echo " "
14618 $cat >ldbl_dig.c <<EOM
14619 #$i_limits I_LIMITS
14620 #$i_float I_FLOAT
14621 #ifdef I_LIMITS
14622 #include <limits.h>
14623 #endif
14624 #ifdef I_FLOAT
14625 #include <float.h>
14626 #endif
14627 #ifdef LDBL_DIG
14628 printf("Contains LDBL_DIG");
14629 #endif
14630 EOM
14631 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14632 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14633         echo "LDBL_DIG found." >&4
14634         val="$define"
14635 else
14636         echo "LDBL_DIG NOT found." >&4
14637         val="$undef"
14638 fi
14639 $rm -f ldbl_dig.?
14640 set d_ldbl_dig
14641 eval $setvar
14642
14643 : see if this is a math.h system
14644 set math.h i_math
14645 eval $inhdr
14646
14647 d_libm_lib_version="$undef"
14648 case $i_math in
14649     $define)
14650         : check to see if math.h defines _LIB_VERSION
14651         echo " "
14652         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14653         $cat >try.c <<EOCP
14654 #include <unistd.h>
14655 #include <math.h>
14656 int main (int argc, char *argv[])
14657 {
14658     printf ("%d\n", _LIB_VERSION);
14659     return (0);
14660     } /* main */
14661 EOCP
14662         set try
14663         if eval $compile; then
14664             foo=`$run ./try`
14665             echo "Yes, it does ($foo)" >&4
14666             d_libm_lib_version="$define"
14667         else
14668             echo "No, it does not (probably harmless)" >&4
14669             fi
14670         $rm_try
14671         ;;
14672
14673     esac
14674
14675 : see if link exists
14676 set link d_link
14677 eval $inlibc
14678
14679 : see if localtime_r exists
14680 set localtime_r d_localtime_r
14681 eval $inlibc
14682 case "$d_localtime_r" in
14683 "$define")
14684         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14685         case "$d_localtime_r_proto:$usethreads" in
14686         ":define")      d_localtime_r_proto=define
14687                 set d_localtime_r_proto localtime_r $hdrs
14688                 eval $hasproto ;;
14689         *)      ;;
14690         esac
14691         case "$d_localtime_r_proto" in
14692         define)
14693         case "$localtime_r_proto" in
14694         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14695         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14696         esac
14697         case "$localtime_r_proto" in
14698         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14699         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14700         esac
14701         case "$localtime_r_proto" in
14702         ''|0)   d_localtime_r=undef
14703                 localtime_r_proto=0
14704                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14705         * )     case "$localtime_r_proto" in
14706                 REENTRANT_PROTO*) ;;
14707                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14708                 esac
14709                 echo "Prototype: $try" ;;
14710         esac
14711         ;;
14712         *)      case "$usethreads" in
14713                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14714                 esac
14715                 d_localtime_r=undef
14716                 localtime_r_proto=0
14717                 ;;
14718         esac
14719         ;;
14720 *)      localtime_r_proto=0
14721         ;;
14722 esac
14723
14724 : see if localtime_r calls tzset
14725 case "$localtime_r_proto" in
14726 REENTRANT_PROTO*)
14727         $cat >try.c <<EOCP
14728 /*  Does our libc's localtime_r call tzset ?
14729  *  return 0 if so, 1 otherwise.
14730  */
14731 #include <sys/types.h>
14732 #include <unistd.h>
14733 #include <time.h>
14734 #include <string.h>
14735 #include <malloc.h>
14736 int main()
14737 {
14738     time_t t = time(0L);
14739     char w_tz[]="TZ" "=GMT+5",
14740          e_tz[]="TZ" "=GMT-5",
14741         *tz_e = (char*)malloc(16),
14742         *tz_w = (char*)malloc(16);
14743     struct tm tm_e, tm_w;
14744     memset(&tm_e,'\0',sizeof(struct tm));
14745     memset(&tm_w,'\0',sizeof(struct tm));
14746     strcpy(tz_e,e_tz);
14747     strcpy(tz_w,w_tz);
14748
14749     putenv(tz_e);
14750     localtime_r(&t, &tm_e);
14751
14752     putenv(tz_w);
14753     localtime_r(&t, &tm_w);
14754
14755     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14756         return 1;
14757     return 0;
14758 }
14759 EOCP
14760         set try
14761         if eval $compile; then
14762             if $run ./try; then
14763                 d_localtime_r_needs_tzset=undef;
14764             else
14765                 d_localtime_r_needs_tzset=define;
14766             fi;
14767         else
14768             d_localtime_r_needs_tzset=undef;
14769         fi;
14770      ;;
14771   *)
14772      d_localtime_r_needs_tzset=undef;
14773      ;;
14774 esac
14775 $rm_try
14776
14777 : see if localeconv exists
14778 set localeconv d_locconv
14779 eval $inlibc
14780
14781 : see if lockf exists
14782 set lockf d_lockf
14783 eval $inlibc
14784
14785 : see if prototype for lseek is available
14786 echo " "
14787 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14788 eval $hasproto
14789
14790 : see if lstat exists
14791 set lstat d_lstat
14792 eval $inlibc
14793
14794 : see if madvise exists
14795 set madvise d_madvise
14796 eval $inlibc
14797
14798 : see if malloc_size exists
14799 set malloc_size d_malloc_size
14800 eval $inlibc
14801
14802 : see if malloc_size_good exists
14803 set malloc_good_size d_malloc_good_size
14804 eval $inlibc
14805
14806 : see if mblen exists
14807 set mblen d_mblen
14808 eval $inlibc
14809
14810 : see if mbstowcs exists
14811 set mbstowcs d_mbstowcs
14812 eval $inlibc
14813
14814 : see if mbtowc exists
14815 set mbtowc d_mbtowc
14816 eval $inlibc
14817
14818 : see if memchr exists
14819 set memchr d_memchr
14820 eval $inlibc
14821
14822 : see if memcmp exists
14823 set memcmp d_memcmp
14824 eval $inlibc
14825
14826 : see if memcpy exists
14827 set memcpy d_memcpy
14828 eval $inlibc
14829
14830 : see if memmove exists
14831 set memmove d_memmove
14832 eval $inlibc
14833
14834 : see if memset exists
14835 set memset d_memset
14836 eval $inlibc
14837
14838 : see if mkdir exists
14839 set mkdir d_mkdir
14840 eval $inlibc
14841
14842 : see if mkdtemp exists
14843 set mkdtemp d_mkdtemp
14844 eval $inlibc
14845
14846 : see if mkfifo exists
14847 set mkfifo d_mkfifo
14848 eval $inlibc
14849
14850 : see if mkstemp exists
14851 set mkstemp d_mkstemp
14852 eval $inlibc
14853
14854 : see if mkstemps exists
14855 set mkstemps d_mkstemps
14856 eval $inlibc
14857
14858 : see if mktime exists
14859 set mktime d_mktime
14860 eval $inlibc
14861
14862 : see if this is a sys/mman.h system
14863 set sys/mman.h i_sysmman
14864 eval $inhdr
14865
14866 : see if mmap exists
14867 set mmap d_mmap
14868 eval $inlibc
14869 : see what shmat returns
14870 : default to something harmless
14871 mmaptype='void *'
14872 case "$i_sysmman$d_mmap" in
14873 "$define$define")
14874         $cat >mmap.c <<'END'
14875 #include <sys/mman.h>
14876 void *mmap();
14877 END
14878         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14879                 mmaptype='void *'
14880         else
14881                 mmaptype='caddr_t'
14882         fi
14883         echo "and it returns ($mmaptype)." >&4
14884         ;;
14885 esac
14886
14887
14888
14889 : see if sqrtl exists
14890 set sqrtl d_sqrtl
14891 eval $inlibc
14892
14893 : see if scalbnl exists
14894 set scalbnl d_scalbnl
14895 eval $inlibc
14896
14897 : see if modfl exists
14898 set modfl d_modfl
14899 eval $inlibc
14900
14901 : see if prototype for modfl is available
14902 echo " "
14903 set d_modflproto modfl $i_math math.h
14904 eval $hasproto
14905
14906 d_modfl_pow32_bug="$undef"
14907
14908 case "$d_longdbl$d_modfl" in
14909 $define$define)
14910         $cat <<EOM
14911 Checking to see whether your modfl() is okay for large values...
14912 EOM
14913 $cat >try.c <<EOCP
14914 #include <math.h>
14915 #include <stdio.h>
14916 EOCP
14917 if $test "X$d_modflproto" != "X$define"; then
14918         $cat >>try.c <<EOCP
14919 /* Sigh. many current glibcs provide the function, but do not prototype it. */
14920 long double modfl (long double, long double *);
14921 EOCP
14922 fi
14923 $cat >>try.c <<EOCP
14924 int main() {
14925     long double nv = 4294967303.15;
14926     long double v, w;
14927     v = modfl(nv, &w);
14928 #ifdef __GLIBC__
14929     printf("glibc");
14930 #endif
14931     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14932     return 0;
14933 }
14934 EOCP
14935         case "$osname:$gccversion" in
14936         aix:)   saveccflags="$ccflags"
14937                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14938         esac
14939         set try
14940         if eval $compile; then
14941                 foo=`$run ./try`
14942                 case "$foo" in
14943                 *" 4294967303.150000 1.150000 4294967302.000000")
14944                         echo >&4 "Your modfl() is broken for large values."
14945                         d_modfl_pow32_bug="$define"
14946                         case "$foo" in
14947                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14948                         ;;
14949                         esac
14950                         ;;
14951                 *" 4294967303.150000 0.150000 4294967303.000000")
14952                         echo >&4 "Your modfl() seems okay for large values."
14953                         ;;
14954                 *)      echo >&4 "I don't understand your modfl() at all."
14955                         d_modfl="$undef"
14956                         ;;
14957                 esac
14958                 $rm_try
14959         else
14960                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14961                 d_modfl="$undef"
14962         fi
14963         case "$osname:$gccversion" in
14964         aix:)   ccflags="$saveccflags" ;; # restore
14965         esac
14966         ;;
14967 esac
14968
14969 if $test "$uselongdouble" = "$define"; then
14970     message=""
14971     if $test "$d_sqrtl" != "$define"; then
14972         message="$message sqrtl"
14973     fi
14974     if $test "$d_modfl" != "$define"; then
14975         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14976             echo "You have both aintl and copysignl, so I can emulate modfl."
14977         else
14978             message="$message modfl"
14979         fi
14980     fi
14981     if $test "$d_frexpl" != "$define"; then
14982         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14983             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14984         else
14985             message="$message frexpl"
14986         fi
14987     fi
14988
14989     if $test "$message" != ""; then
14990         $cat <<EOM >&4
14991
14992 *** You requested the use of long doubles but you do not seem to have
14993 *** the following mathematical functions needed for long double support:
14994 ***    $message
14995 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14996 *** Cannot continue, aborting.
14997
14998 EOM
14999
15000         exit 1
15001     fi
15002 fi
15003
15004 : see if mprotect exists
15005 set mprotect d_mprotect
15006 eval $inlibc
15007
15008 : see if msgctl exists
15009 set msgctl d_msgctl
15010 eval $inlibc
15011
15012 : see if msgget exists
15013 set msgget d_msgget
15014 eval $inlibc
15015
15016 : see if msgsnd exists
15017 set msgsnd d_msgsnd
15018 eval $inlibc
15019
15020 : see if msgrcv exists
15021 set msgrcv d_msgrcv
15022 eval $inlibc
15023
15024 : see how much of the 'msg*(2)' library is present.
15025 h_msg=true
15026 echo " "
15027 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15028 *"$undef"*) h_msg=false;;
15029 esac
15030 case "$osname" in
15031 freebsd)
15032     case "`ipcs 2>&1`" in
15033     "SVID messages"*"not configured"*)
15034         echo "Your $osname does not have the msg*(2) configured." >&4
15035         h_msg=false
15036         val="$undef"
15037         set msgctl d_msgctl
15038         eval $setvar
15039         set msgget d_msgget
15040         eval $setvar
15041         set msgsnd d_msgsnd
15042         eval $setvar
15043         set msgrcv d_msgrcv
15044         eval $setvar
15045         ;;
15046     esac
15047     ;;
15048 esac
15049 : we could also check for sys/ipc.h ...
15050 if $h_msg && $test `./findhdr sys/msg.h`; then
15051         echo "You have the full msg*(2) library." >&4
15052         val="$define"
15053 else
15054         echo "You don't have the full msg*(2) library." >&4
15055         val="$undef"
15056 fi
15057 set d_msg
15058 eval $setvar
15059
15060
15061 echo " "
15062 echo "Checking to see if your system supports struct msghdr..." >&4
15063 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15064 eval $hasstruct
15065 case "$d_msghdr_s" in
15066 "$define")      echo "Yes, it does."   ;;
15067 *)              echo "No, it doesn't." ;;
15068 esac
15069
15070
15071 : see if msync exists
15072 set msync d_msync
15073 eval $inlibc
15074
15075 : see if munmap exists
15076 set munmap d_munmap
15077 eval $inlibc
15078
15079 : see if nice exists
15080 set nice d_nice
15081 eval $inlibc
15082
15083 : see if this is a langinfo.h system
15084 set langinfo.h i_langinfo
15085 eval $inhdr
15086
15087 : see if nl_langinfo exists
15088 set nl_langinfo d_nl_langinfo
15089 eval $inlibc
15090
15091 : check for length of character
15092 echo " "
15093 case "$charsize" in
15094 '')
15095         echo "Checking to see how big your characters are (hey, you never know)..." >&4
15096         $cat >try.c <<EOCP
15097 #include <stdio.h>
15098 #$i_stdlib I_STDLIB
15099 #ifdef I_STDLIB
15100 #include <stdlib.h>
15101 #endif
15102 int main()
15103 {
15104     printf("%d\n", (int)sizeof(char));
15105     exit(0);
15106 }
15107 EOCP
15108         set try
15109         if eval $compile_ok; then
15110                 dflt=`$run ./try`
15111         else
15112                 dflt='1'
15113                 echo "(I can't seem to compile the test program.  Guessing...)"
15114         fi
15115         ;;
15116 *)
15117         dflt="$charsize"
15118         ;;
15119 esac
15120 rp="What is the size of a character (in bytes)?"
15121 . ./myread
15122 charsize="$ans"
15123 $rm_try
15124
15125 : check for volatile keyword
15126 echo " "
15127 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15128 $cat >try.c <<'EOCP'
15129 int main()
15130 {
15131         typedef struct _goo_struct goo_struct;
15132         goo_struct * volatile goo = ((goo_struct *)0);
15133         struct _goo_struct {
15134                 long long_int;
15135                 int reg_int;
15136                 char char_var;
15137         };
15138         typedef unsigned short foo_t;
15139         char *volatile foo;
15140         volatile int bar;
15141         volatile foo_t blech;
15142         foo = foo;
15143 }
15144 EOCP
15145 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15146         val="$define"
15147         echo "Yup, it does."
15148 else
15149         val="$undef"
15150         echo "Nope, it doesn't."
15151 fi
15152 set d_volatile
15153 eval $setvar
15154 $rm_try
15155
15156
15157 echo " "
15158 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15159
15160 case "$use64bitint:$d_quad:$quadtype" in
15161 define:define:?*)
15162         ivtype="$quadtype"
15163         uvtype="$uquadtype"
15164         ivsize=8
15165         uvsize=8
15166         ;;
15167 *)      ivtype="long"
15168         uvtype="unsigned long"
15169         ivsize=$longsize
15170         uvsize=$longsize
15171         ;;
15172 esac
15173
15174 case "$uselongdouble:$d_longdbl" in
15175 define:define)
15176         nvtype="long double"
15177         nvsize=$longdblsize
15178         ;;
15179 *)      nvtype=double
15180         nvsize=$doublesize
15181         ;;
15182 esac
15183
15184 $echo "(IV will be "$ivtype", $ivsize bytes)"
15185 $echo "(UV will be "$uvtype", $uvsize bytes)"
15186 $echo "(NV will be "$nvtype", $nvsize bytes)"
15187
15188 $cat >try.c <<EOCP
15189 #$i_inttypes I_INTTYPES
15190 #ifdef I_INTTYPES
15191 #include <inttypes.h>
15192 #endif
15193 #include <stdio.h>
15194 int main() {
15195 #ifdef INT8
15196    int8_t i =  INT8_MAX;
15197   uint8_t u = UINT8_MAX;
15198   printf("int8_t\n");
15199 #endif
15200 #ifdef INT16
15201    int16_t i =  INT16_MAX;
15202   uint16_t i = UINT16_MAX;
15203   printf("int16_t\n");
15204 #endif
15205 #ifdef INT32
15206    int32_t i =  INT32_MAX;
15207   uint32_t u = UINT32_MAX;
15208   printf("int32_t\n");
15209 #endif
15210 }
15211 EOCP
15212
15213 case "$i8type" in
15214 '')     case "$charsize" in
15215         1)      i8type=char
15216                 u8type="unsigned char"
15217                 i8size=$charsize
15218                 u8size=$charsize
15219                 ;;
15220         esac
15221         ;;
15222 esac
15223 case "$i8type" in
15224 '')     set try -DINT8
15225         if eval $compile; then
15226                 case "`$run ./try`" in
15227                 int8_t) i8type=int8_t
15228                         u8type=uint8_t
15229                         i8size=1
15230                         u8size=1
15231                         ;;
15232                 esac
15233         fi
15234         ;;
15235 esac
15236 case "$i8type" in
15237 '')     if $test $charsize -ge 1; then
15238                 i8type=char
15239                 u8type="unsigned char"
15240                 i8size=$charsize
15241                 u8size=$charsize
15242         fi
15243         ;;
15244 esac
15245
15246 case "$i16type" in
15247 '')     case "$shortsize" in
15248         2)      i16type=short
15249                 u16type="unsigned short"
15250                 i16size=$shortsize
15251                 u16size=$shortsize
15252                 ;;
15253         esac
15254         ;;
15255 esac
15256 case "$i16type" in
15257 '')     set try -DINT16
15258         if eval $compile; then
15259                 case "`$run ./try`" in
15260                 int16_t)
15261                         i16type=int16_t
15262                         u16type=uint16_t
15263                         i16size=2
15264                         u16size=2
15265                         ;;
15266                 esac
15267         fi
15268         ;;
15269 esac
15270 case "$i16type" in
15271 '')     if $test $shortsize -ge 2; then
15272                 i16type=short
15273                 u16type="unsigned short"
15274                 i16size=$shortsize
15275                 u16size=$shortsize
15276         fi
15277         ;;
15278 esac
15279
15280 case "$i32type" in
15281 '')     case "$longsize" in
15282         4)      i32type=long
15283                 u32type="unsigned long"
15284                 i32size=$longsize
15285                 u32size=$longsize
15286                 ;;
15287         *)      case "$intsize" in
15288                 4)      i32type=int
15289                         u32type="unsigned int"
15290                         i32size=$intsize
15291                         u32size=$intsize
15292                         ;;
15293                 esac
15294                 ;;
15295         esac
15296         ;;
15297 esac
15298 case "$i32type" in
15299 '')     set try -DINT32
15300         if eval $compile; then
15301                 case "`$run ./try`" in
15302                 int32_t)
15303                         i32type=int32_t
15304                         u32type=uint32_t
15305                         i32size=4
15306                         u32size=4
15307                         ;;
15308                 esac
15309         fi
15310         ;;
15311 esac
15312 case "$i32type" in
15313 '')     if $test $intsize -ge 4; then
15314                 i32type=int
15315                 u32type="unsigned int"
15316                 i32size=$intsize
15317                 u32size=$intsize
15318         fi
15319         ;;
15320 esac
15321
15322 case "$i64type" in
15323 '')     case "$d_quad:$quadtype" in
15324         define:?*)
15325                 i64type="$quadtype"
15326                 u64type="$uquadtype"
15327                 i64size=8
15328                 u64size=8
15329                 ;;
15330         esac
15331         ;;
15332 esac
15333
15334 $echo "Checking how many bits of your UVs your NVs can preserve..." >&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 #include <sys/types.h>
15346 #include <signal.h>
15347 #ifdef SIGFPE
15348 $volatile int bletched = 0;
15349 $signal_t blech(int s) { bletched = 1; }
15350 #endif
15351 int main() {
15352     $uvtype u = 0;
15353     $nvtype d;
15354     int     n = 8 * $uvsize;
15355     int     i;
15356 #ifdef SIGFPE
15357     signal(SIGFPE, blech);
15358 #endif
15359
15360     for (i = 0; i < n; i++) {
15361       u = u << 1 | ($uvtype)1;
15362       d = ($nvtype)u;
15363       if (($uvtype)d != u)
15364         break;
15365       if (d <= 0)
15366         break;
15367       d = ($nvtype)(u - 1);
15368       if (($uvtype)d != (u - 1))
15369         break;
15370 #ifdef SIGFPE
15371       if (bletched)
15372         break;
15373 #endif
15374     }
15375     printf("%d\n", ((i == n) ? -n : i));
15376     exit(0);
15377 }
15378 EOP
15379 set try
15380
15381 d_nv_preserves_uv="$undef"
15382 if eval $compile; then
15383         nv_preserves_uv_bits="`$run ./try`"
15384 fi
15385 case "$nv_preserves_uv_bits" in
15386 \-[1-9]*)
15387         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15388         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15389         d_nv_preserves_uv="$define"
15390         ;;
15391 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15392         d_nv_preserves_uv="$undef" ;;
15393 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15394         nv_preserves_uv_bits="0" ;;
15395 esac
15396 $rm_try
15397
15398 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15399 : volatile so that the compiler has to store it out to memory.
15400 if test X"$d_volatile" = X"$define"; then
15401         volatile=volatile
15402 fi
15403 $cat <<EOP >try.c
15404 #include <stdio.h>
15405 #$i_stdlib I_STDLIB
15406 #ifdef I_STDLIB
15407 #include <stdlib.h>
15408 #endif
15409 #$i_string I_STRING
15410 #ifdef I_STRING
15411 #  include <string.h>
15412 #else
15413 #  include <strings.h>
15414 #endif
15415 #include <sys/types.h>
15416 #include <signal.h>
15417 #ifdef SIGFPE
15418 $volatile int bletched = 0;
15419 $signal_t blech(int s) { bletched = 1; }
15420 #endif
15421
15422 int checkit($nvtype d, char *where) {
15423     unsigned char *p = (char *)&d;
15424     unsigned char *end = p + sizeof(d);
15425     int fail = 0;
15426
15427     while (p < end)
15428         fail += *p++;
15429
15430     if (!fail)
15431         return 0;
15432
15433     p = (char *)&d;
15434     printf("No - %s: 0x", where);
15435     while (p < end)
15436         printf ("%02X", *p++);
15437     printf("\n");
15438     return 1;
15439 }
15440
15441 int main(int argc, char **argv) {
15442     $nvtype d = 0.0;
15443     int fail = 0;
15444     fail += checkit(d, "0.0");
15445
15446     /* The compiler shouldn't be assuming that bletched is 0  */
15447     d = bletched;
15448
15449     fail += checkit(d, "bleched");
15450
15451 #ifdef SIGFPE
15452     signal(SIGFPE, blech);
15453 #endif
15454
15455     /* Paranoia - the compiler should have no way of knowing that ANSI says
15456        that argv[argc] will always be NULL.  Actually, if it did assume this it
15457        would be buggy, as this is C and main() can be called from elsewhere in
15458        the program.  */
15459     d = argv[argc] ? 1 : 0;
15460
15461     if (d) {
15462         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15463     }
15464
15465     fail += checkit(d, "ternary");
15466
15467     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15468
15469     if (d != 0.0) {
15470         printf("No - memset doesn't give 0.0\n");
15471         /* This might just blow up:  */
15472         printf("(gives %g)\n", d);
15473         return 1;
15474     }
15475
15476 #ifdef SIGFPE
15477     if (bletched) {
15478         printf("No - something bleched\n");
15479         return 1;
15480     }
15481 #endif
15482     if (fail) {
15483       printf("No - %d fail(s)\n", fail);
15484       return 1;
15485     }
15486     printf("Yes\n");
15487     return 0;
15488 }
15489 EOP
15490 set try
15491
15492 d_nv_zero_is_allbits_zero="$undef"
15493 if eval $compile; then
15494     xxx="`$run ./try`"
15495     case "$?" in
15496         0)
15497             case "$xxx" in
15498                 Yes)  cat >&4 <<EOM
15499 0.0 is represented as all bits zero in memory
15500 EOM
15501                     d_nv_zero_is_allbits_zero="$define"
15502                     ;;
15503                 *)  cat >&4 <<EOM
15504 0.0 is not represented as all bits zero in memory
15505 EOM
15506                     d_nv_zero_is_allbits_zero="$undef"
15507                     ;;
15508             esac
15509             ;;
15510         *)  cat >&4 <<EOM
15511 0.0 is not represented as all bits zero in memory
15512 EOM
15513             d_nv_zero_is_allbits_zero="$undef"
15514             ;;
15515     esac
15516 fi
15517 $rm_try
15518
15519 : check for off64_t
15520 echo " "
15521 echo "Checking to see if you have off64_t..." >&4
15522 $cat >try.c <<EOCP
15523 #include <sys/types.h>
15524 #include <unistd.h>
15525 int main() { off64_t x = 7; }
15526 EOCP
15527 set try
15528 if eval $compile; then
15529         val="$define"
15530         echo "You have off64_t."
15531 else
15532         val="$undef"
15533         echo "You do not have off64_t."
15534         case "$lseeksize" in
15535         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15536         esac
15537 fi
15538 $rm_try
15539 set d_off64_t
15540 eval $setvar
15541
15542 : how to create joinable pthreads
15543 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15544         echo " "
15545         echo "Checking what constant to use for creating joinable pthreads..." >&4
15546         $cat >try.c <<'EOCP'
15547 #include <pthread.h>
15548 int main() {
15549     int detachstate = JOINABLE;
15550 }
15551 EOCP
15552         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15553         if eval $compile; then
15554                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15555                 val="$undef" # Yes, undef.
15556                 set d_old_pthread_create_joinable
15557                 eval $setvar
15558                 val=""
15559                 set old_pthread_create_joinable
15560                 eval $setvar
15561         else
15562                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15563                 if eval $compile; then
15564                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15565                         val="$define"
15566                         set d_old_pthread_create_joinable
15567                         eval $setvar
15568                         val=PTHREAD_CREATE_UNDETACHED
15569                         set old_pthread_create_joinable
15570                         eval $setvar
15571                 else
15572                         set try -DJOINABLE=__UNDETACHED
15573                         if eval $compile; then
15574                                 echo "You seem to use __UNDETACHED." >&4
15575                                 val="$define"
15576                                 set d_old_pthread_create_joinable
15577                                 eval $setvar
15578                                 val=__UNDETACHED
15579                                 set old_pthread_create_joinable
15580                                 eval $setvar
15581                         else
15582                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15583                                 val="$define"
15584                                 set d_old_pthread_create_joinable
15585                                 eval $setvar
15586                                 val=0
15587                                 set old_pthread_create_joinable
15588                                 eval $setvar
15589                         fi
15590                 fi
15591         fi
15592         $rm_try
15593 else
15594     d_old_pthread_create_joinable="$undef"
15595     old_pthread_create_joinable=""
15596 fi
15597
15598 : see if pause exists
15599 set pause d_pause
15600 eval $inlibc
15601
15602 : see if poll exists
15603 set poll d_poll
15604 eval $inlibc
15605
15606 : see if readlink exists
15607 set readlink d_readlink
15608 eval $inlibc
15609
15610 echo " "
15611 procselfexe=''
15612 val="$undef"
15613 case "$d_readlink" in
15614 "$define")
15615         if $issymlink /proc/self/exe ; then
15616                 $ls -l /proc/self/exe > reflect
15617                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15618                         echo "You have Linux-like /proc/self/exe."
15619                         procselfexe='"/proc/self/exe"'
15620                         val="$define"
15621                 fi
15622         fi
15623         if $issymlink /proc/curproc/file ; then
15624                 $ls -l /proc/curproc/file > reflect
15625                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15626                         echo "You have BSD-like /proc/curproc/file."
15627                         procselfexe='"/proc/curproc/file"'
15628                         val="$define"
15629                 fi
15630         fi
15631         ;;
15632 esac
15633 $rm -f reflect
15634 set d_procselfexe
15635 eval $setvar
15636
15637 : backward compatibility for d_hvfork
15638 if test X$d_hvfork != X; then
15639         d_vfork="$d_hvfork"
15640         d_hvfork=''
15641 fi
15642 : see if there is a vfork
15643 val=''
15644 set vfork val
15645 eval $inlibc
15646
15647 d_pseudofork=$undef
15648
15649 : Ok, but do we want to use it. vfork is reportedly unreliable in
15650 : perl on Solaris 2.x, and probably elsewhere.
15651 case "$val" in
15652 $define)
15653         echo " "
15654         case "$usevfork" in
15655         false) dflt='n';;
15656         *) dflt='y';;
15657         esac
15658         cat <<'EOM'
15659
15660 Perl can only use a vfork() that doesn't suffer from strict
15661 restrictions on calling functions or modifying global data in
15662 the child.  For example, glibc-2.1 contains such a vfork()
15663 that is unsuitable.  If your system provides a proper fork()
15664 call, chances are that you do NOT want perl to use vfork().
15665
15666 EOM
15667         rp="Do you still want to use vfork()?"
15668         . ./myread
15669         case "$ans" in
15670         y|Y) ;;
15671         *)
15672                 echo "Ok, we won't use vfork()."
15673                 val="$undef"
15674                 ;;
15675         esac
15676         ;;
15677 esac
15678 set d_vfork
15679 eval $setvar
15680 case "$d_vfork" in
15681 $define) usevfork='true';;
15682 *) usevfork='false';;
15683 esac
15684
15685 : see whether the pthread_atfork exists
15686 $cat >try.c <<EOP
15687 #include <pthread.h>
15688 #include <stdio.h>
15689 int main() {
15690 #ifdef  PTHREAD_ATFORK
15691         pthread_atfork(NULL,NULL,NULL);
15692 #endif
15693 }
15694 EOP
15695
15696 : see if pthread_atfork exists
15697 set try -DPTHREAD_ATFORK
15698 if eval $compile; then
15699     val="$define"
15700 else
15701     val="$undef"
15702 fi
15703 case "$usethreads" in
15704 $define)
15705         case "$val" in
15706         $define) echo 'pthread_atfork found.' >&4        ;;
15707         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15708         esac
15709 esac
15710 set d_pthread_atfork
15711 eval $setvar
15712
15713 : see if pthread_attr_setscope exists
15714 set pthread_attr_setscope d_pthread_attr_setscope
15715 eval $inlibc
15716
15717
15718 : see whether the various POSIXish _yields exist
15719 $cat >try.c <<EOP
15720 #include <pthread.h>
15721 #include <stdio.h>
15722 int main() {
15723 #ifdef SCHED_YIELD
15724         sched_yield();
15725 #else
15726 #ifdef PTHREAD_YIELD
15727         pthread_yield();
15728 #else
15729 #ifdef PTHREAD_YIELD_NULL
15730         pthread_yield(NULL);
15731 #endif
15732 #endif
15733 #endif
15734 }
15735 EOP
15736 : see if sched_yield exists
15737 set try -DSCHED_YIELD
15738 if eval $compile; then
15739     val="$define"
15740     sched_yield='sched_yield()'
15741 else
15742     val="$undef"
15743 fi
15744 case "$usethreads" in
15745 $define)
15746         case "$val" in
15747         $define) echo 'sched_yield() found.' >&4        ;;
15748         *)       echo 'sched_yield() NOT found.' >&4    ;;
15749         esac
15750 esac
15751 set d_sched_yield
15752 eval $setvar
15753
15754 : see if pthread_yield exists
15755 set try -DPTHREAD_YIELD
15756 if eval $compile; then
15757     val="$define"
15758     case "$sched_yield" in
15759     '') sched_yield='pthread_yield()' ;;
15760     esac
15761 else
15762     set try -DPTHREAD_YIELD_NULL
15763     if eval $compile; then
15764         val="$define"
15765         case "$sched_yield" in
15766         '') sched_yield='pthread_yield(NULL)' ;;
15767         esac
15768     else
15769         val="$undef"
15770     fi
15771 fi
15772 case "$usethreads" in
15773 $define)
15774         case "$val" in
15775         $define) echo 'pthread_yield() found.' >&4      ;;
15776         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15777         esac
15778         ;;
15779 esac
15780 set d_pthread_yield
15781 eval $setvar
15782 case "$sched_yield" in
15783 '') sched_yield=undef ;;
15784 esac
15785 $rm_try
15786
15787 : see if random_r exists
15788 set random_r d_random_r
15789 eval $inlibc
15790 case "$d_random_r" in
15791 "$define")
15792         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15793         case "$d_random_r_proto:$usethreads" in
15794         ":define")      d_random_r_proto=define
15795                 set d_random_r_proto random_r $hdrs
15796                 eval $hasproto ;;
15797         *)      ;;
15798         esac
15799         case "$d_random_r_proto" in
15800         define)
15801         case "$random_r_proto" in
15802         ''|0) try='int random_r(int*, struct random_data*);'
15803         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15804         esac
15805         case "$random_r_proto" in
15806         ''|0) try='int random_r(long*, struct random_data*);'
15807         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15808         esac
15809         case "$random_r_proto" in
15810         ''|0) try='int random_r(struct random_data*, int32_t*);'
15811         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15812         esac
15813         case "$random_r_proto" in
15814         ''|0)   d_random_r=undef
15815                 random_r_proto=0
15816                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15817         * )     case "$random_r_proto" in
15818                 REENTRANT_PROTO*) ;;
15819                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15820                 esac
15821                 echo "Prototype: $try" ;;
15822         esac
15823         ;;
15824         *)      case "$usethreads" in
15825                 define) echo "random_r has no prototype, not using it." >&4 ;;
15826                 esac
15827                 d_random_r=undef
15828                 random_r_proto=0
15829                 ;;
15830         esac
15831         ;;
15832 *)      random_r_proto=0
15833         ;;
15834 esac
15835
15836 : see if readdir and friends exist
15837 set readdir d_readdir
15838 eval $inlibc
15839 set seekdir d_seekdir
15840 eval $inlibc
15841 set telldir d_telldir
15842 eval $inlibc
15843 set rewinddir d_rewinddir
15844 eval $inlibc
15845
15846 : see if readdir64_r exists
15847 set readdir64_r d_readdir64_r
15848 eval $inlibc
15849 case "$d_readdir64_r" in
15850 "$define")
15851         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15852         case "$d_readdir64_r_proto:$usethreads" in
15853         ":define")      d_readdir64_r_proto=define
15854                 set d_readdir64_r_proto readdir64_r $hdrs
15855                 eval $hasproto ;;
15856         *)      ;;
15857         esac
15858         case "$d_readdir64_r_proto" in
15859         define)
15860         case "$readdir64_r_proto" in
15861         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15862         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15863         esac
15864         case "$readdir64_r_proto" in
15865         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15866         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15867         esac
15868         case "$readdir64_r_proto" in
15869         ''|0)   d_readdir64_r=undef
15870                 readdir64_r_proto=0
15871                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15872         * )     case "$readdir64_r_proto" in
15873                 REENTRANT_PROTO*) ;;
15874                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15875                 esac
15876                 echo "Prototype: $try" ;;
15877         esac
15878         ;;
15879         *)      case "$usethreads" in
15880                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15881                 esac
15882                 d_readdir64_r=undef
15883                 readdir64_r_proto=0
15884                 ;;
15885         esac
15886         ;;
15887 *)      readdir64_r_proto=0
15888         ;;
15889 esac
15890
15891 : see if readdir_r exists
15892 set readdir_r d_readdir_r
15893 eval $inlibc
15894 case "$d_readdir_r" in
15895 "$define")
15896         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15897         case "$d_readdir_r_proto:$usethreads" in
15898         ":define")      d_readdir_r_proto=define
15899                 set d_readdir_r_proto readdir_r $hdrs
15900                 eval $hasproto ;;
15901         *)      ;;
15902         esac
15903         case "$d_readdir_r_proto" in
15904         define)
15905         case "$readdir_r_proto" in
15906         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15907         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15908         esac
15909         case "$readdir_r_proto" in
15910         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15911         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15912         esac
15913         case "$readdir_r_proto" in
15914         ''|0)   d_readdir_r=undef
15915                 readdir_r_proto=0
15916                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15917         * )     case "$readdir_r_proto" in
15918                 REENTRANT_PROTO*) ;;
15919                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15920                 esac
15921                 echo "Prototype: $try" ;;
15922         esac
15923         ;;
15924         *)      case "$usethreads" in
15925                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15926                 esac
15927                 d_readdir_r=undef
15928                 readdir_r_proto=0
15929                 ;;
15930         esac
15931         ;;
15932 *)      readdir_r_proto=0
15933         ;;
15934 esac
15935
15936 : see if readv exists
15937 set readv d_readv
15938 eval $inlibc
15939
15940 : see if recvmsg exists
15941 set recvmsg d_recvmsg
15942 eval $inlibc
15943
15944 : see if rename exists
15945 set rename d_rename
15946 eval $inlibc
15947
15948 : see if rmdir exists
15949 set rmdir d_rmdir
15950 eval $inlibc
15951
15952 : see if memory.h is available.
15953 val=''
15954 set memory.h val
15955 eval $inhdr
15956
15957 : See if it conflicts with string.h
15958 case "$val" in
15959 $define)
15960         case "$strings" in
15961         '') ;;
15962         *)
15963                 $cppstdin $cppflags $cppminus < $strings > mem.h
15964                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15965                         echo " "
15966                         echo "We won't be including <memory.h>."
15967                         val="$undef"
15968                 fi
15969                 $rm -f mem.h
15970                 ;;
15971         esac
15972 esac
15973 set i_memory
15974 eval $setvar
15975
15976 : can bcopy handle overlapping blocks?
15977 echo " "
15978 val="$undef"
15979 case "$d_memmove" in
15980 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15981 *)      case "$d_bcopy" in
15982         "$define")
15983                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15984                 $cat >try.c <<EOCP
15985 #$i_memory I_MEMORY
15986 #$i_stdlib I_STDLIB
15987 #$i_string I_STRING
15988 #$i_unistd I_UNISTD
15989 EOCP
15990         $cat >>try.c <<'EOCP'
15991 #include <stdio.h>
15992 #ifdef I_MEMORY
15993 #  include <memory.h>
15994 #endif
15995 #ifdef I_STDLIB
15996 #  include <stdlib.h>
15997 #endif
15998 #ifdef I_STRING
15999 #  include <string.h>
16000 #else
16001 #  include <strings.h>
16002 #endif
16003 #ifdef I_UNISTD
16004 #  include <unistd.h>  /* Needed for NetBSD */
16005 #endif
16006 int main()
16007 {
16008 char buf[128], abc[128];
16009 char *b;
16010 int len;
16011 int off;
16012 int align;
16013
16014 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16015    try to store the string in read-only memory. */
16016 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16017
16018 for (align = 7; align >= 0; align--) {
16019         for (len = 36; len; len--) {
16020                 b = buf+align;
16021                 bcopy(abc, b, len);
16022                 for (off = 1; off <= len; off++) {
16023                         bcopy(b, b+off, len);
16024                         bcopy(b+off, b, len);
16025                         if (bcmp(b, abc, len))
16026                                 exit(1);
16027                 }
16028         }
16029 }
16030 exit(0);
16031 }
16032 EOCP
16033                 set try
16034                 if eval $compile_ok; then
16035                         if $run ./try 2>/dev/null; then
16036                                 echo "Yes, it can."
16037                                 val="$define"
16038                         else
16039                                 echo "It can't, sorry."
16040                         fi
16041                 else
16042                         echo "(I can't compile the test program, so we'll assume not...)"
16043                 fi
16044                 ;;
16045         esac
16046         $rm_try
16047         ;;
16048 esac
16049 set d_safebcpy
16050 eval $setvar
16051
16052 : can memcpy handle overlapping blocks?
16053 echo " "
16054 val="$undef"
16055 case "$d_memmove" in
16056 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16057 *)      case "$d_memcpy" in
16058         "$define")
16059                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16060                 $cat >try.c <<EOCP
16061 #$i_memory I_MEMORY
16062 #$i_stdlib I_STDLIB
16063 #$i_string I_STRING
16064 #$i_unistd I_UNISTD
16065 EOCP
16066         $cat >>try.c <<'EOCP'
16067 #include <stdio.h>
16068 #ifdef I_MEMORY
16069 #  include <memory.h>
16070 #endif
16071 #ifdef I_STDLIB
16072 #  include <stdlib.h>
16073 #endif
16074 #ifdef I_STRING
16075 #  include <string.h>
16076 #else
16077 #  include <strings.h>
16078 #endif
16079 #ifdef I_UNISTD
16080 #  include <unistd.h>  /* Needed for NetBSD */
16081 #endif
16082 int main()
16083 {
16084 char buf[128], abc[128];
16085 char *b;
16086 int len;
16087 int off;
16088 int align;
16089
16090 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16091    try to store the string in read-only memory. */
16092 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16093
16094 for (align = 7; align >= 0; align--) {
16095         for (len = 36; len; len--) {
16096                 b = buf+align;
16097                 memcpy(b, abc, len);
16098                 for (off = 1; off <= len; off++) {
16099                         memcpy(b+off, b, len);
16100                         memcpy(b, b+off, len);
16101                         if (memcmp(b, abc, len))
16102                                 exit(1);
16103                 }
16104         }
16105 }
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 "It can't, sorry."
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_try
16123         ;;
16124 esac
16125 set d_safemcpy
16126 eval $setvar
16127
16128 : can memcmp be trusted to compare relative magnitude?
16129 val="$undef"
16130 case "$d_memcmp" in
16131 "$define")
16132         echo " "
16133         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16134         $cat >try.c <<EOCP
16135 #$i_memory I_MEMORY
16136 #$i_stdlib I_STDLIB
16137 #$i_string I_STRING
16138 #$i_unistd I_UNISTD
16139 EOCP
16140         $cat >>try.c <<'EOCP'
16141 #include <stdio.h>
16142 #ifdef I_MEMORY
16143 #  include <memory.h>
16144 #endif
16145 #ifdef I_STDLIB
16146 #  include <stdlib.h>
16147 #endif
16148 #ifdef I_STRING
16149 #  include <string.h>
16150 #else
16151 #  include <strings.h>
16152 #endif
16153 #ifdef I_UNISTD
16154 #  include <unistd.h>  /* Needed for NetBSD */
16155 #endif
16156 int main()
16157 {
16158 char a = -1;
16159 char b = 0;
16160 if ((a < b) && memcmp(&a, &b, 1) < 0)
16161         exit(1);
16162 exit(0);
16163 }
16164 EOCP
16165         set try
16166         if eval $compile_ok; then
16167                 if $run ./try 2>/dev/null; then
16168                         echo "Yes, it can."
16169                         val="$define"
16170                 else
16171                         echo "No, it can't (it uses signed chars)."
16172                 fi
16173         else
16174                 echo "(I can't compile the test program, so we'll assume not...)"
16175         fi
16176         ;;
16177 esac
16178 $rm_try
16179 set d_sanemcmp
16180 eval $setvar
16181
16182 : see if prototype for sbrk is available
16183 echo " "
16184 set d_sbrkproto sbrk $i_unistd unistd.h
16185 eval $hasproto
16186
16187 : see if select exists
16188 set select d_select
16189 eval $inlibc
16190
16191 : see if semctl exists
16192 set semctl d_semctl
16193 eval $inlibc
16194
16195 : see if semget exists
16196 set semget d_semget
16197 eval $inlibc
16198
16199 : see if semop exists
16200 set semop d_semop
16201 eval $inlibc
16202
16203 : see how much of the 'sem*(2)' library is present.
16204 h_sem=true
16205 echo " "
16206 case "$d_semctl$d_semget$d_semop" in
16207 *"$undef"*) h_sem=false;;
16208 esac
16209 case "$osname" in
16210 freebsd)
16211     case "`ipcs 2>&1`" in
16212     "SVID messages"*"not configured"*)
16213         echo "Your $osname does not have the sem*(2) configured." >&4
16214         h_sem=false
16215         val="$undef"
16216         set semctl d_semctl
16217         eval $setvar
16218         set semget d_semget
16219         eval $setvar
16220         set semop d_semop
16221         eval $setvar
16222         ;;
16223     esac
16224     ;;
16225 esac
16226 : we could also check for sys/ipc.h ...
16227 if $h_sem && $test `./findhdr sys/sem.h`; then
16228         echo "You have the full sem*(2) library." >&4
16229         val="$define"
16230 else
16231         echo "You don't have the full sem*(2) library." >&4
16232         val="$undef"
16233 fi
16234 set d_sem
16235 eval $setvar
16236
16237 : see whether sys/sem.h defines union semun
16238 echo " "
16239 $cat > try.c <<'END'
16240 #include <sys/types.h>
16241 #include <sys/ipc.h>
16242 #include <sys/sem.h>
16243 int main () { union semun semun; semun.buf = 0; }
16244 END
16245 set try
16246 if eval $compile; then
16247     echo "You have union semun in <sys/sem.h>." >&4
16248     val="$define"
16249 else
16250     echo "You do not have union semun in <sys/sem.h>." >&4
16251     val="$undef"
16252 fi
16253 $rm_try
16254 set d_union_semun
16255 eval $setvar
16256
16257 : see how to do semctl IPC_STAT
16258 case "$d_sem" in
16259 $define)
16260     echo " "
16261     $cat > tryh.h <<END
16262 #ifndef S_IRUSR
16263 #   ifdef S_IREAD
16264 #       define S_IRUSR S_IREAD
16265 #       define S_IWUSR S_IWRITE
16266 #       define S_IXUSR S_IEXEC
16267 #   else
16268 #       define S_IRUSR 0400
16269 #       define S_IWUSR 0200
16270 #       define S_IXUSR 0100
16271 #   endif
16272 #   define S_IRGRP (S_IRUSR>>3)
16273 #   define S_IWGRP (S_IWUSR>>3)
16274 #   define S_IXGRP (S_IXUSR>>3)
16275 #   define S_IROTH (S_IRUSR>>6)
16276 #   define S_IWOTH (S_IWUSR>>6)
16277 #   define S_IXOTH (S_IXUSR>>6)
16278 #endif
16279 #ifndef S_IRWXU
16280 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16281 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16282 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16283 #endif
16284 END
16285     : see whether semctl IPC_STAT can use union semun
16286     case "$d_semctl_semun" in
16287     '')
16288       val="$undef"
16289       $cat > try.c <<END
16290 #include <sys/types.h>
16291 #include <sys/ipc.h>
16292 #include <sys/sem.h>
16293 #include <sys/stat.h>
16294 #include <stdio.h>
16295 #include <errno.h>
16296 #include "tryh.h"
16297 #ifndef errno
16298 extern int errno;
16299 #endif
16300 #$d_union_semun HAS_UNION_SEMUN
16301 int main() {
16302     union semun
16303 #ifndef HAS_UNION_SEMUN
16304     {
16305         int val;
16306         struct semid_ds *buf;
16307         unsigned short *array;
16308     }
16309 #endif
16310     arg;
16311     int sem, st;
16312
16313 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16314     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16315     if (sem > -1) {
16316         struct semid_ds argbuf;
16317         arg.buf = &argbuf;
16318 #       ifdef IPC_STAT
16319         st = semctl(sem, 0, IPC_STAT, arg);
16320         if (st == 0)
16321             printf("semun\n");
16322         else
16323 #       endif /* IPC_STAT */
16324             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16325 #       ifdef IPC_RMID
16326         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16327 #       endif /* IPC_RMID */
16328             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16329     } else
16330 #endif /* IPC_PRIVATE && ... */
16331         printf("semget failed: errno = %d\n", errno);
16332   return 0;
16333 }
16334 END
16335       set try
16336       if eval $compile; then
16337           xxx=`$run ./try`
16338           case "$xxx" in
16339           semun) val="$define" ;;
16340           esac
16341       fi
16342       $rm_try
16343       set d_semctl_semun
16344       eval $setvar
16345       ;;
16346     esac
16347     case "$d_semctl_semun" in
16348     $define)
16349         echo "You can use union semun for semctl IPC_STAT." >&4
16350         also='also'
16351         ;;
16352     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16353         also=''
16354         ;;
16355     esac
16356
16357     : see whether semctl IPC_STAT can use struct semid_ds pointer
16358     case "$d_semctl_semid_ds" in
16359     '')
16360       val="$undef"
16361       $cat > try.c <<'END'
16362 #include <sys/types.h>
16363 #include <sys/ipc.h>
16364 #include <sys/sem.h>
16365 #include <sys/stat.h>
16366 #include "tryh.h"
16367 #include <stdio.h>
16368 #include <errno.h>
16369 #ifndef errno
16370 extern int errno;
16371 #endif
16372 int main() {
16373     struct semid_ds arg;
16374     int sem, st;
16375
16376 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16377     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16378     if (sem > -1) {
16379 #       ifdef IPC_STAT
16380         st = semctl(sem, 0, IPC_STAT, &arg);
16381         if (st == 0)
16382             printf("semid_ds\n");
16383         else
16384 #       endif /* IPC_STAT */
16385             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16386 #       ifdef IPC_RMID
16387         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16388 #       endif /* IPC_RMID */
16389             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16390     } else
16391 #endif /* IPC_PRIVATE && ... */
16392         printf("semget failed: errno = %d\n", errno);
16393
16394     return 0;
16395 }
16396 END
16397       set try
16398       if eval $compile; then
16399           xxx=`$run ./try`
16400           case "$xxx" in
16401           semid_ds) val="$define" ;;
16402           esac
16403       fi
16404       $rm_try
16405       set d_semctl_semid_ds
16406       eval $setvar
16407       ;;
16408     esac
16409     case "$d_semctl_semid_ds" in
16410     $define)
16411         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16412         ;;
16413     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16414         ;;
16415     esac
16416     ;;
16417 *)  val="$undef"
16418
16419     # We do not have the full sem*(2) library, so assume we can not
16420     # use either.
16421
16422     set d_semctl_semun
16423     eval $setvar
16424
16425     set d_semctl_semid_ds
16426     eval $setvar
16427     ;;
16428 esac
16429 $rm_try tryh.h
16430
16431 : see if sendmsg exists
16432 set sendmsg d_sendmsg
16433 eval $inlibc
16434
16435 : see if setegid exists
16436 set setegid d_setegid
16437 eval $inlibc
16438
16439 : see if seteuid exists
16440 set seteuid d_seteuid
16441 eval $inlibc
16442
16443 : see if setgrent exists
16444 set setgrent d_setgrent
16445 eval $inlibc
16446
16447 : see if setgrent_r exists
16448 set setgrent_r d_setgrent_r
16449 eval $inlibc
16450 case "$d_setgrent_r" in
16451 "$define")
16452         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16453         case "$d_setgrent_r_proto:$usethreads" in
16454         ":define")      d_setgrent_r_proto=define
16455                 set d_setgrent_r_proto setgrent_r $hdrs
16456                 eval $hasproto ;;
16457         *)      ;;
16458         esac
16459         case "$d_setgrent_r_proto" in
16460         define)
16461         case "$setgrent_r_proto" in
16462         ''|0) try='int setgrent_r(FILE**);'
16463         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16464         esac
16465         case "$setgrent_r_proto" in
16466         ''|0) try='void setgrent_r(FILE**);'
16467         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16468         esac
16469         case "$setgrent_r_proto" in
16470         ''|0)   d_setgrent_r=undef
16471                 setgrent_r_proto=0
16472                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16473         * )     case "$setgrent_r_proto" in
16474                 REENTRANT_PROTO*) ;;
16475                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16476                 esac
16477                 echo "Prototype: $try" ;;
16478         esac
16479         ;;
16480         *)      case "$usethreads" in
16481                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16482                 esac
16483                 d_setgrent_r=undef
16484                 setgrent_r_proto=0
16485                 ;;
16486         esac
16487         ;;
16488 *)      setgrent_r_proto=0
16489         ;;
16490 esac
16491
16492 : see if sethostent exists
16493 set sethostent d_sethent
16494 eval $inlibc
16495
16496 : see if sethostent_r exists
16497 set sethostent_r d_sethostent_r
16498 eval $inlibc
16499 case "$d_sethostent_r" in
16500 "$define")
16501         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16502         case "$d_sethostent_r_proto:$usethreads" in
16503         ":define")      d_sethostent_r_proto=define
16504                 set d_sethostent_r_proto sethostent_r $hdrs
16505                 eval $hasproto ;;
16506         *)      ;;
16507         esac
16508         case "$d_sethostent_r_proto" in
16509         define)
16510         case "$sethostent_r_proto" in
16511         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16512         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16513         esac
16514         case "$sethostent_r_proto" in
16515         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16516         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16517         esac
16518         case "$sethostent_r_proto" in
16519         ''|0)   d_sethostent_r=undef
16520                 sethostent_r_proto=0
16521                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16522         * )     case "$sethostent_r_proto" in
16523                 REENTRANT_PROTO*) ;;
16524                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16525                 esac
16526                 echo "Prototype: $try" ;;
16527         esac
16528         ;;
16529         *)      case "$usethreads" in
16530                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16531                 esac
16532                 d_sethostent_r=undef
16533                 sethostent_r_proto=0
16534                 ;;
16535         esac
16536         ;;
16537 *)      sethostent_r_proto=0
16538         ;;
16539 esac
16540
16541 : see if setitimer exists
16542 set setitimer d_setitimer
16543 eval $inlibc
16544
16545 : see if setlinebuf exists
16546 set setlinebuf d_setlinebuf
16547 eval $inlibc
16548
16549 : see if setlocale exists
16550 set setlocale d_setlocale
16551 eval $inlibc
16552
16553 : see if locale.h is available
16554 set locale.h i_locale
16555 eval $inhdr
16556
16557 : see if setlocale_r exists
16558 set setlocale_r d_setlocale_r
16559 eval $inlibc
16560 case "$d_setlocale_r" in
16561 "$define")
16562         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16563         case "$d_setlocale_r_proto:$usethreads" in
16564         ":define")      d_setlocale_r_proto=define
16565                 set d_setlocale_r_proto setlocale_r $hdrs
16566                 eval $hasproto ;;
16567         *)      ;;
16568         esac
16569         case "$d_setlocale_r_proto" in
16570         define)
16571         case "$setlocale_r_proto" in
16572         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16573         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16574         esac
16575         case "$setlocale_r_proto" in
16576         ''|0)   d_setlocale_r=undef
16577                 setlocale_r_proto=0
16578                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16579         * )     case "$setlocale_r_proto" in
16580                 REENTRANT_PROTO*) ;;
16581                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16582                 esac
16583                 echo "Prototype: $try" ;;
16584         esac
16585         ;;
16586         *)      case "$usethreads" in
16587                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16588                 esac
16589                 d_setlocale_r=undef
16590                 setlocale_r_proto=0
16591                 ;;
16592         esac
16593         ;;
16594 *)      setlocale_r_proto=0
16595         ;;
16596 esac
16597
16598 : see if setnetent exists
16599 set setnetent d_setnent
16600 eval $inlibc
16601
16602 : see if setnetent_r exists
16603 set setnetent_r d_setnetent_r
16604 eval $inlibc
16605 case "$d_setnetent_r" in
16606 "$define")
16607         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16608         case "$d_setnetent_r_proto:$usethreads" in
16609         ":define")      d_setnetent_r_proto=define
16610                 set d_setnetent_r_proto setnetent_r $hdrs
16611                 eval $hasproto ;;
16612         *)      ;;
16613         esac
16614         case "$d_setnetent_r_proto" in
16615         define)
16616         case "$setnetent_r_proto" in
16617         ''|0) try='int setnetent_r(int, struct netent_data*);'
16618         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16619         esac
16620         case "$setnetent_r_proto" in
16621         ''|0) try='void setnetent_r(int, struct netent_data*);'
16622         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16623         esac
16624         case "$setnetent_r_proto" in
16625         ''|0)   d_setnetent_r=undef
16626                 setnetent_r_proto=0
16627                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16628         * )     case "$setnetent_r_proto" in
16629                 REENTRANT_PROTO*) ;;
16630                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16631                 esac
16632                 echo "Prototype: $try" ;;
16633         esac
16634         ;;
16635         *)      case "$usethreads" in
16636                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16637                 esac
16638                 d_setnetent_r=undef
16639                 setnetent_r_proto=0
16640                 ;;
16641         esac
16642         ;;
16643 *)      setnetent_r_proto=0
16644         ;;
16645 esac
16646
16647 : see if setprotoent exists
16648 set setprotoent d_setpent
16649 eval $inlibc
16650
16651 : see if setpgid exists
16652 set setpgid d_setpgid
16653 eval $inlibc
16654
16655 : see if setpgrp2 exists
16656 set setpgrp2 d_setpgrp2
16657 eval $inlibc
16658
16659 : see if setpriority exists
16660 set setpriority d_setprior
16661 eval $inlibc
16662
16663 : see if setproctitle exists
16664 set setproctitle d_setproctitle
16665 eval $inlibc
16666
16667 : see if setprotoent_r exists
16668 set setprotoent_r d_setprotoent_r
16669 eval $inlibc
16670 case "$d_setprotoent_r" in
16671 "$define")
16672         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16673         case "$d_setprotoent_r_proto:$usethreads" in
16674         ":define")      d_setprotoent_r_proto=define
16675                 set d_setprotoent_r_proto setprotoent_r $hdrs
16676                 eval $hasproto ;;
16677         *)      ;;
16678         esac
16679         case "$d_setprotoent_r_proto" in
16680         define)
16681         case "$setprotoent_r_proto" in
16682         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16683         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16684         esac
16685         case "$setprotoent_r_proto" in
16686         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16687         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16688         esac
16689         case "$setprotoent_r_proto" in
16690         ''|0)   d_setprotoent_r=undef
16691                 setprotoent_r_proto=0
16692                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16693         * )     case "$setprotoent_r_proto" in
16694                 REENTRANT_PROTO*) ;;
16695                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16696                 esac
16697                 echo "Prototype: $try" ;;
16698         esac
16699         ;;
16700         *)      case "$usethreads" in
16701                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16702                 esac
16703                 d_setprotoent_r=undef
16704                 setprotoent_r_proto=0
16705                 ;;
16706         esac
16707         ;;
16708 *)      setprotoent_r_proto=0
16709         ;;
16710 esac
16711
16712 : see if setpwent exists
16713 set setpwent d_setpwent
16714 eval $inlibc
16715
16716 : see if setpwent_r exists
16717 set setpwent_r d_setpwent_r
16718 eval $inlibc
16719 case "$d_setpwent_r" in
16720 "$define")
16721         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16722         case "$d_setpwent_r_proto:$usethreads" in
16723         ":define")      d_setpwent_r_proto=define
16724                 set d_setpwent_r_proto setpwent_r $hdrs
16725                 eval $hasproto ;;
16726         *)      ;;
16727         esac
16728         case "$d_setpwent_r_proto" in
16729         define)
16730         case "$setpwent_r_proto" in
16731         ''|0) try='int setpwent_r(FILE**);'
16732         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16733         esac
16734         case "$setpwent_r_proto" in
16735         ''|0) try='void setpwent_r(FILE**);'
16736         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16737         esac
16738         case "$setpwent_r_proto" in
16739         ''|0)   d_setpwent_r=undef
16740                 setpwent_r_proto=0
16741                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16742         * )     case "$setpwent_r_proto" in
16743                 REENTRANT_PROTO*) ;;
16744                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16745                 esac
16746                 echo "Prototype: $try" ;;
16747         esac
16748         ;;
16749         *)      case "$usethreads" in
16750                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16751                 esac
16752                 d_setpwent_r=undef
16753                 setpwent_r_proto=0
16754                 ;;
16755         esac
16756         ;;
16757 *)      setpwent_r_proto=0
16758         ;;
16759 esac
16760
16761 : see if setregid exists
16762 set setregid d_setregid
16763 eval $inlibc
16764 set setresgid d_setresgid
16765 eval $inlibc
16766
16767 : see if setreuid exists
16768 set setreuid d_setreuid
16769 eval $inlibc
16770 set setresuid d_setresuid
16771 eval $inlibc
16772
16773 : see if setrgid exists
16774 set setrgid d_setrgid
16775 eval $inlibc
16776
16777 : see if setruid exists
16778 set setruid d_setruid
16779 eval $inlibc
16780
16781 : see if setservent exists
16782 set setservent d_setsent
16783 eval $inlibc
16784
16785 : see if setservent_r exists
16786 set setservent_r d_setservent_r
16787 eval $inlibc
16788 case "$d_setservent_r" in
16789 "$define")
16790         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16791         case "$d_setservent_r_proto:$usethreads" in
16792         ":define")      d_setservent_r_proto=define
16793                 set d_setservent_r_proto setservent_r $hdrs
16794                 eval $hasproto ;;
16795         *)      ;;
16796         esac
16797         case "$d_setservent_r_proto" in
16798         define)
16799         case "$setservent_r_proto" in
16800         ''|0) try='int setservent_r(int, struct servent_data*);'
16801         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16802         esac
16803         case "$setservent_r_proto" in
16804         ''|0) try='void setservent_r(int, struct servent_data*);'
16805         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16806         esac
16807         case "$setservent_r_proto" in
16808         ''|0)   d_setservent_r=undef
16809                 setservent_r_proto=0
16810                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16811         * )     case "$setservent_r_proto" in
16812                 REENTRANT_PROTO*) ;;
16813                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16814                 esac
16815                 echo "Prototype: $try" ;;
16816         esac
16817         ;;
16818         *)      case "$usethreads" in
16819                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16820                 esac
16821                 d_setservent_r=undef
16822                 setservent_r_proto=0
16823                 ;;
16824         esac
16825         ;;
16826 *)      setservent_r_proto=0
16827         ;;
16828 esac
16829
16830 : see if setsid exists
16831 set setsid d_setsid
16832 eval $inlibc
16833
16834 : see if setvbuf exists
16835 set setvbuf d_setvbuf
16836 eval $inlibc
16837
16838 : see if sfio.h is available
16839 set sfio.h i_sfio
16840 eval $inhdr
16841
16842
16843 : see if sfio library is available
16844 case "$i_sfio" in
16845 $define)
16846         val=''
16847         set sfreserve val
16848         eval $inlibc
16849         ;;
16850 *)
16851         val="$undef"
16852         ;;
16853 esac
16854 : Ok, but do we want to use it.
16855 case "$val" in
16856 $define)
16857         case "$usesfio" in
16858         true|$define|[yY]*) dflt='y';;
16859         *) dflt='n';;
16860         esac
16861         echo "$package can use the sfio library, but it is experimental."
16862         case "$useperlio" in
16863         "$undef")
16864             echo "For sfio also the PerlIO abstraction layer is needed."
16865             echo "Earlier you said you wouldn't want that."
16866             ;;
16867         esac
16868         rp="You seem to have sfio available, do you want to try using it?"
16869         . ./myread
16870         case "$ans" in
16871         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16872                 useperlio="$define"
16873                 val="$define"
16874                 ;;
16875         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16876                 val="$undef"
16877                 ;;
16878         esac
16879         ;;
16880 *)      case "$usesfio" in
16881         true|$define|[yY]*)
16882                 echo "Sorry, cannot find sfio on this machine." >&4
16883                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16884                 val="$undef"
16885                 ;;
16886         esac
16887         ;;
16888 esac
16889 set d_sfio
16890 eval $setvar
16891 case "$d_sfio" in
16892 $define) usesfio='true';;
16893 *) usesfio='false';;
16894 esac
16895 case "$d_sfio" in
16896 $define) ;;
16897 *)      : Remove sfio from list of libraries to use
16898         case "$libs" in
16899         *-lsfio*)
16900                 echo "Removing unneeded -lsfio from library list" >&4
16901                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16902                 shift
16903                 libs="$*"
16904                 echo "libs = $libs" >&4
16905                 ;;
16906         esac
16907 ;;
16908 esac
16909
16910
16911 : see if shmctl exists
16912 set shmctl d_shmctl
16913 eval $inlibc
16914
16915 : see if shmget exists
16916 set shmget d_shmget
16917 eval $inlibc
16918
16919 : see if shmat exists
16920 set shmat d_shmat
16921 eval $inlibc
16922 : see what shmat returns
16923 case "$d_shmat" in
16924 "$define")
16925         $cat >shmat.c <<'END'
16926 #include <sys/shm.h>
16927 void *shmat();
16928 END
16929         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16930                 shmattype='void *'
16931         else
16932                 shmattype='char *'
16933         fi
16934         echo "and it returns ($shmattype)." >&4
16935         : see if a prototype for shmat is available
16936         xxx=`./findhdr sys/shm.h`
16937         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16938         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16939                 val="$define"
16940         else
16941                 val="$undef"
16942         fi
16943         $rm -f shmat.[co]
16944         ;;
16945 *)
16946         val="$undef"
16947         ;;
16948 esac
16949 set d_shmatprototype
16950 eval $setvar
16951
16952 : see if shmdt exists
16953 set shmdt d_shmdt
16954 eval $inlibc
16955
16956 : see how much of the 'shm*(2)' library is present.
16957 h_shm=true
16958 echo " "
16959 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16960 *"$undef"*) h_shm=false;;
16961 esac
16962 case "$osname" in
16963 freebsd)
16964     case "`ipcs 2>&1`" in
16965     "SVID shared memory"*"not configured"*)
16966         echo "Your $osname does not have the shm*(2) configured." >&4
16967         h_shm=false
16968         val="$undef"
16969         set shmctl d_shmctl
16970         evat $setvar
16971         set shmget d_shmget
16972         evat $setvar
16973         set shmat d_shmat
16974         evat $setvar
16975         set shmdt d_shmdt
16976         evat $setvar
16977         ;;
16978     esac
16979     ;;
16980 esac
16981 : we could also check for sys/ipc.h ...
16982 if $h_shm && $test `./findhdr sys/shm.h`; then
16983         echo "You have the full shm*(2) library." >&4
16984         val="$define"
16985 else
16986         echo "You don't have the full shm*(2) library." >&4
16987         val="$undef"
16988 fi
16989 set d_shm
16990 eval $setvar
16991
16992 echo " "
16993 : see if we have sigaction
16994 if set sigaction val -f d_sigaction; eval $csym; $val; then
16995         echo 'sigaction() found.' >&4
16996         $cat > try.c <<EOP
16997 #include <stdio.h>
16998 #include <sys/types.h>
16999 #include <signal.h>
17000 #$i_stdlib I_STDLIB
17001 #ifdef I_STDLIB
17002 #include <stdlib.h>
17003 #endif
17004 int main()
17005 {
17006     struct sigaction act, oact;
17007     act.sa_flags = 0;
17008     oact.sa_handler = 0;
17009     /* so that act and oact are used */
17010     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17011 }
17012 EOP
17013         set try
17014         if eval $compile_ok; then
17015                 val="$define"
17016         else
17017                 echo "But you don't seem to have a useable struct sigaction." >&4
17018                 val="$undef"
17019         fi
17020 else
17021         echo 'sigaction NOT found.' >&4
17022         val="$undef"
17023 fi
17024 set d_sigaction; eval $setvar
17025 $rm_try
17026
17027 : see if this is a sunmath.h system
17028 set sunmath.h i_sunmath
17029 eval $inhdr
17030
17031 : see if signbit exists
17032 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17033 $cat >try.c <<EOCP
17034 #$i_math I_MATH
17035 #$i_sunmath I_SUNMATH
17036 #ifdef I_MATH
17037 #  include <math.h>
17038 #endif
17039 #ifdef I_SUNMATH  /* Solaris special math library */
17040 #  include <sunmath.h>
17041 #endif
17042 #define NV $nvtype
17043 int main(int argc, char **argv)
17044 {
17045     NV x = 0.0;
17046     NV y = -0.0;
17047     if ((signbit(x) == 0) && (signbit(y) != 0))
17048         return 0;
17049     else
17050         return 1;
17051 }
17052 EOCP
17053 val="$undef"
17054 set try
17055 if eval $compile; then
17056     if $run ./try; then
17057         $echo "Yes." >&4
17058         val="$define"
17059     else
17060         $echo "Signbit seems to be available, but doesn't work as I expected."
17061         $echo "I won't use it." >&4
17062         val="$undef"
17063     fi
17064 else
17065     $echo "Nope." >&4
17066     dflt="$undef"
17067 fi
17068 set d_signbit
17069 eval $setvar
17070 $rm_try
17071
17072 : see if sigprocmask exists
17073 set sigprocmask d_sigprocmask
17074 eval $inlibc
17075
17076 : see if sigsetjmp exists
17077 echo " "
17078 case "$d_sigsetjmp" in
17079 '')
17080         $cat >try.c <<EOP
17081 #include <setjmp.h>
17082 #$i_stdlib I_STDLIB
17083 #ifdef I_STDLIB
17084 #include <stdlib.h>
17085 #endif
17086 sigjmp_buf env;
17087 int set = 1;
17088 int main()
17089 {
17090         if (sigsetjmp(env,1))
17091                 exit(set);
17092         set = 0;
17093         siglongjmp(env, 1);
17094         exit(1);
17095 }
17096 EOP
17097         set try
17098         if eval $compile; then
17099                 if $run ./try >/dev/null 2>&1; then
17100                         echo "POSIX sigsetjmp found." >&4
17101                         val="$define"
17102                 else
17103                         $cat >&4 <<EOM
17104 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17105 I'll ignore them.
17106 EOM
17107                         val="$undef"
17108                 fi
17109         else
17110                 echo "sigsetjmp not found." >&4
17111                 val="$undef"
17112         fi
17113         ;;
17114 *) val="$d_sigsetjmp"
17115         case "$d_sigsetjmp" in
17116         $define) echo "POSIX sigsetjmp found." >&4;;
17117         $undef) echo "sigsetjmp not found." >&4;;
17118         esac
17119         ;;
17120 esac
17121 set d_sigsetjmp
17122 eval $setvar
17123 $rm_try
17124
17125 : see if snprintf exists
17126 set snprintf d_snprintf
17127 eval $inlibc
17128
17129 : see if vsnprintf exists
17130 set vsnprintf d_vsnprintf
17131 eval $inlibc
17132
17133 case "$d_snprintf-$d_vsnprintf" in
17134 "$define-$define")
17135     $cat <<EOM
17136 Checking whether your snprintf() and vsnprintf() work okay...
17137 EOM
17138     $cat >try.c <<'EOCP'
17139 /* v?snprintf testing logic courtesy of Russ Allbery.
17140  * According to C99:
17141  * - if the buffer is too short it still must be \0-terminated
17142  * - if the buffer is too short the potentially required length
17143  *   must be returned and not -1
17144  * - if the buffer is NULL the potentially required length
17145  *   must be returned and not -1 or core dump
17146  */
17147 #include <stdio.h>
17148 #include <stdarg.h>
17149
17150 char buf[2];
17151
17152 int test (char *format, ...)
17153 {
17154     va_list args;
17155     int count;
17156
17157     va_start (args, format);
17158     count = vsnprintf (buf, sizeof buf, format, args);
17159     va_end (args);
17160     return count;
17161 }
17162
17163 int main ()
17164 {
17165     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17166              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17167 }
17168 EOCP
17169     set try
17170     if eval $compile; then
17171         `$run ./try`
17172         case "$?" in
17173         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17174         *) cat <<EOM >&4
17175 Your snprintf() and snprintf() don't seem to be working okay.
17176 EOM
17177            d_snprintf="$undef"
17178            d_vsnprintf="$undef"
17179            ;;
17180         esac
17181     else
17182         echo "(I can't seem to compile the test program--assuming they don't)"
17183         d_snprintf="$undef"
17184         d_vsnprintf="$undef"
17185     fi
17186     $rm_try
17187     ;;
17188 esac
17189
17190 : see if sockatmark exists
17191 set sockatmark d_sockatmark
17192 eval $inlibc
17193
17194 : see if prototype for sockatmark is available
17195 echo " "
17196 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17197 eval $hasproto
17198
17199 : see if socks5_init exists
17200 set socks5_init d_socks5_init
17201 eval $inlibc
17202
17203 : see if sprintf returns the length of the string in the buffer as per ANSI
17204 $echo "Checking whether sprintf returns the length of the string..." >&4
17205 $cat <<EOP >try.c
17206 #include <stdio.h>
17207 #$i_stdlib I_STDLIB
17208 #ifdef I_STDLIB
17209 #include <stdlib.h>
17210 #endif
17211 #$i_string I_STRING
17212 #ifdef I_STRING
17213 #  include <string.h>
17214 #else
17215 #  include <strings.h>
17216 #endif
17217 #$i_math I_MATH
17218 #ifdef I_MATH
17219 #include <math.h>
17220 #endif
17221
17222 char buffer[256];
17223
17224 int check (size_t expect, int test) {
17225   size_t got = strlen(buffer);
17226   if (expect == got)
17227     return 0;
17228
17229   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17230        test, buffer);
17231   exit (test);
17232 }
17233
17234 int main(int argc, char **argv) {
17235   int test = 0;
17236
17237   check(sprintf(buffer, ""), ++test);
17238   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17239   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17240
17241   return 0;
17242 }
17243 EOP
17244 set try
17245
17246 d_sprintf_returns_strlen="$undef"
17247 if eval $compile; then
17248     xxx="`$run ./try`"
17249     case "$?" in
17250         0) cat >&4 <<EOM
17251 sprintf returns the length of the string (as ANSI says it should)
17252 EOM
17253         d_sprintf_returns_strlen="$define"
17254         ;;
17255         *) cat >&4 <<EOM
17256 sprintf does not return the length of the string (how old is this system?)
17257 EOM
17258         d_sprintf_returns_strlen="$undef"
17259         ;;
17260     esac
17261 fi
17262 $rm_try
17263
17264 : see if srand48_r exists
17265 set srand48_r d_srand48_r
17266 eval $inlibc
17267 case "$d_srand48_r" in
17268 "$define")
17269         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17270         case "$d_srand48_r_proto:$usethreads" in
17271         ":define")      d_srand48_r_proto=define
17272                 set d_srand48_r_proto srand48_r $hdrs
17273                 eval $hasproto ;;
17274         *)      ;;
17275         esac
17276         case "$d_srand48_r_proto" in
17277         define)
17278         case "$srand48_r_proto" in
17279         ''|0) try='int srand48_r(long, struct drand48_data*);'
17280         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17281         esac
17282         case "$srand48_r_proto" in
17283         ''|0)   d_srand48_r=undef
17284                 srand48_r_proto=0
17285                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17286         * )     case "$srand48_r_proto" in
17287                 REENTRANT_PROTO*) ;;
17288                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17289                 esac
17290                 echo "Prototype: $try" ;;
17291         esac
17292         ;;
17293         *)      case "$usethreads" in
17294                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17295                 esac
17296                 d_srand48_r=undef
17297                 srand48_r_proto=0
17298                 ;;
17299         esac
17300         ;;
17301 *)      srand48_r_proto=0
17302         ;;
17303 esac
17304
17305 : see if srandom_r exists
17306 set srandom_r d_srandom_r
17307 eval $inlibc
17308 case "$d_srandom_r" in
17309 "$define")
17310         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17311         case "$d_srandom_r_proto:$usethreads" in
17312         ":define")      d_srandom_r_proto=define
17313                 set d_srandom_r_proto srandom_r $hdrs
17314                 eval $hasproto ;;
17315         *)      ;;
17316         esac
17317         case "$d_srandom_r_proto" in
17318         define)
17319         case "$srandom_r_proto" in
17320         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17321         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17322         esac
17323         case "$srandom_r_proto" in
17324         ''|0)   d_srandom_r=undef
17325                 srandom_r_proto=0
17326                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17327         * )     case "$srandom_r_proto" in
17328                 REENTRANT_PROTO*) ;;
17329                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17330                 esac
17331                 echo "Prototype: $try" ;;
17332         esac
17333         ;;
17334         *)      case "$usethreads" in
17335                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17336                 esac
17337                 d_srandom_r=undef
17338                 srandom_r_proto=0
17339                 ;;
17340         esac
17341         ;;
17342 *)      srandom_r_proto=0
17343         ;;
17344 esac
17345
17346 : see if prototype for setresgid is available
17347 echo " "
17348 set d_sresgproto setresgid $i_unistd unistd.h
17349 eval $hasproto
17350
17351 : see if prototype for setresuid is available
17352 echo " "
17353 set d_sresuproto setresuid $i_unistd unistd.h
17354 eval $hasproto
17355
17356 : see if sys/stat.h is available
17357 set sys/stat.h i_sysstat
17358 eval $inhdr
17359
17360
17361 : see if stat knows about block sizes
17362 echo " "
17363 echo "Checking to see if your struct stat has st_blocks field..." >&4
17364 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17365 eval $hasfield
17366
17367
17368 : see if this is a sys/vfs.h system
17369 set sys/vfs.h i_sysvfs
17370 eval $inhdr
17371
17372
17373 : see if this is a sys/statfs.h system
17374 set sys/statfs.h i_sysstatfs
17375 eval $inhdr
17376
17377
17378 echo " "
17379 echo "Checking to see if your system supports struct statfs..." >&4
17380 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
17381 eval $hasstruct
17382 case "$d_statfs_s" in
17383 "$define")      echo "Yes, it does."   ;;
17384 *)              echo "No, it doesn't." ;;
17385 esac
17386
17387
17388
17389 : see if struct statfs knows about f_flags
17390 case "$d_statfs_s" in
17391 define) 
17392         echo " "
17393         echo "Checking to see if your struct statfs has f_flags field..." >&4
17394         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
17395         eval $hasfield
17396         ;;
17397 *)      val="$undef"
17398         set d_statfs_f_flags
17399         eval $setvar
17400         ;;
17401 esac
17402 case "$d_statfs_f_flags" in
17403 "$define")      echo "Yes, it does."   ;;
17404 *)              echo "No, it doesn't." ;;
17405 esac
17406
17407 $cat >&4 <<EOM
17408 Checking how to access stdio streams by file descriptor number...
17409 EOM
17410 case "$stdio_stream_array" in
17411 '')     $cat >try.c <<EOCP
17412 #include <stdio.h>
17413 int main() {
17414   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17415     printf("yes\n");
17416 }
17417 EOCP
17418         for s in _iob __iob __sF
17419         do
17420                 set try -DSTDIO_STREAM_ARRAY=$s
17421                 if eval $compile; then
17422                         case "`$run ./try`" in
17423                         yes)    stdio_stream_array=$s; break ;;
17424                         esac
17425                 fi
17426         done
17427         $rm_try
17428 esac
17429 case "$stdio_stream_array" in
17430 '')     $cat >&4 <<EOM
17431 I can't figure out how to access stdio streams by file descriptor number.
17432 EOM
17433         d_stdio_stream_array="$undef"
17434         ;;
17435 *)      $cat >&4 <<EOM
17436 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17437 EOM
17438         d_stdio_stream_array="$define"
17439         ;;
17440 esac
17441
17442 : see if strcoll exists
17443 set strcoll d_strcoll
17444 eval $inlibc
17445
17446 : check for structure copying
17447 echo " "
17448 echo "Checking to see if your C compiler can copy structs..." >&4
17449 $cat >try.c <<'EOCP'
17450 int main()
17451 {
17452         struct blurfl {
17453                 int dyick;
17454         } foo, bar;
17455
17456         foo = bar;
17457 }
17458 EOCP
17459 if $cc -c try.c >/dev/null 2>&1 ; then
17460         val="$define"
17461         echo "Yup, it can."
17462 else
17463         val="$undef"
17464         echo "Nope, it can't."
17465 fi
17466 set d_strctcpy
17467 eval $setvar
17468 $rm_try
17469
17470 : see if strerror and/or sys_errlist[] exist
17471 echo " "
17472 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17473     if set strerror val -f d_strerror; eval $csym; $val; then
17474                 echo 'strerror() found.' >&4
17475                 d_strerror="$define"
17476                 d_strerrm='strerror(e)'
17477                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17478                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17479                         d_syserrlst="$define"
17480                 else
17481                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17482                         d_syserrlst="$undef"
17483                 fi
17484     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17485                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17486                 echo 'strerror() found in string header.' >&4
17487                 d_strerror="$define"
17488                 d_strerrm='strerror(e)'
17489                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17490                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17491                                 d_syserrlst="$define"
17492                 else
17493                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17494                         d_syserrlst="$undef"
17495                 fi
17496     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17497                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17498                 d_strerror="$undef"
17499                 d_syserrlst="$define"
17500                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17501     else
17502                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17503                 d_strerror="$undef"
17504                 d_syserrlst="$undef"
17505                 d_strerrm='"unknown"'
17506     fi
17507 fi
17508
17509 : see if strerror_r exists
17510 set strerror_r d_strerror_r
17511 eval $inlibc
17512 case "$d_strerror_r" in
17513 "$define")
17514         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17515         case "$d_strerror_r_proto:$usethreads" in
17516         ":define")      d_strerror_r_proto=define
17517                 set d_strerror_r_proto strerror_r $hdrs
17518                 eval $hasproto ;;
17519         *)      ;;
17520         esac
17521         case "$d_strerror_r_proto" in
17522         define)
17523         case "$strerror_r_proto" in
17524         ''|0) try='int strerror_r(int, char*, size_t);'
17525         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17526         esac
17527         case "$strerror_r_proto" in
17528         ''|0) try='int strerror_r(int, char*, int);'
17529         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17530         esac
17531         case "$strerror_r_proto" in
17532         ''|0) try='char* strerror_r(int, char*, size_t);'
17533         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17534         esac
17535         case "$strerror_r_proto" in
17536         ''|0)   d_strerror_r=undef
17537                 strerror_r_proto=0
17538                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17539         * )     case "$strerror_r_proto" in
17540                 REENTRANT_PROTO*) ;;
17541                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17542                 esac
17543                 echo "Prototype: $try" ;;
17544         esac
17545         ;;
17546         *)      case "$usethreads" in
17547                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17548                 esac
17549                 d_strerror_r=undef
17550                 strerror_r_proto=0
17551                 ;;
17552         esac
17553         ;;
17554 *)      strerror_r_proto=0
17555         ;;
17556 esac
17557
17558 : see if strftime exists
17559 set strftime d_strftime
17560 eval $inlibc
17561
17562 : see if strlcat exists
17563 set strlcat d_strlcat
17564 eval $inlibc
17565
17566 : see if strlcpy exists
17567 set strlcpy d_strlcpy
17568 eval $inlibc
17569
17570 : see if strtod exists
17571 set strtod d_strtod
17572 eval $inlibc
17573
17574 : see if strtol exists
17575 set strtol d_strtol
17576 eval $inlibc
17577
17578 : see if strtold exists
17579 set strtold d_strtold
17580 eval $inlibc
17581
17582 : see if strtoll exists
17583 set strtoll d_strtoll
17584 eval $inlibc
17585
17586 case "$d_longlong-$d_strtoll" in
17587 "$define-$define")
17588         $cat <<EOM
17589 Checking whether your strtoll() works okay...
17590 EOM
17591         $cat >try.c <<'EOCP'
17592 #include <errno.h>
17593 #ifdef __hpux
17594 #define strtoll __strtoll
17595 #endif
17596 #ifdef __EMX__
17597 #define strtoll _strtoll
17598 #endif
17599 #include <stdio.h>
17600 extern long long int strtoll(char *s, char **, int); 
17601 static int bad = 0;
17602 int check(char *s, long long ell, int een) {
17603         long long gll;
17604         errno = 0;
17605         gll = strtoll(s, 0, 10);
17606         if (!((gll == ell) && (errno == een)))
17607                 bad++;
17608 }
17609 int main() {
17610         check(" 1",                                      1LL, 0);
17611         check(" 0",                                      0LL, 0);
17612         check("-1",                                     -1LL, 0);
17613         check("-9223372036854775808", -9223372036854775808LL, 0);
17614         check("-9223372036854775808", -9223372036854775808LL, 0);
17615         check(" 9223372036854775807",  9223372036854775807LL, 0);
17616         check("-9223372036854775808", -9223372036854775808LL, 0);
17617         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17618         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17619         if (!bad)
17620                 printf("ok\n");
17621 }
17622 EOCP
17623         set try
17624         if eval $compile; then
17625                 yyy=`$run ./try`
17626                 case "$yyy" in
17627                 ok) echo "Your strtoll() seems to be working okay." ;;
17628                 *) cat <<EOM >&4
17629 Your strtoll() doesn't seem to be working okay.
17630 EOM
17631                    d_strtoll="$undef"
17632                    ;;
17633                 esac
17634         else
17635                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17636                 d_strtoll="$undef"
17637         fi
17638         ;;
17639 esac
17640
17641 : see if strtoq exists
17642 set strtoq d_strtoq
17643 eval $inlibc
17644
17645 : see if strtoul exists
17646 set strtoul d_strtoul
17647 eval $inlibc
17648
17649 case "$d_strtoul" in
17650 "$define")
17651         $cat <<EOM
17652 Checking whether your strtoul() works okay...
17653 EOM
17654         $cat >try.c <<'EOCP'
17655 #include <errno.h>
17656 #include <stdio.h>
17657 extern unsigned long int strtoul(char *s, char **, int); 
17658 static int bad = 0;
17659 void check(char *s, unsigned long eul, int een) {
17660         unsigned long gul;
17661         errno = 0;
17662         gul = strtoul(s, 0, 10);
17663         if (!((gul == eul) && (errno == een)))
17664                 bad++;
17665 }
17666 int main() {
17667         check(" 1", 1L, 0);
17668         check(" 0", 0L, 0);
17669 EOCP
17670         case "$longsize" in
17671         8)
17672             $cat >>try.c <<'EOCP'
17673         check("18446744073709551615", 18446744073709551615UL, 0);
17674         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17675 #if 0 /* strtoul() for /^-/ strings is undefined. */
17676         check("-1", 18446744073709551615UL, 0);
17677         check("-18446744073709551614", 2, 0);
17678         check("-18446744073709551615", 1, 0);
17679         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17680         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17681 #endif
17682 EOCP
17683                 ;;
17684         4)
17685                     $cat >>try.c <<'EOCP'
17686         check("4294967295", 4294967295UL, 0);
17687         check("4294967296", 4294967295UL, ERANGE);
17688 #if 0 /* strtoul() for /^-/ strings is undefined. */
17689         check("-1", 4294967295UL, 0);
17690         check("-4294967294", 2, 0);
17691         check("-4294967295", 1, 0);
17692         check("-4294967296", 4294967295UL, ERANGE);
17693         check("-4294967297", 4294967295UL, ERANGE);
17694 #endif
17695 EOCP
17696                 ;;
17697         *)
17698 : Should we write these tests to be more portable by sprintf-ing
17699 : ~0 and then manipulating that char string as input for strtol?
17700                 ;;
17701         esac
17702         $cat >>try.c <<'EOCP'
17703         if (!bad)
17704                 printf("ok\n");
17705         return 0;
17706 }
17707 EOCP
17708         set try
17709         if eval $compile; then
17710                 case "`$run ./try`" in
17711                 ok) echo "Your strtoul() seems to be working okay." ;;
17712                 *) cat <<EOM >&4
17713 Your strtoul() doesn't seem to be working okay.
17714 EOM
17715                    d_strtoul="$undef"
17716                    ;;
17717                 esac
17718         else
17719                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17720                 d_strtoul="$undef"
17721         fi
17722         ;;
17723 esac
17724
17725 : see if strtoull exists
17726 set strtoull d_strtoull
17727 eval $inlibc
17728
17729 case "$d_longlong-$d_strtoull" in
17730 "$define-$define")
17731         $cat <<EOM
17732 Checking whether your strtoull() works okay...
17733 EOM
17734         $cat >try.c <<'EOCP'
17735 #include <errno.h>
17736 #ifdef __hpux
17737 #define strtoull __strtoull
17738 #endif
17739 #include <stdio.h>
17740 extern unsigned long long int strtoull(char *s, char **, int); 
17741 static int bad = 0;
17742 int check(char *s, long long eull, int een) {
17743         long long gull;
17744         errno = 0;
17745         gull = strtoull(s, 0, 10);
17746         if (!((gull == eull) && (errno == een)))
17747                 bad++;
17748 }
17749 int main() {
17750         check(" 1",                                        1LL, 0);
17751         check(" 0",                                        0LL, 0);
17752         check("18446744073709551615",  18446744073709551615ULL, 0);
17753         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17754 #if 0 /* strtoull() for /^-/ strings is undefined. */
17755         check("-1",                    18446744073709551615ULL, 0);
17756         check("-18446744073709551614",                     2LL, 0);
17757         check("-18446744073709551615",                     1LL, 0);
17758         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17759         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17760 #endif
17761         if (!bad)
17762                 printf("ok\n");
17763 }
17764 EOCP
17765         set try
17766         if eval $compile; then
17767                 case "`$run ./try`" in
17768                 ok) echo "Your strtoull() seems to be working okay." ;;
17769                 *) cat <<EOM >&4
17770 Your strtoull() doesn't seem to be working okay.
17771 EOM
17772                    d_strtoull="$undef"
17773                    ;;
17774                 esac
17775         else
17776                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17777                 d_strtoull="$undef"
17778         fi
17779         ;;
17780 esac
17781
17782 : see if strtouq exists
17783 set strtouq d_strtouq
17784 eval $inlibc
17785
17786 case "$d_strtouq" in
17787 "$define")
17788         $cat <<EOM
17789 Checking whether your strtouq() works okay...
17790 EOM
17791         $cat >try.c <<'EOCP'
17792 #include <errno.h>
17793 #include <stdio.h>
17794 extern unsigned long long int strtouq(char *s, char **, int); 
17795 static int bad = 0;
17796 void check(char *s, unsigned long long eull, int een) {
17797         unsigned long long gull;
17798         errno = 0;
17799         gull = strtouq(s, 0, 10);
17800         if (!((gull == eull) && (errno == een)))
17801                 bad++;
17802 }
17803 int main() {
17804         check(" 1",                                        1LL, 0);
17805         check(" 0",                                        0LL, 0);
17806         check("18446744073709551615",  18446744073709551615ULL, 0);
17807         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17808 #if 0 /* strtouq() for /^-/ strings is undefined. */
17809         check("-1",                    18446744073709551615ULL, 0);
17810         check("-18446744073709551614",                     2LL, 0);
17811         check("-18446744073709551615",                     1LL, 0);
17812         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17813         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17814 #endif
17815         if (!bad)
17816                 printf("ok\n");
17817         return 0;
17818 }
17819 EOCP
17820         set try
17821         if eval $compile; then
17822                 case "`$run ./try`" in
17823                 ok) echo "Your strtouq() seems to be working okay." ;;
17824                 *) cat <<EOM >&4
17825 Your strtouq() doesn't seem to be working okay.
17826 EOM
17827                    d_strtouq="$undef"
17828                    ;;
17829                 esac
17830         else
17831                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17832                 d_strtouq="$undef"
17833         fi
17834         ;;
17835 esac
17836
17837 : see if strxfrm exists
17838 set strxfrm d_strxfrm
17839 eval $inlibc
17840
17841 : see if symlink exists
17842 set symlink d_symlink
17843 eval $inlibc
17844
17845 : see if syscall exists
17846 set syscall d_syscall
17847 eval $inlibc
17848
17849 : see if prototype for syscall is available
17850 echo " "
17851 set d_syscallproto syscall $i_unistd unistd.h
17852 eval $hasproto
17853
17854 : see if sysconf exists
17855 set sysconf d_sysconf
17856 eval $inlibc
17857
17858 : see if system exists
17859 set system d_system
17860 eval $inlibc
17861
17862 : see if tcgetpgrp exists
17863 set tcgetpgrp d_tcgetpgrp
17864 eval $inlibc
17865
17866 : see if tcsetpgrp exists
17867 set tcsetpgrp d_tcsetpgrp
17868 eval $inlibc
17869
17870 : see if prototype for telldir is available
17871 echo " "
17872 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17873 eval $hasproto
17874
17875 : see if time exists
17876 echo " "
17877 if test "X$d_time" = X -o X"$timetype" = X; then
17878     if set time val -f d_time; eval $csym; $val; then
17879                 echo 'time() found.' >&4
17880                 val="$define"
17881                 rp="What is the type returned by time() on this system?"
17882                 set time_t timetype long stdio.h sys/types.h
17883                 eval $typedef_ask
17884     else
17885                 echo 'time() not found, hope that will do.' >&4
17886                 val="$undef"
17887                 timetype='int';
17888     fi
17889     set d_time
17890     eval $setvar
17891 fi
17892
17893 : see if this is a sys/times.h system
17894 set sys/times.h i_systimes
17895 eval $inhdr
17896
17897 : see if times exists
17898 echo " "
17899 if set times val -f d_times; eval $csym; $val; then
17900         echo 'times() found.' >&4
17901         d_times="$define"
17902         inc=''
17903         case "$i_systimes" in
17904         "$define") inc='sys/times.h';;
17905         esac
17906         rp="What is the type returned by times() on this system?"
17907         set clock_t clocktype long stdio.h sys/types.h $inc
17908         eval $typedef_ask
17909 else
17910         echo 'times() NOT found, hope that will do.' >&4
17911         d_times="$undef"
17912         clocktype='int'
17913 fi
17914
17915 : see if tmpnam_r exists
17916 set tmpnam_r d_tmpnam_r
17917 eval $inlibc
17918 case "$d_tmpnam_r" in
17919 "$define")
17920         hdrs="$i_systypes sys/types.h define stdio.h "
17921         case "$d_tmpnam_r_proto:$usethreads" in
17922         ":define")      d_tmpnam_r_proto=define
17923                 set d_tmpnam_r_proto tmpnam_r $hdrs
17924                 eval $hasproto ;;
17925         *)      ;;
17926         esac
17927         case "$d_tmpnam_r_proto" in
17928         define)
17929         case "$tmpnam_r_proto" in
17930         ''|0) try='char* tmpnam_r(char*);'
17931         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17932         esac
17933         case "$tmpnam_r_proto" in
17934         ''|0)   d_tmpnam_r=undef
17935                 tmpnam_r_proto=0
17936                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17937         * )     case "$tmpnam_r_proto" in
17938                 REENTRANT_PROTO*) ;;
17939                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17940                 esac
17941                 echo "Prototype: $try" ;;
17942         esac
17943         ;;
17944         *)      case "$usethreads" in
17945                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17946                 esac
17947                 d_tmpnam_r=undef
17948                 tmpnam_r_proto=0
17949                 ;;
17950         esac
17951         ;;
17952 *)      tmpnam_r_proto=0
17953         ;;
17954 esac
17955
17956 : see if truncate exists
17957 set truncate d_truncate
17958 eval $inlibc
17959
17960 : see if ttyname_r exists
17961 set ttyname_r d_ttyname_r
17962 eval $inlibc
17963 case "$d_ttyname_r" in
17964 "$define")
17965         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17966         case "$d_ttyname_r_proto:$usethreads" in
17967         ":define")      d_ttyname_r_proto=define
17968                 set d_ttyname_r_proto ttyname_r $hdrs
17969                 eval $hasproto ;;
17970         *)      ;;
17971         esac
17972         case "$d_ttyname_r_proto" in
17973         define)
17974         case "$ttyname_r_proto" in
17975         ''|0) try='int ttyname_r(int, char*, size_t);'
17976         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17977         esac
17978         case "$ttyname_r_proto" in
17979         ''|0) try='int ttyname_r(int, char*, int);'
17980         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17981         esac
17982         case "$ttyname_r_proto" in
17983         ''|0) try='char* ttyname_r(int, char*, int);'
17984         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17985         esac
17986         case "$ttyname_r_proto" in
17987         ''|0)   d_ttyname_r=undef
17988                 ttyname_r_proto=0
17989                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17990         * )     case "$ttyname_r_proto" in
17991                 REENTRANT_PROTO*) ;;
17992                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17993                 esac
17994                 echo "Prototype: $try" ;;
17995         esac
17996         ;;
17997         *)      case "$usethreads" in
17998                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17999                 esac
18000                 d_ttyname_r=undef
18001                 ttyname_r_proto=0
18002                 ;;
18003         esac
18004         ;;
18005 *)      ttyname_r_proto=0
18006         ;;
18007 esac
18008
18009 : see if tzname[] exists
18010 echo " "
18011 if set tzname val -a d_tzname; eval $csym; $val; then
18012         val="$define"
18013         echo 'tzname[] found.' >&4
18014 else
18015         val="$undef"
18016         echo 'tzname[] NOT found.' >&4
18017 fi
18018 set d_tzname
18019 eval $setvar
18020
18021 case "$osname" in
18022 next|rhapsody|darwin) multiarch="$define" ;;
18023 esac
18024 case "$multiarch" in
18025 ''|[nN]*) multiarch="$undef" ;;
18026 esac
18027
18028 : check for ordering of bytes in a UV
18029 echo " "
18030 case "$usecrosscompile$multiarch" in
18031 *$define*)
18032         $cat <<EOM
18033 You seem to be either cross-compiling or doing a multiarchitecture build,
18034 skipping the byteorder check.
18035
18036 EOM
18037         byteorder='ffff'
18038         ;;
18039 *)
18040         case "$byteorder" in
18041         '')
18042                 $cat <<'EOM'
18043 In the following, larger digits indicate more significance.  A big-endian
18044 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18045 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18046 machines may have weird orders like 3412.  A Cray will report 87654321,
18047 an Alpha will report 12345678. If the test program works the default is
18048 probably right.
18049 I'm now running the test program...
18050 EOM
18051                 $cat >try.c <<EOCP
18052 #include <stdio.h>
18053 #$i_stdlib I_STDLIB
18054 #ifdef I_STDLIB
18055 #include <stdlib.h>
18056 #endif
18057 #include <sys/types.h>
18058 typedef $uvtype UV;
18059 int main()
18060 {
18061         int i;
18062         union {
18063                 UV l;
18064                 char c[$uvsize];
18065         } u;
18066
18067         if ($uvsize > 4)
18068                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18069         else
18070                 u.l = (UV)0x04030201;
18071         for (i = 0; i < $uvsize; i++)
18072                 printf("%c", u.c[i]+'0');
18073         printf("\n");
18074         exit(0);
18075 }
18076 EOCP
18077                 xxx_prompt=y
18078                 set try
18079                 if eval $compile && $run ./try > /dev/null; then
18080                         dflt=`$run ./try`
18081                         case "$dflt" in
18082                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18083                                 echo "(The test program ran ok.)"
18084                                 echo "byteorder=$dflt"
18085                                 xxx_prompt=n
18086                         ;;
18087                         ????|????????) echo "(The test program ran ok.)" ;;
18088                         *) echo "(The test program didn't run right for some reason.)" ;;
18089                         esac
18090                 else
18091                         dflt='4321'
18092                         cat <<'EOM'
18093 (I can't seem to compile the test program.  Guessing big-endian...)
18094 EOM
18095                 fi
18096                 case "$xxx_prompt" in
18097                 y)
18098                         rp="What is the order of bytes in $uvtype?"
18099                         . ./myread
18100                         byteorder="$ans"
18101                         ;;
18102                 *)      byteorder=$dflt
18103                         ;;
18104                 esac
18105                 ;;
18106         esac
18107         $rm_try
18108         ;;
18109 esac
18110
18111 $cat <<EOM
18112
18113 Checking to see whether you can access character data unalignedly...
18114 EOM
18115 case "$d_u32align" in
18116 '')   $cat >try.c <<EOCP
18117 #include <stdio.h>
18118 #$i_stdlib I_STDLIB
18119 #ifdef I_STDLIB
18120 #include <stdlib.h>
18121 #endif
18122 #define U32 $u32type
18123 #define BYTEORDER 0x$byteorder
18124 #define U8 $u8type
18125 #include <signal.h>
18126 #ifdef SIGBUS
18127 $signal_t bletch(int s) { exit(4); }
18128 #endif
18129 int main() {
18130 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18131     U8 buf[8];
18132     U32 *up;
18133     int i;
18134
18135     if (sizeof(U32) != 4) {
18136         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18137         exit(1);
18138     }
18139
18140     fflush(stdout);
18141
18142 #ifdef SIGBUS
18143     signal(SIGBUS, bletch);
18144 #endif
18145
18146     buf[0] = 0;
18147     buf[1] = 0;
18148     buf[2] = 0;
18149     buf[3] = 1;
18150     buf[4] = 0;
18151     buf[5] = 0;
18152     buf[6] = 0;
18153     buf[7] = 1;
18154
18155     for (i = 0; i < 4; i++) {
18156         up = (U32*)(buf + i);
18157         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18158                (*up == 1 << (8*(3-i)))  /* little-endian */
18159               )
18160            )
18161         {
18162             printf("read failed (%x)\n", *up);
18163             exit(2);
18164         }
18165     }
18166
18167     /* write test */
18168     for (i = 0; i < 4; i++) {
18169         up = (U32*)(buf + i);
18170         *up = 0xBeef;
18171         if (*up != 0xBeef) {
18172             printf("write failed (%x)\n", *up);
18173             exit(3);
18174         }
18175     }
18176
18177     exit(0);
18178 #else
18179     printf("1\n");
18180     exit(1);
18181 #endif
18182     return 0;
18183 }
18184 EOCP
18185 set try
18186 if eval $compile_ok; then
18187         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18188         $run ./try 2>&1 >/dev/null
18189         case "$?" in
18190         0)      cat >&4 <<EOM
18191 You can access character data pretty unalignedly.
18192 EOM
18193                 d_u32align="$undef"
18194                 ;;
18195         *)      cat >&4 <<EOM
18196 It seems that you must access character data in an aligned manner.
18197 EOM
18198                 d_u32align="$define"
18199                 ;;
18200         esac
18201 else
18202         rp='Can you access character data at unaligned addresses?'
18203         dflt='n'
18204         . ./myread
18205         case "$ans" in
18206         [yY]*)  d_u32align="$undef"  ;;
18207         *)      d_u32align="$define" ;;
18208         esac
18209 fi
18210 $rm_try
18211 ;;
18212 esac
18213
18214 : see if ualarm exists
18215 set ualarm d_ualarm
18216 eval $inlibc
18217
18218 : see if umask exists
18219 set umask d_umask
18220 eval $inlibc
18221
18222 : see if unordered exists
18223 set unordered d_unordered
18224 eval $inlibc
18225
18226 : see if unsetenv exists
18227 set unsetenv d_unsetenv
18228 eval $inlibc
18229
18230 : see if usleep exists
18231 set usleep d_usleep
18232 eval $inlibc
18233
18234 : see if prototype for usleep is available
18235 echo " "
18236 set d_usleepproto usleep $i_unistd unistd.h
18237 eval $hasproto
18238
18239 : see if ustat exists
18240 set ustat d_ustat
18241 eval $inlibc
18242
18243 : see if closedir exists
18244 set closedir d_closedir
18245 eval $inlibc
18246
18247 case "$d_closedir" in
18248 "$define")
18249         echo " "
18250         echo "Checking whether closedir() returns a status..." >&4
18251         cat > try.c <<EOM
18252 #$i_dirent I_DIRENT             /**/
18253 #$i_sysdir I_SYS_DIR            /**/
18254 #$i_sysndir I_SYS_NDIR          /**/
18255 #$i_systypes I_SYS_TYPES        /**/
18256
18257 #if defined(I_SYS_TYPES)
18258 #include <sys/types.h>
18259 #endif
18260 #if defined(I_DIRENT)
18261 #include <dirent.h>
18262 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18263 #include <sys/dir.h>
18264 #endif
18265 #else
18266 #ifdef I_SYS_NDIR
18267 #include <sys/ndir.h>
18268 #else
18269 #ifdef I_SYS_DIR
18270 #ifdef hp9000s500
18271 #include <ndir.h>       /* may be wrong in the future */
18272 #else
18273 #include <sys/dir.h>
18274 #endif
18275 #endif
18276 #endif
18277 #endif
18278 int main() { return closedir(opendir(".")); }
18279 EOM
18280         set try
18281         if eval $compile_ok; then
18282                 if $run ./try > /dev/null 2>&1 ; then
18283                         echo "Yes, it does."
18284                         val="$undef"
18285                 else
18286                         echo "No, it doesn't."
18287                         val="$define"
18288                 fi
18289         else
18290                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18291                 val="$define"
18292         fi
18293         ;;
18294 *)
18295         val="$undef";
18296         ;;
18297 esac
18298 set d_void_closedir
18299 eval $setvar
18300 $rm_try
18301
18302 : see if there is a wait4
18303 set wait4 d_wait4
18304 eval $inlibc
18305
18306 : see if waitpid exists
18307 set waitpid d_waitpid
18308 eval $inlibc
18309
18310 : see if wcstombs exists
18311 set wcstombs d_wcstombs
18312 eval $inlibc
18313
18314 : see if wctomb exists
18315 set wctomb d_wctomb
18316 eval $inlibc
18317
18318 : see if writev exists
18319 set writev d_writev
18320 eval $inlibc
18321
18322 : preserve RCS keywords in files with variable substitution, grrr
18323 Date='$Date'
18324 Id='$Id'
18325 Log='$Log'
18326 RCSfile='$RCSfile'
18327 Revision='$Revision'
18328
18329 : check for alignment requirements
18330 echo " "
18331 case "$usecrosscompile$multiarch" in
18332 *$define*)
18333         $cat <<EOM
18334 You seem to be either cross-compiling or doing a multiarchitecture build,
18335 skipping the memory alignment check.
18336
18337 EOM
18338         case "$alignbytes" in
18339         '') alignbytes=8 ;;
18340         esac
18341         ;;
18342 *)
18343         case "$alignbytes" in
18344         '') echo "Checking alignment constraints..." >&4
18345                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18346                         $cat >try.c <<'EOCP'
18347 typedef long double NV;
18348 EOCP
18349                 else
18350                         $cat >try.c <<'EOCP'
18351 typedef double NV;
18352 EOCP
18353                 fi
18354                 $cat >>try.c <<'EOCP'
18355 #include <stdio.h>
18356 struct foobar {
18357         char foo;
18358         NV bar;
18359 } try_algn;
18360 int main()
18361 {
18362     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18363     return(0);
18364 }
18365 EOCP
18366                 set try
18367                 if eval $compile_ok; then
18368                         dflt=`$run ./try`
18369                 else
18370                         dflt='8'
18371                         echo "(I can't seem to compile the test program...)"
18372                 fi
18373                 ;;
18374         *) dflt="$alignbytes"
18375                 ;;
18376         esac
18377         rp="Doubles must be aligned on a how-many-byte boundary?"
18378         . ./myread
18379         alignbytes="$ans"
18380         $rm_try
18381         ;;
18382 esac
18383
18384
18385 : set the base revision
18386 baserev=5.0
18387
18388 : how do we concatenate cpp tokens here?
18389 echo " "
18390 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18391 $cat >cpp_stuff.c <<'EOCP'
18392 #define RCAT(a,b)a/**/b
18393 #define ACAT(a,b)a ## b
18394 RCAT(Rei,ser)
18395 ACAT(Cir,cus)
18396 EOCP
18397 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18398 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18399         echo "Oh!  Smells like ANSI's been here." >&4
18400         echo "We can catify or stringify, separately or together!"
18401         cpp_stuff=42
18402 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18403         echo "Ah, yes!  The good old days!" >&4
18404         echo "However, in the good old days we don't know how to stringify and"
18405         echo "catify at the same time."
18406         cpp_stuff=1
18407 else
18408         $cat >&4 <<EOM
18409 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18410 You're going to have to edit the values of CAT[2-5] in config.h...
18411 EOM
18412         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18413 fi
18414 $rm -f cpp_stuff.*
18415
18416 : see if this is a db.h system
18417 set db.h i_db
18418 eval $inhdr
18419
18420 case "$i_db" in
18421 $define)
18422         : Check db version.
18423         echo " "
18424         echo "Checking Berkeley DB version ..." >&4
18425         $cat >try.c <<EOCP
18426 #$d_const HASCONST
18427 #ifndef HASCONST
18428 #define const
18429 #endif
18430 #include <sys/types.h>
18431 #include <stdio.h>
18432 #$i_stdlib I_STDLIB
18433 #ifdef I_STDLIB
18434 #include <stdlib.h>
18435 #endif
18436 #include <db.h>
18437 int main(int argc, char *argv[])
18438 {
18439 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18440     int Major, Minor, Patch ;
18441     unsigned long Version ;
18442     (void)db_version(&Major, &Minor, &Patch) ;
18443     if (argc == 2) {
18444         printf("%d %d %d %d %d %d\n",
18445                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18446                Major, Minor, Patch);
18447         exit(0);
18448     }
18449     printf("You have Berkeley DB Version 2 or greater.\n");
18450
18451     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18452                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18453     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18454                 Major, Minor, Patch) ;
18455
18456     /* check that db.h & libdb are compatible */
18457     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18458         printf("db.h and libdb are incompatible.\n") ;
18459         exit(3);
18460     }
18461
18462     printf("db.h and libdb are compatible.\n") ;
18463
18464     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18465                 + DB_VERSION_PATCH ;
18466
18467     /* needs to be >= 2.3.4 */
18468     if (Version < 2003004) {
18469     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18470         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18471         exit(2);
18472     }
18473
18474     exit(0);
18475 #else
18476 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18477     if (argc == 2) {
18478         printf("1 0 0\n");
18479         exit(0);
18480     }
18481     printf("You have Berkeley DB Version 1.\n");
18482     exit(0);    /* DB version < 2: the coast is clear. */
18483 #else
18484     exit(1);    /* <db.h> not Berkeley DB? */
18485 #endif
18486 #endif
18487 }
18488 EOCP
18489         set try
18490         if eval $compile_ok && $run ./try; then
18491                 echo 'Looks OK.' >&4
18492                 set `$run ./try 1`
18493                 db_version_major=$1
18494                 db_version_minor=$2
18495                 db_version_patch=$3
18496         else
18497                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18498                 i_db=$undef
18499                 case " $libs " in
18500                 *"-ldb "*)
18501                         : Remove db from list of libraries to use
18502                         echo "Removing unusable -ldb from library list" >&4
18503                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18504                         shift
18505                         libs="$*"
18506                         echo "libs = $libs" >&4
18507                         ;;
18508                 esac
18509         fi
18510         $rm_try
18511         ;;
18512 esac
18513
18514 case "$i_db" in
18515 define)
18516         : Check the return type needed for hash
18517         echo " "
18518         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18519         $cat >try.c <<EOCP
18520 #$d_const HASCONST
18521 #ifndef HASCONST
18522 #define const
18523 #endif
18524 #include <sys/types.h>
18525 #include <db.h>
18526
18527 #ifndef DB_VERSION_MAJOR
18528 u_int32_t hash_cb (ptr, size)
18529 const void *ptr;
18530 size_t size;
18531 {
18532 }
18533 HASHINFO info;
18534 int main()
18535 {
18536         info.hash = hash_cb;
18537 }
18538 #endif
18539 EOCP
18540         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18541                 if $contains warning try.out >>/dev/null 2>&1 ; then
18542                         db_hashtype='int'
18543                 else
18544                         db_hashtype='u_int32_t'
18545                 fi
18546         else
18547                 : XXX Maybe we should just give up here.
18548                 db_hashtype=u_int32_t
18549                 $cat try.out >&4
18550                 echo "Help:  I can't seem to compile the db test program." >&4
18551                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18552         fi
18553         $rm_try
18554         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18555         ;;
18556 *)      db_hashtype=u_int32_t
18557         ;;
18558 esac
18559 case "$i_db" in
18560 define)
18561         : Check the return type needed for prefix
18562         echo " "
18563         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18564         cat >try.c <<EOCP
18565 #$d_const HASCONST
18566 #ifndef HASCONST
18567 #define const
18568 #endif
18569 #include <sys/types.h>
18570 #include <db.h>
18571
18572 #ifndef DB_VERSION_MAJOR
18573 size_t prefix_cb (key1, key2)
18574 const DBT *key1;
18575 const DBT *key2;
18576 {
18577 }
18578 BTREEINFO info;
18579 int main()
18580 {
18581         info.prefix = prefix_cb;
18582 }
18583 #endif
18584 EOCP
18585         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18586                 if $contains warning try.out >>/dev/null 2>&1 ; then
18587                         db_prefixtype='int'
18588                 else
18589                         db_prefixtype='size_t'
18590                 fi
18591         else
18592                 db_prefixtype='size_t'
18593                 : XXX Maybe we should just give up here.
18594                 $cat try.out >&4
18595                 echo "Help:  I can't seem to compile the db test program." >&4
18596                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18597         fi
18598         $rm_try
18599         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18600         ;;
18601 *)      db_prefixtype='size_t'
18602         ;;
18603 esac
18604
18605 : How can we generate normalized random numbers ?
18606 echo " "
18607 echo "Looking for a random number function..." >&4
18608 case "$randfunc" in
18609 '')
18610         if set drand48 val -f; eval $csym; $val; then
18611                 dflt="drand48"
18612                 echo "Good, found drand48()." >&4
18613         elif set random val -f; eval $csym; $val; then
18614                 dflt="random"
18615                 echo "OK, found random()." >&4
18616         else
18617                 dflt="rand"
18618                 echo "Yick, looks like I have to use rand()." >&4
18619         fi
18620         echo " "
18621         ;;
18622 *)
18623         dflt="$randfunc"
18624         ;;
18625 esac
18626 cont=true
18627
18628 case "$ccflags" in
18629 *-Dmy_rand=*|*-Dmy_srand=*)
18630         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18631         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18632         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18633         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18634         ;;
18635 esac
18636
18637 while $test "$cont"; do
18638         rp="Use which function to generate random numbers?"
18639         . ./myread
18640         if $test "$ans" = "$dflt"; then
18641                 : null
18642         else
18643                 randbits=''
18644         fi
18645         randfunc="$ans"
18646         if set $ans val -f; eval $csym; $val; then
18647                 cont=''
18648         else
18649                 dflt=y
18650                 rp="I cannot find function $ans. Use that name anyway?"
18651                 . ./myread
18652                 dflt=rand
18653                 case "$ans" in
18654                         [yY]*) cont='';;
18655                 esac
18656         fi
18657         case "$cont" in
18658         '')
18659                 case "$randfunc" in
18660                 drand48)
18661                         drand01="drand48()"
18662                         seedfunc="srand48"
18663                         randbits=48
18664                         randseedtype=long
18665                         ;;
18666                 rand|random)
18667                         case "$randbits" in
18668                         '')
18669 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18670                                 $cat >try.c <<EOCP
18671 #$i_unistd I_UNISTD
18672 #$i_stdlib I_STDLIB
18673 #include <stdio.h>
18674 #ifdef I_UNISTD
18675 #  include <unistd.h>
18676 #endif
18677 #ifdef I_STDLIB
18678 #  include <stdlib.h>
18679 #endif
18680 int main()
18681 {
18682         register int i;
18683         register unsigned long tmp;
18684         register unsigned long max = 0L;
18685
18686         for (i = 1000; i; i--) {
18687                 tmp = (unsigned long) $randfunc();
18688                 if (tmp > max) max = tmp;
18689         }
18690         for (i = 0; max; i++)
18691                 max /= 2;
18692         printf("%d\n",i);
18693 }
18694 EOCP
18695                                 set try
18696                                 if eval $compile_ok; then
18697                                         dflt=`try`
18698                                 else
18699                                         dflt='?'
18700                                         echo "(I can't seem to compile the test program...)"
18701                                 fi
18702                                 ;;
18703                         *)
18704                                 dflt="$randbits"
18705                                 ;;
18706                         esac
18707                         rp="How many bits does your $randfunc() function produce?"
18708                         . ./myread
18709                         randbits="$ans"
18710                         $rm_try
18711                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18712                         seedfunc="s$randfunc"
18713                         randseedtype=unsigned
18714                         ;;
18715                 *)
18716                         dflt="31"
18717                         rp="How many bits does your $randfunc() function produce?"
18718                         . ./myread
18719                         randbits="$ans"
18720                         seedfunc="s$randfunc"
18721                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18722                         if set $seedfunc val -f; eval $csym; $val; then
18723                                 echo "(Using $seedfunc() to seed random generator)"
18724                         else
18725                                 echo "(Warning: no $seedfunc() to seed random generator)"
18726                                 seedfunc=rand
18727                         fi
18728                         randseedtype=unsigned
18729                         ;;
18730                 esac
18731                 ;;
18732         esac
18733 done
18734
18735 echo " "
18736 echo "Determining whether or not we are on an EBCDIC system..." >&4
18737 $cat >try.c <<'EOM'
18738 int main()
18739 {
18740   if ('M'==0xd4) return 0;
18741   return 1;
18742 }
18743 EOM
18744
18745 val=$undef
18746 set try
18747 if eval $compile_ok; then
18748         if $run ./try; then
18749                 echo "You seem to speak EBCDIC." >&4
18750                 val="$define"
18751         else
18752                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18753         fi
18754 else
18755         echo "I'm unable to compile the test program." >&4
18756         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18757 fi
18758 $rm_try
18759 set ebcdic
18760 eval $setvar
18761
18762 echo " "
18763 $cat >&4 <<EOM
18764 Checking how to flush all pending stdio output...
18765 EOM
18766 # I only know how to find the first 32 possibly open files on SunOS.
18767 # See also hints/sunos_4_1.sh and util.c  --AD
18768 case "$osname" in
18769 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18770 esac
18771 $cat >>try.c <<EOCP
18772 #include <stdio.h>
18773 #$i_stdlib I_STDLIB
18774 #ifdef I_STDLIB
18775 #include <stdlib.h>
18776 #endif
18777 #$i_unistd I_UNISTD
18778 #ifdef I_UNISTD
18779 # include <unistd.h>
18780 #endif
18781 #$d_sysconf HAS_SYSCONF
18782 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18783 #ifdef HAS_STDIO_STREAM_ARRAY
18784 # define STDIO_STREAM_ARRAY $stdio_stream_array
18785 #endif
18786 int main() {
18787   FILE* p;
18788   unlink("try.out");
18789   p = fopen("try.out", "w");
18790 #ifdef TRY_FPUTC
18791   fputc('x', p);
18792 #else
18793 # ifdef TRY_FPRINTF
18794   fprintf(p, "x");
18795 # endif
18796 #endif
18797 #ifdef TRY_FFLUSH_NULL
18798   fflush(NULL);
18799 #endif
18800 #ifdef TRY_FFLUSH_ALL
18801   {
18802     long open_max = -1;
18803 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18804     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18805 # else
18806 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18807     open_max = sysconf(_SC_OPEN_MAX);
18808 #  else
18809 #   ifdef FOPEN_MAX
18810     open_max = FOPEN_MAX;
18811 #   else
18812 #    ifdef OPEN_MAX
18813     open_max = OPEN_MAX;
18814 #    else
18815 #     ifdef _NFILE
18816     open_max = _NFILE;
18817 #     endif
18818 #    endif
18819 #   endif
18820 #  endif
18821 # endif
18822 # ifdef HAS_STDIO_STREAM_ARRAY
18823     if (open_max > 0) {
18824       long i;
18825       for (i = 0; i < open_max; i++)
18826             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18827                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18828                 STDIO_STREAM_ARRAY[i]._flag)
18829                 fflush(&STDIO_STREAM_ARRAY[i]);
18830     }
18831   }
18832 # endif
18833 #endif
18834   _exit(42);
18835 }
18836 EOCP
18837 : first we have to find out how _not_ to flush
18838 $to try.c
18839 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18840     output=''
18841     set try -DTRY_FPUTC
18842     if eval $compile; then
18843             $run ./try 2>/dev/null
18844             code="$?"
18845             $from try.out
18846             if $test ! -s try.out -a "X$code" = X42; then
18847                 output=-DTRY_FPUTC
18848             fi
18849     fi
18850     case "$output" in
18851     '')
18852             set try -DTRY_FPRINTF
18853             if eval $compile; then
18854                     $run ./try 2>/dev/null
18855                     code="$?"
18856                     $from try.out
18857                     if $test ! -s try.out -a "X$code" = X42; then
18858                         output=-DTRY_FPRINTF
18859                     fi
18860             fi
18861         ;;
18862     esac
18863 fi
18864 : check for fflush NULL behaviour
18865 case "$fflushNULL" in
18866 '')     set try -DTRY_FFLUSH_NULL $output
18867         if eval $compile; then
18868                 $run ./try 2>/dev/null
18869                 code="$?"
18870                 $from try.out
18871                 if $test -s try.out -a "X$code" = X42; then
18872                         fflushNULL="`$cat try.out`"
18873                 else
18874                         if $test "X$code" != X42; then
18875                                 $cat >&4 <<EOM
18876 (If this test failed, don't worry, we'll try another method shortly.)
18877 EOM
18878                         fi
18879                 fi
18880         fi
18881         $rm_try
18882         case "$fflushNULL" in
18883         x)      $cat >&4 <<EOM
18884 Your fflush(NULL) works okay for output streams.
18885 Let's see if it clobbers input pipes...
18886 EOM
18887 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18888 # bug that improperly flushes the input end of pipes.  So we avoid the
18889 # autoflush on fork/system/exec support for now. :-(
18890 $cat >tryp.c <<EOCP
18891 #include <stdio.h>
18892 int
18893 main(int argc, char **argv)
18894 {
18895     char buf[1024];
18896     int i;
18897     char *bp = buf;
18898     while (1) {
18899         while ((i = getc(stdin)) != -1
18900                && (*bp++ = i) != '\n'
18901                && bp < &buf[1024])
18902         /* DO NOTHING */ ;
18903         *bp = '\0';
18904         fprintf(stdout, "%s", buf);
18905         fflush(NULL);
18906         if (i == -1)
18907             return 0;
18908         bp = buf;
18909     }
18910 }
18911 EOCP
18912                 fflushNULL="$define"
18913                 set tryp
18914                 if eval $compile; then
18915                     $rm -f tryp.out
18916                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18917                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18918                        $cat >&4 <<EOM
18919 fflush(NULL) seems to behave okay with input streams.
18920 EOM
18921                         fflushNULL="$define"
18922                     else
18923                         $cat >&4 <<EOM
18924 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18925 EOM
18926                         fflushNULL="$undef"
18927                     fi
18928                 fi
18929                 $rm -f core tryp.c tryp.core core.tryp.*
18930                 ;;
18931         '')     $cat >&4 <<EOM
18932 Your fflush(NULL) isn't working (contrary to ANSI C).
18933 EOM
18934                 fflushNULL="$undef"
18935                 ;;
18936         *)      $cat >&4 <<EOM
18937 Cannot figure out whether your fflush(NULL) works or not.
18938 I'm assuming it doesn't (contrary to ANSI C).
18939 EOM
18940                 fflushNULL="$undef"
18941                 ;;
18942         esac
18943         ;;
18944 $define|true|[yY]*)
18945         fflushNULL="$define"
18946         ;;
18947 *)
18948         fflushNULL="$undef"
18949         ;;
18950 esac
18951 : check explicit looping only if NULL did not work, and if the pipe
18952 : bug does not show up on an explicit flush too
18953 case "$fflushNULL" in
18954 "$undef")
18955         $cat >tryp.c <<EOCP
18956 #include <stdio.h>
18957 int
18958 main(int argc, char **argv)
18959 {
18960     char buf[1024];
18961     int i;
18962     char *bp = buf;
18963     while (1) {
18964         while ((i = getc(stdin)) != -1
18965                && (*bp++ = i) != '\n'
18966                && bp < &buf[1024])
18967         /* DO NOTHING */ ;
18968         *bp = '\0';
18969         fprintf(stdout, "%s", buf);
18970         fflush(stdin);
18971         if (i == -1)
18972             return 0;
18973         bp = buf;
18974     }
18975 }
18976 EOCP
18977         set tryp
18978         if eval $compile; then
18979             $rm -f tryp.out
18980             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18981             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18982                $cat >&4 <<EOM
18983 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18984 EOM
18985                 : now check for fflushall behaviour
18986                 case "$fflushall" in
18987                 '')     set try -DTRY_FFLUSH_ALL $output
18988                         if eval $compile; then
18989                                 $cat >&4 <<EOM
18990 (Now testing the other method--but note that this also may fail.)
18991 EOM
18992                                 $run ./try 2>/dev/null
18993                                 code=$?
18994                                 $from try.out
18995                                 if $test -s try.out -a "X$code" = X42; then
18996                                         fflushall="`$cat try.out`"
18997                                 fi
18998                         fi
18999                         $rm_try
19000                         case "$fflushall" in
19001                         x)      $cat >&4 <<EOM
19002 Whew. Flushing explicitly all the stdio streams works.
19003 EOM
19004                                 fflushall="$define"
19005                                 ;;
19006                         '')     $cat >&4 <<EOM
19007 Sigh. Flushing explicitly all the stdio streams doesn't work.
19008 EOM
19009                                 fflushall="$undef"
19010                                 ;;
19011                         *)      $cat >&4 <<EOM
19012 Cannot figure out whether flushing stdio streams explicitly works or not.
19013 I'm assuming it doesn't.
19014 EOM
19015                                 fflushall="$undef"
19016                                 ;;
19017                         esac
19018                         ;;
19019                 "$define"|true|[yY]*)
19020                         fflushall="$define"
19021                         ;;
19022                 *)
19023                         fflushall="$undef"
19024                         ;;
19025                 esac
19026             else
19027                 $cat >&4 <<EOM
19028 All is futile.  Even fflush(stdin) clobbers input pipes!
19029 EOM
19030                 fflushall="$undef"
19031             fi
19032         else
19033             fflushall="$undef"
19034         fi
19035         $rm -f core tryp.c tryp.core core.tryp.*
19036         ;;
19037 *)      fflushall="$undef"
19038         ;;
19039 esac
19040
19041 case "$fflushNULL$fflushall" in
19042 undefundef)
19043         $cat <<EOM
19044 OK, I give up.  I cannot figure out how to flush pending stdio output.
19045 We won't be flushing handles at all before fork/exec/popen.
19046 EOM
19047         ;;
19048 esac
19049 $rm_try
19050
19051 : Store the full pathname to the ar program for use in the C program
19052 : Respect a hint or command line value for full_ar.
19053 case "$full_ar" in
19054 '') full_ar=$ar ;;
19055 esac
19056
19057 : Store the full pathname to the sed program for use in the C program
19058 full_sed=$sed
19059
19060 : see what type gids are declared as in the kernel
19061 echo " "
19062 echo "Looking for the type for group ids returned by getgid()."
19063 set gid_t gidtype xxx stdio.h sys/types.h
19064 eval $typedef
19065 case "$gidtype" in
19066 xxx)
19067         xxx=`./findhdr sys/user.h`
19068         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19069         case $1 in
19070         unsigned) dflt="$1 $2" ;;
19071         *) dflt="$1" ;;
19072         esac
19073         ;;
19074 *) dflt="$gidtype";;
19075 esac
19076 case "$gidtype" in
19077 gid_t) echo "gid_t found." ;;
19078 *)      rp="What is the type for group ids returned by getgid()?"
19079         . ./myread
19080         gidtype="$ans"
19081         ;;
19082 esac
19083
19084 echo " "
19085 case "$gidtype" in
19086 *_t) zzz="$gidtype"     ;;
19087 *)   zzz="gid"          ;;
19088 esac
19089 echo "Checking the size of $zzz..." >&4 
19090 cat > try.c <<EOCP
19091 #include <sys/types.h>
19092 #include <stdio.h>
19093 #$i_stdlib I_STDLIB
19094 #ifdef I_STDLIB
19095 #include <stdlib.h>
19096 #endif
19097 int main() {
19098     printf("%d\n", (int)sizeof($gidtype));
19099     exit(0);
19100 }
19101 EOCP
19102 set try
19103 if eval $compile_ok; then
19104         yyy=`$run ./try`
19105         case "$yyy" in
19106         '')     gidsize=4
19107                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19108                 ;;
19109         *)      gidsize=$yyy
19110                 echo "Your $zzz is $gidsize bytes long."
19111                 ;;
19112         esac
19113 else
19114         gidsize=4
19115         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19116 fi
19117
19118
19119 echo " "
19120 case "$gidtype" in
19121 *_t) zzz="$gidtype"     ;;
19122 *)   zzz="gid"          ;;
19123 esac
19124 echo "Checking the sign of $zzz..." >&4 
19125 cat > try.c <<EOCP
19126 #include <sys/types.h>
19127 #include <stdio.h>
19128 int main() {
19129         $gidtype foo = -1;
19130         if (foo < 0)
19131                 printf("-1\n");
19132         else
19133                 printf("1\n");
19134 }
19135 EOCP
19136 set try
19137 if eval $compile; then
19138         yyy=`$run ./try`
19139         case "$yyy" in
19140         '')     gidsign=1
19141                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19142                 ;;
19143         *)      gidsign=$yyy
19144                 case "$gidsign" in
19145                  1) echo "Your $zzz is unsigned." ;;
19146                 -1) echo "Your $zzz is signed."   ;;
19147                 esac
19148                 ;;
19149         esac
19150 else
19151         gidsign=1
19152         echo "(I can't compile the test program--guessing unsigned.)" >&4
19153 fi
19154
19155
19156 echo " "
19157
19158 if $test X"$quadtype" != X; then
19159
19160 echo "Checking how to print 64-bit integers..." >&4
19161
19162 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19163         $cat >try.c <<'EOCP'
19164 #include <sys/types.h>
19165 #include <stdio.h>
19166 int main() {
19167   int q = 12345678901;
19168   printf("%ld\n", q);
19169 }
19170 EOCP
19171         set try
19172         if eval $compile; then
19173                 yyy=`$run ./try`
19174                 case "$yyy" in
19175                 12345678901)
19176                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19177                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19178                         echo "We will use %d."
19179                         ;;
19180                 esac
19181         fi
19182 fi
19183
19184 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19185         $cat >try.c <<'EOCP'
19186 #include <sys/types.h>
19187 #include <stdio.h>
19188 int main() {
19189   long q = 12345678901;
19190   printf("%ld\n", q);
19191 }
19192 EOCP
19193         set try
19194         if eval $compile; then
19195                 yyy=`$run ./try`
19196                 case "$yyy" in
19197                 12345678901)
19198                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19199                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19200                         echo "We will use %ld."
19201                         ;;
19202                 esac
19203         fi
19204 fi
19205
19206 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19207         $cat >try.c <<'EOCP'
19208 #include <sys/types.h>
19209 #include <inttypes.h>
19210 #include <stdio.h>
19211 int main() {
19212   int64_t q = 12345678901;
19213   printf("%" PRId64 "\n", q);
19214 }
19215 EOCP
19216         set try
19217         if eval $compile; then
19218                 yyy=`$run ./try`
19219                 case "$yyy" in
19220                 12345678901)
19221                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19222                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19223                         echo "We will use the C9X style."
19224                         ;;
19225                 esac
19226         fi
19227 fi
19228
19229 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19230         $cat >try.c <<EOCP
19231 #include <sys/types.h>
19232 #include <stdio.h>
19233 int main() {
19234   $quadtype q = 12345678901;
19235   printf("%Ld\n", q);
19236 }
19237 EOCP
19238         set try
19239         if eval $compile; then
19240                 yyy=`$run ./try`
19241                 case "$yyy" in
19242                 12345678901)
19243                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19244                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19245                         echo "We will use %Ld."
19246                         ;;
19247                 esac
19248         fi
19249 fi
19250
19251 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19252         $cat >try.c <<'EOCP'
19253 #include <sys/types.h>
19254 #include <stdio.h>
19255 int main() {
19256   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19257   printf("%lld\n", q);
19258 }
19259 EOCP
19260         set try
19261         if eval $compile; then
19262                 yyy=`$run ./try`
19263                 case "$yyy" in
19264                 12345678901)
19265                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19266                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19267                         echo "We will use the %lld style."
19268                         ;;
19269                 esac
19270         fi
19271 fi
19272
19273 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19274         $cat >try.c <<EOCP
19275 #include <sys/types.h>
19276 #include <stdio.h>
19277 int main() {
19278   $quadtype q = 12345678901;
19279   printf("%qd\n", q);
19280 }
19281 EOCP
19282         set try
19283         if eval $compile; then
19284                 yyy=`$run ./try`
19285                 case "$yyy" in
19286                 12345678901)
19287                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19288                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19289                         echo "We will use %qd."
19290                         ;;
19291                 esac
19292         fi
19293 fi
19294
19295 if $test X"$sPRId64" = X; then
19296         echo "Cannot figure out how to print 64-bit integers." >&4
19297 fi
19298 $rm_try
19299
19300 fi
19301
19302 case "$sPRId64" in
19303 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19304         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19305         ;;
19306 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19307         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19308         ;;
19309 esac
19310
19311
19312 echo " "
19313 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19314
19315 if $test X"$ivsize" = X8; then
19316         ivdformat="$sPRId64"
19317         uvuformat="$sPRIu64"
19318         uvoformat="$sPRIo64"
19319         uvxformat="$sPRIx64"
19320         uvXUformat="$sPRIXU64"
19321 else
19322         if $test X"$ivsize" = X"$longsize"; then
19323                 ivdformat='"ld"'
19324                 uvuformat='"lu"'
19325                 uvoformat='"lo"'
19326                 uvxformat='"lx"'
19327                 uvXUformat='"lX"'
19328         else
19329                 if $test X"$ivsize" = X"$intsize"; then
19330                         ivdformat='"d"'
19331                         uvuformat='"u"'
19332                         uvoformat='"o"'
19333                         uvxformat='"x"'
19334                         uvXUformat='"X"'
19335                 else
19336                         : far out
19337                         if $test X"$ivsize" = X"$shortsize"; then
19338                                 ivdformat='"hd"'
19339                                 uvuformat='"hu"'
19340                                 uvoformat='"ho"'
19341                                 uvxformat='"hx"'
19342                                 uvXUformat='"hX"'
19343                         fi
19344                 fi
19345         fi
19346 fi
19347
19348 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19349         nveformat="$sPRIeldbl"
19350         nvfformat="$sPRIfldbl"
19351         nvgformat="$sPRIgldbl"
19352         nvEUformat="$sPRIEUldbl"
19353         nvFUformat="$sPRIFUldbl"
19354         nvGUformat="$sPRIGUldbl"
19355 else
19356         nveformat='"e"'
19357         nvfformat='"f"'
19358         nvgformat='"g"'
19359         nvEUformat='"E"'
19360         nvFUformat='"F"'
19361         nvGUformat='"G"'
19362 fi
19363
19364 case "$ivdformat" in
19365 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19366     exit 1
19367     ;;
19368 esac
19369
19370
19371 echo " "
19372 $echo "Checking the format string to be used for gids..." >&4
19373
19374 case "$gidsign" in
19375 -1)     if $test X"$gidsize" = X"$ivsize"; then
19376                 gidformat="$ivdformat"
19377         else
19378                 if $test X"$gidsize" = X"$longsize"; then
19379                         gidformat='"ld"'
19380                 else
19381                         if $test X"$gidsize" = X"$intsize"; then
19382                                 gidformat='"d"'
19383                         else
19384                                 if $test X"$gidsize" = X"$shortsize"; then
19385                                         gidformat='"hd"'
19386                                 fi
19387                         fi
19388                 fi
19389         fi
19390         ;;
19391 *)      if $test X"$gidsize" = X"$uvsize"; then
19392                 gidformat="$uvuformat"
19393         else
19394                 if $test X"$gidsize" = X"$longsize"; then
19395                         gidformat='"lu"'
19396                 else
19397                         if $test X"$gidsize" = X"$intsize"; then
19398                                 gidformat='"u"'
19399                         else
19400                                 if $test X"$gidsize" = X"$shortsize"; then
19401                                         gidformat='"hu"'
19402                                 fi
19403                         fi
19404                 fi
19405         fi
19406         ;;
19407 esac
19408
19409 : see if getgroups exists
19410 set getgroups d_getgrps
19411 eval $inlibc
19412
19413 : see if setgroups exists
19414 set setgroups d_setgrps
19415 eval $inlibc
19416
19417
19418 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19419 echo " "
19420 case "$d_getgrps$d_setgrps" in
19421 *define*)
19422         case "$groupstype" in
19423         '') dflt="$gidtype" ;;
19424         *)  dflt="$groupstype" ;;
19425         esac
19426         $cat <<EOM
19427 What type of pointer is the second argument to getgroups() and setgroups()?
19428 Usually this is the same as group ids, $gidtype, but not always.
19429
19430 EOM
19431         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19432         . ./myread
19433         groupstype="$ans"
19434         ;;
19435 *)  groupstype="$gidtype";;
19436 esac
19437
19438
19439 if $test $patchlevel -lt 9; then
19440 : MAD is not available in 5.8.x or earlier.
19441     ans=n;
19442 else
19443     case "$mad" in
19444     $define|true|[yY]*) dflt='y' ;;
19445     *)                  dflt='n' ;;
19446     esac
19447     cat <<EOM
19448
19449 Would you like to build with Misc Attribute Decoration? This is development
19450 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19451 overhead on the interpreter.
19452
19453 If this doesn't make any sense to you, just accept the default '$dflt'.
19454 EOM
19455     rp='Build Perl with MAD?'
19456     . ./myread
19457 fi
19458 case "$ans" in
19459 y|Y)    val="$define"
19460         madlyh='madly.h madly.act madly.tab'
19461         madlysrc='madly.c'
19462         madlyobj="madly$_o" ;;
19463 *)      val="$undef"
19464         madlyh=''
19465         madlysrc=''
19466         madlyobj='' ;;
19467 esac
19468 set mad
19469 eval $setvar
19470
19471 echo " "
19472 echo "Checking if your $make program sets \$(MAKE)..." >&4
19473 case "$make_set_make" in
19474 '')
19475         $sed 's/^X //' > testmake.mak << 'EOF'
19476 Xall:
19477 X       @echo 'maketemp="$(MAKE)"'
19478 EOF
19479         case "`$make -f testmake.mak 2>/dev/null`" in
19480         *maketemp=*) make_set_make='#' ;;
19481         *)      make_set_make="MAKE=$make" ;;
19482         esac
19483         $rm -f testmake.mak
19484         ;;
19485 esac
19486 case "$make_set_make" in
19487 '#') echo "Yup, it does.";;
19488 *) echo "Nope, it doesn't.";;
19489 esac
19490
19491 : see what type is used for mode_t
19492 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19493 set mode_t modetype int stdio.h sys/types.h
19494 eval $typedef_ask
19495
19496 : see if we need va_copy
19497 echo " "
19498 case "$i_stdarg" in
19499 "$define")
19500         $cat >try.c <<EOCP
19501 #include <stdarg.h>
19502 #include <stdio.h>
19503 #$i_stdlib I_STDLIB
19504 #ifdef I_STDLIB
19505 #include <stdlib.h>
19506 #endif
19507 #include <signal.h>
19508
19509 int
19510 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19511 {
19512   return vfprintf(f, fmt, *valp);
19513 }
19514
19515 int
19516 myvfprintf(FILE *f, const  char *fmt, va_list val)
19517 {
19518   return ivfprintf(f, fmt, &val);
19519 }
19520
19521 int
19522 myprintf(char *fmt, ...)
19523 {
19524   va_list val;
19525   va_start(val, fmt);
19526   return myvfprintf(stdout, fmt, val);
19527 }
19528
19529 int
19530 main(int ac, char **av)
19531 {
19532   signal(SIGSEGV, exit);
19533
19534   myprintf("%s%cs all right, then\n", "that", '\'');
19535   exit(0);
19536 }
19537 EOCP
19538         set try
19539         if eval $compile && $run ./try 2>&1 >/dev/null; then
19540                 case "`$run ./try`" in
19541                 "that's all right, then")
19542                         okay=yes
19543                         ;;
19544                 esac
19545         fi
19546         case "$okay" in
19547         yes)    echo "It seems that you don't need va_copy()." >&4
19548                 need_va_copy="$undef"
19549                 ;;
19550         *)      echo "It seems that va_copy() or similar will be needed." >&4
19551                 need_va_copy="$define"
19552                 ;;
19553         esac
19554         $rm_try
19555         ;;
19556 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19557         ;;
19558 esac
19559
19560 : see what type is used for size_t
19561 rp="What is the type used for the length parameter for string functions?"
19562 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19563 eval $typedef_ask
19564
19565 : check for type of arguments to gethostbyaddr. 
19566 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19567         case "$d_gethbyaddr" in
19568         $define)
19569                 $cat <<EOM
19570
19571 Checking to see what type of arguments are accepted by gethostbyaddr().
19572 EOM
19573                 hdrs="$define sys/types.h
19574                         $d_socket sys/socket.h 
19575                         $i_niin netinet/in.h 
19576                         $i_netdb netdb.h
19577                         $i_unistd unistd.h"
19578                 : The first arg can 'char *' or 'void *'
19579                 : The second arg is some of integral type
19580                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19581                         for yyy in size_t long int; do
19582                                 case "$netdb_host_type" in
19583                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19584                                         if ./protochk "$try" $hdrs; then
19585                                                 echo "Your system accepts $xxx for the first arg."
19586                                                 echo "...and $yyy for the second arg."
19587                                                 netdb_host_type="$xxx"
19588                                                 netdb_hlen_type="$yyy"
19589                                         fi
19590                                         ;;
19591                                 esac
19592                         done
19593                 done
19594                 : In case none of those worked, prompt the user.
19595                 case "$netdb_host_type" in
19596                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19597                         dflt='char *'
19598                         . ./myread
19599                         netdb_host_type=$ans
19600                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19601                         dflt="$sizetype"
19602                         . ./myread
19603                         netdb_hlen_type=$ans
19604                         ;;
19605                 esac
19606                 ;;
19607         *)      : no gethostbyaddr, so pick harmless defaults
19608                 netdb_host_type='char *'
19609                 netdb_hlen_type="$sizetype"
19610                 ;;
19611         esac
19612         # Remove the "const" if needed. -- but then we'll have a 
19613         # prototype clash!
19614         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19615 fi
19616
19617 : check for type of argument to gethostbyname. 
19618 if test "X$netdb_name_type" = X ; then
19619         case "$d_gethbyname" in
19620         $define)
19621                 $cat <<EOM
19622
19623 Checking to see what type of argument is accepted by gethostbyname().
19624 EOM
19625                 hdrs="$define sys/types.h
19626                         $d_socket sys/socket.h 
19627                         $i_niin netinet/in.h 
19628                         $i_netdb netdb.h
19629                         $i_unistd unistd.h"
19630                 for xxx in "const char *" "char *"; do
19631                         case "$netdb_name_type" in
19632                         '')     try="extern struct hostent *gethostbyname($xxx);"
19633                                 if ./protochk "$try" $hdrs; then
19634                                         echo "Your system accepts $xxx."
19635                                         netdb_name_type="$xxx"
19636                                 fi
19637                                 ;;
19638                         esac
19639                 done
19640                 : In case none of those worked, prompt the user.
19641                 case "$netdb_name_type" in
19642                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19643                         dflt='char *'
19644                         . ./myread
19645                         netdb_name_type=$ans
19646                         ;;
19647                 esac
19648                 ;;
19649         *)      : no gethostbyname, so pick harmless default
19650                 netdb_name_type='char *'
19651                 ;;
19652         esac
19653 fi
19654
19655 : check for type of 1st argument to getnetbyaddr. 
19656 if test "X$netdb_net_type" = X ; then
19657         case "$d_getnbyaddr" in
19658         $define)
19659                 $cat <<EOM
19660
19661 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19662 EOM
19663                 hdrs="$define sys/types.h
19664                         $d_socket sys/socket.h 
19665                         $i_niin netinet/in.h 
19666                         $i_netdb netdb.h
19667                         $i_unistd unistd.h"
19668                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19669                         case "$netdb_net_type" in
19670                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19671                                 if ./protochk "$try" $hdrs; then
19672                                         echo "Your system accepts $xxx."
19673                                         netdb_net_type="$xxx"
19674                                 fi
19675                                 ;;
19676                         esac
19677                 done
19678                 : In case none of those worked, prompt the user.
19679                 case "$netdb_net_type" in
19680                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19681                         dflt='long'
19682                         . ./myread
19683                         netdb_net_type=$ans
19684                         ;;
19685                 esac
19686                 ;;
19687         *)      : no getnetbyaddr, so pick harmless default
19688                 netdb_net_type='long'
19689                 ;;
19690         esac
19691 fi
19692 : locate the preferred pager for this system
19693 fn=f/
19694 case "$pager" in
19695 '')
19696         dflt=''
19697         case "$pg" in
19698         /*) dflt=$pg;;
19699         [a-zA-Z]:/*) dflt=$pg;;
19700         esac
19701         case "$more" in
19702         /*) dflt=$more;;
19703         [a-zA-Z]:/*) dflt=$more;;
19704         esac
19705         case "$less" in
19706         /*) dflt=$less;;
19707         [a-zA-Z]:/*) dflt=$less;;
19708         esac
19709         case "$dflt" in
19710         '') dflt=/usr/ucb/more;;
19711         esac
19712         ;;
19713 *)      dflt="$pager"
19714         : Instruct ./getfile to trust the hinted or previous pager value,
19715         : even if it does not begin with a slash.  For example, on os2,
19716         : pager might be cmd /c more.  See comments in UU/getfile.
19717         fn="f/($pager)"
19718         ;;
19719 esac
19720 echo " "
19721 rp='What pager is used on your system?'
19722 . ./getfile
19723 pager="$ans"
19724
19725 : see what type pids are declared as in the kernel
19726 rp="What is the type of process ids on this system?"
19727 set pid_t pidtype int stdio.h sys/types.h
19728 eval $typedef_ask
19729
19730 : see if ar generates random libraries by itself
19731 echo " "
19732 echo "Checking how to generate random libraries on your machine..." >&4
19733 echo 'int bar1() { return bar2(); }' > bar1.c
19734 echo 'int bar2() { return 2; }' > bar2.c
19735 $cat > foo.c <<EOP
19736 #$i_stdlib I_STDLIB
19737 #ifdef I_STDLIB
19738 #include <stdlib.h>
19739 #endif
19740 int main() { printf("%d\n", bar1()); exit(0); }
19741 EOP
19742 $cc $ccflags -c bar1.c >/dev/null 2>&1
19743 $cc $ccflags -c bar2.c >/dev/null 2>&1
19744 $cc $ccflags -c foo.c >/dev/null 2>&1
19745 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19746 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19747         $run ./foobar >/dev/null 2>&1; then
19748         echo "$ar appears to generate random libraries itself."
19749         orderlib=false
19750         if [ "X$ranlib" = "X" ]; then
19751             ranlib=":"
19752         fi
19753 elif $ar s bar$_a >/dev/null 2>&1 &&
19754         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19755         $run ./foobar >/dev/null 2>&1; then
19756                 echo "a table of contents needs to be added with '$ar s'."
19757                 orderlib=false
19758                 ranlib="$ar s"
19759 elif $ar ts bar$_a >/dev/null 2>&1 &&
19760         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19761         $run ./foobar >/dev/null 2>&1; then
19762                 echo "a table of contents needs to be added with '$ar ts'."
19763                 orderlib=false
19764                 ranlib="$ar ts"
19765 else
19766         case "$ranlib" in
19767         :) ranlib='';;
19768         '')
19769                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19770                 $test -f $ranlib || ranlib=''
19771                 ;;
19772         esac
19773         if $test -n "$ranlib"; then
19774                 echo "your system has '$ranlib'; we'll use that."
19775                 orderlib=false
19776         else
19777                 echo "your system doesn't seem to support random libraries"
19778                 echo "so we'll use lorder and tsort to order the libraries."
19779                 orderlib=true
19780                 ranlib=":"
19781         fi
19782 fi
19783 $rm -f foo* bar*
19784
19785 : check for type of arguments to select. 
19786 case "$selecttype" in
19787 '') case "$d_select" in
19788         $define)
19789                 echo " "
19790                 $cat <<EOM
19791 Checking to see what type of arguments are accepted by select().
19792 EOM
19793                 hdrs="$define sys/types.h
19794                         $i_systime sys/time.h 
19795                         $i_sysselct sys/select.h
19796                         $d_socket sys/socket.h"
19797                 : The first arg can be int, unsigned, or size_t
19798                 : The last arg may or may not be 'const'
19799                 val=''
19800                 : void pointer has been seen but using that
19801                 : breaks the selectminbits test
19802                 for xxx in 'fd_set *' 'int *'; do
19803                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19804                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19805                                         case "$val" in
19806                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19807                                                 if ./protochk "$try" $hdrs; then
19808                                                         echo "Your system accepts $xxx."
19809                                                         val="$xxx"
19810                                                 fi
19811                                                 ;;
19812                                         esac
19813                                 done
19814                         done
19815                 done
19816                 case "$val" in
19817                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19818                         case "$d_fd_set" in
19819                                 $define) dflt="fd_set *" ;;
19820                                 *)              dflt="int *" ;;
19821                         esac
19822                         . ./myread
19823                         val=$ans
19824                         ;;
19825                 esac
19826                 selecttype="$val"
19827                 ;;
19828         *)      : no select, so pick a harmless default
19829                 selecttype='int *'
19830                 ;;
19831         esac
19832         ;;
19833 esac
19834
19835 : check for the select 'width'
19836 case "$selectminbits" in
19837 '') safebits=`expr $ptrsize \* 8`
19838     case "$d_select" in
19839         $define)
19840                 $cat <<EOM
19841
19842 Checking to see on how many bits at a time your select() operates...
19843 EOM
19844                 $cat >try.c <<EOCP
19845 #include <sys/types.h>
19846 #$i_time I_TIME
19847 #$i_systime I_SYS_TIME
19848 #$i_systimek I_SYS_TIME_KERNEL
19849 #ifdef I_TIME
19850 #   include <time.h>
19851 #endif
19852 #ifdef I_SYS_TIME
19853 #   ifdef I_SYS_TIME_KERNEL
19854 #       define KERNEL
19855 #   endif
19856 #   include <sys/time.h>
19857 #   ifdef I_SYS_TIME_KERNEL
19858 #       undef KERNEL
19859 #   endif
19860 #endif
19861 #$i_sysselct I_SYS_SELECT
19862 #ifdef I_SYS_SELECT
19863 #include <sys/select.h>
19864 #endif
19865 #$d_socket HAS_SOCKET
19866 #ifdef HAS_SOCKET
19867 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19868 #endif
19869 #include <stdio.h>
19870 #$i_stdlib I_STDLIB
19871 #ifdef I_STDLIB
19872 #include <stdlib.h>
19873 #endif
19874 $selecttype b;
19875 #define S sizeof(*(b))
19876 #define MINBITS 64
19877 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19878 #define NBITS  (NBYTES * 8)
19879 int main() {
19880     char *s = (char *)malloc(NBYTES);
19881     struct timeval t;
19882     int i;
19883     FILE* fp;
19884     int fd;
19885
19886     if (!s)
19887         exit(1);
19888     fclose(stdin);
19889     fp = fopen("try.c", "r");
19890     if (fp == 0)
19891       exit(2);
19892     fd = fileno(fp);
19893     if (fd < 0)
19894       exit(3);
19895     b = ($selecttype)s;
19896     for (i = 0; i < NBITS; i++)
19897         FD_SET(i, b);
19898     t.tv_sec  = 0;
19899     t.tv_usec = 0;
19900     select(fd + 1, b, 0, 0, &t);
19901     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19902     free(s);
19903     printf("%d\n", i + 1);
19904     return 0;
19905 }
19906 EOCP
19907                 set try
19908                 if eval $compile_ok; then
19909                         selectminbits=`$run ./try`
19910                         case "$selectminbits" in
19911                         '')     cat >&4 <<EOM
19912 Cannot figure out on how many bits at a time your select() operates.
19913 I'll play safe and guess it is $safebits bits.
19914 EOM
19915                                 selectminbits=$safebits
19916                                 bits="$safebits bits"
19917                                 ;;
19918                         1)      bits="1 bit" ;;
19919                         *)      bits="$selectminbits bits" ;;
19920                         esac
19921                         echo "Your select() operates on $bits at a time." >&4
19922                 else
19923                         rp='What is the minimum number of bits your select() operates on?'
19924                         case "$byteorder" in
19925                         12345678)       dflt=64 ;;
19926                         1234)           dflt=32 ;;
19927                         *)              dflt=1  ;;
19928                         esac
19929                         . ./myread
19930                         val=$ans
19931                         selectminbits="$val"
19932                 fi
19933                 $rm_try
19934                 ;;
19935         *)      : no select, so pick a harmless default
19936                 selectminbits=$safebits
19937                 ;;
19938         esac
19939         ;;
19940 esac
19941
19942 : Trace out the files included by signal.h, then look for SIGxxx names.
19943 : Remove SIGARRAYSIZE used by HPUX.
19944 : Remove SIGSTKSIZE used by Linux.
19945 : Remove SIGSTKSZ used by Posix.
19946 : Remove SIGTYP void lines used by OS2.
19947 : Some cpps, like os390, dont give the file name anywhere
19948 if [ "X$fieldn" = X ]; then
19949         : Just make some guesses.  We check them later.
19950         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19951 else
19952         xxx=`echo '#include <signal.h>' |
19953         $cppstdin $cppminus $cppflags 2>/dev/null |
19954         $grep '^[       ]*#.*include' | 
19955         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19956 fi
19957 : Check this list of files to be sure we have parsed the cpp output ok.
19958 : This will also avoid potentially non-existent files, such 
19959 : as ../foo/bar.h
19960 xxxfiles=''
19961 for xx in $xxx /dev/null ; do
19962         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19963 done
19964 : If we have found no files, at least try signal.h
19965 case "$xxxfiles" in
19966 '')     xxxfiles=`./findhdr signal.h` ;;
19967 esac
19968 xxx=`awk '
19969 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19970         print substr($2, 4, 20)
19971 }
19972 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19973         print substr($3, 4, 20)
19974 }' $xxxfiles`
19975 : Append some common names just in case the awk scan failed.
19976 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19977 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19978 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19979 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19980 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19981
19982 : generate a few handy files for later
19983 $cat > signal.c <<EOCP
19984 #include <sys/types.h>
19985 #include <signal.h>
19986 #$i_stdlib I_STDLIB
19987 #ifdef I_STDLIB
19988 #include <stdlib.h>
19989 #endif
19990 #include <stdio.h>
19991 int main() {
19992
19993 /* Strange style to avoid deeply-nested #if/#else/#endif */
19994 #ifndef NSIG
19995 #  ifdef _NSIG
19996 #    define NSIG (_NSIG)
19997 #  endif
19998 #endif
19999
20000 #ifndef NSIG
20001 #  ifdef SIGMAX
20002 #    define NSIG (SIGMAX+1)
20003 #  endif
20004 #endif
20005
20006 #ifndef NSIG
20007 #  ifdef SIG_MAX
20008 #    define NSIG (SIG_MAX+1)
20009 #  endif
20010 #endif
20011
20012 #ifndef NSIG
20013 #  ifdef _SIG_MAX
20014 #    define NSIG (_SIG_MAX+1)
20015 #  endif
20016 #endif
20017
20018 #ifndef NSIG
20019 #  ifdef MAXSIG
20020 #    define NSIG (MAXSIG+1)
20021 #  endif
20022 #endif
20023
20024 #ifndef NSIG
20025 #  ifdef MAX_SIG
20026 #    define NSIG (MAX_SIG+1)
20027 #  endif
20028 #endif
20029
20030 #ifndef NSIG
20031 #  ifdef SIGARRAYSIZE
20032 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20033 #  endif
20034 #endif
20035
20036 #ifndef NSIG
20037 #  ifdef _sys_nsig
20038 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20039 #  endif
20040 #endif
20041
20042 /* Default to some arbitrary number that's big enough to get most
20043    of the common signals.
20044 */
20045 #ifndef NSIG
20046 #    define NSIG 50
20047 #endif
20048
20049 printf("NSIG %d\n", NSIG);
20050
20051 #ifndef JUST_NSIG
20052
20053 EOCP
20054
20055 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20056 {
20057         printf "#ifdef SIG"; printf $1; printf "\n"
20058         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20059         printf $1; printf ");\n"
20060         printf "#endif\n"
20061 }
20062 END {
20063         printf "#endif /* JUST_NSIG */\n";
20064         printf "exit(0);\n}\n";
20065 }
20066 ' >>signal.c
20067 $cat >signal.awk <<'EOP'
20068 BEGIN { ndups = 0 }
20069 $1 ~ /^NSIG$/ { nsig = $2 }
20070 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20071     if ($2 > maxsig) { maxsig = $2 }
20072     if (sig_name[$2]) {
20073         dup_name[ndups] = $1
20074         dup_num[ndups] = $2
20075         ndups++ 
20076     }
20077     else {
20078         sig_name[$2] = $1
20079         sig_num[$2] = $2
20080     }
20081 }
20082 END { 
20083     if (nsig == 0) {
20084         nsig = maxsig + 1
20085     }
20086     printf("NSIG %d\n", nsig);
20087     for (n = 1; n < nsig; n++) {
20088         if (sig_name[n]) {
20089             printf("%s %d\n", sig_name[n], sig_num[n])
20090         }
20091         else {
20092             printf("NUM%d %d\n", n, n) 
20093         }
20094     }
20095     for (n = 0; n < ndups; n++) {
20096         printf("%s %d\n", dup_name[n], dup_num[n])
20097     }
20098 }
20099 EOP
20100 $cat >signal_cmd <<EOS
20101 $startsh
20102 if $test -s signal.lst; then
20103     echo "Using your existing signal.lst file"
20104         exit 0
20105 fi
20106 xxx="$xxx"
20107 EOS
20108 $cat >>signal_cmd <<'EOS'
20109
20110 set signal
20111 if eval $compile_ok; then
20112         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
20113 else
20114         echo "(I can't seem be able to compile the whole test program)" >&4
20115         echo "(I'll try it in little pieces.)" >&4
20116         set signal -DJUST_NSIG
20117         if eval $compile_ok; then
20118                 $run ./signal$_exe > signal.nsg
20119                 $cat signal.nsg
20120         else
20121                 echo "I can't seem to figure out how many signals you have." >&4
20122                 echo "Guessing 50." >&4
20123                 echo 'NSIG 50' > signal.nsg
20124         fi
20125         : Now look at all the signal names, one at a time.
20126         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20127                 $cat > signal.c <<EOCP
20128 #include <sys/types.h>
20129 #include <signal.h>
20130 #include <stdio.h>
20131 int main() {
20132 printf("$xx %d\n", SIG${xx});
20133 return 0;
20134 }
20135 EOCP
20136                 set signal
20137                 if eval $compile; then
20138                         echo "SIG${xx} found."
20139                         $run ./signal$_exe  >> signal.ls1
20140                 else
20141                         echo "SIG${xx} NOT found."
20142                 fi
20143         done
20144         if $test -s signal.ls1; then
20145                 $cat signal.nsg signal.ls1 |
20146                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20147         fi
20148
20149 fi
20150 if $test -s signal.lst; then
20151         :
20152 else
20153         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20154         echo 'kill -l' >signal
20155         set X `csh -f <signal`
20156         $rm -f signal
20157         shift
20158         case $# in
20159         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20160         esac
20161         echo $@ | $tr ' ' $trnl | \
20162             $awk '{ printf "%s %d\n", $1, ++s; }
20163                   END { printf "NSIG %d\n", ++s }' >signal.lst
20164 fi
20165 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20166 EOS
20167 chmod a+x signal_cmd
20168 $eunicefix signal_cmd
20169
20170 : generate list of signal names
20171 echo " "
20172 case "$sig_name_init" in
20173 '') doinit=yes ;;
20174 *)  case "$sig_num_init" in
20175     ''|*,*) doinit=yes ;;
20176     esac ;;
20177 esac
20178 case "$doinit" in
20179 yes)
20180         echo "Generating a list of signal names and numbers..." >&4
20181         . ./signal_cmd
20182         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20183         sig_name=`$awk 'BEGIN { printf "ZERO " }
20184                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20185         sig_num=`$awk  'BEGIN { printf "0 " }
20186                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20187         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20188                              !/^NSIG/   { printf "\"%s\", ", $1 }
20189                              END        { printf "0\n" }' signal.lst`
20190         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20191                              !/^NSIG/   { printf "%d, ", $2}
20192                              END        { printf "0\n"}' signal.lst`
20193         ;;
20194 esac
20195 echo "The following $sig_count signals are available:"
20196 echo " "
20197 echo $sig_name | $awk \
20198 'BEGIN { linelen = 0 }
20199 {
20200         for (i = 1; i <= NF; i++) {
20201                 name = "SIG" $i " "
20202                 linelen = linelen + length(name)
20203                 if (linelen > 70) {
20204                         printf "\n"
20205                         linelen = length(name)
20206                 }
20207                 printf "%s", name
20208         }
20209         printf "\n"
20210 }'
20211 sig_size=`echo $sig_name | awk '{print NF}'`
20212 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
20213
20214 echo " "
20215 case "$sizetype" in
20216 *_t) zzz="$sizetype"    ;;
20217 *)   zzz="filesize"     ;;
20218 esac
20219 echo "Checking the size of $zzz..." >&4 
20220 cat > try.c <<EOCP
20221 #include <sys/types.h>
20222 #include <stdio.h>
20223 #$i_stdlib I_STDLIB
20224 #ifdef I_STDLIB
20225 #include <stdlib.h>
20226 #endif
20227 int main() {
20228     printf("%d\n", (int)sizeof($sizetype));
20229     exit(0);
20230 }
20231 EOCP
20232 set try
20233 if eval $compile_ok; then
20234         yyy=`$run ./try`
20235         case "$yyy" in
20236         '')     sizesize=4
20237                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20238                 ;;
20239         *)      sizesize=$yyy
20240                 echo "Your $zzz size is $sizesize bytes."
20241                 ;;
20242         esac
20243 else
20244         sizesize=4
20245         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20246 fi
20247
20248
20249 : check for socklen_t
20250 echo " "
20251 echo "Checking to see if you have socklen_t..." >&4
20252 $cat >try.c <<EOCP
20253 #include <sys/types.h>
20254 #$d_socket HAS_SOCKET
20255 #ifdef HAS_SOCKET
20256 #include <sys/socket.h>
20257 #endif
20258 int main() { socklen_t x = 16; }
20259 EOCP
20260 set try
20261 if eval $compile; then
20262         val="$define"
20263         echo "You have socklen_t."
20264 else
20265         val="$undef"
20266         echo "You do not have socklen_t."
20267         case "$sizetype" in
20268         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20269         esac
20270 fi
20271 $rm_try
20272 set d_socklen_t
20273 eval $setvar
20274
20275 : see if this is a socks.h system
20276 set socks.h i_socks
20277 eval $inhdr
20278
20279 : check for type of the size argument to socket calls
20280 case "$d_socket" in
20281 "$define")
20282         $cat <<EOM
20283
20284 Checking to see what type is the last argument of accept().
20285 EOM
20286         yyy=''
20287         case "$d_socklen_t" in
20288         "$define") yyy="$yyy socklen_t"
20289         esac
20290         yyy="$yyy $sizetype int long unsigned"
20291         for xxx in $yyy; do
20292                 case "$socksizetype" in
20293                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20294                         case "$usesocks" in
20295                         "$define")
20296                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20297                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20298                                         socksizetype="$xxx"
20299                                 fi
20300                                 ;;
20301                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20302                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20303                                         socksizetype="$xxx"
20304                                 fi
20305                                 ;;
20306                         esac
20307                         ;;
20308                 esac
20309         done
20310 : In case none of those worked, prompt the user.
20311         case "$socksizetype" in
20312         '')     rp='What is the type for socket address structure sizes?'
20313                 dflt='int'
20314                 . ./myread
20315                 socksizetype=$ans
20316                 ;;
20317         esac
20318         ;;
20319 *)      : no sockets, so pick relatively harmless default
20320         socksizetype='int'
20321         ;;
20322 esac
20323
20324 : see what type is used for signed size_t
20325 set ssize_t ssizetype int stdio.h sys/types.h
20326 eval $typedef
20327 dflt="$ssizetype"
20328 $cat > try.c <<EOM
20329 #include <stdio.h>
20330 #$i_stdlib I_STDLIB
20331 #ifdef I_STDLIB
20332 #include <stdlib.h>
20333 #endif
20334 #include <sys/types.h>
20335 #define Size_t $sizetype
20336 #define SSize_t $dflt
20337 int main()
20338 {
20339         if (sizeof(Size_t) == sizeof(SSize_t))
20340                 printf("$dflt\n");
20341         else if (sizeof(Size_t) == sizeof(int))
20342                 printf("int\n");
20343         else
20344                 printf("long\n");
20345         exit(0);
20346 }
20347 EOM
20348 echo " "
20349 set try
20350 if eval $compile_ok && $run ./try > /dev/null; then
20351         ssizetype=`$run ./try`
20352         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20353 else
20354         $cat >&4 <<EOM
20355 Help! I can't compile and run the ssize_t test program: please enlighten me!
20356 (This is probably a misconfiguration in your system or libraries, and
20357 you really ought to fix it.  Still, I'll try anyway.)
20358
20359 I need a type that is the same size as $sizetype, but is guaranteed to
20360 be signed.  Common values are ssize_t, int and long.
20361
20362 EOM
20363         rp="What signed type is the same size as $sizetype?"
20364         . ./myread
20365         ssizetype="$ans"
20366 fi
20367 $rm_try
20368
20369 : see what type of char stdio uses.
20370 echo " "
20371 echo '#include <stdio.h>' > stdio.c
20372 $cppstdin $cppminus < stdio.c > stdioh
20373 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20374         echo "Your stdio uses unsigned chars." >&4
20375         stdchar="unsigned char"
20376 else
20377         echo "Your stdio uses signed chars." >&4
20378         stdchar="char"
20379 fi
20380 $rm -f stdio.* stdioh
20381
20382 : see what type uids are declared as in the kernel
20383 echo " "
20384 echo "Looking for the type for user ids returned by getuid()."
20385 set uid_t uidtype xxx stdio.h sys/types.h
20386 eval $typedef
20387 case "$uidtype" in
20388 xxx)
20389         xxx=`./findhdr sys/user.h`
20390         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20391         case $1 in
20392         unsigned) dflt="$1 $2" ;;
20393         *) dflt="$1" ;;
20394         esac
20395         ;;
20396 *) dflt="$uidtype";;
20397 esac
20398 case "$uidtype" in
20399 uid_t)  echo "uid_t found." ;;
20400 *)      rp="What is the type for user ids returned by getuid()?"
20401         . ./myread
20402         uidtype="$ans"
20403         ;;
20404 esac
20405
20406 echo " "
20407 case "$uidtype" in
20408 *_t) zzz="$uidtype"     ;;
20409 *)   zzz="uid"          ;;
20410 esac
20411 echo "Checking the size of $zzz..." >&4 
20412 cat > try.c <<EOCP
20413 #include <sys/types.h>
20414 #include <stdio.h>
20415 #$i_stdlib I_STDLIB
20416 #ifdef I_STDLIB
20417 #include <stdlib.h>
20418 #endif
20419 int main() {
20420     printf("%d\n", (int)sizeof($uidtype));
20421     exit(0);
20422 }
20423 EOCP
20424 set try
20425 if eval $compile_ok; then
20426         yyy=`$run ./try`
20427         case "$yyy" in
20428         '')     uidsize=4
20429                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20430                 ;;
20431         *)      uidsize=$yyy
20432                 echo "Your $zzz is $uidsize bytes long."
20433                 ;;
20434         esac
20435 else
20436         uidsize=4
20437         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20438 fi
20439
20440 echo " "
20441 case "$uidtype" in
20442 *_t) zzz="$uidtype"     ;;
20443 *)   zzz="uid"          ;;
20444 esac
20445 echo "Checking the sign of $zzz..." >&4
20446 cat > try.c <<EOCP
20447 #include <sys/types.h>
20448 #include <stdio.h>
20449 int main() {
20450         $uidtype foo = -1;
20451         if (foo < 0)
20452                 printf("-1\n");
20453         else
20454                 printf("1\n");
20455 }
20456 EOCP
20457 set try
20458 if eval $compile; then
20459         yyy=`$run ./try`
20460         case "$yyy" in
20461         '')     uidsign=1
20462                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20463                 ;;
20464         *)      uidsign=$yyy
20465                 case "$uidsign" in
20466                  1) echo "Your $zzz is unsigned." ;;
20467                 -1) echo "Your $zzz is signed."   ;;
20468                 esac
20469                 ;;
20470         esac
20471 else
20472         uidsign=1
20473         echo "(I can't compile the test program--guessing unsigned.)" >&4
20474 fi
20475
20476
20477
20478 echo " "
20479 $echo "Checking the format string to be used for uids..." >&4
20480
20481 case "$uidsign" in
20482 -1)     if $test X"$uidsize" = X"$ivsize"; then
20483                 uidformat="$ivdformat"
20484         else
20485                 if $test X"$uidsize" = X"$longsize"; then
20486                         uidformat='"ld"'
20487                 else
20488                         if $test X"$uidsize" = X"$intsize"; then
20489                                 uidformat='"d"'
20490                         else
20491                                 if $test X"$uidsize" = X"$shortsize"; then
20492                                         uidformat='"hd"'
20493                                 fi
20494                         fi
20495                 fi
20496         fi
20497         ;;
20498 *)      if $test X"$uidsize" = X"$uvsize"; then
20499                 uidformat="$uvuformat"
20500         else
20501                 if $test X"$uidsize" = X"$longsize"; then
20502                         uidformat='"lu"'
20503                 else
20504                         if $test X"$uidsize" = X"$intsize"; then
20505                                 uidformat='"u"'
20506                         else
20507                                 if $test X"$uidsize" = X"$shortsize"; then
20508                                         uidformat='"hu"'
20509                                 fi
20510                         fi
20511                 fi
20512         fi
20513         ;;
20514 esac
20515
20516
20517 case "$usesitecustomize" in
20518     $define|true|[Yy]*)
20519         usesitecustomize="$define"
20520         ;;
20521     *)
20522         usesitecustomize="$undef"
20523         ;;
20524     esac
20525
20526 : determine compiler compiler
20527 case "$yacc" in
20528 '')
20529         dflt=yacc;;
20530 *)
20531         dflt="$yacc";;
20532 esac
20533 echo " "
20534 comp='yacc'
20535 if $test -f "$byacc$_exe"; then
20536         dflt="$byacc"
20537         comp="byacc or $comp"
20538 fi
20539 if $test -f "$bison$_exe"; then
20540         comp="$comp or bison -y"
20541 fi
20542 rp="Which compiler compiler ($comp) shall I use?"
20543 . ./myread
20544 yacc="$ans"
20545 case "$yacc" in
20546 *bis*)
20547         case "$yacc" in
20548         *-y*) ;;
20549         *)
20550                 yacc="$yacc -y"
20551                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20552                 ;;
20553         esac
20554         ;;
20555 esac
20556
20557 : see if this is a fp.h system
20558 set fp.h i_fp
20559 eval $inhdr
20560
20561 : see if this is a fp_class.h system
20562 set fp_class.h i_fp_class
20563 eval $inhdr
20564
20565 : see if gdbm.h is available
20566 set gdbm.h t_gdbm
20567 eval $inhdr
20568 case "$t_gdbm" in
20569 $define)
20570         : see if gdbm_open exists
20571         set gdbm_open d_gdbm_open
20572         eval $inlibc
20573         case "$d_gdbm_open" in
20574         $undef)
20575                 t_gdbm="$undef"
20576                 echo "We won't be including <gdbm.h>"
20577                 ;;
20578         esac
20579         ;;
20580 esac
20581 val="$t_gdbm"
20582 set i_gdbm
20583 eval $setvar
20584
20585 : see if this is a ieeefp.h system
20586 case "$i_ieeefp" in
20587 '' ) set ieeefp.h i_ieeefp
20588      eval $inhdr
20589      ;;
20590 esac
20591
20592 : see if this is a libutil.h system
20593 set libutil.h i_libutil
20594 eval $inhdr
20595
20596 : see if mach cthreads are available
20597 if test "X$usethreads" = "X$define"; then
20598         set mach/cthreads.h i_machcthr
20599         eval $inhdr
20600 else
20601         i_machcthr="$undef"
20602 fi
20603
20604
20605
20606 : see if this is a mntent.h system
20607 set mntent.h i_mntent
20608 eval $inhdr
20609
20610 : see if ndbm.h is available
20611 set ndbm.h t_ndbm
20612 eval $inhdr
20613
20614 case "$t_ndbm" in
20615 $undef)
20616     # Some Linux distributions such as RedHat 7.1 put the
20617     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20618     if $test -f /usr/include/gdbm/ndbm.h; then
20619         echo '<gdbm/ndbm.h> found.'
20620         ccflags="$ccflags -I/usr/include/gdbm"
20621         cppflags="$cppflags -I/usr/include/gdbm"
20622         t_ndbm=$define
20623     fi
20624     ;;
20625 esac
20626
20627 case "$t_ndbm" in
20628 $define)
20629         : see if dbm_open exists
20630         set dbm_open d_dbm_open
20631         eval $inlibc
20632         case "$d_dbm_open" in
20633         $undef)
20634                 t_ndbm="$undef"
20635                 echo "We won't be including <ndbm.h>"
20636                 ;;
20637         esac
20638         ;;
20639 esac
20640 val="$t_ndbm"
20641 set i_ndbm
20642 eval $setvar
20643
20644 : see if net/errno.h is available
20645 val=''
20646 set net/errno.h val
20647 eval $inhdr
20648
20649 : Unfortunately, it causes problems on some systems.  Arrgh.
20650 case "$val" in
20651 $define)
20652         cat > try.c <<'EOM'
20653 #include <stdio.h>
20654 #include <errno.h>
20655 #include <net/errno.h>
20656 int func()
20657 {
20658         return ENOTSOCK;
20659 }
20660 EOM
20661         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20662                 echo "We'll be including <net/errno.h>." >&4
20663         else
20664                 echo "We won't be including <net/errno.h>." >&4
20665                 val="$undef"
20666         fi
20667         $rm_try
20668         ;;
20669 esac
20670 set i_neterrno
20671 eval $setvar
20672
20673 : see if netinet/tcp.h is available
20674 set netinet/tcp.h i_netinettcp
20675 eval $inhdr
20676
20677 : see if this is a poll.h system
20678 set poll.h i_poll
20679 eval $inhdr
20680
20681 : see if this is a prot.h system
20682 set prot.h i_prot
20683 eval $inhdr
20684
20685 echo " "
20686 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20687 $cat <<'EOSH' > Cppsym.know
20688 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20689 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20690 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20691 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20692 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20693 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20694 bull c cadmus clipper CMU COFF COMPILER_VERSION
20695 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20696 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20697 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20698 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20699 GLIBC GLIBC_MINOR
20700 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20701 H3050R H3050RX hbullx20 hcx host_mips
20702 hp200 hp300 hp700 HP700 hp800 hp9000
20703 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20704 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20705 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20706 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20707 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20708 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20709 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20710 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20711 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20712 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20713 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20714 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20715 MATH_HAS_NO_SIDE_EFFECTS
20716 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20717 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20718 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20719 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20720 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20721 NetBSD news1500 news1700 news1800 news1900 news3700
20722 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20723 ns32016 ns32332 ns32k nsc32000
20724 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20725 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20726 pc532 pdp11 PGC PIC plexus PORTAR posix
20727 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20728 POSIX_C_SOURCE POSIX_SOURCE POWER
20729 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
20730 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20731 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20732 sony sony_news sonyrisc sparc sparclite spectrum
20733 stardent stdc STDC_EXT stratos sun sun3 sun386
20734 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20735 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20736 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20737 sysV68 sysV88 Tek4132 Tek4300 titan
20738 TM3200 TM5400 TM5600
20739 tower tower32 tower32_200 tower32_600 tower32_700
20740 tower32_800 tower32_850 tss
20741 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20742 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20743 unix UNIX95 UNIX99 unixpc unos
20744 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20745 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20746 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20747 USGr4 USGr4_2
20748 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20749 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20750 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20751 z8000
20752 EOSH
20753 # Maybe put other stuff here too.
20754 cat <<EOSH >>Cppsym.know
20755 $osname
20756 EOSH
20757 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20758 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20759 $cat Cppsym.know > Cppsym.c
20760 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20761 $rm -f Cppsym.a Cppsym.b Cppsym.c
20762 cat <<EOSH > Cppsym
20763 $startsh
20764 if $test \$# -gt 0; then
20765     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20766     if $test -s Cppsym.got; then
20767         $rm -f Cppsym.got
20768         exit 0
20769     fi
20770     $rm -f Cppsym.got
20771     exit 1
20772 else
20773     $tr " " "$trnl" | ./Cppsym.try
20774     exit 0
20775 fi
20776 EOSH
20777 chmod +x Cppsym
20778 $eunicefix Cppsym
20779 cat <<EOSH > Cppsym.try
20780 $startsh
20781 cat <<'EOCP' > try.c
20782 #include <stdio.h>
20783 #if cpp_stuff == 1
20784 #define STRINGIFY(a)    "a"
20785 #endif
20786 #if cpp_stuff == 42
20787 #define StGiFy(a)  #a
20788 #define STRINGIFY(a)    StGiFy(a)
20789 #endif
20790 #if $cpp_stuff != 1 && $cpp_stuff != 42
20791 #   include "Bletch: How does this C preprocessor stringify macros?"
20792 #endif
20793 int main() {
20794 EOCP
20795 $awk \\
20796 EOSH
20797 cat <<'EOSH' >> Cppsym.try
20798 'length($1) > 0 {
20799     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20800     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20801     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20802     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20803 }'       >> try.c
20804 echo 'return 0;}' >> try.c
20805 EOSH
20806 cat <<EOSH >> Cppsym.try
20807 ccflags="$ccflags"
20808 case "$osname-$gccversion" in
20809 irix-) ccflags="\$ccflags -woff 1178" ;;
20810 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20811 esac
20812 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20813 EOSH
20814 chmod +x Cppsym.try
20815 $eunicefix Cppsym.try
20816 ./Cppsym < Cppsym.know > Cppsym.true
20817 : Add in any linux cpp "predefined macros":
20818 case "$osname::$gccversion" in
20819   *linux*::*.*)
20820     tHdrH=_tmpHdr
20821     rm -f $tHdrH'.h' $tHdrH
20822     touch $tHdrH'.h'
20823     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20824        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20825        if [ -s $tHdrH'_cppsym.real' ]; then
20826           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20827        fi
20828     fi
20829     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20830   ;;
20831 esac
20832 : now check the C compiler for additional symbols
20833 postprocess_cc_v=''
20834 case "$osname" in
20835 aix) postprocess_cc_v="|$tr , ' '" ;;
20836 esac
20837 $cat >ccsym <<EOS
20838 $startsh
20839 $cat >tmp.c <<EOF
20840 extern int foo;
20841 EOF
20842 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20843 do
20844         case "\$i" in
20845         -D*) echo "\$i" | $sed 's/^-D//';;
20846         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20847         esac
20848 done
20849 $rm_try
20850 EOS
20851 postprocess_cc_v=''
20852 chmod +x ccsym
20853 $eunicefix ccsym
20854 ./ccsym > ccsym1.raw
20855 if $test -s ccsym1.raw; then
20856        $sort ccsym1.raw | $uniq >ccsym.raw
20857 else
20858        mv ccsym1.raw ccsym.raw
20859 fi
20860
20861 $awk '/\=/ { print $0; next }
20862         { print $0"=1" }' ccsym.raw >ccsym.list
20863 $comm -13 Cppsym.true ccsym.list >ccsym.own
20864 $comm -12 Cppsym.true ccsym.list >ccsym.com
20865 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20866 also=''
20867 if $test -z ccsym.raw; then
20868         echo "Your C compiler doesn't seem to define any symbols!" >&4
20869         echo " "
20870         echo "However, your C preprocessor defines the following symbols:"
20871         $cat Cppsym.true
20872         ccsymbols=''
20873         cppsymbols=`$cat Cppsym.true`
20874         cppsymbols=`echo $cppsymbols`
20875         cppccsymbols="$cppsymbols"
20876 else
20877         if $test -s ccsym.com; then
20878                 echo "Your C compiler and pre-processor define these symbols:"
20879                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20880                 also='also '
20881                 symbols='ones'
20882                 cppccsymbols=`$cat ccsym.com`
20883                 cppccsymbols=`echo $cppccsymbols`
20884                 $test "$silent" || sleep 1
20885         fi
20886         if $test -s ccsym.cpp; then
20887                 $test "$also" && echo " "
20888                 echo "Your C pre-processor ${also}defines the following symbols:"
20889                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20890                 also='further '
20891                 cppsymbols=`$cat ccsym.cpp`
20892                 cppsymbols=`echo $cppsymbols`
20893                 $test "$silent" || sleep 1
20894         fi
20895         if $test -s ccsym.own; then
20896                 $test "$also" && echo " "
20897                 echo "Your C compiler ${also}defines the following cpp symbols:"
20898                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20899                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20900                 ccsymbols=`$cat ccsym.own`
20901                 ccsymbols=`echo $ccsymbols`
20902                 $test "$silent" || sleep 1
20903         fi
20904 fi
20905
20906 : see if this is a termio system
20907 val="$undef"
20908 val2="$undef"
20909 val3="$undef"
20910 if $test `./findhdr termios.h`; then
20911         set tcsetattr i_termios
20912         eval $inlibc
20913         val3="$i_termios"
20914 fi
20915 echo " "
20916 case "$val3" in
20917 "$define") echo "You have POSIX termios.h... good!" >&4;;
20918 *) if ./Cppsym pyr; then
20919                 case "`/bin/universe`" in
20920                 ucb) if $test `./findhdr sgtty.h`; then
20921                                 val2="$define"
20922                                 echo "<sgtty.h> found." >&4
20923                         else
20924                                 echo "System is pyramid with BSD universe."
20925                                 echo "<sgtty.h> not found--you could have problems." >&4
20926                         fi;;
20927                 *) if $test `./findhdr termio.h`; then
20928                                 val="$define"
20929                                 echo "<termio.h> found." >&4
20930                         else
20931                                 echo "System is pyramid with USG universe."
20932                                 echo "<termio.h> not found--you could have problems." >&4
20933                         fi;;
20934                 esac
20935         elif ./usg; then
20936                 if $test `./findhdr termio.h`; then
20937                         echo "<termio.h> found." >&4
20938                         val="$define"
20939                 elif $test `./findhdr sgtty.h`; then
20940                         echo "<sgtty.h> found." >&4
20941                         val2="$define"
20942                 else
20943 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20944                 fi
20945         else
20946                 if $test `./findhdr sgtty.h`; then
20947                         echo "<sgtty.h> found." >&4
20948                         val2="$define"
20949                 elif $test `./findhdr termio.h`; then
20950                         echo "<termio.h> found." >&4
20951                         val="$define"
20952                 else
20953 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20954                 fi
20955         fi;;
20956 esac
20957 set i_termio; eval $setvar
20958 val=$val2; set i_sgtty; eval $setvar
20959 val=$val3; set i_termios; eval $setvar
20960
20961 : see if stddef is available
20962 set stddef.h i_stddef
20963 eval $inhdr
20964
20965 : see if sys/access.h is available
20966 set sys/access.h i_sysaccess
20967 eval $inhdr
20968
20969 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20970 set sys/filio.h i_sysfilio
20971 eval $inhdr
20972 echo " "
20973 if $test `./findhdr sys/ioctl.h`; then
20974         val="$define"
20975         echo '<sys/ioctl.h> found.' >&4
20976 else
20977         val="$undef"
20978         if $test $i_sysfilio = "$define"; then
20979             echo '<sys/ioctl.h> NOT found.' >&4
20980         else
20981                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20982                 $test $i_termio = "$define" && xxx="termio.h"
20983                 $test $i_termios = "$define" && xxx="termios.h"
20984 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20985         fi
20986 fi
20987 set i_sysioctl
20988 eval $setvar
20989
20990 : see if socket ioctl defs are in sys/sockio.h
20991 echo " "
20992 xxx=`./findhdr sys/sockio.h`
20993 if $test "$xxx"; then
20994         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20995                 val="$define"
20996                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20997         else
20998                 val="$undef"
20999                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21000         fi
21001 else
21002         val="$undef"
21003         $cat <<EOM
21004 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21005 EOM
21006 fi
21007 set i_syssockio
21008 eval $setvar
21009
21010
21011 : see if this is a syslog.h system
21012 set syslog.h i_syslog
21013 eval $inhdr
21014
21015
21016 : see if this is a sys/mode.h system
21017 set sys/mode.h i_sysmode
21018 eval $inhdr
21019
21020 : see if sys/resource.h has to be included
21021 set sys/resource.h i_sysresrc
21022 eval $inhdr
21023
21024 : see if sys/security.h is available
21025 set sys/security.h i_syssecrt
21026 eval $inhdr
21027
21028 : see if this is a sys/statvfs.h system
21029 set sys/statvfs.h i_sysstatvfs
21030 eval $inhdr
21031
21032 : see if this is a sys/un.h system
21033 set sys/un.h i_sysun
21034 eval $inhdr
21035
21036
21037 : see if this is a sys/utsname.h system
21038 set sys/utsname.h i_sysutsname
21039 eval $inhdr
21040
21041 : see if this is a syswait system
21042 set sys/wait.h i_syswait
21043 eval $inhdr
21044
21045 : see if this is a ustat.h system
21046 set ustat.h i_ustat
21047 eval $inhdr
21048
21049 : see if this is an utime system
21050 set utime.h i_utime
21051 eval $inhdr
21052
21053 : see if this is a values.h system
21054 set values.h i_values
21055 eval $inhdr
21056
21057 : see if this is a vfork system
21058 case "$d_vfork" in
21059 "$define")
21060         set vfork.h i_vfork
21061         eval $inhdr
21062         ;;
21063 *)
21064         i_vfork="$undef"
21065         ;;
21066 esac
21067
21068 echo " "
21069 echo "Looking for extensions..." >&4
21070 : If we are using the old config.sh, known_extensions may contain
21071 : old or inaccurate or duplicate values.
21072 known_extensions=''
21073 nonxs_extensions=''
21074 : We do not use find because it might not be available.
21075 : We do not just use MANIFEST because the user may have dropped
21076 : some additional extensions into the source tree and expect them
21077 : to be built.
21078
21079 : Function to recursively find available extensions, ignoring DynaLoader
21080 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21081 find_extensions='
21082     for xxx in *; do
21083         case "$xxx" in
21084             DynaLoader|dynaload) ;;
21085             *)
21086             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21087                 known_extensions="$known_extensions $1$xxx";
21088             elif $test -f $xxx/Makefile.PL; then
21089                 nonxs_extensions="$nonxs_extensions $1$xxx";
21090             else
21091                 if $test -d $xxx -a $# -lt 10; then
21092                     set $1$xxx/ $*;
21093                     cd "$xxx";
21094                     eval $find_extensions;
21095                     cd ..;
21096                     shift;
21097                 fi;
21098             fi
21099             ;;
21100         esac;
21101     done'
21102 tdir=`pwd`
21103 cd "$rsrc/ext"
21104 set X
21105 shift
21106 eval $find_extensions
21107 # Special case:  Add in threads/shared since it is not picked up by the
21108 # recursive find above (and adding in general recursive finding breaks
21109 # SDBM_File/sdbm).  A.D.  10/25/2001.
21110 known_extensions="$known_extensions threads/shared"
21111 set X $known_extensions
21112 shift
21113 known_extensions="$*"
21114 set X $nonxs_extensions
21115 shift
21116 nonxs_extensions="$*"
21117 cd "$tdir"
21118
21119 : Now see which are supported on this system.
21120 avail_ext=''
21121 for xxx in $known_extensions ; do
21122         case "$xxx" in
21123         DB_File|db_file)
21124                 case "$i_db" in
21125                 $define) avail_ext="$avail_ext $xxx" ;;
21126                 esac
21127                 ;;
21128         GDBM_File|gdbm_fil)
21129                 case "$i_gdbm" in
21130                 $define) avail_ext="$avail_ext $xxx" ;;
21131                 esac
21132                 ;;
21133         I18N/Langinfo|i18n_lan)
21134                 case "$i_langinfo$d_nl_langinfo" in
21135                 $define$define) avail_ext="$avail_ext $xxx" ;;
21136                 esac
21137                 ;;
21138         IPC/SysV|ipc/sysv)
21139                 : XXX Do we need a useipcsysv variable here
21140                 case "${d_msg}${d_sem}${d_shm}" in
21141                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21142                 esac
21143                 ;;
21144         NDBM_File|ndbm_fil)
21145                 case "$i_ndbm" in
21146                 $define)
21147                     case "$osname-$use64bitint" in
21148                     hpux-define)
21149                         case "$libs" in
21150                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21151                         esac
21152                         ;;
21153                     *) avail_ext="$avail_ext $xxx" ;;
21154                     esac
21155                     ;;
21156                 esac
21157                 ;;
21158         ODBM_File|odbm_fil)
21159                 case "${i_dbm}${i_rpcsvcdbm}" in
21160                 *"${define}"*)
21161                     case "$d_cplusplus" in
21162                     define) ;; # delete as a function name will not work
21163                     *)  case "$osname-$use64bitint" in
21164                         hpux-define)
21165                             case "$libs" in
21166                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21167                             esac
21168                             ;;
21169                         *) avail_ext="$avail_ext $xxx" ;;
21170                         esac
21171                         ;;
21172                     esac
21173                     ;;
21174                 esac
21175                 ;;
21176         Opcode|opcode)
21177                 case "$useopcode" in
21178                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21179                 esac
21180                 ;;
21181         POSIX|posix)
21182                 case "$useposix" in
21183                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21184                 esac
21185                 ;;
21186         Socket|socket)
21187                 case "$d_socket" in
21188                 true|$define|y)
21189                     case "$osname" in
21190                     beos) ;; # not unless BONE
21191                     *) avail_ext="$avail_ext $xxx" ;;
21192                     esac
21193                     ;;
21194                 esac
21195                 ;;
21196         Sys/Syslog|sys/syslog)
21197                 : XXX syslog requires socket
21198                 case "$d_socket" in
21199                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21200                 esac
21201                 ;;
21202         Thread|thread)
21203                 case "$usethreads" in
21204                 true|$define|y)
21205                         case "$use5005threads" in
21206                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21207                         esac
21208                 esac
21209                 ;;
21210         threads|threads/shared)
21211                 # threads and threads::shared are special cases.
21212                 # To stop people from asking "Perl 5.8.0 was supposed
21213                 # to have this new fancy threads implementation but my
21214                 # perl doesn't have it" and from people trying to
21215                 # (re)install the threads module using CPAN.pm and
21216                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21217                 # the threads.pm and threads/shared.pm will always be
21218                 # there, croaking informatively ("you need to rebuild
21219                 # all of Perl with threads, sorry") when threads haven't
21220                 # been compiled in.
21221                 # --jhi
21222                 avail_ext="$avail_ext $xxx"
21223                 ;;
21224         Win32*)
21225                 case "$osname" in
21226                 cygwin) avail_ext="$avail_ext $xxx" ;;
21227                 esac
21228                 ;;
21229         XS/APItest|xs/apitest)
21230                 # This is just for testing.  Skip it unless we have dynamic loading.
21231
21232                 case "$usedl" in
21233                 $define) avail_ext="$avail_ext $xxx" ;;
21234                 esac
21235                 ;;
21236         XS/Typemap|xs/typemap)
21237                 # This is just for testing.  Skip it unless we have dynamic loading.
21238                 case "$usedl" in
21239                 $define) avail_ext="$avail_ext $xxx" ;;
21240                 esac
21241                 ;;
21242         *)      avail_ext="$avail_ext $xxx"
21243                 ;;
21244         esac
21245 done
21246
21247 set X $avail_ext
21248 shift
21249 avail_ext="$*"
21250
21251 case "$onlyextensions" in
21252 '') ;;
21253 *)  keepextensions=''
21254     echo "You have requested that only certains extensions be included..." >&4
21255     for i in $onlyextensions; do
21256         case " $avail_ext " in
21257         *" $i "*)
21258             echo "Keeping extension $i."
21259             keepextensions="$keepextensions $i"
21260             ;;
21261         *) echo "Ignoring extension $i." ;;
21262         esac
21263     done
21264     avail_ext="$keepextensions"
21265     ;;
21266 esac
21267
21268 case "$noextensions" in
21269 '') ;;
21270 *)  keepextensions=''
21271     echo "You have requested that certain extensions be ignored..." >&4
21272     for i in $avail_ext; do
21273         case " $noextensions " in
21274         *" $i "*) echo "Ignoring extension $i." ;;
21275         *) echo "Keeping extension $i.";
21276            keepextensions="$keepextensions $i"
21277            ;;
21278         esac
21279     done
21280     avail_ext="$keepextensions"
21281     ;;
21282 esac
21283
21284 : Now see which nonxs extensions are supported on this system.
21285 : For now assume all are.
21286 nonxs_ext=''
21287 for xxx in $nonxs_extensions ; do
21288         case "$xxx" in
21289         *)      nonxs_ext="$nonxs_ext $xxx"
21290                 ;;
21291         esac
21292 done
21293
21294 set X $nonxs_ext
21295 shift
21296 nonxs_ext="$*"
21297
21298 case $usedl in
21299 $define)
21300         $cat <<EOM
21301 A number of extensions are supplied with $package.  You may choose to
21302 compile these extensions for dynamic loading (the default), compile
21303 them into the $package executable (static loading), or not include
21304 them at all.  Answer "none" to include no extensions.
21305 Note that DynaLoader is always built and need not be mentioned here.
21306
21307 EOM
21308         case "$dynamic_ext" in
21309         '')
21310                 : Exclude those listed in static_ext
21311                 dflt=''
21312                 for xxx in $avail_ext; do
21313                         case " $static_ext " in
21314                         *" $xxx "*) ;;
21315                         *) dflt="$dflt $xxx" ;;
21316                         esac
21317                 done
21318                 set X $dflt
21319                 shift
21320                 dflt="$*"
21321                 ;;
21322         *)      dflt="$dynamic_ext"
21323                 # Perhaps we are reusing an old out-of-date config.sh.
21324                 case "$hint" in
21325                 previous)
21326                         if test X"$dynamic_ext" != X"$avail_ext"; then
21327                                 $cat <<EOM
21328 NOTICE:  Your previous config.sh list may be incorrect.
21329 The extensions now available to you are
21330         ${avail_ext}
21331 but the default list from your previous config.sh is
21332         ${dynamic_ext}
21333
21334 EOM
21335                         fi
21336                         ;;
21337                 esac
21338                 ;;
21339         esac
21340         case "$dflt" in
21341         '')     dflt=none;;
21342         esac
21343         rp="What extensions do you wish to load dynamically?"
21344         . ./myread
21345         case "$ans" in
21346         none) dynamic_ext=' ' ;;
21347         *) dynamic_ext="$ans" ;;
21348         esac
21349
21350         case "$static_ext" in
21351         '')
21352                 : Exclude those already listed in dynamic linking
21353                 dflt=''
21354                 for xxx in $avail_ext; do
21355                         case " $dynamic_ext " in
21356                         *" $xxx "*) ;;
21357                         *) dflt="$dflt $xxx" ;;
21358                         esac
21359                 done
21360                 set X $dflt
21361                 shift
21362                 dflt="$*"
21363                 ;;
21364         *)  dflt="$static_ext"
21365                 ;;
21366         esac
21367
21368         case "$dflt" in
21369         '')     dflt=none;;
21370         esac
21371         rp="What extensions do you wish to load statically?"
21372         . ./myread
21373         case "$ans" in
21374         none) static_ext=' ' ;;
21375         *) static_ext="$ans" ;;
21376         esac
21377         ;;
21378 *)
21379         $cat <<EOM
21380 A number of extensions are supplied with $package.  Answer "none"
21381 to include no extensions.
21382 Note that DynaLoader is always built and need not be mentioned here.
21383
21384 EOM
21385         case "$static_ext" in
21386         '') dflt="$avail_ext" ;;
21387         *)      dflt="$static_ext"
21388                 # Perhaps we are reusing an old out-of-date config.sh.
21389                 case "$hint" in
21390                 previous)
21391                         if test X"$static_ext" != X"$avail_ext"; then
21392                                 $cat <<EOM
21393 NOTICE:  Your previous config.sh list may be incorrect.
21394 The extensions now available to you are
21395         ${avail_ext}
21396 but the default list from your previous config.sh is
21397         ${static_ext}
21398
21399 EOM
21400                         fi
21401                         ;;
21402                 esac
21403                 ;;
21404         esac
21405         : Exclude those that are not xs extensions
21406         case "$dflt" in
21407         '')     dflt=none;;
21408         esac
21409         rp="What extensions do you wish to include?"
21410         . ./myread
21411         case "$ans" in
21412         none) static_ext=' ' ;;
21413         *) static_ext="$ans" ;;
21414         esac
21415         ;;
21416 esac
21417 #
21418 # Encode is a special case.  If we are building Encode as a static
21419 # extension, we need to explicitly list its subextensions as well.
21420 # For other nested extensions, this is handled automatically by
21421 # the appropriate Makefile.PL.
21422 case " $static_ext " in
21423         *" Encode "*) # Add the subextensions of Encode
21424         cd "$rsrc/ext"
21425         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21426                 static_ext="$static_ext Encode/$xxx"
21427         done
21428         cd "$tdir"
21429         ;;
21430 esac
21431
21432 set X $dynamic_ext $static_ext $nonxs_ext
21433 shift
21434 extensions="$*"
21435
21436 # Sanity check:  We require an extension suitable for use with
21437 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21438 # should show up as failures in the test suite, but it's helpful to
21439 # catch them now.) The 'extensions' list is normally sorted
21440 # alphabetically, so we need to accept either
21441 #    DB_File ... Fcntl ... IO  ....
21442 # or something like
21443 #    Fcntl ... NDBM_File ... IO  ....
21444 case " $extensions"  in
21445 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21446 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21447 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21448 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21449    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21450    ;;
21451 esac
21452
21453 : Remove libraries needed only for extensions
21454 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21455 : The exception is SunOS 4.x, which needs them.
21456 case "${osname}X${osvers}" in
21457 sunos*X4*)
21458     perllibs="$libs"
21459     ;;
21460 *) case "$usedl" in
21461     $define|true|[yY]*)
21462             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21463             shift
21464             perllibs="$*"
21465             ;;
21466     *)  perllibs="$libs"
21467             ;;
21468     esac
21469     ;;
21470 esac
21471
21472 : Remove build directory name from cppstdin so it can be used from
21473 : either the present location or the final installed location.
21474 echo " "
21475 : Get out of the UU directory to get correct path name.
21476 cd ..
21477 case "$cppstdin" in
21478 `pwd`/cppstdin)
21479         echo "Stripping down cppstdin path name"
21480         cppstdin=cppstdin
21481         ;;
21482 esac
21483 cd UU
21484
21485 : end of configuration questions
21486 echo " "
21487 echo "End of configuration questions."
21488 echo " "
21489
21490 : back to where it started
21491 if test -d ../UU; then
21492         cd ..
21493 fi
21494
21495 : configuration may be patched via a 'config.arch' file
21496 if $test -f config.arch; then
21497         echo "I see a config.arch file, loading it."
21498         . ./config.arch
21499 fi
21500
21501 : configuration may be patched via a 'config.over' file
21502 if $test -f config.over; then
21503         echo " "
21504         dflt=y
21505         rp='I see a config.over file.  Do you wish to load it?'
21506         . UU/myread
21507         case "$ans" in
21508         n*) echo "OK, I'll ignore it.";;
21509         *)      . ./config.over
21510                 echo "Configuration override changes have been loaded."
21511                 ;;
21512         esac
21513 fi
21514
21515 : in case they want portability, strip down executable paths
21516 case "$d_portable" in
21517 "$define")
21518         echo " "
21519         echo "Stripping down executable paths..." >&4
21520         for file in $loclist $trylist; do
21521                 eval temp=\$$file
21522                 eval $file=`basename $temp`
21523         done
21524         ;;
21525 esac
21526
21527 : create config.sh file
21528 echo " "
21529 echo "Creating config.sh..." >&4
21530 $spitshell <<EOT >config.sh
21531 $startsh
21532 #
21533 # This file was produced by running the Configure script. It holds all the
21534 # definitions figured out by Configure. Should you modify one of these values,
21535 # do not forget to propagate your changes by running "Configure -der". You may
21536 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21537 #
21538
21539 # Package name      : $package
21540 # Source directory  : $src
21541 # Configuration time: $cf_time
21542 # Configured by     : $cf_by
21543 # Target system     : $myuname
21544
21545 Author='$Author'
21546 Date='$Date'
21547 Header='$Header'
21548 Id='$Id'
21549 Locker='$Locker'
21550 Log='$Log'
21551 Mcc='$Mcc'
21552 RCSfile='$RCSfile'
21553 Revision='$Revision'
21554 Source='$Source'
21555 State='$State'
21556 _a='$_a'
21557 _exe='$_exe'
21558 _o='$_o'
21559 afs='$afs'
21560 afsroot='$afsroot'
21561 alignbytes='$alignbytes'
21562 ansi2knr='$ansi2knr'
21563 aphostname='$aphostname'
21564 api_revision='$api_revision'
21565 api_subversion='$api_subversion'
21566 api_version='$api_version'
21567 api_versionstring='$api_versionstring'
21568 ar='$ar'
21569 archlib='$archlib'
21570 archlibexp='$archlibexp'
21571 archname64='$archname64'
21572 archname='$archname'
21573 archobjs='$archobjs'
21574 asctime_r_proto='$asctime_r_proto'
21575 awk='$awk'
21576 baserev='$baserev'
21577 bash='$bash'
21578 bin='$bin'
21579 binexp='$binexp'
21580 bison='$bison'
21581 byacc='$byacc'
21582 byteorder='$byteorder'
21583 c='$c'
21584 castflags='$castflags'
21585 cat='$cat'
21586 cc='$cc'
21587 cccdlflags='$cccdlflags'
21588 ccdlflags='$ccdlflags'
21589 ccflags='$ccflags'
21590 ccflags_uselargefiles='$ccflags_uselargefiles'
21591 ccname='$ccname'
21592 ccsymbols='$ccsymbols'
21593 ccversion='$ccversion'
21594 cf_by='$cf_by'
21595 cf_email='$cf_email'
21596 cf_time='$cf_time'
21597 charsize='$charsize'
21598 chgrp='$chgrp'
21599 chmod='$chmod'
21600 chown='$chown'
21601 clocktype='$clocktype'
21602 comm='$comm'
21603 compress='$compress'
21604 contains='$contains'
21605 cp='$cp'
21606 cpio='$cpio'
21607 cpp='$cpp'
21608 cpp_stuff='$cpp_stuff'
21609 cppccsymbols='$cppccsymbols'
21610 cppflags='$cppflags'
21611 cpplast='$cpplast'
21612 cppminus='$cppminus'
21613 cpprun='$cpprun'
21614 cppstdin='$cppstdin'
21615 cppsymbols='$cppsymbols'
21616 crypt_r_proto='$crypt_r_proto'
21617 cryptlib='$cryptlib'
21618 csh='$csh'
21619 ctermid_r_proto='$ctermid_r_proto'
21620 ctime_r_proto='$ctime_r_proto'
21621 d_Gconvert='$d_Gconvert'
21622 d_PRIEUldbl='$d_PRIEUldbl'
21623 d_PRIFUldbl='$d_PRIFUldbl'
21624 d_PRIGUldbl='$d_PRIGUldbl'
21625 d_PRIXU64='$d_PRIXU64'
21626 d_PRId64='$d_PRId64'
21627 d_PRIeldbl='$d_PRIeldbl'
21628 d_PRIfldbl='$d_PRIfldbl'
21629 d_PRIgldbl='$d_PRIgldbl'
21630 d_PRIi64='$d_PRIi64'
21631 d_PRIo64='$d_PRIo64'
21632 d_PRIu64='$d_PRIu64'
21633 d_PRIx64='$d_PRIx64'
21634 d_SCNfldbl='$d_SCNfldbl'
21635 d__fwalk='$d__fwalk'
21636 d_access='$d_access'
21637 d_accessx='$d_accessx'
21638 d_aintl='$d_aintl'
21639 d_alarm='$d_alarm'
21640 d_archlib='$d_archlib'
21641 d_asctime_r='$d_asctime_r'
21642 d_atolf='$d_atolf'
21643 d_atoll='$d_atoll'
21644 d_attribute_format='$d_attribute_format'
21645 d_attribute_malloc='$d_attribute_malloc'
21646 d_attribute_nonnull='$d_attribute_nonnull'
21647 d_attribute_noreturn='$d_attribute_noreturn'
21648 d_attribute_pure='$d_attribute_pure'
21649 d_attribute_unused='$d_attribute_unused'
21650 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21651 d_bcmp='$d_bcmp'
21652 d_bcopy='$d_bcopy'
21653 d_bsd='$d_bsd'
21654 d_bsdgetpgrp='$d_bsdgetpgrp'
21655 d_bsdsetpgrp='$d_bsdsetpgrp'
21656 d_builtin_choose_expr='$d_builtin_choose_expr'
21657 d_builtin_expect='$d_builtin_expect'
21658 d_bzero='$d_bzero'
21659 d_c99_variadic_macros='$d_c99_variadic_macros'
21660 d_casti32='$d_casti32'
21661 d_castneg='$d_castneg'
21662 d_charvspr='$d_charvspr'
21663 d_chown='$d_chown'
21664 d_chroot='$d_chroot'
21665 d_chsize='$d_chsize'
21666 d_class='$d_class'
21667 d_clearenv='$d_clearenv'
21668 d_closedir='$d_closedir'
21669 d_cmsghdr_s='$d_cmsghdr_s'
21670 d_const='$d_const'
21671 d_copysignl='$d_copysignl'
21672 d_cplusplus='$d_cplusplus'
21673 d_crypt='$d_crypt'
21674 d_crypt_r='$d_crypt_r'
21675 d_csh='$d_csh'
21676 d_ctermid='$d_ctermid'
21677 d_ctermid_r='$d_ctermid_r'
21678 d_ctime_r='$d_ctime_r'
21679 d_cuserid='$d_cuserid'
21680 d_dbl_dig='$d_dbl_dig'
21681 d_dbminitproto='$d_dbminitproto'
21682 d_difftime='$d_difftime'
21683 d_dir_dd_fd='$d_dir_dd_fd'
21684 d_dirfd='$d_dirfd'
21685 d_dirnamlen='$d_dirnamlen'
21686 d_dlerror='$d_dlerror'
21687 d_dlopen='$d_dlopen'
21688 d_dlsymun='$d_dlsymun'
21689 d_dosuid='$d_dosuid'
21690 d_drand48_r='$d_drand48_r'
21691 d_drand48proto='$d_drand48proto'
21692 d_dup2='$d_dup2'
21693 d_eaccess='$d_eaccess'
21694 d_endgrent='$d_endgrent'
21695 d_endgrent_r='$d_endgrent_r'
21696 d_endhent='$d_endhent'
21697 d_endhostent_r='$d_endhostent_r'
21698 d_endnent='$d_endnent'
21699 d_endnetent_r='$d_endnetent_r'
21700 d_endpent='$d_endpent'
21701 d_endprotoent_r='$d_endprotoent_r'
21702 d_endpwent='$d_endpwent'
21703 d_endpwent_r='$d_endpwent_r'
21704 d_endsent='$d_endsent'
21705 d_endservent_r='$d_endservent_r'
21706 d_eofnblk='$d_eofnblk'
21707 d_eunice='$d_eunice'
21708 d_faststdio='$d_faststdio'
21709 d_fchdir='$d_fchdir'
21710 d_fchmod='$d_fchmod'
21711 d_fchown='$d_fchown'
21712 d_fcntl='$d_fcntl'
21713 d_fcntl_can_lock='$d_fcntl_can_lock'
21714 d_fd_macros='$d_fd_macros'
21715 d_fd_set='$d_fd_set'
21716 d_fds_bits='$d_fds_bits'
21717 d_fgetpos='$d_fgetpos'
21718 d_finite='$d_finite'
21719 d_finitel='$d_finitel'
21720 d_flexfnam='$d_flexfnam'
21721 d_flock='$d_flock'
21722 d_flockproto='$d_flockproto'
21723 d_fork='$d_fork'
21724 d_fp_class='$d_fp_class'
21725 d_fpathconf='$d_fpathconf'
21726 d_fpclass='$d_fpclass'
21727 d_fpclassify='$d_fpclassify'
21728 d_fpclassl='$d_fpclassl'
21729 d_fpos64_t='$d_fpos64_t'
21730 d_frexpl='$d_frexpl'
21731 d_fs_data_s='$d_fs_data_s'
21732 d_fseeko='$d_fseeko'
21733 d_fsetpos='$d_fsetpos'
21734 d_fstatfs='$d_fstatfs'
21735 d_fstatvfs='$d_fstatvfs'
21736 d_fsync='$d_fsync'
21737 d_ftello='$d_ftello'
21738 d_ftime='$d_ftime'
21739 d_futimes='$d_futimes'
21740 d_getcwd='$d_getcwd'
21741 d_getespwnam='$d_getespwnam'
21742 d_getfsstat='$d_getfsstat'
21743 d_getgrent='$d_getgrent'
21744 d_getgrent_r='$d_getgrent_r'
21745 d_getgrgid_r='$d_getgrgid_r'
21746 d_getgrnam_r='$d_getgrnam_r'
21747 d_getgrps='$d_getgrps'
21748 d_gethbyaddr='$d_gethbyaddr'
21749 d_gethbyname='$d_gethbyname'
21750 d_gethent='$d_gethent'
21751 d_gethname='$d_gethname'
21752 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21753 d_gethostbyname_r='$d_gethostbyname_r'
21754 d_gethostent_r='$d_gethostent_r'
21755 d_gethostprotos='$d_gethostprotos'
21756 d_getitimer='$d_getitimer'
21757 d_getlogin='$d_getlogin'
21758 d_getlogin_r='$d_getlogin_r'
21759 d_getmnt='$d_getmnt'
21760 d_getmntent='$d_getmntent'
21761 d_getnbyaddr='$d_getnbyaddr'
21762 d_getnbyname='$d_getnbyname'
21763 d_getnent='$d_getnent'
21764 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21765 d_getnetbyname_r='$d_getnetbyname_r'
21766 d_getnetent_r='$d_getnetent_r'
21767 d_getnetprotos='$d_getnetprotos'
21768 d_getpagsz='$d_getpagsz'
21769 d_getpbyname='$d_getpbyname'
21770 d_getpbynumber='$d_getpbynumber'
21771 d_getpent='$d_getpent'
21772 d_getpgid='$d_getpgid'
21773 d_getpgrp2='$d_getpgrp2'
21774 d_getpgrp='$d_getpgrp'
21775 d_getppid='$d_getppid'
21776 d_getprior='$d_getprior'
21777 d_getprotobyname_r='$d_getprotobyname_r'
21778 d_getprotobynumber_r='$d_getprotobynumber_r'
21779 d_getprotoent_r='$d_getprotoent_r'
21780 d_getprotoprotos='$d_getprotoprotos'
21781 d_getprpwnam='$d_getprpwnam'
21782 d_getpwent='$d_getpwent'
21783 d_getpwent_r='$d_getpwent_r'
21784 d_getpwnam_r='$d_getpwnam_r'
21785 d_getpwuid_r='$d_getpwuid_r'
21786 d_getsbyname='$d_getsbyname'
21787 d_getsbyport='$d_getsbyport'
21788 d_getsent='$d_getsent'
21789 d_getservbyname_r='$d_getservbyname_r'
21790 d_getservbyport_r='$d_getservbyport_r'
21791 d_getservent_r='$d_getservent_r'
21792 d_getservprotos='$d_getservprotos'
21793 d_getspnam='$d_getspnam'
21794 d_getspnam_r='$d_getspnam_r'
21795 d_gettimeod='$d_gettimeod'
21796 d_gmtime_r='$d_gmtime_r'
21797 d_gnulibc='$d_gnulibc'
21798 d_grpasswd='$d_grpasswd'
21799 d_hasmntopt='$d_hasmntopt'
21800 d_htonl='$d_htonl'
21801 d_ilogbl='$d_ilogbl'
21802 d_inc_version_list='$d_inc_version_list'
21803 d_index='$d_index'
21804 d_inetaton='$d_inetaton'
21805 d_int64_t='$d_int64_t'
21806 d_isascii='$d_isascii'
21807 d_isfinite='$d_isfinite'
21808 d_isinf='$d_isinf'
21809 d_isnan='$d_isnan'
21810 d_isnanl='$d_isnanl'
21811 d_killpg='$d_killpg'
21812 d_lchown='$d_lchown'
21813 d_ldbl_dig='$d_ldbl_dig'
21814 d_libm_lib_version='$d_libm_lib_version'
21815 d_link='$d_link'
21816 d_localtime_r='$d_localtime_r'
21817 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21818 d_locconv='$d_locconv'
21819 d_lockf='$d_lockf'
21820 d_longdbl='$d_longdbl'
21821 d_longlong='$d_longlong'
21822 d_lseekproto='$d_lseekproto'
21823 d_lstat='$d_lstat'
21824 d_madvise='$d_madvise'
21825 d_malloc_good_size='$d_malloc_good_size'
21826 d_malloc_size='$d_malloc_size'
21827 d_mblen='$d_mblen'
21828 d_mbstowcs='$d_mbstowcs'
21829 d_mbtowc='$d_mbtowc'
21830 d_memchr='$d_memchr'
21831 d_memcmp='$d_memcmp'
21832 d_memcpy='$d_memcpy'
21833 d_memmove='$d_memmove'
21834 d_memset='$d_memset'
21835 d_mkdir='$d_mkdir'
21836 d_mkdtemp='$d_mkdtemp'
21837 d_mkfifo='$d_mkfifo'
21838 d_mkstemp='$d_mkstemp'
21839 d_mkstemps='$d_mkstemps'
21840 d_mktime='$d_mktime'
21841 d_mmap='$d_mmap'
21842 d_modfl='$d_modfl'
21843 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21844 d_modflproto='$d_modflproto'
21845 d_mprotect='$d_mprotect'
21846 d_msg='$d_msg'
21847 d_msg_ctrunc='$d_msg_ctrunc'
21848 d_msg_dontroute='$d_msg_dontroute'
21849 d_msg_oob='$d_msg_oob'
21850 d_msg_peek='$d_msg_peek'
21851 d_msg_proxy='$d_msg_proxy'
21852 d_msgctl='$d_msgctl'
21853 d_msgget='$d_msgget'
21854 d_msghdr_s='$d_msghdr_s'
21855 d_msgrcv='$d_msgrcv'
21856 d_msgsnd='$d_msgsnd'
21857 d_msync='$d_msync'
21858 d_munmap='$d_munmap'
21859 d_mymalloc='$d_mymalloc'
21860 d_nice='$d_nice'
21861 d_nl_langinfo='$d_nl_langinfo'
21862 d_nv_preserves_uv='$d_nv_preserves_uv'
21863 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21864 d_off64_t='$d_off64_t'
21865 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21866 d_oldpthreads='$d_oldpthreads'
21867 d_oldsock='$d_oldsock'
21868 d_open3='$d_open3'
21869 d_pathconf='$d_pathconf'
21870 d_pause='$d_pause'
21871 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21872 d_phostname='$d_phostname'
21873 d_pipe='$d_pipe'
21874 d_poll='$d_poll'
21875 d_portable='$d_portable'
21876 d_printf_format_null='$d_printf_format_null'
21877 d_procselfexe='$d_procselfexe'
21878 d_pseudofork='$d_pseudofork'
21879 d_pthread_atfork='$d_pthread_atfork'
21880 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21881 d_pthread_yield='$d_pthread_yield'
21882 d_pwage='$d_pwage'
21883 d_pwchange='$d_pwchange'
21884 d_pwclass='$d_pwclass'
21885 d_pwcomment='$d_pwcomment'
21886 d_pwexpire='$d_pwexpire'
21887 d_pwgecos='$d_pwgecos'
21888 d_pwpasswd='$d_pwpasswd'
21889 d_pwquota='$d_pwquota'
21890 d_qgcvt='$d_qgcvt'
21891 d_quad='$d_quad'
21892 d_random_r='$d_random_r'
21893 d_readdir64_r='$d_readdir64_r'
21894 d_readdir='$d_readdir'
21895 d_readdir_r='$d_readdir_r'
21896 d_readlink='$d_readlink'
21897 d_readv='$d_readv'
21898 d_recvmsg='$d_recvmsg'
21899 d_rename='$d_rename'
21900 d_rewinddir='$d_rewinddir'
21901 d_rmdir='$d_rmdir'
21902 d_safebcpy='$d_safebcpy'
21903 d_safemcpy='$d_safemcpy'
21904 d_sanemcmp='$d_sanemcmp'
21905 d_sbrkproto='$d_sbrkproto'
21906 d_scalbnl='$d_scalbnl'
21907 d_sched_yield='$d_sched_yield'
21908 d_scm_rights='$d_scm_rights'
21909 d_seekdir='$d_seekdir'
21910 d_select='$d_select'
21911 d_sem='$d_sem'
21912 d_semctl='$d_semctl'
21913 d_semctl_semid_ds='$d_semctl_semid_ds'
21914 d_semctl_semun='$d_semctl_semun'
21915 d_semget='$d_semget'
21916 d_semop='$d_semop'
21917 d_sendmsg='$d_sendmsg'
21918 d_setegid='$d_setegid'
21919 d_seteuid='$d_seteuid'
21920 d_setgrent='$d_setgrent'
21921 d_setgrent_r='$d_setgrent_r'
21922 d_setgrps='$d_setgrps'
21923 d_sethent='$d_sethent'
21924 d_sethostent_r='$d_sethostent_r'
21925 d_setitimer='$d_setitimer'
21926 d_setlinebuf='$d_setlinebuf'
21927 d_setlocale='$d_setlocale'
21928 d_setlocale_r='$d_setlocale_r'
21929 d_setnent='$d_setnent'
21930 d_setnetent_r='$d_setnetent_r'
21931 d_setpent='$d_setpent'
21932 d_setpgid='$d_setpgid'
21933 d_setpgrp2='$d_setpgrp2'
21934 d_setpgrp='$d_setpgrp'
21935 d_setprior='$d_setprior'
21936 d_setproctitle='$d_setproctitle'
21937 d_setprotoent_r='$d_setprotoent_r'
21938 d_setpwent='$d_setpwent'
21939 d_setpwent_r='$d_setpwent_r'
21940 d_setregid='$d_setregid'
21941 d_setresgid='$d_setresgid'
21942 d_setresuid='$d_setresuid'
21943 d_setreuid='$d_setreuid'
21944 d_setrgid='$d_setrgid'
21945 d_setruid='$d_setruid'
21946 d_setsent='$d_setsent'
21947 d_setservent_r='$d_setservent_r'
21948 d_setsid='$d_setsid'
21949 d_setvbuf='$d_setvbuf'
21950 d_sfio='$d_sfio'
21951 d_shm='$d_shm'
21952 d_shmat='$d_shmat'
21953 d_shmatprototype='$d_shmatprototype'
21954 d_shmctl='$d_shmctl'
21955 d_shmdt='$d_shmdt'
21956 d_shmget='$d_shmget'
21957 d_sigaction='$d_sigaction'
21958 d_signbit='$d_signbit'
21959 d_sigprocmask='$d_sigprocmask'
21960 d_sigsetjmp='$d_sigsetjmp'
21961 d_sitearch='$d_sitearch'
21962 d_snprintf='$d_snprintf'
21963 d_sockatmark='$d_sockatmark'
21964 d_sockatmarkproto='$d_sockatmarkproto'
21965 d_socket='$d_socket'
21966 d_socklen_t='$d_socklen_t'
21967 d_sockpair='$d_sockpair'
21968 d_socks5_init='$d_socks5_init'
21969 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21970 d_sqrtl='$d_sqrtl'
21971 d_srand48_r='$d_srand48_r'
21972 d_srandom_r='$d_srandom_r'
21973 d_sresgproto='$d_sresgproto'
21974 d_sresuproto='$d_sresuproto'
21975 d_statblks='$d_statblks'
21976 d_statfs_f_flags='$d_statfs_f_flags'
21977 d_statfs_s='$d_statfs_s'
21978 d_statvfs='$d_statvfs'
21979 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21980 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21981 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21982 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21983 d_stdio_stream_array='$d_stdio_stream_array'
21984 d_stdiobase='$d_stdiobase'
21985 d_stdstdio='$d_stdstdio'
21986 d_strchr='$d_strchr'
21987 d_strcoll='$d_strcoll'
21988 d_strctcpy='$d_strctcpy'
21989 d_strerrm='$d_strerrm'
21990 d_strerror='$d_strerror'
21991 d_strerror_r='$d_strerror_r'
21992 d_strftime='$d_strftime'
21993 d_strlcat='$d_strlcat'
21994 d_strlcpy='$d_strlcpy'
21995 d_strtod='$d_strtod'
21996 d_strtol='$d_strtol'
21997 d_strtold='$d_strtold'
21998 d_strtoll='$d_strtoll'
21999 d_strtoq='$d_strtoq'
22000 d_strtoul='$d_strtoul'
22001 d_strtoull='$d_strtoull'
22002 d_strtouq='$d_strtouq'
22003 d_strxfrm='$d_strxfrm'
22004 d_suidsafe='$d_suidsafe'
22005 d_symlink='$d_symlink'
22006 d_syscall='$d_syscall'
22007 d_syscallproto='$d_syscallproto'
22008 d_sysconf='$d_sysconf'
22009 d_sysernlst='$d_sysernlst'
22010 d_syserrlst='$d_syserrlst'
22011 d_system='$d_system'
22012 d_tcgetpgrp='$d_tcgetpgrp'
22013 d_tcsetpgrp='$d_tcsetpgrp'
22014 d_telldir='$d_telldir'
22015 d_telldirproto='$d_telldirproto'
22016 d_time='$d_time'
22017 d_times='$d_times'
22018 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22019 d_tm_tm_zone='$d_tm_tm_zone'
22020 d_tmpnam_r='$d_tmpnam_r'
22021 d_truncate='$d_truncate'
22022 d_ttyname_r='$d_ttyname_r'
22023 d_tzname='$d_tzname'
22024 d_u32align='$d_u32align'
22025 d_ualarm='$d_ualarm'
22026 d_umask='$d_umask'
22027 d_uname='$d_uname'
22028 d_union_semun='$d_union_semun'
22029 d_unordered='$d_unordered'
22030 d_unsetenv='$d_unsetenv'
22031 d_usleep='$d_usleep'
22032 d_usleepproto='$d_usleepproto'
22033 d_ustat='$d_ustat'
22034 d_vendorarch='$d_vendorarch'
22035 d_vendorbin='$d_vendorbin'
22036 d_vendorlib='$d_vendorlib'
22037 d_vendorscript='$d_vendorscript'
22038 d_vfork='$d_vfork'
22039 d_void_closedir='$d_void_closedir'
22040 d_voidsig='$d_voidsig'
22041 d_voidtty='$d_voidtty'
22042 d_volatile='$d_volatile'
22043 d_vprintf='$d_vprintf'
22044 d_vsnprintf='$d_vsnprintf'
22045 d_wait4='$d_wait4'
22046 d_waitpid='$d_waitpid'
22047 d_wcstombs='$d_wcstombs'
22048 d_wctomb='$d_wctomb'
22049 d_writev='$d_writev'
22050 d_xenix='$d_xenix'
22051 date='$date'
22052 db_hashtype='$db_hashtype'
22053 db_prefixtype='$db_prefixtype'
22054 db_version_major='$db_version_major'
22055 db_version_minor='$db_version_minor'
22056 db_version_patch='$db_version_patch'
22057 defvoidused='$defvoidused'
22058 direntrytype='$direntrytype'
22059 dlext='$dlext'
22060 dlsrc='$dlsrc'
22061 doublesize='$doublesize'
22062 drand01='$drand01'
22063 drand48_r_proto='$drand48_r_proto'
22064 dynamic_ext='$dynamic_ext'
22065 eagain='$eagain'
22066 ebcdic='$ebcdic'
22067 echo='$echo'
22068 egrep='$egrep'
22069 emacs='$emacs'
22070 endgrent_r_proto='$endgrent_r_proto'
22071 endhostent_r_proto='$endhostent_r_proto'
22072 endnetent_r_proto='$endnetent_r_proto'
22073 endprotoent_r_proto='$endprotoent_r_proto'
22074 endpwent_r_proto='$endpwent_r_proto'
22075 endservent_r_proto='$endservent_r_proto'
22076 eunicefix='$eunicefix'
22077 exe_ext='$exe_ext'
22078 expr='$expr'
22079 extensions='$extensions'
22080 extras='$extras'
22081 fflushNULL='$fflushNULL'
22082 fflushall='$fflushall'
22083 find='$find'
22084 firstmakefile='$firstmakefile'
22085 flex='$flex'
22086 fpossize='$fpossize'
22087 fpostype='$fpostype'
22088 freetype='$freetype'
22089 from='$from'
22090 full_ar='$full_ar'
22091 full_csh='$full_csh'
22092 full_sed='$full_sed'
22093 gccansipedantic='$gccansipedantic'
22094 gccosandvers='$gccosandvers'
22095 gccversion='$gccversion'
22096 getgrent_r_proto='$getgrent_r_proto'
22097 getgrgid_r_proto='$getgrgid_r_proto'
22098 getgrnam_r_proto='$getgrnam_r_proto'
22099 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22100 gethostbyname_r_proto='$gethostbyname_r_proto'
22101 gethostent_r_proto='$gethostent_r_proto'
22102 getlogin_r_proto='$getlogin_r_proto'
22103 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22104 getnetbyname_r_proto='$getnetbyname_r_proto'
22105 getnetent_r_proto='$getnetent_r_proto'
22106 getprotobyname_r_proto='$getprotobyname_r_proto'
22107 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22108 getprotoent_r_proto='$getprotoent_r_proto'
22109 getpwent_r_proto='$getpwent_r_proto'
22110 getpwnam_r_proto='$getpwnam_r_proto'
22111 getpwuid_r_proto='$getpwuid_r_proto'
22112 getservbyname_r_proto='$getservbyname_r_proto'
22113 getservbyport_r_proto='$getservbyport_r_proto'
22114 getservent_r_proto='$getservent_r_proto'
22115 getspnam_r_proto='$getspnam_r_proto'
22116 gidformat='$gidformat'
22117 gidsign='$gidsign'
22118 gidsize='$gidsize'
22119 gidtype='$gidtype'
22120 glibpth='$glibpth'
22121 gmake='$gmake'
22122 gmtime_r_proto='$gmtime_r_proto'
22123 gnulibc_version='$gnulibc_version'
22124 grep='$grep'
22125 groupcat='$groupcat'
22126 groupstype='$groupstype'
22127 gzip='$gzip'
22128 h_fcntl='$h_fcntl'
22129 h_sysfile='$h_sysfile'
22130 hint='$hint'
22131 hostcat='$hostcat'
22132 html1dir='$html1dir'
22133 html1direxp='$html1direxp'
22134 html3dir='$html3dir'
22135 html3direxp='$html3direxp'
22136 i16size='$i16size'
22137 i16type='$i16type'
22138 i32size='$i32size'
22139 i32type='$i32type'
22140 i64size='$i64size'
22141 i64type='$i64type'
22142 i8size='$i8size'
22143 i8type='$i8type'
22144 i_arpainet='$i_arpainet'
22145 i_bsdioctl='$i_bsdioctl'
22146 i_crypt='$i_crypt'
22147 i_db='$i_db'
22148 i_dbm='$i_dbm'
22149 i_dirent='$i_dirent'
22150 i_dld='$i_dld'
22151 i_dlfcn='$i_dlfcn'
22152 i_fcntl='$i_fcntl'
22153 i_float='$i_float'
22154 i_fp='$i_fp'
22155 i_fp_class='$i_fp_class'
22156 i_gdbm='$i_gdbm'
22157 i_grp='$i_grp'
22158 i_ieeefp='$i_ieeefp'
22159 i_inttypes='$i_inttypes'
22160 i_langinfo='$i_langinfo'
22161 i_libutil='$i_libutil'
22162 i_limits='$i_limits'
22163 i_locale='$i_locale'
22164 i_machcthr='$i_machcthr'
22165 i_malloc='$i_malloc'
22166 i_math='$i_math'
22167 i_memory='$i_memory'
22168 i_mntent='$i_mntent'
22169 i_ndbm='$i_ndbm'
22170 i_netdb='$i_netdb'
22171 i_neterrno='$i_neterrno'
22172 i_netinettcp='$i_netinettcp'
22173 i_niin='$i_niin'
22174 i_poll='$i_poll'
22175 i_prot='$i_prot'
22176 i_pthread='$i_pthread'
22177 i_pwd='$i_pwd'
22178 i_rpcsvcdbm='$i_rpcsvcdbm'
22179 i_sfio='$i_sfio'
22180 i_sgtty='$i_sgtty'
22181 i_shadow='$i_shadow'
22182 i_socks='$i_socks'
22183 i_stdarg='$i_stdarg'
22184 i_stddef='$i_stddef'
22185 i_stdlib='$i_stdlib'
22186 i_string='$i_string'
22187 i_sunmath='$i_sunmath'
22188 i_sysaccess='$i_sysaccess'
22189 i_sysdir='$i_sysdir'
22190 i_sysfile='$i_sysfile'
22191 i_sysfilio='$i_sysfilio'
22192 i_sysin='$i_sysin'
22193 i_sysioctl='$i_sysioctl'
22194 i_syslog='$i_syslog'
22195 i_sysmman='$i_sysmman'
22196 i_sysmode='$i_sysmode'
22197 i_sysmount='$i_sysmount'
22198 i_sysndir='$i_sysndir'
22199 i_sysparam='$i_sysparam'
22200 i_sysresrc='$i_sysresrc'
22201 i_syssecrt='$i_syssecrt'
22202 i_sysselct='$i_sysselct'
22203 i_syssockio='$i_syssockio'
22204 i_sysstat='$i_sysstat'
22205 i_sysstatfs='$i_sysstatfs'
22206 i_sysstatvfs='$i_sysstatvfs'
22207 i_systime='$i_systime'
22208 i_systimek='$i_systimek'
22209 i_systimes='$i_systimes'
22210 i_systypes='$i_systypes'
22211 i_sysuio='$i_sysuio'
22212 i_sysun='$i_sysun'
22213 i_sysutsname='$i_sysutsname'
22214 i_sysvfs='$i_sysvfs'
22215 i_syswait='$i_syswait'
22216 i_termio='$i_termio'
22217 i_termios='$i_termios'
22218 i_time='$i_time'
22219 i_unistd='$i_unistd'
22220 i_ustat='$i_ustat'
22221 i_utime='$i_utime'
22222 i_values='$i_values'
22223 i_varargs='$i_varargs'
22224 i_varhdr='$i_varhdr'
22225 i_vfork='$i_vfork'
22226 ignore_versioned_solibs='$ignore_versioned_solibs'
22227 inc_version_list='$inc_version_list'
22228 inc_version_list_init='$inc_version_list_init'
22229 incpath='$incpath'
22230 inews='$inews'
22231 initialinstalllocation='$initialinstalllocation'
22232 installarchlib='$installarchlib'
22233 installbin='$installbin'
22234 installhtml1dir='$installhtml1dir'
22235 installhtml3dir='$installhtml3dir'
22236 installman1dir='$installman1dir'
22237 installman3dir='$installman3dir'
22238 installprefix='$installprefix'
22239 installprefixexp='$installprefixexp'
22240 installprivlib='$installprivlib'
22241 installscript='$installscript'
22242 installsitearch='$installsitearch'
22243 installsitebin='$installsitebin'
22244 installsitehtml1dir='$installsitehtml1dir'
22245 installsitehtml3dir='$installsitehtml3dir'
22246 installsitelib='$installsitelib'
22247 installsiteman1dir='$installsiteman1dir'
22248 installsiteman3dir='$installsiteman3dir'
22249 installsitescript='$installsitescript'
22250 installstyle='$installstyle'
22251 installusrbinperl='$installusrbinperl'
22252 installvendorarch='$installvendorarch'
22253 installvendorbin='$installvendorbin'
22254 installvendorhtml1dir='$installvendorhtml1dir'
22255 installvendorhtml3dir='$installvendorhtml3dir'
22256 installvendorlib='$installvendorlib'
22257 installvendorman1dir='$installvendorman1dir'
22258 installvendorman3dir='$installvendorman3dir'
22259 installvendorscript='$installvendorscript'
22260 intsize='$intsize'
22261 issymlink='$issymlink'
22262 ivdformat='$ivdformat'
22263 ivsize='$ivsize'
22264 ivtype='$ivtype'
22265 known_extensions='$known_extensions'
22266 ksh='$ksh'
22267 ld='$ld'
22268 lddlflags='$lddlflags'
22269 ldflags='$ldflags'
22270 ldflags_uselargefiles='$ldflags_uselargefiles'
22271 ldlibpthname='$ldlibpthname'
22272 less='$less'
22273 lib_ext='$lib_ext'
22274 libc='$libc'
22275 libperl='$libperl'
22276 libpth='$libpth'
22277 libs='$libs'
22278 libsdirs='$libsdirs'
22279 libsfiles='$libsfiles'
22280 libsfound='$libsfound'
22281 libspath='$libspath'
22282 libswanted='$libswanted'
22283 libswanted_uselargefiles='$libswanted_uselargefiles'
22284 line='$line'
22285 lint='$lint'
22286 lkflags='$lkflags'
22287 ln='$ln'
22288 lns='$lns'
22289 localtime_r_proto='$localtime_r_proto'
22290 locincpth='$locincpth'
22291 loclibpth='$loclibpth'
22292 longdblsize='$longdblsize'
22293 longlongsize='$longlongsize'
22294 longsize='$longsize'
22295 lp='$lp'
22296 lpr='$lpr'
22297 ls='$ls'
22298 lseeksize='$lseeksize'
22299 lseektype='$lseektype'
22300 mad='$mad'
22301 madlyh='$madlyh'
22302 madlyobj='$madlyobj'
22303 madlysrc='$madlysrc'
22304 mail='$mail'
22305 mailx='$mailx'
22306 make='$make'
22307 make_set_make='$make_set_make'
22308 mallocobj='$mallocobj'
22309 mallocsrc='$mallocsrc'
22310 malloctype='$malloctype'
22311 man1dir='$man1dir'
22312 man1direxp='$man1direxp'
22313 man1ext='$man1ext'
22314 man3dir='$man3dir'
22315 man3direxp='$man3direxp'
22316 man3ext='$man3ext'
22317 mips_type='$mips_type'
22318 mistrustnm='$mistrustnm'
22319 mkdir='$mkdir'
22320 mmaptype='$mmaptype'
22321 modetype='$modetype'
22322 more='$more'
22323 multiarch='$multiarch'
22324 mv='$mv'
22325 myarchname='$myarchname'
22326 mydomain='$mydomain'
22327 myhostname='$myhostname'
22328 myuname='$myuname'
22329 n='$n'
22330 need_va_copy='$need_va_copy'
22331 netdb_hlen_type='$netdb_hlen_type'
22332 netdb_host_type='$netdb_host_type'
22333 netdb_name_type='$netdb_name_type'
22334 netdb_net_type='$netdb_net_type'
22335 nm='$nm'
22336 nm_opt='$nm_opt'
22337 nm_so_opt='$nm_so_opt'
22338 nonxs_ext='$nonxs_ext'
22339 nroff='$nroff'
22340 nvEUformat='$nvEUformat'
22341 nvFUformat='$nvFUformat'
22342 nvGUformat='$nvGUformat'
22343 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22344 nveformat='$nveformat'
22345 nvfformat='$nvfformat'
22346 nvgformat='$nvgformat'
22347 nvsize='$nvsize'
22348 nvtype='$nvtype'
22349 o_nonblock='$o_nonblock'
22350 obj_ext='$obj_ext'
22351 old_pthread_create_joinable='$old_pthread_create_joinable'
22352 optimize='$optimize'
22353 orderlib='$orderlib'
22354 osname='$osname'
22355 osvers='$osvers'
22356 otherlibdirs='$otherlibdirs'
22357 package='$package'
22358 pager='$pager'
22359 passcat='$passcat'
22360 patchlevel='$patchlevel'
22361 path_sep='$path_sep'
22362 perl5='$perl5'
22363 perl='$perl'
22364 perl_patchlevel='$perl_patchlevel'
22365 perladmin='$perladmin'
22366 perllibs='$perllibs'
22367 perlpath='$perlpath'
22368 pg='$pg'
22369 phostname='$phostname'
22370 pidtype='$pidtype'
22371 plibpth='$plibpth'
22372 pmake='$pmake'
22373 pr='$pr'
22374 prefix='$prefix'
22375 prefixexp='$prefixexp'
22376 privlib='$privlib'
22377 privlibexp='$privlibexp'
22378 procselfexe='$procselfexe'
22379 prototype='$prototype'
22380 ptrsize='$ptrsize'
22381 quadkind='$quadkind'
22382 quadtype='$quadtype'
22383 randbits='$randbits'
22384 randfunc='$randfunc'
22385 random_r_proto='$random_r_proto'
22386 randseedtype='$randseedtype'
22387 ranlib='$ranlib'
22388 rd_nodata='$rd_nodata'
22389 readdir64_r_proto='$readdir64_r_proto'
22390 readdir_r_proto='$readdir_r_proto'
22391 revision='$revision'
22392 rm='$rm'
22393 rm_try='$rm_try'
22394 rmail='$rmail'
22395 run='$run'
22396 runnm='$runnm'
22397 sPRIEUldbl='$sPRIEUldbl'
22398 sPRIFUldbl='$sPRIFUldbl'
22399 sPRIGUldbl='$sPRIGUldbl'
22400 sPRIXU64='$sPRIXU64'
22401 sPRId64='$sPRId64'
22402 sPRIeldbl='$sPRIeldbl'
22403 sPRIfldbl='$sPRIfldbl'
22404 sPRIgldbl='$sPRIgldbl'
22405 sPRIi64='$sPRIi64'
22406 sPRIo64='$sPRIo64'
22407 sPRIu64='$sPRIu64'
22408 sPRIx64='$sPRIx64'
22409 sSCNfldbl='$sSCNfldbl'
22410 sched_yield='$sched_yield'
22411 scriptdir='$scriptdir'
22412 scriptdirexp='$scriptdirexp'
22413 sed='$sed'
22414 seedfunc='$seedfunc'
22415 selectminbits='$selectminbits'
22416 selecttype='$selecttype'
22417 sendmail='$sendmail'
22418 setgrent_r_proto='$setgrent_r_proto'
22419 sethostent_r_proto='$sethostent_r_proto'
22420 setlocale_r_proto='$setlocale_r_proto'
22421 setnetent_r_proto='$setnetent_r_proto'
22422 setprotoent_r_proto='$setprotoent_r_proto'
22423 setpwent_r_proto='$setpwent_r_proto'
22424 setservent_r_proto='$setservent_r_proto'
22425 sh='$sh'
22426 shar='$shar'
22427 sharpbang='$sharpbang'
22428 shmattype='$shmattype'
22429 shortsize='$shortsize'
22430 shrpenv='$shrpenv'
22431 shsharp='$shsharp'
22432 sig_count='$sig_count'
22433 sig_name='$sig_name'
22434 sig_name_init='$sig_name_init'
22435 sig_num='$sig_num'
22436 sig_num_init='$sig_num_init'
22437 sig_size='$sig_size'
22438 signal_t='$signal_t'
22439 sitearch='$sitearch'
22440 sitearchexp='$sitearchexp'
22441 sitebin='$sitebin'
22442 sitebinexp='$sitebinexp'
22443 sitehtml1dir='$sitehtml1dir'
22444 sitehtml1direxp='$sitehtml1direxp'
22445 sitehtml3dir='$sitehtml3dir'
22446 sitehtml3direxp='$sitehtml3direxp'
22447 sitelib='$sitelib'
22448 sitelib_stem='$sitelib_stem'
22449 sitelibexp='$sitelibexp'
22450 siteman1dir='$siteman1dir'
22451 siteman1direxp='$siteman1direxp'
22452 siteman3dir='$siteman3dir'
22453 siteman3direxp='$siteman3direxp'
22454 siteprefix='$siteprefix'
22455 siteprefixexp='$siteprefixexp'
22456 sitescript='$sitescript'
22457 sitescriptexp='$sitescriptexp'
22458 sizesize='$sizesize'
22459 sizetype='$sizetype'
22460 sleep='$sleep'
22461 smail='$smail'
22462 so='$so'
22463 sockethdr='$sockethdr'
22464 socketlib='$socketlib'
22465 socksizetype='$socksizetype'
22466 sort='$sort'
22467 spackage='$spackage'
22468 spitshell='$spitshell'
22469 srand48_r_proto='$srand48_r_proto'
22470 srandom_r_proto='$srandom_r_proto'
22471 src='$src'
22472 ssizetype='$ssizetype'
22473 startperl='$startperl'
22474 startsh='$startsh'
22475 static_ext='$static_ext'
22476 stdchar='$stdchar'
22477 stdio_base='$stdio_base'
22478 stdio_bufsiz='$stdio_bufsiz'
22479 stdio_cnt='$stdio_cnt'
22480 stdio_filbuf='$stdio_filbuf'
22481 stdio_ptr='$stdio_ptr'
22482 stdio_stream_array='$stdio_stream_array'
22483 strerror_r_proto='$strerror_r_proto'
22484 strings='$strings'
22485 submit='$submit'
22486 subversion='$subversion'
22487 sysman='$sysman'
22488 tail='$tail'
22489 tar='$tar'
22490 targetarch='$targetarch'
22491 tbl='$tbl'
22492 tee='$tee'
22493 test='$test'
22494 timeincl='$timeincl'
22495 timetype='$timetype'
22496 tmpnam_r_proto='$tmpnam_r_proto'
22497 to='$to'
22498 touch='$touch'
22499 tr='$tr'
22500 trnl='$trnl'
22501 troff='$troff'
22502 ttyname_r_proto='$ttyname_r_proto'
22503 u16size='$u16size'
22504 u16type='$u16type'
22505 u32size='$u32size'
22506 u32type='$u32type'
22507 u64size='$u64size'
22508 u64type='$u64type'
22509 u8size='$u8size'
22510 u8type='$u8type'
22511 uidformat='$uidformat'
22512 uidsign='$uidsign'
22513 uidsize='$uidsize'
22514 uidtype='$uidtype'
22515 uname='$uname'
22516 uniq='$uniq'
22517 uquadtype='$uquadtype'
22518 use5005threads='$use5005threads'
22519 use64bitall='$use64bitall'
22520 use64bitint='$use64bitint'
22521 usecrosscompile='$usecrosscompile'
22522 usedl='$usedl'
22523 usefaststdio='$usefaststdio'
22524 useithreads='$useithreads'
22525 uselargefiles='$uselargefiles'
22526 uselongdouble='$uselongdouble'
22527 usemallocwrap='$usemallocwrap'
22528 usemorebits='$usemorebits'
22529 usemultiplicity='$usemultiplicity'
22530 usemymalloc='$usemymalloc'
22531 usenm='$usenm'
22532 useopcode='$useopcode'
22533 useperlio='$useperlio'
22534 useposix='$useposix'
22535 usereentrant='$usereentrant'
22536 userelocatableinc='$userelocatableinc'
22537 usesfio='$usesfio'
22538 useshrplib='$useshrplib'
22539 usesitecustomize='$usesitecustomize'
22540 usesocks='$usesocks'
22541 usethreads='$usethreads'
22542 usevendorprefix='$usevendorprefix'
22543 usevfork='$usevfork'
22544 usrinc='$usrinc'
22545 uuname='$uuname'
22546 uvXUformat='$uvXUformat'
22547 uvoformat='$uvoformat'
22548 uvsize='$uvsize'
22549 uvtype='$uvtype'
22550 uvuformat='$uvuformat'
22551 uvxformat='$uvxformat'
22552 vendorarch='$vendorarch'
22553 vendorarchexp='$vendorarchexp'
22554 vendorbin='$vendorbin'
22555 vendorbinexp='$vendorbinexp'
22556 vendorhtml1dir='$vendorhtml1dir'
22557 vendorhtml1direxp='$vendorhtml1direxp'
22558 vendorhtml3dir='$vendorhtml3dir'
22559 vendorhtml3direxp='$vendorhtml3direxp'
22560 vendorlib='$vendorlib'
22561 vendorlib_stem='$vendorlib_stem'
22562 vendorlibexp='$vendorlibexp'
22563 vendorman1dir='$vendorman1dir'
22564 vendorman1direxp='$vendorman1direxp'
22565 vendorman3dir='$vendorman3dir'
22566 vendorman3direxp='$vendorman3direxp'
22567 vendorprefix='$vendorprefix'
22568 vendorprefixexp='$vendorprefixexp'
22569 vendorscript='$vendorscript'
22570 vendorscriptexp='$vendorscriptexp'
22571 version='$version'
22572 version_patchlevel_string='$version_patchlevel_string'
22573 versiononly='$versiononly'
22574 vi='$vi'
22575 voidflags='$voidflags'
22576 xlibpth='$xlibpth'
22577 yacc='$yacc'
22578 yaccflags='$yaccflags'
22579 zcat='$zcat'
22580 zip='$zip'
22581 EOT
22582
22583 : Add in command line options if available
22584 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22585
22586 : add special variables
22587 $test -f $src/patchlevel.h && \
22588 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22589 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22590 echo "PERL_CONFIG_SH=true" >>config.sh
22591
22592 : propagate old symbols
22593 if $test -f UU/config.sh; then
22594         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22595         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22596         $sort | $uniq -u >UU/oldsyms
22597         set X `cat UU/oldsyms`
22598         shift
22599         case $# in
22600         0) ;;
22601         *)
22602                 cat <<EOM
22603 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22604 EOM
22605                 echo "# Variables propagated from previous config.sh file." >>config.sh
22606                 for sym in `cat UU/oldsyms`; do
22607                         echo "    Propagating $hint variable "'$'"$sym..."
22608                         eval 'tmp="$'"${sym}"'"'
22609                         echo "$tmp" | \
22610                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22611                 done
22612                 ;;
22613         esac
22614 fi
22615
22616 : Finish up by extracting the .SH files
22617 case "$alldone" in
22618 exit)
22619         $rm -rf UU
22620         echo "Extraction done."
22621         exit 0
22622         ;;
22623 cont)
22624         ;;
22625 '')
22626         dflt=''
22627         nostick=true
22628         $cat <<EOM
22629
22630 If you'd like to make any changes to the config.sh file before I begin
22631 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22632
22633 EOM
22634         rp="Press return or use a shell escape to edit config.sh:"
22635         . UU/myread
22636         nostick=''
22637         case "$ans" in
22638         '') ;;
22639         *) : in case they cannot read
22640                 sh 1>&4 -c "$ans";;
22641         esac
22642         ;;
22643 esac
22644
22645 : if this fails, just run all the .SH files by hand
22646 . ./config.sh
22647
22648 echo " "
22649 exec 1>&4
22650 pwd=`pwd`
22651 . ./UU/extract
22652 cd "$pwd"
22653
22654 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22655         dflt=y
22656         case "$silent" in
22657         true) ;;
22658         *)
22659                 $cat <<EOM
22660
22661 Now you need to generate make dependencies by running "$make depend".
22662 You might prefer to run it in background: "$make depend > makedepend.out &"
22663 It can take a while, so you might not want to run it right now.
22664
22665 EOM
22666                 ;;
22667         esac
22668         rp="Run $make depend now?"
22669         . UU/myread
22670         case "$ans" in
22671         y*)
22672                 $make depend && echo "Now you must run '$make'."
22673                 ;;
22674         *)
22675                 echo "You must run '$make depend' then '$make'."
22676                 ;;
22677         esac
22678 elif test -f [Mm]akefile; then
22679         echo " "
22680         echo "Now you must run a $make."
22681 else
22682         echo "Configure done."
22683 fi
22684
22685 if $test -f Policy.sh; then
22686     $cat <<EOM
22687
22688 If you compile $package on a different machine or from a different object
22689 directory, copy the Policy.sh file from this object directory to the
22690 new one before you run Configure -- this will help you with most of
22691 the policy defaults.
22692
22693 EOM
22694 fi
22695 if $test -f config.msg; then
22696     echo "Hmm.  I also noted the following information while running:"
22697     echo " "
22698     $cat config.msg >&4
22699     $rm -f config.msg
22700 fi
22701 $rm -f kit*isdone ark*isdone
22702 $rm -rf UU
22703
22704 : End of Configure
22705