Less sed'ing in Cygwin Makefile.SHs
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Wed Jun 13 22:14:49 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         case "`$cc -v -c try.c 2>&1`" in
2507         *gcc*) trygcc=no ;;
2508         esac
2509         if $test X"$trygcc" = Xyes; then
2510             if gcc -o try -c try.c; then
2511                 echo " "
2512                 echo "You seem to have a working gcc, though." >&4
2513                 rp="Would you like to use it?"
2514                 dflt=y
2515                 if $test -f myread; then
2516                     . ./myread
2517                 else
2518                     if $test -f UU/myread; then
2519                         . ./UU/myread
2520                     else
2521                         echo "Cannot find myread, sorry.  Aborting." >&2
2522                         exit 1
2523                     fi
2524                 fi  
2525                 case "$ans" in
2526                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2527                        if $test -f usethreads.cbu; then
2528                            $cat >&4 <<EOM 
2529
2530 *** However, any setting of the C compiler flags (e.g. for thread support)
2531 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2532 *** (together with e.g. -Dusethreads).
2533
2534 EOM
2535                        fi;;
2536                 esac
2537             fi
2538         fi
2539     fi
2540     $rm -f try try.*
2541     ;;
2542 esac
2543 EOSC
2544
2545 cat <<EOS >checkcc
2546 $startsh
2547 EOS
2548 cat <<'EOSC' >>checkcc
2549 case "$cc" in        
2550 '') ;;
2551 *)  $rm -f try try.*              
2552     $cat >try.c <<EOM
2553 int main(int argc, char *argv[]) {
2554   return 0;
2555 }
2556 EOM
2557     if $cc -o try $ccflags $ldflags try.c; then
2558        :
2559     else
2560         if $test X"$despair" = Xyes; then
2561            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2562         fi
2563         $cat >&4 <<EOM         
2564 You need to find a working C compiler.
2565 Either (purchase and) install the C compiler supplied by your OS vendor,
2566 or for a free C compiler try http://gcc.gnu.org/
2567 I cannot continue any further, aborting.
2568 EOM
2569         exit 1
2570     fi
2571     $rm -f try try.*
2572     ;;
2573 esac
2574 EOSC
2575
2576 : determine whether symbolic links are supported
2577 echo " "
2578 $touch blurfl
2579 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2580         echo "Symbolic links are supported." >&4
2581         lns="$ln -s"
2582 else
2583         echo "Symbolic links are NOT supported." >&4
2584         lns="$ln"
2585 fi
2586 $rm -f blurfl sym
2587
2588 : determine whether symbolic links are supported
2589 echo " "
2590 case "$lns" in
2591 *"ln"*" -s")
2592         echo "Checking how to test for symbolic links..." >&4
2593         $lns blurfl sym
2594         if $test "X$issymlink" = X; then
2595                 case "$newsh" in
2596                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2597                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2598                 esac
2599                 if test $? = 0; then
2600                         issymlink="test -h"
2601                 else
2602                         echo "Your builtin 'test -h' may be broken." >&4
2603                         case "$test" in
2604                         /*)     ;;
2605                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2606                                 for p in $pth
2607                                 do
2608                                         if test -f "$p/$test"; then
2609                                                 test="$p/$test"
2610                                                 break
2611                                         fi
2612                                 done
2613                                 ;;
2614                         esac
2615                         case "$test" in
2616                         /*)
2617                                 echo "Trying external '$test -h'." >&4
2618                                 issymlink="$test -h"
2619                                 if $test ! -h sym >/dev/null 2>&1; then
2620                                         echo "External '$test -h' is broken, too." >&4
2621                                         issymlink=''
2622                                 fi
2623                                 ;;
2624                         *)      issymlink='' ;;
2625                         esac
2626                 fi              
2627         fi
2628         if $test "X$issymlink" = X; then
2629                 if $test -L sym 2>/dev/null; then
2630                         issymlink="$test -L"
2631                         echo "The builtin '$test -L' worked." >&4
2632                 fi
2633         fi
2634         if $test "X$issymlink" != X; then
2635                 echo "You can test for symbolic links with '$issymlink'." >&4
2636         else
2637                 echo "I do not know how you can test for symbolic links." >&4
2638         fi
2639         $rm -f blurfl sym
2640         ;;
2641 *)      echo "No symbolic links, so not testing for their testing..." >&4
2642         ;;
2643 esac
2644 echo " "
2645
2646
2647 case "$mksymlinks" in
2648 $define|true|[yY]*)
2649         case "$src" in
2650         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2651                 exit 1
2652                 ;;
2653         *)      case "$lns:$issymlink" in
2654                 *"ln"*" -s:"*"test -"?)
2655                         echo "Creating the symbolic links..." >&4
2656                         echo "(First creating the subdirectories...)" >&4
2657                         cd ..
2658                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2659                                 read directory
2660                                 test -z "$directory" && break
2661                                 mkdir -p $directory
2662                         done
2663                         # Sanity check 1.
2664                         if test ! -d t/base; then
2665                                 echo "Failed to create the subdirectories.  Aborting." >&4
2666                                 exit 1
2667                         fi
2668                         echo "(Then creating the symlinks...)" >&4
2669                         awk '{print $1}' $src/MANIFEST | while true; do
2670                                 read filename
2671                                 test -z "$filename" && break
2672                                 if test -f $filename; then
2673                                         if $issymlink $filename; then
2674                                                 rm -f $filename
2675                                         fi
2676                                 fi
2677                                 if test -f $filename; then
2678                                         echo "$filename already exists, not symlinking."
2679                                 else
2680                                         ln -s $src/$filename $filename
2681                                 fi
2682                         done
2683                         # Sanity check 2.
2684                         if test ! -f t/base/lex.t; then
2685                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2686                                 exit 1
2687                         fi
2688                         cd UU
2689                         ;;
2690                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2691                         ;;
2692                 esac
2693                 ;;
2694         esac
2695         ;;
2696 esac
2697
2698
2699 case "$usecrosscompile" in
2700 $define|true|[yY]*)
2701         $echo "Cross-compiling..."
2702         croak=''
2703         case "$cc" in
2704         *-*-gcc) # A cross-compiling gcc, probably.
2705             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2706             ar=$targetarch-ar
2707             # leave out ld, choosing it is more complex
2708             nm=$targetarch-nm
2709             ranlib=$targetarch-ranlib
2710             $echo 'extern int foo;' > try.c
2711             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2712             shift
2713             if $test $# -gt 0; then
2714                 incpth="$incpth $*"
2715                 incpth="`$echo $incpth|$sed 's/^ //'`"
2716                 echo "Guessing incpth '$incpth'." >&4
2717                 for i in $*; do
2718                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2719                     if $test -d $j; then
2720                         libpth="$libpth $j"
2721                     fi
2722                 done   
2723                 libpth="`$echo $libpth|$sed 's/^ //'`"
2724                 echo "Guessing libpth '$libpth'." >&4
2725             fi
2726             $rm -f try.c
2727             ;;
2728         esac
2729         case "$targetarch" in
2730         '') echo "Targetarch not defined." >&4; croak=y ;;
2731         *)  echo "Using targetarch $targetarch." >&4 ;;
2732         esac
2733         case "$incpth" in
2734         '') echo "Incpth not defined." >&4; croak=y ;;
2735         *)  echo "Using incpth '$incpth'." >&4 ;;
2736         esac
2737         case "$libpth" in
2738         '') echo "Libpth not defined." >&4; croak=y ;;
2739         *)  echo "Using libpth '$libpth'." >&4 ;;
2740         esac
2741         case "$usrinc" in
2742         '') for i in $incpth; do
2743                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2744                     usrinc=$i
2745                     echo "Guessing usrinc $usrinc." >&4
2746                     break
2747                 fi
2748             done
2749             case "$usrinc" in
2750             '') echo "Usrinc not defined." >&4; croak=y ;;
2751             esac
2752             ;;
2753         *)  echo "Using usrinc $usrinc." >&4 ;;
2754         esac
2755         case "$targethost" in
2756         '') echo "Targethost not defined." >&4; croak=y ;;
2757         *)  echo "Using targethost $targethost." >&4
2758         esac
2759         locincpth=' '
2760         loclibpth=' '
2761         case "$croak" in
2762         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2763         esac
2764         case "$src" in
2765         /*) run=$src/Cross/run
2766             targetmkdir=$src/Cross/mkdir
2767             to=$src/Cross/to
2768             from=$src/Cross/from
2769             ;;
2770         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2771             run=$pwd/Cross/run
2772             targetmkdir=$pwd/Cross/mkdir
2773             to=$pwd/Cross/to
2774             from=$pwd/Cross/from
2775             ;;
2776         esac
2777         case "$targetrun" in
2778         '') targetrun=ssh ;;
2779         esac
2780         case "$targetto" in
2781         '') targetto=scp ;;
2782         esac
2783         case "$targetfrom" in
2784         '') targetfrom=scp ;;
2785         esac
2786         run=$run-$targetrun
2787         to=$to-$targetto
2788         from=$from-$targetfrom
2789         case "$targetdir" in
2790         '')  targetdir=/tmp
2791              echo "Guessing targetdir $targetdir." >&4
2792              ;;
2793         esac
2794         case "$targetuser" in
2795         '')  targetuser=root
2796              echo "Guessing targetuser $targetuser." >&4
2797              ;;
2798         esac
2799         case "$targetfrom" in
2800         scp)    q=-q ;;
2801         *)      q='' ;;
2802         esac
2803         case "$targetrun" in
2804         ssh|rsh)
2805             cat >$run <<EOF
2806 #!/bin/sh
2807 case "\$1" in
2808 -cwd)
2809   shift
2810   cwd=\$1
2811   shift
2812   ;;
2813 esac
2814 case "\$cwd" in
2815 '') cwd=$targetdir ;;
2816 esac
2817 exe=\$1
2818 shift
2819 if $test ! -f \$exe.xok; then
2820   $to \$exe
2821   $touch \$exe.xok
2822 fi
2823 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2824 EOF
2825             ;;
2826         *)  echo "Unknown targetrun '$targetrun'" >&4
2827             exit 1
2828             ;;
2829         esac
2830         case "$targetmkdir" in
2831         */Cross/mkdir)
2832             cat >$targetmkdir <<EOF
2833 #!/bin/sh
2834 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2835 EOF
2836             $chmod a+rx $targetmkdir
2837             ;;
2838         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2839             exit 1
2840             ;;
2841         esac
2842         case "$targetto" in
2843         scp|rcp)
2844             cat >$to <<EOF
2845 #!/bin/sh
2846 for f in \$@
2847 do
2848   case "\$f" in
2849   /*)
2850     $targetmkdir \`dirname \$f\`
2851     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2852     ;;
2853   *)
2854     $targetmkdir $targetdir/\`dirname \$f\`
2855     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2856     ;;
2857   esac
2858 done
2859 exit 0
2860 EOF
2861             ;;
2862         cp) cat >$to <<EOF
2863 #!/bin/sh
2864 for f in \$@
2865 do
2866   case "\$f" in
2867   /*)
2868     $mkdir -p $targetdir/\`dirname \$f\`
2869     $cp \$f $targetdir/\$f || exit 1
2870     ;;
2871   *)
2872     $targetmkdir $targetdir/\`dirname \$f\`
2873     $cp \$f $targetdir/\$f || exit 1
2874     ;;
2875   esac
2876 done
2877 exit 0
2878 EOF
2879             ;;
2880         *)  echo "Unknown targetto '$targetto'" >&4
2881             exit 1
2882             ;;
2883         esac
2884         case "$targetfrom" in
2885         scp|rcp)
2886           cat >$from <<EOF
2887 #!/bin/sh
2888 for f in \$@
2889 do
2890   $rm -f \$f
2891   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2892 done
2893 exit 0
2894 EOF
2895             ;;
2896         cp) cat >$from <<EOF
2897 #!/bin/sh
2898 for f in \$@
2899 do
2900   $rm -f \$f
2901   cp $targetdir/\$f . || exit 1
2902 done
2903 exit 0
2904 EOF
2905             ;;
2906         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2907             exit 1
2908             ;;
2909         esac
2910         if $test ! -f $run; then
2911             echo "Target 'run' script '$run' not found." >&4
2912         else
2913             $chmod a+rx $run
2914         fi
2915         if $test ! -f $to; then
2916             echo "Target 'to' script '$to' not found." >&4
2917         else
2918             $chmod a+rx $to
2919         fi
2920         if $test ! -f $from; then
2921             echo "Target 'from' script '$from' not found." >&4
2922         else
2923             $chmod a+rx $from
2924         fi
2925         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2926             exit 1
2927         fi
2928         cat >&4 <<EOF
2929 Using '$run' for remote execution,
2930 and '$from' and '$to'
2931 for remote file transfer.
2932 EOF
2933         ;;
2934 *)      run=''
2935         to=:
2936         from=:
2937         usecrosscompile='undef'
2938         targetarch=''
2939         ;;
2940 esac
2941
2942 : see whether [:lower:] and [:upper:] are supported character classes
2943 echo " "
2944 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2945 ABYZ)
2946         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2947         up='[:upper:]'
2948         low='[:lower:]'
2949         ;;
2950 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2951         # (0xd9 and 0xe2), therefore that is a nice testing point.
2952         if test "X$up" = X -o "X$low" = X; then
2953             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2954             rs) up='[A-Z]'
2955                 low='[a-z]'
2956                 ;;
2957             esac
2958         fi
2959         if test "X$up" = X -o "X$low" = X; then
2960             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2961             rs) up='A-Z'
2962                 low='a-z'
2963                 ;;
2964             esac
2965         fi
2966         if test "X$up" = X -o "X$low" = X; then
2967             case "`echo RS | od -x 2>/dev/null`" in
2968             *D9E2*|*d9e2*)
2969                 echo "Hey, this might be EBCDIC." >&4
2970                 if test "X$up" = X -o "X$low" = X; then
2971                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2972                     rs) up='[A-IJ-RS-Z]'
2973                         low='[a-ij-rs-z]'
2974                         ;;
2975                     esac
2976                 fi
2977                 if test "X$up" = X -o "X$low" = X; then
2978                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2979                     rs) up='A-IJ-RS-Z'
2980                         low='a-ij-rs-z'
2981                         ;;
2982                     esac
2983                 fi
2984                 ;;
2985             esac
2986         fi
2987 esac
2988 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2989 rs)
2990     echo "Using $up and $low to convert case." >&4
2991     ;;
2992 *)
2993     echo "I don't know how to translate letters from upper to lower case." >&4
2994     echo "Your tr is not acting any way I know of." >&4
2995     exit 1
2996     ;;
2997 esac
2998 : set up the translation script tr, must be called with ./tr of course
2999 cat >tr <<EOSC
3000 $startsh
3001 case "\$1\$2" in
3002 '[A-Z][a-z]') exec $tr '$up' '$low';;
3003 '[a-z][A-Z]') exec $tr '$low' '$up';;
3004 esac
3005 exec $tr "\$@"
3006 EOSC
3007 chmod +x tr
3008 $eunicefix tr
3009
3010 : Try to determine whether config.sh was made on this system
3011 case "$config_sh" in
3012 '')
3013 myuname=`$uname -a 2>/dev/null`
3014 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3015 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3016 # because the A-Z/a-z are not consecutive.
3017 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3018         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3019 newmyuname="$myuname"
3020 dflt=n
3021 case "$knowitall" in
3022 '')
3023         if test -f ../config.sh; then
3024                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3025                         eval "`grep myuname= ../config.sh`"
3026                 fi
3027                 if test "X$myuname" = "X$newmyuname"; then
3028                         dflt=y
3029                 fi
3030         fi
3031         ;;
3032 *) dflt=y;;
3033 esac
3034
3035 : Get old answers from old config file if Configure was run on the
3036 : same system, otherwise use the hints.
3037 hint=default
3038 cd ..
3039 if test -f config.sh; then
3040         echo " "
3041         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3042         . UU/myread
3043         case "$ans" in
3044         n*|N*) echo "OK, I'll ignore it."
3045                 mv config.sh config.sh.old
3046                 myuname="$newmyuname"
3047                 ;;
3048         *)  echo "Fetching default answers from your old config.sh file..." >&4
3049                 tmp_n="$n"
3050                 tmp_c="$c"
3051                 tmp_sh="$sh"
3052                 . ./config.sh
3053                 cp config.sh UU
3054                 n="$tmp_n"
3055                 c="$tmp_c"
3056                 : Older versions did not always set $sh.  Catch re-use of such
3057                 : an old config.sh.
3058                 case "$sh" in
3059                 '') sh="$tmp_sh" ;;
3060                 esac
3061                 hint=previous
3062                 ;;
3063         esac
3064 fi
3065 . ./UU/checkcc
3066 if test ! -f config.sh; then
3067         $cat <<EOM
3068
3069 First time through, eh?  I have some defaults handy for some systems
3070 that need some extra help getting the Configure answers right:
3071
3072 EOM
3073         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3074         dflt=''
3075         : Half the following guesses are probably wrong... If you have better
3076         : tests or hints, please send them to perlbug@perl.org
3077         : The metaconfig authors would also appreciate a copy...
3078         $test -f /irix && osname=irix
3079         $test -f /xenix && osname=sco_xenix
3080         $test -f /dynix && osname=dynix
3081         $test -f /dnix && osname=dnix
3082         $test -f /lynx.os && osname=lynxos
3083         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3084         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3085         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3086         $test -f /bin/mips && /bin/mips && osname=mips
3087         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3088                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3089         $test -d /usr/apollo/bin && osname=apollo
3090         $test -f /etc/saf/_sactab && osname=svr4
3091         $test -d /usr/include/minix && osname=minix
3092         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3093         if $test -d /MachTen -o -d /MachTen_Folder; then
3094                 osname=machten
3095                 if $test -x /sbin/version; then
3096                         osvers=`/sbin/version | $awk '{print $2}' |
3097                         $sed -e 's/[A-Za-z]$//'`
3098                 elif $test -x /usr/etc/version; then
3099                         osvers=`/usr/etc/version | $awk '{print $2}' |
3100                         $sed -e 's/[A-Za-z]$//'`
3101                 else
3102                         osvers="$2.$3"
3103                 fi
3104         fi
3105
3106         $test -f /sys/posix.dll &&
3107                 $test -f /usr/bin/what &&
3108                 set X `/usr/bin/what /sys/posix.dll` &&
3109                 $test "$3" = UWIN &&
3110                 osname=uwin &&
3111                 osvers="$5"
3112
3113         if $test -f $uname; then
3114                 set X $myuname
3115                 shift
3116
3117                 case "$5" in
3118                 fps*) osname=fps ;;
3119                 mips*)
3120                         case "$4" in
3121                         umips) osname=umips ;;
3122                         *) osname=mips ;;
3123                         esac;;
3124                 [23]100) osname=mips ;;
3125                 next*) osname=next ;;
3126                 i386*)
3127                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3128                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3129                                 osname='sco'
3130                                 osvers=$tmp
3131                         elif $test -f /etc/kconfig; then
3132                                 osname=isc
3133                                 if test "$lns" = "$ln -s"; then
3134                                         osvers=4
3135                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3136                                         osvers=3
3137                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3138                                         osvers=2
3139                                 fi
3140                         fi
3141                         tmp=''
3142                         ;;
3143                 pc*)
3144                         if test -n "$DJGPP"; then
3145                                 osname=dos
3146                                 osvers=djgpp
3147                         fi
3148                         ;;
3149                 esac
3150
3151                 case "$1" in
3152                 aix) osname=aix
3153                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3154                         case "$tmp" in
3155                         # oslevel can fail with:
3156                         # oslevel: Unable to acquire lock.
3157                         *not\ found) osvers="$4"."$3" ;;
3158                         '<3240'|'<>3240') osvers=3.2.0 ;;
3159                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3160                         '=3250'|'>3250') osvers=3.2.5 ;;
3161                         *) osvers=$tmp;;
3162                         esac
3163                         ;;
3164                 bsd386) osname=bsd386
3165                         osvers=`$uname -r`
3166                         ;;
3167                 cygwin*) osname=cygwin
3168                         osvers="$3"
3169                         ;;
3170                 *dc.osx) osname=dcosx
3171                         osvers="$3"
3172                         ;;
3173                 dnix) osname=dnix
3174                         osvers="$3"
3175                         ;;
3176                 domainos) osname=apollo
3177                         osvers="$3"
3178                         ;;
3179                 dgux)   osname=dgux
3180                         osvers="$3"
3181                         ;;
3182                 dragonfly) osname=dragonfly
3183                         osvers="$3"
3184                         ;;
3185                 dynixptx*) osname=dynixptx
3186                         osvers=`echo "$4"|sed 's/^v//'`
3187                         ;;
3188                 freebsd) osname=freebsd
3189                         osvers="$3" ;;
3190                 genix)  osname=genix ;;
3191                 gnu)    osname=gnu
3192                         osvers="$3" ;;
3193                 hp*)    osname=hpux
3194                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3195                         ;;
3196                 irix*)  osname=irix
3197                         case "$3" in
3198                         4*) osvers=4 ;;
3199                         5*) osvers=5 ;;
3200                         *)      osvers="$3" ;;
3201                         esac
3202                         ;;
3203                 linux)  osname=linux
3204                         case "$3" in
3205                         *)      osvers="$3" ;;
3206                         esac
3207                         ;;
3208                 MiNT)   osname=mint
3209                         ;;
3210                 netbsd*) osname=netbsd
3211                         osvers="$3"
3212                         ;;
3213                 news-os) osvers="$3"
3214                         case "$3" in
3215                         4*) osname=newsos4 ;;
3216                         *) osname=newsos ;;
3217                         esac
3218                         ;;
3219                 next*) osname=next ;;
3220                 nonstop-ux) osname=nonstopux ;;
3221                 openbsd) osname=openbsd
3222                         osvers="$3"
3223                         ;;
3224                 os2)    osname=os2
3225                         osvers="$4"
3226                         ;;
3227                 POSIX-BC | posix-bc ) osname=posix-bc
3228                         osvers="$3"
3229                         ;;
3230                 powerux | power_ux | powermax_os | powermaxos | \
3231                 powerunix | power_unix) osname=powerux
3232                         osvers="$3"
3233                         ;;
3234                 qnx) osname=qnx
3235                         osvers="$4"
3236                         ;;
3237                 solaris) osname=solaris
3238                         case "$3" in
3239                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3240                         *)      osvers="$3" ;;
3241                         esac
3242                         ;;
3243                 sunos) osname=sunos
3244                         case "$3" in
3245                         5*) osname=solaris
3246                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3247                         *)      osvers="$3" ;;
3248                         esac
3249                         ;;
3250                 titanos) osname=titanos
3251                         case "$3" in
3252                         1*) osvers=1 ;;
3253                         2*) osvers=2 ;;
3254                         3*) osvers=3 ;;
3255                         4*) osvers=4 ;;
3256                         *)      osvers="$3" ;;
3257                         esac
3258                         ;;
3259                 ultrix) osname=ultrix
3260                         osvers="$3"
3261                         ;;
3262                 osf1|mls+)      case "$5" in
3263                                 alpha)
3264                                         osname=dec_osf
3265                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3266                                         case "$osvers" in
3267                                         [1-9].[0-9]*) ;;
3268                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3269                                         esac
3270                                         ;;
3271                         hp*)    osname=hp_osf1  ;;
3272                         mips)   osname=mips_osf1 ;;
3273                         esac
3274                         ;;
3275                 # UnixWare 7.1.2 is known as Open UNIX 8
3276                 openunix|unixware) osname=svr5
3277                         osvers="$4"
3278                         ;;
3279                 uts)    osname=uts
3280                         osvers="$3"
3281                         ;;
3282                 vos) osvers="$3"
3283                         ;;
3284                 $2) case "$osname" in
3285                         *isc*) ;;
3286                         *freebsd*) ;;
3287                         svr*)
3288                                 : svr4.x or possibly later
3289                                 case "svr$3" in
3290                                 ${osname}*)
3291                                         osname=svr$3
3292                                         osvers=$4
3293                                         ;;
3294                                 esac
3295                                 case "$osname" in
3296                                 svr4.0)
3297                                         : Check for ESIX
3298                                         if test -f /stand/boot ; then
3299                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3300                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3301                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3302                                                         if test -n "$isesix"; then
3303                                                                 osname=esix4
3304                                                         fi
3305                                                 fi
3306                                         fi
3307                                         ;;
3308                                 esac
3309                                 ;;
3310                         *)      if test -f /etc/systemid; then
3311                                         osname=sco
3312                                         set `echo $3 | $sed 's/\./ /g'` $4
3313                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3314                                                 osvers=$1.$2.$3
3315                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3316                                                 osvers=$1.$2
3317                                         elif $test -f $src/hints/sco_$1.sh; then
3318                                                 osvers=$1
3319                                         fi
3320                                 else
3321                                         case "$osname" in
3322                                         '') : Still unknown.  Probably a generic Sys V.
3323                                                 osname="sysv"
3324                                                 osvers="$3"
3325                                                 ;;
3326                                         esac
3327                                 fi
3328                                 ;;
3329                         esac
3330                         ;;
3331                 *)      case "$osname" in
3332                         '') : Still unknown.  Probably a generic BSD.
3333                                 osname="$1"
3334                                 osvers="$3"
3335                                 ;;
3336                         esac
3337                         ;;
3338                 esac
3339         else
3340                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3341                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3342                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3343                                 osname=news_os
3344                         fi
3345                         $rm -f UU/kernel.what
3346                 elif test -d c:/. -o -n "$is_os2" ; then
3347                         set X $myuname
3348                         osname=os2
3349                         osvers="$5"
3350                 fi
3351         fi
3352
3353         case "$targetarch" in
3354         '') ;;
3355         *)  hostarch=$osname
3356             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3357             osvers=''
3358             ;;
3359         esac
3360
3361         : Now look for a hint file osname_osvers, unless one has been
3362         : specified already.
3363         case "$hintfile" in
3364         ''|' ')
3365                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3366                 : Also try without trailing minor version numbers.
3367                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3368                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3369                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3370                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3371                 case "$file" in
3372                 '') dflt=none ;;
3373                 *)  case "$osvers" in
3374                         '') dflt=$file
3375                                 ;;
3376                         *)  if $test -f $src/hints/$file.sh ; then
3377                                         dflt=$file
3378                                 elif $test -f $src/hints/$xfile.sh ; then
3379                                         dflt=$xfile
3380                                 elif $test -f $src/hints/$xxfile.sh ; then
3381                                         dflt=$xxfile
3382                                 elif $test -f $src/hints/$xxxfile.sh ; then
3383                                         dflt=$xxxfile
3384                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3385                                         dflt=$xxxxfile
3386                                 elif $test -f "$src/hints/${osname}.sh" ; then
3387                                         dflt="${osname}"
3388                                 else
3389                                         dflt=none
3390                                 fi
3391                                 ;;
3392                         esac
3393                         ;;
3394                 esac
3395                 if $test -f Policy.sh ; then
3396                         case "$dflt" in
3397                         *Policy*) ;;
3398                         none) dflt="Policy" ;;
3399                         *) dflt="Policy $dflt" ;;
3400                         esac
3401                 fi
3402                 ;;
3403         *)
3404                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3405                 ;;
3406         esac
3407
3408         if $test -f Policy.sh ; then
3409                 $cat <<EOM
3410
3411 There's also a Policy hint file available, which should make the
3412 site-specific (policy) questions easier to answer.
3413 EOM
3414
3415         fi
3416
3417         $cat <<EOM
3418
3419 You may give one or more space-separated answers, or "none" if appropriate.
3420 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3421 previous run of Configure, you may specify it as well as or instead of
3422 OS-specific hints.  If hints are provided for your OS, you should use them:
3423 although Perl can probably be built without hints on many platforms, using
3424 hints often improve performance and may enable features that Configure can't
3425 set up on its own. If there are no hints that match your OS, specify "none";
3426 DO NOT give a wrong version or a wrong OS.
3427
3428 EOM
3429
3430         rp="Which of these apply, if any?"
3431         . UU/myread
3432         tans=$ans
3433         for file in $tans; do
3434                 if $test X$file = XPolicy -a -f Policy.sh; then
3435                         . Policy.sh
3436                         $cat Policy.sh >> UU/config.sh
3437                 elif $test -f $src/hints/$file.sh; then
3438                         . $src/hints/$file.sh
3439                         $cat $src/hints/$file.sh >> UU/config.sh
3440                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3441                         : nothing
3442                 else
3443                         : Give one chance to correct a possible typo.
3444                         echo "$file.sh does not exist"
3445                         dflt=$file
3446                         rp="hint to use instead?"
3447                         . UU/myread
3448                         for file in $ans; do
3449                                 if $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$ans = X -o X$ans = Xnone ; then
3453                                         : nothing
3454                                 else
3455                                         echo "$file.sh does not exist -- ignored."
3456                                 fi
3457                         done
3458                 fi
3459         done
3460
3461         hint=recommended
3462         : Remember our hint file for later.
3463         if $test -f "$src/hints/$file.sh" ; then
3464                 hintfile="$file"
3465         else
3466                 hintfile=''
3467         fi
3468 fi
3469 cd UU
3470 ;;
3471 *)
3472         echo " "
3473         echo "Fetching default answers from $config_sh..." >&4
3474         tmp_n="$n"
3475         tmp_c="$c"
3476         cd ..
3477         cp $config_sh config.sh 2>/dev/null
3478         chmod +w config.sh
3479         . ./config.sh
3480         cd UU
3481         cp ../config.sh .
3482         n="$tmp_n"
3483         c="$tmp_c"
3484         hint=previous
3485         ;;
3486 esac
3487 test "$override" && . ./optdef.sh
3488
3489 : Restore computed paths
3490 for file in $loclist $trylist; do
3491         eval $file="\$_$file"
3492 done
3493
3494 cat << EOM
3495
3496 Configure uses the operating system name and version to set some defaults.
3497 The default value is probably right if the name rings a bell. Otherwise,
3498 since spelling matters for me, either accept the default or answer "none"
3499 to leave it blank.
3500
3501 EOM
3502 case "$osname" in
3503         ''|' ')
3504                 case "$hintfile" in
3505                 ''|' '|none) dflt=none ;;
3506                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3507                 esac
3508                 ;;
3509         *) dflt="$osname" ;;
3510 esac
3511 rp="Operating system name?"
3512 . ./myread
3513 case "$ans" in
3514 none)  osname='' ;;
3515 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3516 esac
3517 echo " "
3518 case "$osvers" in
3519         ''|' ')
3520                 case "$hintfile" in
3521                 ''|' '|none) dflt=none ;;
3522                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3523                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3524                         case "$dflt" in
3525                         ''|' ') dflt=none ;;
3526                         esac
3527                         ;;
3528                 esac
3529                 ;;
3530         *) dflt="$osvers" ;;
3531 esac
3532 rp="Operating system version?"
3533 . ./myread
3534 case "$ans" in
3535 none)  osvers='' ;;
3536 *) osvers="$ans" ;;
3537 esac
3538
3539
3540 . ./posthint.sh
3541
3542 : who configured the system
3543 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3544 case "$cf_by" in
3545 "")
3546         cf_by=`(logname) 2>/dev/null`
3547         case "$cf_by" in
3548         "")
3549                 cf_by=`(whoami) 2>/dev/null`
3550                 case "$cf_by" in
3551                 "") cf_by=unknown ;;
3552                 esac ;;
3553         esac ;;
3554 esac
3555
3556 : decide how portable to be.  Allow command line overrides.
3557 case "$d_portable" in
3558 "$undef") ;;
3559 *)      d_portable="$define" ;;
3560 esac
3561
3562 : set up shell script to do ~ expansion
3563 cat >filexp <<EOSS
3564 $startsh
3565 : expand filename
3566 case "\$1" in
3567  ~/*|~)
3568         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3569         ;;
3570  ~*)
3571         if $test -f /bin/csh; then
3572                 /bin/csh -f -c "glob \$1"
3573                 failed=\$?
3574                 echo ""
3575                 exit \$failed
3576         else
3577                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3578                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3579                 if $test ! -d "\$dir"; then
3580                         me=\`basename \$0\`
3581                         echo "\$me: can't locate home directory for: \$name" >&2
3582                         exit 1
3583                 fi
3584                 case "\$1" in
3585                 */*)
3586                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3587                         ;;
3588                 *)
3589                         echo \$dir
3590                         ;;
3591                 esac
3592         fi
3593         ;;
3594 *)
3595         echo \$1
3596         ;;
3597 esac
3598 EOSS
3599 chmod +x filexp
3600 $eunicefix filexp
3601
3602 : now set up to get a file name
3603 cat <<EOS >getfile
3604 $startsh
3605 EOS
3606 cat <<'EOSC' >>getfile
3607 tilde=''
3608 fullpath=''
3609 already=''
3610 skip=''
3611 none_ok=''
3612 exp_file=''
3613 nopath_ok=''
3614 orig_rp="$rp"
3615 orig_dflt="$dflt"
3616 case "$gfpth" in
3617 '') gfpth='.' ;;
3618 esac
3619
3620 case "$fn" in
3621 *\(*)
3622         : getfile will accept an answer from the comma-separated list
3623         : enclosed in parentheses even if it does not meet other criteria.
3624         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3625         fn=`echo $fn | sed 's/(.*)//'`
3626         ;;
3627 esac
3628
3629 case "$fn" in
3630 *:*)
3631         loc_file=`expr $fn : '.*:\(.*\)'`
3632         fn=`expr $fn : '\(.*\):.*'`
3633         ;;
3634 esac
3635
3636 case "$fn" in
3637 *~*) tilde=true;;
3638 esac
3639 case "$fn" in
3640 */*) fullpath=true;;
3641 esac
3642 case "$fn" in
3643 *+*) skip=true;;
3644 esac
3645 case "$fn" in
3646 *n*) none_ok=true;;
3647 esac
3648 case "$fn" in
3649 *e*) exp_file=true;;
3650 esac
3651 case "$fn" in
3652 *p*) nopath_ok=true;;
3653 esac
3654
3655 case "$fn" in
3656 *f*) type='File';;
3657 *d*) type='Directory';;
3658 *l*) type='Locate';;
3659 esac
3660
3661 what="$type"
3662 case "$what" in
3663 Locate) what='File';;
3664 esac
3665
3666 case "$exp_file" in
3667 '')
3668         case "$d_portable" in
3669         "$define") ;;
3670         *) exp_file=true;;
3671         esac
3672         ;;
3673 esac
3674
3675 cd ..
3676 while test "$type"; do
3677         redo=''
3678         rp="$orig_rp"
3679         dflt="$orig_dflt"
3680         case "$tilde" in
3681         true) rp="$rp (~name ok)";;
3682         esac
3683         . UU/myread
3684         if test -f UU/getfile.ok && \
3685                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3686         then
3687                 value="$ans"
3688                 ansexp="$ans"
3689                 break
3690         fi
3691         case "$ans" in
3692         none)
3693                 value=''
3694                 ansexp=''
3695                 case "$none_ok" in
3696                 true) type='';;
3697                 esac
3698                 ;;
3699         *)
3700                 case "$tilde" in
3701                 '') value="$ans"
3702                         ansexp="$ans";;
3703                 *)
3704                         value=`UU/filexp $ans`
3705                         case $? in
3706                         0)
3707                                 if test "$ans" != "$value"; then
3708                                         echo "(That expands to $value on this system.)"
3709                                 fi
3710                                 ;;
3711                         *) value="$ans";;
3712                         esac
3713                         ansexp="$value"
3714                         case "$exp_file" in
3715                         '') value="$ans";;
3716                         esac
3717                         ;;
3718                 esac
3719                 case "$fullpath" in
3720                 true)
3721                         case "$ansexp" in
3722                         /*) value="$ansexp" ;;
3723                         [a-zA-Z]:/*) value="$ansexp" ;;
3724                         *)
3725                                 redo=true
3726                                 case "$already" in
3727                                 true)
3728                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3729                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3730                                         ;;
3731                                 *)
3732                                 echo "Please give a full path name, starting with slash." >&4
3733                                         case "$tilde" in
3734                                         true)
3735                                 echo "Note that using ~name is ok provided it expands well." >&4
3736                                                 already=true
3737                                                 ;;
3738                                         esac
3739                                 esac
3740                                 ;;
3741                         esac
3742                         ;;
3743                 esac
3744                 case "$redo" in
3745                 '')
3746                         case "$type" in
3747                         File)
3748                                 for fp in $gfpth; do
3749                                         if test "X$fp" = X.; then
3750                                             pf="$ansexp"
3751                                         else    
3752                                             pf="$fp/$ansexp"
3753                                         fi
3754                                         if test -f "$pf"; then
3755                                                 type=''
3756                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3757                                         then
3758                                                 echo "($value is not a plain file, but that's ok.)"
3759                                                 type=''
3760                                         fi
3761                                         if test X"$type" = X; then
3762                                             value="$pf"
3763                                             break
3764                                         fi
3765                                 done
3766                                 ;;
3767                         Directory)
3768                                 for fp in $gfpth; do
3769                                         if test "X$fp" = X.; then
3770                                             dir="$ans"
3771                                             direxp="$ansexp"
3772                                         else    
3773                                             dir="$fp/$ansexp"
3774                                             direxp="$fp/$ansexp"
3775                                         fi
3776                                         if test -d "$direxp"; then
3777                                                 type=''
3778                                                 value="$dir"
3779                                                 break
3780                                         fi
3781                                 done
3782                                 ;;
3783                         Locate)
3784                                 if test -d "$ansexp"; then
3785                                         echo "(Looking for $loc_file in directory $value.)"
3786                                         value="$value/$loc_file"
3787                                         ansexp="$ansexp/$loc_file"
3788                                 fi
3789                                 if test -f "$ansexp"; then
3790                                         type=''
3791                                 fi
3792                                 case "$nopath_ok" in
3793                                 true)   case "$value" in
3794                                         */*) ;;
3795                                         *)      echo "Assuming $value will be in people's path."
3796                                                 type=''
3797                                                 ;;
3798                                         esac
3799                                         ;;
3800                                 esac
3801                                 ;;
3802                         esac
3803
3804                         case "$skip" in
3805                         true) type='';
3806                         esac
3807
3808                         case "$type" in
3809                         '') ;;
3810                         *)
3811                                 if test "$fastread" = yes; then
3812                                         dflt=y
3813                                 else
3814                                         dflt=n
3815                                 fi
3816                                 rp="$what $value doesn't exist.  Use that name anyway?"
3817                                 . UU/myread
3818                                 dflt=''
3819                                 case "$ans" in
3820                                 y*) type='';;
3821                                 *) echo " ";;
3822                                 esac
3823                                 ;;
3824                         esac
3825                         ;;
3826                 esac
3827                 ;;
3828         esac
3829 done
3830 cd UU
3831 ans="$value"
3832 rp="$orig_rp"
3833 dflt="$orig_dflt"
3834 rm -f getfile.ok
3835 test "X$gfpthkeep" != Xy && gfpth=""
3836 EOSC
3837
3838 : determine root of directory hierarchy where package will be installed.
3839 case "$prefix" in
3840 '')
3841         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3842         ;;
3843 *?/)
3844         dflt=`echo "$prefix" | sed 's/.$//'`
3845         ;;
3846 *)
3847         dflt="$prefix"
3848         ;;
3849 esac
3850 $cat <<EOM
3851
3852 By default, $package will be installed in $dflt/bin, manual pages
3853 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3854 installation directories. Typically this is something like /usr/local.
3855 If you wish to have binaries under /usr/bin but other parts of the
3856 installation under /usr/local, that's ok: you will be prompted
3857 separately for each of the installation directories, the prefix being
3858 only used to set the defaults.
3859
3860 EOM
3861 fn=d~
3862 rp='Installation prefix to use?'
3863 . ./getfile
3864 oldprefix=''
3865 case "$prefix" in
3866 '') ;;
3867 *)
3868         case "$ans" in
3869         "$prefix") ;;
3870         *) oldprefix="$prefix";;
3871         esac
3872         ;;
3873 esac
3874 prefix="$ans"
3875 prefixexp="$ansexp"
3876
3877 case "$afsroot" in
3878 '')     afsroot=/afs ;;
3879 *)      afsroot=$afsroot ;;
3880 esac
3881
3882 : is AFS running?
3883 echo " "
3884 case "$afs" in
3885 $define|true)   afs=true ;;
3886 $undef|false)   afs=false ;;
3887 *)      if test -d $afsroot; then
3888                 afs=true
3889         else
3890                 afs=false
3891         fi
3892         ;;
3893 esac
3894 if $afs; then
3895         echo "AFS may be running... I'll be extra cautious then..." >&4
3896 else
3897         echo "AFS does not seem to be running..." >&4
3898 fi
3899
3900 : determine installation prefix for where package is to be installed.
3901 if $afs; then 
3902 $cat <<EOM
3903
3904 Since you are running AFS, I need to distinguish the directory in which
3905 files will reside from the directory in which they are installed (and from
3906 which they are presumably copied to the former directory by occult means).
3907
3908 EOM
3909         case "$installprefix" in
3910         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3911         *) dflt="$installprefix";;
3912         esac
3913 else
3914 $cat <<EOM
3915
3916 In some special cases, particularly when building $package for distribution,
3917 it is convenient to distinguish the directory in which files should be
3918 installed from the directory ($prefix) in which they will
3919 eventually reside.  For most users, these two directories are the same.
3920
3921 EOM
3922         case "$installprefix" in
3923         '') dflt=$prefix ;;
3924         *) dflt=$installprefix;;
3925         esac
3926 fi
3927 fn=d~
3928 rp='What installation prefix should I use for installing files?'
3929 . ./getfile
3930 installprefix="$ans"
3931 installprefixexp="$ansexp"
3932
3933 : Perform the prefixexp/installprefixexp correction if necessary
3934 cat <<EOS >installprefix
3935 $startsh
3936 EOS
3937 cat <<'EOSC' >>installprefix
3938 : Change installation prefix, if necessary.
3939 if $test X"$prefix" != X"$installprefix"; then
3940     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3941 else
3942     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3943 fi
3944 EOSC
3945 chmod +x installprefix
3946 $eunicefix installprefix
3947
3948 : Set variables such as privlib and privlibexp from the output of ./getfile
3949 : performing the prefixexp/installprefixexp correction if necessary.
3950 cat <<EOS >setprefixvar
3951 $startsh
3952 EOS
3953 cat <<'EOSC' >>setprefixvar
3954 eval "${prefixvar}=\"\$ans\""
3955 eval "${prefixvar}exp=\"\$ansexp\""
3956 . ./installprefix
3957 EOSC
3958 chmod +x setprefixvar
3959 $eunicefix setprefixvar
3960
3961 : set up the script used to warn in case of inconsistency
3962 cat <<EOS >whoa
3963 $startsh
3964 EOS
3965 cat <<'EOSC' >>whoa
3966 dflt=y
3967 case "$hint" in
3968     recommended)
3969         case "$hintfile" in
3970         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3971                 ;;
3972         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
3973                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
3974                 ;;
3975         esac
3976         ;;
3977     *)  echo " "
3978         echo "*** WHOA THERE!!! ***" >&4
3979         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3980         ;;
3981 esac
3982 rp="    Keep the $hint value?"
3983 . ./myread
3984 case "$ans" in
3985 y) td=$was; tu=$was;;
3986 esac
3987 EOSC
3988
3989 : function used to set $1 to $val
3990 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3991 case "$val$was" in
3992 $define$undef) . ./whoa; eval "$var=\$td";;
3993 $undef$define) . ./whoa; eval "$var=\$tu";;
3994 *) eval "$var=$val";;
3995 esac'
3996
3997 case "$usesocks" in
3998 $define|true|[yY]*)     dflt='y';;
3999 *) dflt='n';;
4000 esac
4001 cat <<EOM
4002
4003 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4004 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4005 to use the PerlIO abstraction layer, this will be implicitly selected.
4006
4007 If this doesn't make any sense to you, just accept the default '$dflt'.
4008 EOM
4009 rp='Build Perl for SOCKS?'
4010 . ./myread
4011 case "$ans" in
4012 y|Y)    val="$define" ;;     
4013 *)      val="$undef" ;;
4014 esac
4015 set usesocks
4016 eval $setvar
4017
4018 case "$usesocks" in
4019 $define|true|[yY]*) useperlio="$define";;
4020 esac
4021
4022 case "$useperlio" in
4023 $define|true|[yY]*|'')  dflt='y';;
4024 *) dflt='n';;
4025 esac
4026 cat <<EOM
4027
4028 Previous version of $package used the standard IO mechanisms as
4029 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4030 alternate IO mechanisms via the PerlIO abstraction layer, but the
4031 stdio mechanism is still available if needed.  The abstraction layer
4032 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4033 Using PerlIO with sfio may cause problems with some extension modules.
4034
4035 If this doesn't make any sense to you, just accept the default '$dflt'.
4036 EOM
4037 rp='Use the PerlIO abstraction layer?'
4038 . ./myread
4039 case "$ans" in
4040 y|Y) 
4041         val="$define"
4042         ;;
4043 *)      
4044         echo "Ok, doing things the stdio way."
4045         val="$undef"
4046         ;;
4047 esac
4048 set useperlio
4049 eval $setvar 
4050
4051 case "$usesocks" in
4052 $define|true|[yY]*)
4053         case "$useperlio" in
4054         $define|true|[yY]*) ;;
4055         *)      cat >&4 <<EOM
4056
4057 You are using the SOCKS proxy protocol library which means that you
4058 should also use the PerlIO layer.  You may be headed for trouble.
4059
4060 EOM
4061                 ;;
4062         esac
4063         ;;
4064 esac
4065
4066         
4067 : get the patchlevel
4068 echo " "
4069 echo "Getting the current patchlevel..." >&4
4070 if $test -r $rsrc/patchlevel.h;then
4071         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4072         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4073         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4074         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4075         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4076         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4077         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
4078 else
4079         revision=0
4080         patchlevel=0
4081         subversion=0
4082         api_revision=0
4083         api_version=0
4084         api_subversion=0
4085         perl_patchlevel=0
4086         $echo "(You do not have patchlevel.h.  Eek.)"
4087 fi
4088 if $test -r $rsrc/.patch ; then
4089         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4090                 perl_patchlevel=`cat $rsrc/.patch`
4091         fi
4092 fi
4093 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4094 version_patchlevel_string="version $patchlevel subversion $subversion"
4095 case "$perl_patchlevel" in
4096 0|'') ;;
4097 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4098 esac
4099
4100 $echo "(You have $package $version_patchlevel_string.)"
4101
4102 case "$osname" in
4103 dos|vms)
4104         : XXX Should be a Configure test for double-dots in filenames.
4105         version=`echo $revision $patchlevel $subversion | \
4106                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4107         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4108                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4109         ;;
4110 *)
4111         version=`echo $revision $patchlevel $subversion | \
4112                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4113         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4114                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4115         ;;
4116 esac
4117 : Special case the 5.005_xx maintenance series, which used 5.005
4118 : without any subversion label as a subdirectory in $sitelib
4119 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4120         api_versionstring='5.005'
4121 fi
4122
4123 case "$usethreads" in
4124 $define|true|[yY]*)     dflt='y';;
4125 *)     # Catch case where user specified ithreads or 5005threads but
4126        # forgot -Dusethreads (A.D. 4/2002)
4127        case "$useithreads$use5005threads" in
4128        *$define*)      
4129                 case "$useperlio" in
4130                 "$define")      dflt='y' ;;
4131                 *)              dflt='n' ;;
4132                 esac
4133                 ;;
4134        *)       dflt='n';;
4135        esac
4136        ;;
4137 esac
4138 cat <<EOM
4139
4140 Perl can be built to take advantage of threads on some systems.
4141 To do so, Configure can be run with -Dusethreads.
4142
4143 Note that Perl built with threading support runs slightly slower
4144 and uses more memory than plain Perl. The current implementation
4145 is believed to be stable, but it is fairly new, and so should be
4146 treated with caution.
4147
4148 If this doesn't make any sense to you, just accept the default '$dflt'.
4149 EOM
4150 rp='Build a threading Perl?'
4151 . ./myread
4152 case "$ans" in
4153 y|Y)    val="$define" ;;
4154 *)      val="$undef" ;;
4155 esac
4156 set usethreads
4157 eval $setvar
4158
4159 if $test $patchlevel -lt 9; then
4160     case "$usethreads" in
4161     $define)
4162         $cat <<EOM
4163
4164 Since release 5.6, Perl has had two different threading implementations,
4165 the newer interpreter-based version (ithreads) with one interpreter per
4166 thread, and the older 5.005 version (5005threads).
4167 The 5005threads version is effectively unmaintained and will probably be
4168 removed in Perl 5.10, so there should be no need to build a Perl using it
4169 unless needed for backwards compatibility with some existing 5.005threads
4170 code.
4171
4172 EOM
4173         : Default to ithreads unless overridden on command line or with
4174         : old config.sh
4175         dflt='y'
4176         case "$use5005threads" in
4177                 $define|true|[yY]*) dflt='n';;
4178         esac
4179         case "$useithreads" in
4180                 $undef|false|[nN]*) dflt='n';;
4181         esac
4182         rp='Use the newer interpreter-based ithreads?'
4183         . ./myread
4184         case "$ans" in
4185         y|Y)    val="$define" ;;
4186         *)      val="$undef" ;;
4187         esac
4188         set useithreads
4189         eval $setvar
4190         : Now set use5005threads to the opposite value.
4191         case "$useithreads" in
4192         $define) val="$undef" ;;
4193         *) val="$define" ;;
4194         esac
4195         set use5005threads
4196         eval $setvar
4197         ;;
4198     *)
4199         useithreads="$undef"
4200         use5005threads="$undef"
4201         ;;
4202     esac
4203
4204     case "$useithreads$use5005threads" in
4205     "$define$define")
4206         $cat >&4 <<EOM
4207
4208 You cannot have both the ithreads and the 5.005 threads enabled
4209 at the same time.  Disabling the 5.005 threads since they are
4210 much less stable than the ithreads.
4211
4212 EOM
4213         use5005threads="$undef"
4214         ;;
4215     esac
4216
4217 else
4218 : perl-5.9.x and later
4219
4220     if test X"$usethreads" = "X$define"; then
4221         case "$use5005threads" in
4222             $define|true|[yY]*)
4223                 $cat >&4 <<EOM
4224
4225 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4226
4227 EOM
4228             ;;
4229         esac
4230     fi
4231
4232     use5005threads="$undef"
4233     useithreads="$usethreads"
4234 fi
4235
4236 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4237         cat >&4 <<EOF
4238 ***
4239 *** To build with ithreads you must also use the PerlIO layer.
4240 *** Cannot continue, aborting.
4241 ***
4242 EOF
4243         exit 1
4244 fi
4245
4246 case "$d_oldpthreads" in
4247 '')     : Configure tests would be welcome here.  For now, assume undef.
4248         val="$undef" ;;
4249 *)      val="$d_oldpthreads" ;;
4250 esac
4251 set d_oldpthreads
4252 eval $setvar
4253
4254
4255 : Look for a hint-file generated 'call-back-unit'.  If the
4256 : user has specified that a threading perl is to be built,
4257 : we may need to set or change some other defaults.
4258 if $test -f usethreads.cbu; then
4259     echo "Your platform has some specific hints regarding threaded builds, using them..."
4260     . ./usethreads.cbu
4261 else
4262     case "$usethreads" in
4263         "$define"|true|[yY]*)
4264                 $cat <<EOM
4265 (Your platform does not have any specific hints for threaded builds.
4266  Assuming POSIX threads, then.)
4267 EOM
4268         ;;
4269     esac
4270 fi
4271
4272 cat <<EOM
4273
4274 Perl can be built so that multiple Perl interpreters can coexist
4275 within the same Perl executable.
4276 EOM
4277
4278 case "$useithreads" in
4279 $define)
4280         cat <<EOM
4281 This multiple interpreter support is required for interpreter-based threads.
4282 EOM
4283         val="$define"
4284         ;;
4285 *)      case "$usemultiplicity" in
4286         $define|true|[yY]*)     dflt='y';;
4287         *) dflt='n';;
4288         esac
4289         echo " "
4290         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4291         rp='Build Perl for multiplicity?'
4292         . ./myread
4293         case "$ans" in
4294         y|Y)    val="$define" ;;
4295         *)      val="$undef" ;;
4296         esac
4297         ;;
4298 esac
4299 set usemultiplicity
4300 eval $setvar
4301
4302
4303 case "$usemorebits" in
4304 "$define"|true|[yY]*)
4305         use64bitint="$define"
4306         uselongdouble="$define"
4307         usemorebits="$define"
4308         ;;
4309 *)      usemorebits="$undef"
4310         ;;
4311 esac
4312
4313 : make some quick guesses about what we are up against
4314 echo " "
4315 $echo $n "Hmm...  $c"
4316 echo exit 1 >bsd
4317 echo exit 1 >usg
4318 echo exit 1 >v7
4319 echo exit 1 >osf1
4320 echo exit 1 >eunice
4321 echo exit 1 >xenix
4322 echo exit 1 >venix
4323 echo exit 1 >os2
4324 d_bsd="$undef"
4325 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4326 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4327 then
4328         echo "Looks kind of like an OSF/1 system, but we'll see..."
4329         echo exit 0 >osf1
4330 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4331         xxx=`./loc addbib blurfl $pth`
4332         if $test -f $xxx; then
4333         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4334                 echo exit 0 >bsd
4335                 echo exit 0 >usg
4336         else
4337                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4338                         echo "Looks kind of like an extended USG system, but we'll see..."
4339                 else
4340                         echo "Looks kind of like a USG system, but we'll see..."
4341                 fi
4342                 echo exit 0 >usg
4343         fi
4344 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4345         echo "Looks kind of like a BSD system, but we'll see..."
4346         d_bsd="$define"
4347         echo exit 0 >bsd
4348 else
4349         echo "Looks kind of like a Version 7 system, but we'll see..."
4350         echo exit 0 >v7
4351 fi
4352 case "$eunicefix" in
4353 *unixtovms*)
4354         $cat <<'EOI'
4355 There is, however, a strange, musty smell in the air that reminds me of
4356 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4357 EOI
4358         echo exit 0 >eunice
4359         d_eunice="$define"
4360 : it so happens the Eunice I know will not run shell scripts in Unix format
4361         ;;
4362 *)
4363         echo " "
4364         echo "Congratulations.  You aren't running Eunice."
4365         d_eunice="$undef"
4366         ;;
4367 esac
4368 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4369 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4370 : semicolon as a patch separator
4371 case "$p_" in
4372 :) ;;
4373 *)
4374         $cat <<'EOI'
4375 I have the feeling something is not exactly right, however...don't tell me...
4376 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4377 (Or you may be running DOS with DJGPP.)
4378 EOI
4379         echo exit 0 >os2
4380         ;;
4381 esac
4382 if test -f /xenix; then
4383         echo "Actually, this looks more like a XENIX system..."
4384         echo exit 0 >xenix
4385         d_xenix="$define"
4386 else
4387         echo " "
4388         echo "It's not Xenix..."
4389         d_xenix="$undef"
4390 fi
4391 chmod +x xenix
4392 $eunicefix xenix
4393 if test -f /venix; then
4394         echo "Actually, this looks more like a VENIX system..."
4395         echo exit 0 >venix
4396 else
4397         echo " "
4398         if ./xenix; then
4399                 : null
4400         else
4401                 echo "Nor is it Venix..."
4402         fi
4403 fi
4404 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4405 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4406 $rm -f foo
4407
4408 case "$cc" in
4409 '') dflt=cc;;
4410 *) dflt="$cc";;
4411 esac
4412 rp="Use which C compiler?"
4413 . ./myread
4414 cc="$ans"
4415
4416 : See if they have not cc but they do have gcc
4417 . ./trygcc
4418 : Look for a hint-file generated 'call-back-unit'.  Now that the
4419 : user has specified the compiler, we may need to set or change some
4420 : other defaults.
4421 if $test -f cc.cbu; then
4422     . ./cc.cbu
4423 fi
4424 . ./checkcc
4425
4426 echo " "
4427 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4428 $cat >try.c <<EOM
4429 #include <stdio.h>
4430 int main() {
4431 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4432 #ifdef __VERSION__
4433         printf("%s\n", __VERSION__);
4434 #else
4435         printf("%s\n", "1");
4436 #endif
4437 #endif
4438         return(0);
4439 }
4440 EOM
4441 if $cc -o try $ccflags $ldflags try.c; then
4442         gccversion=`$run ./try`
4443         case "$gccversion" in
4444         '') echo "You are not using GNU cc." ;;
4445         *)  echo "You are using GNU cc $gccversion."
4446             ccname=gcc
4447             ;;
4448         esac
4449 else
4450         echo " "
4451         echo "*** WHOA THERE!!! ***" >&4
4452         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4453         case "$knowitall" in
4454         '')
4455         echo "    You'd better start hunting for one and let me know about it." >&4
4456                 exit 1
4457                 ;;
4458         esac
4459 fi
4460 $rm -f try try.*
4461 case "$gccversion" in
4462 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4463 esac
4464 case "$gccversion" in
4465 '') gccosandvers='' ;;
4466 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4467    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4468    gccshortvers=''
4469    case "$gccosandvers" in
4470    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4471    $osname$osvers) ;; # looking good
4472    $osname*) cat <<EOM >&4
4473
4474 *** WHOA THERE!!! ***
4475
4476     Your gcc has not been compiled for the exact release of
4477     your operating system ($gccosandvers versus $osname$osvers).
4478
4479     In general it is a good idea to keep gcc synchronized with
4480     the operating system because otherwise serious problems
4481     may ensue when trying to compile software, like Perl.
4482
4483     I'm trying to be optimistic here, though, and will continue.
4484     If later during the configuration and build icky compilation
4485     problems appear (headerfile conflicts being the most common
4486     manifestation), I suggest reinstalling the gcc to match
4487     your operating system release.
4488
4489 EOM
4490       ;;
4491    *) gccosandvers='' ;; # failed to parse, better be silent
4492    esac
4493    ;;
4494 esac
4495 case "$ccname" in
4496 '') ccname="$cc" ;;
4497 esac
4498
4499 # gcc 3.* complain about adding -Idirectories that they already know about,
4500 # so we will take those off from locincpth.
4501 case "$gccversion" in
4502 3*)
4503     echo "main(){}">try.c
4504     for incdir in $locincpth; do
4505        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4506              grep '^c[cp]p*[01]: warning: changing search order '`
4507        if test "X$warn" != X; then
4508            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4509        fi
4510     done
4511     $rm -f try try.*
4512 esac
4513
4514 : What should the include directory be ?
4515 echo " "
4516 $echo $n "Hmm...  $c"
4517 dflt='/usr/include'
4518 incpath=''
4519 mips_type=''
4520 if $test -f /bin/mips && /bin/mips; then
4521         echo "Looks like a MIPS system..."
4522         $cat >usr.c <<'EOCP'
4523 #ifdef SYSTYPE_BSD43
4524 /bsd43
4525 #endif
4526 EOCP
4527         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4528                 dflt='/bsd43/usr/include'
4529                 incpath='/bsd43'
4530                 mips_type='BSD 4.3'
4531         else
4532                 mips_type='System V'
4533         fi
4534         $rm -f usr.c usr.out
4535         echo "and you're compiling with the $mips_type compiler and libraries."
4536         xxx_prompt=y
4537         echo "exit 0" >mips
4538 else
4539         echo "Doesn't look like a MIPS system."
4540         xxx_prompt=n
4541         echo "exit 1" >mips
4542 fi
4543 chmod +x mips
4544 $eunicefix mips
4545 case "$usrinc" in
4546 '') ;;
4547 *) dflt="$usrinc";;
4548 esac
4549 case "$xxx_prompt" in
4550 y)      fn=d/
4551         echo " "
4552         rp='Where are the include files you want to use?'
4553         . ./getfile
4554         usrinc="$ans"
4555         ;;
4556 *)      usrinc="$dflt"
4557         ;;
4558 esac
4559
4560 : see how we invoke the C preprocessor
4561 echo " "
4562 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4563 cat <<'EOT' >testcpp.c
4564 #define ABC abc
4565 #define XYZ xyz
4566 ABC.XYZ
4567 EOT
4568 cd ..
4569 if test ! -f cppstdin; then
4570         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4571                 # AIX cc -E doesn't show the absolute headerfile
4572                 # locations but we'll cheat by using the -M flag.
4573                 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
4574         else
4575                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4576         fi
4577 else
4578         echo "Keeping your $hint cppstdin wrapper."
4579 fi
4580 chmod 755 cppstdin
4581 wrapper=`pwd`/cppstdin
4582 ok='false'
4583 cd UU
4584
4585 if $test "X$cppstdin" != "X" && \
4586         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4587         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4588 then
4589         echo "You used to use $cppstdin $cppminus so we'll use that again."
4590         case "$cpprun" in
4591         '') echo "But let's see if we can live without a wrapper..." ;;
4592         *)
4593                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4594                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4595                 then
4596                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4597                         ok='true'
4598                 else
4599                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4600                 fi
4601                 ;;
4602         esac
4603 else
4604         case "$cppstdin" in
4605         '') ;;
4606         *)
4607                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4608                 ;;
4609         esac
4610 fi
4611
4612 if $ok; then
4613         : nothing
4614 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4615         $cc -E <testcpp.c >testcpp.out 2>&1; \
4616         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4617         echo "Yup, it does."
4618         x_cpp="$cc -E"
4619         x_minus='';
4620 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4621         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4622         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4623         echo "Yup, it does."
4624         x_cpp="$cc -E"
4625         x_minus='-';
4626 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4627         $cc -P <testcpp.c >testcpp.out 2>&1; \
4628         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4629         echo "Yipee, that works!"
4630         x_cpp="$cc -P"
4631         x_minus='';
4632 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4633         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4634         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4635         echo "At long last!"
4636         x_cpp="$cc -P"
4637         x_minus='-';
4638 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4639         $cpp <testcpp.c >testcpp.out 2>&1; \
4640         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4641         echo "It works!"
4642         x_cpp="$cpp"
4643         x_minus='';
4644 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4645         $cpp - <testcpp.c >testcpp.out 2>&1; \
4646         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4647         echo "Hooray, it works!  I was beginning to wonder."
4648         x_cpp="$cpp"
4649         x_minus='-';
4650 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4651         $wrapper <testcpp.c >testcpp.out 2>&1; \
4652         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4653         x_cpp="$wrapper"
4654         x_minus=''
4655         echo "Eureka!"
4656 else
4657         dflt=''
4658         rp="No dice.  I can't find a C preprocessor.  Name one:"
4659         . ./myread
4660         x_cpp="$ans"
4661         x_minus=''
4662         $x_cpp <testcpp.c >testcpp.out 2>&1
4663         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4664                 echo "OK, that will do." >&4
4665         else
4666 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4667                 exit 1
4668         fi
4669 fi
4670
4671 case "$ok" in
4672 false)
4673         cppstdin="$x_cpp"
4674         cppminus="$x_minus"
4675         cpprun="$x_cpp"
4676         cpplast="$x_minus"
4677         set X $x_cpp
4678         shift
4679         case "$1" in
4680         "$cpp")
4681                 echo "Perhaps can we force $cc -E using a wrapper..."
4682                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4683                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4684                 then
4685                         echo "Yup, we can."
4686                         cppstdin="$wrapper"
4687                         cppminus='';
4688                 else
4689                         echo "Nope, we'll have to live without it..."
4690                 fi
4691                 ;;
4692         esac
4693         case "$cpprun" in
4694         "$wrapper")
4695                 cpprun=''
4696                 cpplast=''
4697                 ;;
4698         esac
4699         ;;
4700 esac
4701
4702 case "$cppstdin" in
4703 "$wrapper"|'cppstdin') ;;
4704 *) $rm -f $wrapper;;
4705 esac
4706 $rm -f testcpp.c testcpp.out
4707
4708 : Set private lib path
4709 case "$plibpth" in
4710 '') if ./mips; then
4711                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4712         fi;;
4713 esac
4714 case "$libpth" in
4715 ' ') dlist='';;
4716 '') dlist="$loclibpth $plibpth $glibpth";;
4717 *) dlist="$libpth";;
4718 esac
4719
4720 : Now check and see which directories actually exist, avoiding duplicates
4721 libpth=''
4722 for xxx in $dlist
4723 do
4724     if $test -d $xxx; then
4725                 case " $libpth " in
4726                 *" $xxx "*) ;;
4727                 *) libpth="$libpth $xxx";;
4728                 esac
4729     fi
4730 done
4731 $cat <<'EOM'
4732
4733 Some systems have incompatible or broken versions of libraries.  Among
4734 the directories listed in the question below, please remove any you
4735 know not to be holding relevant libraries, and add any that are needed.
4736 Say "none" for none.
4737
4738 EOM
4739 case "$libpth" in
4740 '') dflt='none';;
4741 *)
4742         set X $libpth
4743         shift
4744         dflt=${1+"$@"}
4745         ;;
4746 esac
4747 rp="Directories to use for library searches?"
4748 . ./myread
4749 case "$ans" in
4750 none) libpth=' ';;
4751 *) libpth="$ans";;
4752 esac
4753
4754 : compute shared library extension
4755 case "$so" in
4756 '')
4757         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4758                 dflt='sl'
4759         else
4760                 dflt='so'
4761         fi
4762         ;;
4763 *) dflt="$so";;
4764 esac
4765 $cat <<EOM
4766
4767 On some systems, shared libraries may be available.  Answer 'none' if
4768 you want to suppress searching of shared libraries for the remainder
4769 of this configuration.
4770
4771 EOM
4772 rp='What is the file extension used for shared libraries?'
4773 . ./myread
4774 so="$ans"
4775
4776 : Define several unixisms.
4777 : Hints files or command line option can be used to override them.
4778 : The convoluted testing is in case hints files set either the old
4779 : or the new name.
4780 case "$_exe" in
4781 '')     case "$exe_ext" in
4782         '')     ;;
4783         *)      _exe="$exe_ext" ;;
4784         esac
4785         ;;
4786 esac
4787 case "$_a" in
4788 '')     case "$lib_ext" in
4789     '') _a='.a';;
4790         *)      _a="$lib_ext" ;;
4791         esac
4792         ;;
4793 esac
4794 case "$_o" in
4795 '') case "$obj_ext" in
4796         '')     _o='.o';;
4797         *)      _o="$obj_ext";;
4798         esac
4799         ;;
4800 esac
4801 case "$p_" in
4802 '') case "$path_sep" in
4803         '')     p_=':';;
4804         *)      p_="$path_sep";;
4805         esac
4806         ;;
4807 esac
4808 exe_ext=$_exe
4809 lib_ext=$_a
4810 obj_ext=$_o
4811 path_sep=$p_
4812
4813 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4814
4815 : Which makefile gets called first.  This is used by make depend.
4816 case "$firstmakefile" in
4817 '') firstmakefile='makefile';;
4818 esac
4819
4820 case "$ccflags" in
4821 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4822 esac
4823
4824 case "$uselongdouble" in
4825 $define|true|[yY]*)     dflt='y';;
4826 *) dflt='n';;
4827 esac
4828 cat <<EOM
4829
4830 Perl can be built to take advantage of long doubles which
4831 (if available) may give more accuracy and range for floating point numbers.
4832
4833 If this doesn't make any sense to you, just accept the default '$dflt'.
4834 EOM
4835 rp='Try to use long doubles if available?'
4836 . ./myread
4837 case "$ans" in
4838 y|Y)    val="$define"   ;;
4839 *)      val="$undef"    ;;
4840 esac
4841 set uselongdouble
4842 eval $setvar
4843
4844 case "$uselongdouble" in
4845 true|[yY]*) uselongdouble="$define" ;;
4846 esac
4847
4848 : Look for a hint-file generated 'call-back-unit'.  If the
4849 : user has specified that long doubles should be used,
4850 : we may need to set or change some other defaults.
4851 if $test -f uselongdouble.cbu; then
4852     echo "Your platform has some specific hints regarding long doubles, using them..."
4853     . ./uselongdouble.cbu
4854 else
4855     case "$uselongdouble" in
4856         $define)
4857                 $cat <<EOM
4858 (Your platform does not have any specific hints for long doubles.)
4859 EOM
4860         ;;
4861     esac
4862 fi
4863
4864 : Looking for optional libraries
4865 echo " "
4866 echo "Checking for optional libraries..." >&4
4867 case "$libs" in
4868 ' '|'') dflt='';;
4869 *) dflt="$libs";;
4870 esac
4871 case "$libswanted" in
4872 '') libswanted='c_s';;
4873 esac
4874 case "$usesocks" in
4875 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4876 esac
4877 libsfound=''
4878 libsfiles=''
4879 libsdirs=''
4880 libspath=''
4881 for thisdir in $libpth $xlibpth; do
4882   test -d $thisdir && libspath="$libspath $thisdir"
4883 done
4884 for thislib in $libswanted; do
4885         for thisdir in $libspath; do
4886             xxx=''
4887             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4888                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4889                 $test -f "$xxx" && eval $libscheck
4890                 $test -f "$xxx" && libstyle=shared
4891             fi
4892             if test ! -f "$xxx"; then
4893                 xxx=$thisdir/lib$thislib.$so
4894                 $test -f "$xxx" && eval $libscheck
4895                 $test -f "$xxx" && libstyle=shared
4896             fi  
4897             if test ! -f "$xxx"; then
4898                 xxx=$thisdir/lib$thislib$_a
4899                 $test -f "$xxx" && eval $libscheck
4900                 $test -f "$xxx" && libstyle=static
4901             fi
4902             if test ! -f "$xxx"; then
4903                 xxx=$thisdir/$thislib$_a
4904                 $test -f "$xxx" && eval $libscheck
4905                 $test -f "$xxx" && libstyle=static
4906             fi
4907             if test ! -f "$xxx"; then
4908                 xxx=$thisdir/lib${thislib}_s$_a
4909                 $test -f "$xxx" && eval $libscheck
4910                 $test -f "$xxx" && libstyle=static
4911                 $test -f "$xxx" && thislib=${thislib}_s
4912             fi
4913             if test ! -f "$xxx"; then
4914                 xxx=$thisdir/Slib$thislib$_a
4915                 $test -f "$xxx" && eval $libscheck
4916                 $test -f "$xxx" && libstyle=static
4917             fi
4918             if $test -f "$xxx"; then
4919                 case "$libstyle" in
4920                 shared) echo "Found -l$thislib (shared)." ;;
4921                 static) echo "Found -l$thislib." ;;
4922                 *)      echo "Found -l$thislib ($libstyle)." ;;
4923                 esac
4924                 case " $dflt " in
4925                 *"-l$thislib "*);;
4926                 *) dflt="$dflt -l$thislib"
4927                    libsfound="$libsfound $xxx"
4928                    yyy=`basename $xxx`
4929                    libsfiles="$libsfiles $yyy"
4930                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4931                    case " $libsdirs " in
4932                    *" $yyy "*) ;;
4933                    *) libsdirs="$libsdirs $yyy" ;;
4934                    esac
4935                    ;;
4936                 esac
4937                 break
4938             fi  
4939         done
4940         if $test ! -f "$xxx"; then
4941             echo "No -l$thislib."
4942         fi
4943 done
4944 set X $dflt
4945 shift
4946 dflt="$*"
4947 case "$libs" in
4948 '') dflt="$dflt";;
4949 *) dflt="$libs";;
4950 esac
4951 case "$dflt" in
4952 ' '|'') dflt='none';;
4953 esac
4954
4955 $cat <<EOM
4956
4957 In order to compile $package on your machine, a number of libraries
4958 are usually needed.  Include any other special libraries here as well.
4959 Say "none" for none.  The default list is almost always right.
4960 EOM
4961
4962 echo " "
4963 rp="What libraries to use?"
4964 . ./myread
4965 case "$ans" in
4966 none) libs=' ';;
4967 *) libs="$ans";;
4968 esac
4969
4970 : determine optimization, if desired, or use for debug flag also
4971 case "$optimize" in
4972 ' '|$undef) dflt='none';;
4973 '') dflt='-O';;
4974 *) dflt="$optimize";;
4975 esac
4976 $cat <<EOH
4977
4978 By default, $package compiles with the -O flag to use the optimizer.
4979 Alternately, you might want to use the symbolic debugger, which uses
4980 the -g flag (on traditional Unix systems).  Either flag can be
4981 specified here.  To use neither flag, specify the word "none".
4982
4983 EOH
4984 rp="What optimizer/debugger flag should be used?"
4985 . ./myread
4986 optimize="$ans"
4987 case "$optimize" in
4988 'none') optimize=" ";;
4989 esac
4990
4991 : Check what DEBUGGING is required from the command line
4992 : -DEBUGGING      or -DDEBUGGING or
4993 : -DEBUGGING=both                       = -g + -DDEBUGGING
4994 : -DEBUGGING=-g   or -Doptimize=-g      = -g
4995 : -DEBUGGING=none or -UDEBUGGING        =
4996 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
4997 case "$EBUGGING" in
4998 '')     ;;
4999 *)      DEBUGGING=$EBUGGING ;;
5000 esac
5001
5002 case "$DEBUGGING" in
5003 -g|both|$define)
5004     case "$optimize" in
5005         *-g*) ;;
5006         *)    optimize="$optimize -g" ;;
5007     esac ;;
5008 none|$undef)
5009     case "$optimize" in
5010         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5011                 shift
5012                 optimize="$*"
5013                 ;;
5014     esac ;;
5015 esac
5016
5017 dflt=''
5018 case "$DEBUGGING" in
5019 both|$define) dflt='-DDEBUGGING'
5020 esac
5021
5022 : We will not override a previous value, but we might want to
5023 : augment a hint file
5024 case "$hint" in
5025 default|recommended)
5026         case "$gccversion" in
5027         1*) dflt="$dflt -fpcc-struct-return" ;;
5028         esac
5029         case "$optimize:$DEBUGGING" in
5030         *-g*:old) dflt="$dflt -DDEBUGGING";;
5031         esac
5032         case "$gccversion" in
5033         2*) if test -d /etc/conf/kconfig.d &&
5034                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5035                 then
5036                         # Interactive Systems (ISC) POSIX mode.
5037                         dflt="$dflt -posix"
5038                 fi
5039                 ;;
5040         esac
5041         case "$gccversion" in
5042         1*) ;;
5043         2.[0-8]*) ;;
5044         ?*)     echo " "
5045                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
5046                 echo 'int main(void) { return 0; }' > gcctest.c
5047                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
5048                         echo "Yes, it does." 2>&1
5049                         case "$ccflags" in
5050                         *strict-aliasing*)
5051                                 echo "Leaving current flags $ccflags alone." 2>&1
5052                                 ;;
5053                         *) dflt="$dflt -fno-strict-aliasing" ;;
5054                         esac
5055                 else
5056                         echo "Nope, it doesn't, but that's ok." 2>&1
5057                 fi
5058                 ;;
5059         esac
5060         # For gcc, adding -pipe speeds up compilations for some, but apparently
5061         # some assemblers can't read from stdin.  (It also slows down compilations
5062         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5063         case "$gccversion" in
5064         ?*)     echo " "
5065                 echo "Checking if your compiler accepts -pipe" 2>&1
5066                 echo 'int main(void) { return 0; }' > gcctest.c
5067                 if $cc -pipe -o gcctest gcctest.c; then
5068                         echo "Yes, it does." 2>&1
5069                         case "$ccflags" in
5070                         *-pipe*)
5071                                 echo "Leaving current flags $ccflags alone." 2>&1
5072                                 ;;
5073                         *) dflt="$dflt -pipe" ;;
5074                         esac
5075                 else
5076                         echo "Nope, it doesn't, but that's ok." 2>&1
5077                 fi
5078                 ;;
5079         esac
5080         ;;
5081 esac
5082
5083 case "$mips_type" in
5084 *BSD*|'') inclwanted="$locincpth $usrinc";;
5085 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5086 esac
5087 for thisincl in $inclwanted; do
5088         if $test -d $thisincl; then
5089                 if $test x$thisincl != x$usrinc; then
5090                         case "$dflt" in
5091                         *" -I$thisincl "*);;
5092                         *) dflt="$dflt -I$thisincl ";;
5093                         esac
5094                 fi
5095         fi
5096 done
5097
5098 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5099         xxx=true;
5100 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5101         xxx=true;
5102 else
5103         xxx=false;
5104 fi;
5105 if $xxx; then
5106         case "$dflt" in
5107         *$2*);;
5108         *) dflt="$dflt -D$2";;
5109         esac;
5110 fi'
5111
5112 set signal.h LANGUAGE_C; eval $inctest
5113
5114 case "$usesocks" in
5115 $define)
5116         ccflags="$ccflags -DSOCKS"
5117         ;;
5118 esac
5119
5120 case "$hint" in
5121 default|recommended) dflt="$ccflags $dflt" ;;
5122 *) dflt="$ccflags";;
5123 esac
5124
5125 case "$dflt" in
5126 ''|' ') dflt=none;;
5127 esac
5128
5129 $cat <<EOH
5130
5131 Your C compiler may want other flags.  For this question you should include
5132 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5133 but you should NOT include libraries or ld flags like -lwhatever.  If you
5134 want $package to honor its debug switch, you should include -DDEBUGGING here.
5135 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5136
5137 To use no flags, specify the word "none".
5138
5139 EOH
5140 set X $dflt
5141 shift
5142 dflt=${1+"$@"}
5143 rp="Any additional cc flags?"
5144 . ./myread
5145 case "$ans" in
5146 none) ccflags='';;
5147 *) ccflags="$ans";;
5148 esac
5149
5150 : the following weeds options from ccflags that are of no interest to cpp
5151 case "$cppflags" in
5152 '') cppflags="$ccflags" ;;
5153 *)  cppflags="$cppflags $ccflags" ;;
5154 esac
5155 case "$gccversion" in
5156 1*) cppflags="$cppflags -D__GNUC__"
5157 esac
5158 case "$mips_type" in
5159 '');;
5160 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5161 esac
5162 case "$cppflags" in
5163 '');;
5164 *)
5165         echo " "
5166         echo "Let me guess what the preprocessor flags are..." >&4
5167         set X $cppflags
5168         shift
5169         cppflags=''
5170         $cat >cpp.c <<'EOM'
5171 #define BLURFL foo
5172
5173 BLURFL xx LFRULB
5174 EOM
5175         previous=''
5176         for flag in $*
5177         do
5178                 case "$flag" in
5179                 -*) ftry="$flag";;
5180                 *) ftry="$previous $flag";;
5181                 esac
5182                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5183                         >cpp1.out 2>/dev/null && \
5184                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5185                         >cpp2.out 2>/dev/null && \
5186                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5187                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5188                 then
5189                         cppflags="$cppflags $ftry"
5190                         previous=''
5191                 else
5192                         previous="$flag"
5193                 fi
5194         done
5195         set X $cppflags
5196         shift
5197         cppflags=${1+"$@"}
5198         case "$cppflags" in
5199         *-*)  echo "They appear to be: $cppflags";;
5200         esac
5201         $rm -f cpp.c cpp?.out
5202         ;;
5203 esac
5204
5205 : flags used in final linking phase
5206 case "$ldflags" in
5207 '') if ./venix; then
5208                 dflt='-i -z'
5209         else
5210                 dflt=''
5211         fi
5212         case "$ccflags" in
5213         *-posix*) dflt="$dflt -posix" ;;
5214         esac
5215         ;;
5216 *) dflt="$ldflags";;
5217 esac
5218
5219 : Try to guess additional flags to pick up local libraries.
5220 for thislibdir in $libpth; do
5221         case " $loclibpth " in
5222         *" $thislibdir "*)
5223                 case "$dflt " in
5224                 *"-L$thislibdir "*) ;;
5225                 *)  dflt="$dflt -L$thislibdir" ;;
5226                 esac
5227                 ;;
5228         esac
5229 done
5230
5231 case "$dflt" in
5232 '') dflt='none' ;;
5233 esac
5234
5235 $cat <<EOH
5236
5237 Your C linker may need flags.  For this question you should
5238 include -L/whatever and any other flags used by the C linker, but you
5239 should NOT include libraries like -lwhatever.
5240
5241 Make sure you include the appropriate -L/path flags if your C linker
5242 does not normally search all of the directories you specified above,
5243 namely
5244         $libpth
5245 To use no flags, specify the word "none".
5246
5247 EOH
5248
5249 rp="Any additional ld flags (NOT including libraries)?"
5250 . ./myread
5251 case "$ans" in
5252 none) ldflags='';;
5253 *) ldflags="$ans";;
5254 esac
5255 rmlist="$rmlist pdp11"
5256
5257 : coherency check
5258 echo " "
5259 echo "Checking your choice of C compiler and flags for coherency..." >&4
5260 $cat > try.c <<'EOF'
5261 #include <stdio.h>
5262 int main() { printf("Ok\n"); return(0); }
5263 EOF
5264 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5265 shift
5266 $cat >try.msg <<'EOM'
5267 I've tried to compile and run the following simple program:
5268
5269 EOM
5270 $cat try.c >> try.msg
5271
5272 $cat >> try.msg <<EOM
5273
5274 I used the command:
5275
5276         $*
5277         $run ./try
5278
5279 and I got the following output:
5280
5281 EOM
5282 dflt=y
5283 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5284         if $sh -c "$run ./try" >>try.msg 2>&1; then
5285                 xxx=`$run ./try`
5286                 case "$xxx" in
5287                 "Ok") dflt=n ;;
5288                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5289                         case " $libs " in
5290                         *" -lsfio "*)
5291                                 cat >> try.msg <<'EOQS'
5292 If $libs contains -lsfio, and sfio is mis-configured, then it
5293 sometimes (apparently) runs and exits with a 0 status, but with no
5294 output!  It may have to do with sfio's use of _exit vs. exit.
5295
5296 EOQS
5297                                 rp="You have a big problem.  Shall I abort Configure"
5298                                 dflt=y
5299                                 ;;
5300                         esac
5301                         ;;
5302                 esac
5303         else
5304                 echo "The program compiled OK, but exited with status $?." >>try.msg
5305                 rp="You have a problem.  Shall I abort Configure"
5306                 dflt=y
5307         fi
5308 else
5309         echo "I can't compile the test program." >>try.msg
5310         rp="You have a BIG problem.  Shall I abort Configure"
5311         dflt=y
5312 fi
5313 case "$dflt" in
5314 y)
5315         $cat try.msg >&4
5316         case "$knowitall" in
5317         '')
5318                 echo "(The supplied flags or libraries might be incorrect.)"
5319                 ;;
5320         *) dflt=n;;
5321         esac
5322         echo " "
5323         . ./myread
5324         case "$ans" in
5325         n*|N*) ;;
5326         *)      echo "Ok.  Stopping Configure." >&4
5327                 exit 1
5328                 ;;
5329         esac
5330         ;;
5331 n) echo "OK, that should do.";;
5332 esac
5333 $rm_try
5334
5335 : define a shorthand compile call
5336 compile='
5337 mc_file=$1;
5338 shift;
5339 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5340 : define a shorthand compile call for compilations that should be ok.
5341 compile_ok='
5342 mc_file=$1;
5343 shift;
5344 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5345
5346 : determine filename position in cpp output
5347 echo " "
5348 echo "Computing filename position in cpp output for #include directives..." >&4
5349 case "$osname" in
5350 vos) testaccess=-e ;;
5351 *)   testaccess=-r ;;
5352 esac
5353 echo '#include <stdio.h>' > foo.c
5354 $cat >fieldn <<EOF
5355 $startsh
5356 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5357 $grep '^[       ]*#.*stdio\.h' | \
5358 while read cline; do
5359         pos=1
5360         set \$cline
5361         while $test \$# -gt 0; do
5362                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5363                         echo "\$pos"
5364                         exit 0
5365                 fi
5366                 shift
5367                 pos=\`expr \$pos + 1\`
5368         done
5369 done
5370 EOF
5371 chmod +x fieldn
5372 fieldn=`./fieldn`
5373 $rm -f foo.c fieldn
5374 case $fieldn in
5375 '') pos='???';;
5376 1) pos=first;;
5377 2) pos=second;;
5378 3) pos=third;;
5379 *) pos="${fieldn}th";;
5380 esac
5381 echo "Your cpp writes the filename in the $pos field of the line."
5382
5383 case "$osname" in
5384 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5385 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5386 *)   cppfilter='' ;;
5387 esac
5388 : locate header file
5389 $cat >findhdr <<EOF
5390 $startsh
5391 wanted=\$1
5392 name=''
5393 for usrincdir in $usrinc
5394 do
5395         if test -f \$usrincdir/\$wanted; then
5396                 echo "\$usrincdir/\$wanted"
5397                 exit 0
5398         fi
5399 done
5400 awkprg='{ print \$$fieldn }'
5401 echo "#include <\$wanted>" > foo\$\$.c
5402 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5403 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5404 while read cline; do
5405         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5406         case "\$name" in
5407         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5408         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5409         *) exit 2;;
5410         esac;
5411 done;
5412 #
5413 # status = 0: grep returned 0 lines, case statement not executed
5414 # status = 1: headerfile found
5415 # status = 2: while loop executed, no headerfile found
5416 #
5417 status=\$?
5418 $rm -f foo\$\$.c;
5419 if test \$status -eq 1; then
5420         exit 0;
5421 fi
5422 exit 1
5423 EOF
5424 chmod +x findhdr
5425
5426 : define an alternate in-header-list? function
5427 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5428 cont=true; xxf="echo \"<\$1> found.\" >&4";
5429 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5430 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5431 esac;
5432 case $# in 4) instead=instead;; *) instead="at last";; esac;
5433 while $test "$cont"; do
5434         xxx=`./findhdr $1`
5435         var=$2; eval "was=\$$2";
5436         if $test "$xxx" && $test -r "$xxx";
5437         then eval $xxf;
5438         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5439                 cont="";
5440         else eval $xxnf;
5441         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5442         set $yyy; shift; shift; yyy=$@;
5443         case $# in 0) cont="";;
5444         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5445                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5446         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5447                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5448         esac;
5449 done;
5450 while $test "$yyy";
5451 do set $yyy; var=$2; eval "was=\$$2";
5452         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5453         set $yyy; shift; shift; yyy=$@;
5454 done'
5455
5456 : see if stdlib is available
5457 set stdlib.h i_stdlib
5458 eval $inhdr
5459
5460 : check for lengths of integral types
5461 echo " "
5462 case "$intsize" in
5463 '')
5464         echo "Checking to see how big your integers are..." >&4
5465         $cat >try.c <<EOCP
5466 #include <stdio.h>
5467 #$i_stdlib I_STDLIB
5468 #ifdef I_STDLIB
5469 #include <stdlib.h>
5470 #endif
5471 int main()
5472 {
5473         printf("intsize=%d;\n", (int)sizeof(int));
5474         printf("longsize=%d;\n", (int)sizeof(long));
5475         printf("shortsize=%d;\n", (int)sizeof(short));
5476         exit(0);
5477 }
5478 EOCP
5479         set try
5480         if eval $compile_ok && $run ./try > /dev/null; then
5481                 eval `$run ./try`
5482                 echo "Your integers are $intsize bytes long."
5483                 echo "Your long integers are $longsize bytes long."
5484                 echo "Your short integers are $shortsize bytes long."
5485         else
5486                 $cat >&4 <<EOM
5487 !
5488 Help! I can't compile and run the intsize test program: please enlighten me!
5489 (This is probably a misconfiguration in your system or libraries, and
5490 you really ought to fix it.  Still, I'll try anyway.)
5491 !
5492 EOM
5493                 dflt=4
5494                 rp="What is the size of an integer (in bytes)?"
5495                 . ./myread
5496                 intsize="$ans"
5497                 dflt=$intsize
5498                 rp="What is the size of a long integer (in bytes)?"
5499                 . ./myread
5500                 longsize="$ans"
5501                 dflt=2
5502                 rp="What is the size of a short integer (in bytes)?"
5503                 . ./myread
5504                 shortsize="$ans"
5505         fi
5506         ;;
5507 esac
5508 $rm_try
5509
5510 : check for long long
5511 echo " "
5512 echo "Checking to see if you have long long..." >&4
5513 echo 'int main() { long long x = 7; return 0; }' > try.c
5514 set try
5515 if eval $compile; then
5516         val="$define"
5517         echo "You have long long."
5518 else
5519         val="$undef"
5520         echo "You do not have long long."
5521 fi
5522 $rm_try
5523 set d_longlong
5524 eval $setvar
5525
5526 : check for length of long long
5527 case "${d_longlong}${longlongsize}" in
5528 $define)
5529         echo " "
5530         echo "Checking to see how big your long longs are..." >&4
5531         $cat >try.c <<'EOCP'
5532 #include <stdio.h>
5533 int main()
5534 {
5535     printf("%d\n", (int)sizeof(long long));
5536     return(0);
5537 }
5538 EOCP
5539         set try
5540         if eval $compile_ok; then
5541                 longlongsize=`$run ./try`
5542                 echo "Your long longs are $longlongsize bytes long."
5543         else
5544                 dflt='8'
5545                 echo " "
5546                 echo "(I can't seem to compile the test program.  Guessing...)"
5547                 rp="What is the size of a long long (in bytes)?"
5548                 . ./myread
5549                 longlongsize="$ans"
5550         fi
5551         if $test "X$longsize" = "X$longlongsize"; then
5552                 echo "(That isn't any different from an ordinary long.)"
5553         fi
5554         ;;
5555 esac
5556 $rm_try
5557
5558 : see if inttypes.h is available
5559 : we want a real compile instead of Inhdr because some systems
5560 : have an inttypes.h which includes non-existent headers
5561 echo " "
5562 $cat >try.c <<EOCP
5563 #include <inttypes.h>
5564 int main() {
5565         static int32_t foo32 = 0x12345678;
5566 }
5567 EOCP
5568 set try
5569 if eval $compile; then
5570         echo "<inttypes.h> found." >&4
5571         val="$define"
5572 else
5573         echo "<inttypes.h> NOT found." >&4
5574         val="$undef"
5575 fi
5576 $rm_try
5577 set i_inttypes
5578 eval $setvar
5579
5580 : check for int64_t
5581 echo " "
5582 echo "Checking to see if you have int64_t..." >&4
5583 $cat >try.c <<EOCP
5584 #include <sys/types.h>
5585 #$i_inttypes I_INTTYPES
5586 #ifdef I_INTTYPES
5587 #include <inttypes.h>
5588 #endif
5589 int main() { int64_t x = 7; }
5590 EOCP
5591 set try
5592 if eval $compile; then
5593         val="$define"
5594         echo "You have int64_t."
5595 else
5596         val="$undef"
5597         echo "You do not have int64_t."
5598 fi
5599 $rm_try
5600 set d_int64_t
5601 eval $setvar
5602
5603
5604 echo " "
5605 echo "Checking which 64-bit integer type we could use..." >&4
5606
5607 case "$intsize" in
5608 8) val=int
5609    set quadtype
5610    eval $setvar
5611    val='"unsigned int"'
5612    set uquadtype
5613    eval $setvar
5614    quadkind=1
5615    ;;
5616 *) case "$longsize" in
5617    8) val=long
5618       set quadtype
5619       eval $setvar
5620       val='"unsigned long"'
5621       set uquadtype
5622       eval $setvar
5623       quadkind=2
5624       ;;
5625    *) case "$d_longlong:$longlongsize" in
5626       define:8)
5627         val='"long long"'
5628         set quadtype
5629         eval $setvar
5630         val='"unsigned long long"'
5631         set uquadtype
5632         eval $setvar
5633         quadkind=3
5634         ;;
5635       *) case "$d_int64_t" in
5636          define)
5637            val=int64_t
5638            set quadtype
5639            eval $setvar
5640            val=uint64_t
5641            set uquadtype
5642            eval $setvar
5643            quadkind=4
5644            ;;
5645          esac
5646          ;;
5647       esac
5648       ;;
5649    esac
5650    ;;
5651 esac
5652
5653 case "$quadtype" in
5654 '')     echo "Alas, no 64-bit integer types in sight." >&4
5655         d_quad="$undef"
5656         ;;
5657 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5658         d_quad="$define"
5659         ;;
5660 esac
5661
5662
5663 case "$uselonglong" in
5664 "$define"|true|[yY]*)
5665         cat <<EOM >&4
5666
5667 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5668 EOM
5669         use64bitint="$define"
5670         ;;
5671 esac                          
5672 case "$use64bits" in
5673 "$define"|true|[yY]*)
5674         cat <<EOM >&4
5675
5676 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5677 EOM
5678         use64bitint="$define"
5679         ;;
5680 esac                          
5681 case "$use64bitints" in
5682 "$define"|true|[yY]*)
5683         cat <<EOM >&4
5684
5685 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5686 EOM
5687         use64bitint="$define"
5688         ;;
5689 esac                          
5690 case "$use64bitsint" in
5691 "$define"|true|[yY]*)
5692         cat <<EOM >&4
5693
5694 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5695 EOM
5696         use64bitint="$define"
5697         ;;
5698 esac                          
5699 case "$uselonglongs" in
5700 "$define"|true|[yY]*)
5701         cat <<EOM >&4
5702
5703 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5704 EOM
5705         use64bitint="$define"
5706         ;;
5707 esac                          
5708 case "$use64bitsall" in
5709 "$define"|true|[yY]*)
5710         cat <<EOM >&4
5711
5712 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5713 EOM
5714         use64bitall="$define"
5715         ;;
5716 esac                          
5717
5718 case "$ccflags" in
5719 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5720 esac
5721 case "$use64bitall" in
5722 "$define"|true|[yY]*) use64bitint="$define" ;;
5723 esac
5724
5725 case "$longsize" in
5726 8) cat <<EOM
5727
5728 You have natively 64-bit long integers.
5729 EOM
5730    val="$define"
5731    ;;
5732 *) case "$use64bitint" in
5733    "$define"|true|[yY]*) dflt='y';;
5734    *) dflt='n';;
5735    esac
5736    case "$d_quad" in
5737    "$define") ;;
5738    *) dflt='n' ;;
5739    esac
5740    cat <<EOM
5741
5742 Perl can be built to take advantage of 64-bit integer types
5743 on some systems.  To do so, Configure can be run with -Duse64bitint.
5744 Choosing this option will most probably introduce binary incompatibilities.
5745
5746 If this doesn't make any sense to you, just accept the default '$dflt'.
5747 (The default has been chosen based on your configuration.)
5748 EOM
5749    rp='Try to use 64-bit integers, if available?'
5750    . ./myread
5751    case "$ans" in
5752    [yY]*) val="$define" ;;
5753    *)     val="$undef"  ;;
5754    esac
5755    ;;
5756 esac
5757 set use64bitint
5758 eval $setvar
5759
5760 case "$use64bitall" in
5761 "$define"|true|[yY]*) dflt='y' ;;
5762 *) case "$longsize" in
5763    8) dflt='y' ;;
5764    *) dflt='n' ;;
5765    esac
5766    ;;
5767 esac    
5768 cat <<EOM
5769
5770 You may also choose to try maximal 64-bitness.  It means using as much
5771 64-bitness as possible on the platform.  This in turn means even more
5772 binary incompatibilities.  On the other hand, your platform may not
5773 have any more 64-bitness available than what you already have chosen.
5774
5775 If this doesn't make any sense to you, just accept the default '$dflt'.
5776 (The default has been chosen based on your configuration.)
5777 EOM
5778 rp='Try to use maximal 64-bit support, if available?'
5779 . ./myread
5780 case "$ans" in
5781 [yY]*) val="$define" ;;
5782 *)     val="$undef"  ;;
5783 esac
5784 set use64bitall
5785 eval $setvar
5786 case "$use64bitall" in
5787 "$define")
5788         case "$use64bitint" in
5789         "$undef")
5790                 cat <<EOM
5791
5792 Since you have chosen a maximally 64-bit build, I'm also turning on
5793 the use of 64-bit integers.
5794 EOM
5795                 use64bitint="$define" ;;
5796         esac
5797         ;;
5798 esac
5799
5800 : Look for a hint-file generated 'call-back-unit'.  If the
5801 : user has specified that a 64-bit perl is to be built,
5802 : we may need to set or change some other defaults.
5803 if $test -f use64bitint.cbu; then
5804         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5805         . ./use64bitint.cbu
5806 fi
5807 case "$use64bitint" in
5808 "$define"|true|[yY]*)
5809         case "$longsize" in
5810         4) case "$archname64" in
5811            '') archname64=64int ;;
5812            esac
5813            ;;
5814         esac
5815         ;;
5816 esac
5817
5818 : Look for a hint-file generated 'call-back-unit'.  If the
5819 : user has specified that a maximally 64-bit perl is to be built,
5820 : we may need to set or change some other defaults.
5821 if $test -f use64bitall.cbu; then
5822         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5823         . ./use64bitall.cbu
5824 fi
5825 case "$use64bitall" in
5826 "$define"|true|[yY]*)
5827         case "$longsize" in
5828         4) case "$archname64" in
5829            ''|64int) archname64=64all ;;
5830            esac
5831            ;;
5832         esac
5833         ;;
5834 esac
5835
5836 case "$d_quad:$use64bitint" in
5837 $undef:$define)
5838         cat >&4 <<EOF
5839
5840 *** You have chosen to use 64-bit integers,
5841 *** but none can be found.
5842 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5843 *** Cannot continue, aborting.
5844
5845 EOF
5846         exit 1
5847         ;;
5848 esac
5849
5850 : check for length of double
5851 echo " "
5852 case "$doublesize" in
5853 '')
5854         echo "Checking to see how big your double precision numbers are..." >&4
5855         $cat >try.c <<EOCP
5856 #include <stdio.h>
5857 #$i_stdlib I_STDLIB
5858 #ifdef I_STDLIB
5859 #include <stdlib.h>
5860 #endif
5861 int main()
5862 {
5863     printf("%d\n", (int)sizeof(double));
5864     exit(0);
5865 }
5866 EOCP
5867         set try
5868         if eval $compile_ok; then
5869                 doublesize=`$run ./try`
5870                 echo "Your double is $doublesize bytes long."
5871         else
5872                 dflt='8'
5873                 echo "(I can't seem to compile the test program.  Guessing...)"
5874                 rp="What is the size of a double precision number (in bytes)?"
5875                 . ./myread
5876                 doublesize="$ans"
5877         fi
5878         ;;
5879 esac
5880 $rm_try
5881
5882 : check for long doubles
5883 echo " "
5884 echo "Checking to see if you have long double..." >&4
5885 echo 'int main() { long double x = 7.0; }' > try.c
5886 set try
5887 if eval $compile; then
5888         val="$define"
5889         echo "You have long double."
5890 else
5891         val="$undef"
5892         echo "You do not have long double."
5893 fi
5894 $rm_try
5895 set d_longdbl
5896 eval $setvar
5897
5898 : check for length of long double
5899 case "${d_longdbl}${longdblsize}" in
5900 $define)
5901         echo " "
5902         echo "Checking to see how big your long doubles are..." >&4
5903         $cat >try.c <<'EOCP'
5904 #include <stdio.h>
5905 int main()
5906 {
5907         printf("%d\n", sizeof(long double));
5908 }
5909 EOCP
5910         set try
5911         set try
5912         if eval $compile; then
5913                 longdblsize=`$run ./try`
5914                 echo "Your long doubles are $longdblsize bytes long."
5915         else
5916                 dflt='8'
5917                 echo " "
5918                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5919                 rp="What is the size of a long double (in bytes)?"
5920                 . ./myread
5921                 longdblsize="$ans"
5922         fi
5923         if $test "X$doublesize" = "X$longdblsize"; then
5924                 echo "That isn't any different from an ordinary double."
5925                 echo "I'll keep your setting anyway, but you may see some"
5926                 echo "harmless compilation warnings."
5927         fi
5928         ;;
5929 esac
5930 $rm_try
5931
5932 : determine the architecture name
5933 echo " "
5934 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5935         tarch=`arch`"-$osname"
5936 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5937         if uname -m > tmparch 2>&1 ; then
5938                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5939                         -e 's/$/'"-$osname/" tmparch`
5940         else
5941                 tarch="$osname"
5942         fi
5943         $rm -f tmparch
5944 else
5945         tarch="$osname"
5946 fi
5947 case "$myarchname" in
5948 ''|"$tarch") ;;
5949 *)
5950         echo "(Your architecture name used to be $myarchname.)"
5951         archname=''
5952         ;;
5953 esac
5954 case "$targetarch" in
5955 '') ;;
5956 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5957 esac
5958 myarchname="$tarch"
5959 case "$archname" in
5960 '') dflt="$tarch";;
5961 *) dflt="$archname";;
5962 esac
5963 rp='What is your architecture name'
5964 . ./myread
5965 archname="$ans"
5966 case "$usethreads" in
5967 $define)
5968         echo "Threads selected." >&4
5969         case "$archname" in
5970         *-thread*) echo "...and architecture name already has -thread." >&4
5971                 ;;
5972         *)      archname="$archname-thread"
5973                 echo "...setting architecture name to $archname." >&4
5974                 ;;
5975         esac
5976         ;;
5977 esac
5978 case "$usemultiplicity" in
5979 $define)
5980         echo "Multiplicity selected." >&4
5981         case "$archname" in
5982         *-multi*) echo "...and architecture name already has -multi." >&4
5983                 ;;
5984         *)      archname="$archname-multi"
5985                 echo "...setting architecture name to $archname." >&4
5986                 ;;
5987         esac
5988         ;;
5989 esac
5990 case "$use64bitint$use64bitall" in
5991 *"$define"*)
5992         case "$archname64" in
5993         '')
5994                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5995                 ;;
5996         *)
5997                 case "$use64bitint" in
5998                 "$define") echo "64 bit integers selected." >&4 ;;
5999                 esac
6000                 case "$use64bitall" in
6001                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6002                 esac
6003                 case "$archname" in
6004                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6005                         ;;
6006                 *)      archname="$archname-$archname64"
6007                         echo "...setting architecture name to $archname." >&4
6008                         ;;
6009                 esac
6010                 ;;
6011         esac
6012 esac
6013 case "$uselongdouble" in
6014 $define)
6015         echo "Long doubles selected." >&4
6016         case "$longdblsize" in
6017         $doublesize)
6018                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6019                 ;;
6020         *)
6021                 case "$archname" in
6022                 *-ld*) echo "...and architecture name already has -ld." >&4
6023                         ;;
6024                 *)      archname="$archname-ld"
6025                         echo "...setting architecture name to $archname." >&4
6026                         ;;
6027                 esac
6028                 ;;
6029         esac
6030         ;;
6031 esac
6032 case "$useperlio" in
6033 $define)
6034         echo "Perlio selected." >&4
6035         ;;
6036 *)
6037         echo "Perlio not selected, using stdio." >&4
6038         case "$archname" in
6039         *-stdio*) echo "...and architecture name already has -stdio." >&4
6040                 ;;
6041         *)      archname="$archname-stdio"
6042                 echo "...setting architecture name to $archname." >&4
6043                 ;;
6044         esac
6045         ;;
6046 esac
6047 if $test -f archname.cbu; then
6048         echo "Your platform has some specific hints for architecture name, using them..."
6049         . ./archname.cbu
6050 fi
6051
6052 : set the prefixit variable, to compute a suitable default value
6053 prefixit='case "$3" in
6054 ""|none)
6055         case "$oldprefix" in
6056         "") eval "$1=\"\$$2\"";;
6057         *)
6058                 case "$3" in
6059                 "") eval "$1=";;
6060                 none)
6061                         eval "tp=\"\$$2\"";
6062                         case "$tp" in
6063                         ""|" ") eval "$1=\"\$$2\"";;
6064                         *) eval "$1=";;
6065                         esac;;
6066                 esac;;
6067         esac;;
6068 *)
6069         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6070         case "$tp" in
6071         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6072         /*-$oldprefix/*|\~*-$oldprefix/*)
6073                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6074         *) eval "$1=\"\$$2\"";;
6075         esac;;
6076 esac'
6077
6078 : determine installation style
6079 : For now, try to deduce it from prefix unless it is already set.
6080 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6081 case "$installstyle" in
6082 '')     case "$prefix" in
6083                 *perl*) dflt='lib';;
6084                 *) dflt='lib/perl5' ;;
6085         esac
6086         ;;
6087 *)      dflt="$installstyle" ;;
6088 esac
6089 : Probably not worth prompting for this since we prompt for all
6090 : the directories individually, and the prompt would be too long and
6091 : confusing anyway.
6092 installstyle=$dflt
6093
6094 : determine where public executables go
6095 echo " "
6096 set dflt bin bin
6097 eval $prefixit
6098 fn=d~
6099 rp='Pathname where the public executables will reside?'
6100 . ./getfile
6101 if $test "X$ansexp" != "X$binexp"; then
6102         installbin=''
6103 fi
6104 prefixvar=bin
6105 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6106 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6107 :     this via initialinstalllocation
6108 . ./setprefixvar
6109
6110 case "$userelocatableinc" in
6111 $define|true|[yY]*)     dflt='y' ;;
6112 *)                      dflt='n' ;;
6113 esac
6114 cat <<EOM
6115
6116 Would you like to build Perl so that the installation is relocatable, so that
6117 library paths in @INC are determined relative to the path of the perl binary?
6118 This is not advised for system Perl installs, or if you need to run setid
6119 scripts or scripts under taint mode.
6120
6121 If this doesn't make any sense to you, just accept the default '$dflt'.
6122 EOM
6123 rp='Use relocatable @INC?'
6124 . ./myread
6125 case "$ans" in
6126 y|Y)    val="$define" ;;
6127 *)      val="$undef"  ;;
6128 esac
6129 set userelocatableinc
6130 eval $setvar
6131
6132 initialinstalllocation="$binexp"
6133 : Default prefix is now "up one level from where the binaries are"
6134 case "$userelocatableinc" in
6135 $define|true|[yY]*)
6136     bin=".../"
6137     binexp=".../"
6138     prefix=".../.."
6139     prefixexp=".../.."
6140     installprefixexp=".../.."
6141     ;;
6142 esac
6143
6144 : determine where private library files go
6145 : Usual default is /usr/local/lib/perl5/$version.
6146 : Also allow things like /opt/perl/lib/$version, since
6147 : /opt/perl/lib/perl5... would be redundant.
6148 : The default "style" setting is made in installstyle.U
6149 case "$installstyle" in
6150 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6151 *)       set dflt privlib lib/$version ;;
6152 esac
6153 eval $prefixit
6154 $cat <<EOM
6155
6156 There are some auxiliary files for $package that need to be put into a
6157 private library directory that is accessible by everyone.
6158
6159 EOM
6160 fn=$binexp
6161 fn=d~+
6162 rp='Pathname where the private library files will reside?'
6163 . ./getfile
6164 prefixvar=privlib
6165 . ./setprefixvar
6166
6167 : set the prefixup variable, to restore leading tilda escape
6168 prefixup='case "$prefixexp" in
6169 "$prefix") ;;
6170 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6171 esac'
6172
6173 : determine where public architecture dependent libraries go
6174 set archlib archlib
6175 eval $prefixit
6176 : privlib default is /usr/local/lib/$package/$version
6177 : archlib default is /usr/local/lib/$package/$version/$archname
6178 : privlib may have an optional trailing /share.
6179 tdflt=`echo $privlib | $sed 's,/share$,,'`
6180 tdflt=$tdflt/$archname
6181 case "$archlib" in
6182 '')     dflt=$tdflt
6183         ;;
6184 *)      dflt="$archlib"
6185     ;;
6186 esac
6187 $cat <<EOM
6188
6189 $spackage contains architecture-dependent library files.  If you are
6190 sharing libraries in a heterogeneous environment, you might store
6191 these files in a separate location.  Otherwise, you can just include
6192 them with the rest of the public library files.
6193
6194 EOM
6195 fn=$binexp
6196 fn=d+~
6197 rp='Where do you want to put the public architecture-dependent libraries?'
6198 . ./getfile
6199 prefixvar=archlib
6200 . ./setprefixvar
6201 if $test X"$archlib" = X"$privlib"; then
6202         d_archlib="$undef"
6203 else
6204         d_archlib="$define"
6205 fi
6206
6207 : see if setuid scripts can be secure
6208 $cat <<EOM
6209
6210 Some kernels have a bug that prevents setuid #! scripts from being
6211 secure.  Some sites have disabled setuid #! scripts because of this.
6212
6213 First let's decide if your kernel supports secure setuid #! scripts.
6214 (If setuid #! scripts would be secure but have been disabled anyway,
6215 don't say that they are secure if asked.)
6216
6217 EOM
6218
6219 val="$undef"
6220 if $test -d /dev/fd; then
6221         echo "#!$ls" >reflect
6222         chmod +x,u+s reflect
6223         ./reflect >flect 2>&1
6224         if $contains "/dev/fd" flect >/dev/null; then
6225                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6226                 val="$define"
6227         else
6228                 $cat <<EOM
6229 If you are not sure if they are secure, I can check but I'll need a
6230 username and password different from the one you are using right now.
6231 If you don't have such a username or don't want me to test, simply
6232 enter 'none'.
6233
6234 EOM
6235                 rp='Other username to test security of setuid scripts with?'
6236                 dflt='none'
6237                 . ./myread
6238                 case "$ans" in
6239                 n|none)
6240                         case "$d_suidsafe" in
6241                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6242                                 dflt=n;;
6243                         "$undef")
6244                                 echo "Well, the $hint value is *not* secure." >&4
6245                                 dflt=n;;
6246                         *)      echo "Well, the $hint value *is* secure." >&4
6247                                 dflt=y;;
6248                         esac
6249                         ;;
6250                 *)
6251                         $rm -f reflect flect
6252                         echo "#!$ls" >reflect
6253                         chmod +x,u+s reflect
6254                         echo >flect
6255                         chmod a+w flect
6256                         echo '"su" will (probably) prompt you for '"$ans's password."
6257                         su $ans -c './reflect >flect'
6258                         if $contains "/dev/fd" flect >/dev/null; then
6259                                 echo "Okay, it looks like setuid scripts are secure." >&4
6260                                 dflt=y
6261                         else
6262                                 echo "I don't think setuid scripts are secure." >&4
6263                                 dflt=n
6264                         fi
6265                         ;;
6266                 esac
6267                 rp='Does your kernel have *secure* setuid scripts?'
6268                 . ./myread
6269                 case "$ans" in
6270                 [yY]*)  val="$define";;
6271                 *)      val="$undef";;
6272                 esac
6273         fi
6274 else
6275         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6276         echo "(That's for file descriptors, not floppy disks.)"
6277         val="$undef"
6278 fi
6279 set d_suidsafe
6280 eval $setvar
6281
6282 $rm -f reflect flect
6283
6284 : now see if they want to do setuid emulation
6285 echo " "
6286 val="$undef"
6287 case "$d_suidsafe" in
6288 "$define")
6289         val="$undef"
6290         echo "No need to emulate SUID scripts since they are secure here." >&4
6291         ;;
6292 *)
6293         $cat <<EOM
6294 Some systems have disabled setuid scripts, especially systems where
6295 setuid scripts cannot be secure.  On systems where setuid scripts have
6296 been disabled, the setuid/setgid bits on scripts are currently
6297 useless.  It is possible for $package to detect those bits and emulate
6298 setuid/setgid in a secure fashion.  This emulation will only work if
6299 setuid scripts have been disabled in your kernel.
6300
6301 EOM
6302         case "$d_dosuid" in
6303         "$define") dflt=y ;;
6304         *) dflt=n ;;
6305         esac
6306         rp="Do you want to do setuid/setgid emulation?"
6307         . ./myread
6308         case "$ans" in
6309         [yY]*)  val="$define";;
6310         *)      val="$undef";;
6311         esac
6312         ;;
6313 esac
6314 set d_dosuid
6315 eval $setvar
6316
6317 : Find perl5.005 or later.
6318 echo "Looking for a previously installed perl5.005 or later... "
6319 case "$perl5" in
6320 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6321                 : Check if this perl is recent and can load a simple module
6322                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6323                         perl5=$tdir/perl
6324                         break;
6325                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6326                         perl5=$tdir/perl5
6327                         break;
6328                 fi
6329         done
6330         ;;
6331 *)      perl5="$perl5"
6332         ;;
6333 esac
6334 case "$perl5" in
6335 '')     echo "None found.  That's ok.";;
6336 *)      echo "Using $perl5." ;;
6337 esac
6338
6339 $cat <<EOM
6340
6341 After $package is installed, you may wish to install various
6342 add-on modules and utilities.  Typically, these add-ons will
6343 be installed under $prefix with the rest
6344 of this package.  However, you may wish to install such add-ons
6345 elsewhere under a different prefix.
6346
6347 If you do not wish to put everything under a single prefix, that's
6348 ok.  You will be prompted for the individual locations; this siteprefix
6349 is only used to suggest the defaults.
6350
6351 The default should be fine for most people.
6352
6353 EOM
6354 fn=d~+
6355 rp='Installation prefix to use for add-on modules and utilities?'
6356 : XXX Here might be another good place for an installstyle setting.
6357 case "$siteprefix" in
6358 '') dflt=$prefix ;;
6359 *)  dflt=$siteprefix ;;
6360 esac
6361 . ./getfile
6362 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6363 oldsiteprefix=''
6364 case "$siteprefix" in
6365 '') ;;
6366 *)      case "$ans" in
6367         "$prefix") ;;
6368         *) oldsiteprefix="$prefix";;
6369         esac
6370         ;;
6371 esac
6372 siteprefix="$ans"
6373 siteprefixexp="$ansexp"
6374
6375 : determine where site specific libraries go.
6376 : Usual default is /usr/local/lib/perl5/site_perl/$version
6377 : The default "style" setting is made in installstyle.U
6378 : XXX No longer works with Prefixit stuff.
6379 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6380 case "$sitelib" in
6381 '') case "$installstyle" in
6382         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6383         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6384         esac
6385         ;;
6386 *)      dflt="$sitelib"
6387         ;;
6388 esac
6389 $cat <<EOM
6390
6391 The installation process will create a directory for
6392 site-specific extensions and modules.  Most users find it convenient
6393 to place all site-specific files in this directory rather than in the
6394 main distribution directory.
6395
6396 EOM
6397 fn=d~+
6398 rp='Pathname for the site-specific library files?'
6399 . ./getfile
6400 prefixvar=sitelib
6401 . ./setprefixvar
6402 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6403
6404 : Determine list of previous versions to include in @INC
6405 $cat > getverlist <<EOPL
6406 #!$perl5 -w
6407 use File::Basename;
6408 \$api_versionstring = "$api_versionstring";
6409 \$version = "$version";
6410 \$stem = "$sitelib_stem";
6411 \$archname = "$archname";
6412 EOPL
6413         $cat >> getverlist <<'EOPL'
6414 # The list found is store twice for each entry: the original name, and
6415 # the binary broken down version as pack "sss", so sorting is easy and
6416 # unambiguous. This will work for all versions that have a maximum of
6417 # three digit groups, separate by '.'s or '_'s. Names are extended with
6418 # ".0.0" to ensure at least three elements for the pack.
6419 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6420
6421 # Can't have leading @ because metaconfig interprets it as a command!
6422 ;@inc_version_list=();
6423 # XXX Redo to do opendir/readdir?
6424 if (-d $stem) {
6425     chdir($stem);
6426     ;@candidates = map {
6427         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6428 }
6429 else {
6430     ;@candidates = ();
6431 }
6432
6433 ($pversion, $aversion, $vsn5005) = map {
6434     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6435 foreach $d (@candidates) {
6436     if ($d->[1] lt $pversion) {
6437         if ($d->[1] ge $aversion) {
6438             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6439         }
6440         elsif ($d->[1] ge $vsn5005) {
6441             unshift(@inc_version_list, grep { -d } $d->[0]);
6442         }
6443     }
6444     else {
6445         # Skip newer version.  I.e. don't look in
6446         # 5.7.0 if we're installing 5.6.1.
6447     }
6448 }
6449
6450 if (@inc_version_list) {
6451     print join(' ', @inc_version_list);
6452 }
6453 else {
6454     # Blank space to preserve value for next Configure run.
6455     print " ";
6456 }
6457 EOPL
6458 chmod +x getverlist
6459 case "$inc_version_list" in
6460 '')     if test -x "$perl5$exe_ext"; then
6461                 dflt=`$perl5 getverlist`
6462         else
6463                 dflt='none'
6464         fi
6465         ;;
6466 $undef) dflt='none' ;;
6467 *)  eval dflt=\"$inc_version_list\" ;;
6468 esac
6469 case "$dflt" in
6470 ''|' ') dflt=none ;;
6471 esac
6472 case "$dflt" in
6473 5.005) dflt=none ;;
6474 esac
6475 $cat <<EOM
6476
6477 In order to ease the process of upgrading, this version of perl
6478 can be configured to use modules built and installed with earlier
6479 versions of perl that were installed under $prefix.  Specify here
6480 the list of earlier versions that this version of perl should check.
6481 If Configure detected no earlier versions of perl installed under
6482 $prefix, then the list will be empty.  Answer 'none' to tell perl
6483 to not search earlier versions.
6484
6485 The default should almost always be sensible, so if you're not sure,
6486 just accept the default.
6487 EOM
6488
6489 rp='List of earlier versions to include in @INC?'
6490 . ./myread
6491 case "$ans" in
6492 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6493 *) inc_version_list="$ans" ;;
6494 esac
6495 case "$inc_version_list" in
6496 ''|' ')
6497         inc_version_list_init='0'
6498         d_inc_version_list="$undef"
6499         ;;
6500 *)      inc_version_list_init=`echo $inc_version_list |
6501                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6502         d_inc_version_list="$define"
6503         ;;
6504 esac
6505 $rm -f getverlist
6506
6507 : see if this is a malloc.h system
6508 : we want a real compile instead of Inhdr because some systems have a
6509 : malloc.h that just gives a compile error saying to use stdlib.h instead
6510 echo " "
6511 $cat >try.c <<EOCP
6512 #include <stdlib.h>
6513 #include <malloc.h>
6514 int main () { return 0; }
6515 EOCP
6516 set try
6517 if eval $compile; then
6518     echo "<malloc.h> found." >&4
6519     val="$define"
6520 else
6521     echo "<malloc.h> NOT found." >&4
6522     val="$undef"
6523 fi
6524 $rm_try
6525 set i_malloc
6526 eval $setvar
6527
6528 : check for void type
6529 echo " "
6530 echo "Checking to see how well your C compiler groks the void type..." >&4
6531 case "$voidflags" in
6532 '')
6533         $cat >try.c <<EOCP
6534 #$i_stdlib I_STDLIB
6535 #ifdef I_STDLIB
6536 #include <stdlib.h>
6537 #endif
6538 #if TRY & 1
6539 void sub() {
6540 #else
6541 sub() {
6542 #endif
6543         extern void moo();      /* function returning void */
6544         void (*goo)();          /* ptr to func returning void */
6545 #if TRY & 8
6546         void *hue;              /* generic ptr */
6547 #endif
6548 #if TRY & 2
6549         void (*foo[10])();
6550 #endif
6551
6552 #if TRY & 4
6553         if(goo == moo) {
6554                 exit(0);
6555         }
6556 #endif
6557         exit(0);
6558 }
6559 int main() { sub(); }
6560 EOCP
6561         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6562                 voidflags=$defvoidused
6563         echo "Good.  It appears to support void to the level $package wants.">&4
6564                 if $contains warning .out >/dev/null 2>&1; then
6565                         echo "However, you might get some warnings that look like this:"
6566                         $cat .out
6567                 fi
6568         else
6569 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6570                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6571                         echo "It supports 1..."
6572                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6573                                 echo "It also supports 2..."
6574                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6575                                         voidflags=7
6576                                         echo "And it supports 4 but not 8 definitely."
6577                                 else
6578                                         echo "It doesn't support 4..."
6579                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6580                                                 voidflags=11
6581                                                 echo "But it supports 8."
6582                                         else
6583                                                 voidflags=3
6584                                                 echo "Neither does it support 8."
6585                                         fi
6586                                 fi
6587                         else
6588                                 echo "It does not support 2..."
6589                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6590                                         voidflags=13
6591                                         echo "But it supports 4 and 8."
6592                                 else
6593                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6594                                                 voidflags=5
6595                                                 echo "And it supports 4 but has not heard about 8."
6596                                         else
6597                                                 echo "However it supports 8 but not 4."
6598                                         fi
6599                                 fi
6600                         fi
6601                 else
6602                         echo "There is no support at all for void."
6603                         voidflags=0
6604                 fi
6605         fi
6606 esac
6607 case "$voidflags" in
6608 "$defvoidused") ;;
6609 *)      $cat >&4 <<'EOM'
6610   Support flag bits are:
6611     1: basic void declarations.
6612     2: arrays of pointers to functions returning void.
6613     4: operations between pointers to and addresses of void functions.
6614     8: generic void pointers.
6615 EOM
6616         dflt="$voidflags";
6617         rp="Your void support flags add up to what?"
6618         . ./myread
6619         voidflags="$ans"
6620         ;;
6621 esac
6622 $rm_try
6623
6624 : check for length of pointer
6625 echo " "
6626 case "$ptrsize" in
6627 '')
6628         echo "Checking to see how big your pointers are..." >&4
6629         if test "$voidflags" -gt 7; then
6630                 echo '#define VOID_PTR char *' > try.c
6631         else
6632                 echo '#define VOID_PTR void *' > try.c
6633         fi
6634         $cat >>try.c <<EOCP
6635 #include <stdio.h>
6636 #$i_stdlib I_STDLIB
6637 #ifdef I_STDLIB
6638 #include <stdlib.h>
6639 #endif
6640 int main()
6641 {
6642     printf("%d\n", (int)sizeof(VOID_PTR));
6643     exit(0);
6644 }
6645 EOCP
6646         set try
6647         if eval $compile_ok; then
6648                 ptrsize=`$run ./try`
6649                 echo "Your pointers are $ptrsize bytes long."
6650         else
6651                 dflt='4'
6652                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6653                 rp="What is the size of a pointer (in bytes)?"
6654                 . ./myread
6655                 ptrsize="$ans"
6656         fi
6657         ;;
6658 esac
6659 $rm_try
6660 case "$use64bitall" in
6661 "$define"|true|[yY]*)
6662         case "$ptrsize" in
6663         4)      cat <<EOM >&4
6664
6665 *** You have chosen a maximally 64-bit build,
6666 *** but your pointers are only 4 bytes wide.
6667 *** Please rerun Configure without -Duse64bitall.
6668 EOM
6669                 case "$d_quad" in
6670                 define)
6671                         cat <<EOM >&4
6672 *** Since you have quads, you could possibly try with -Duse64bitint.
6673 EOM
6674                         ;;
6675                 esac
6676                 cat <<EOM >&4
6677 *** Cannot continue, aborting.
6678
6679 EOM
6680
6681                 exit 1
6682                 ;;
6683         esac
6684         ;;
6685 esac
6686
6687
6688 : determine whether to use malloc wrapping
6689 echo " "
6690 case "$usemallocwrap" in
6691 [yY]*|true|$define)     dflt='y' ;;
6692 [nN]*|false|$undef)     dflt='n' ;;
6693 *)      case "$usedevel" in
6694         [yY]*|true|$define)     dflt='y' ;;
6695         *) dflt='n' ;;
6696         esac
6697         ;;
6698 esac
6699 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6700 . ./myread
6701 usemallocwrap="$ans"
6702 case "$ans" in
6703 y*|true)
6704         usemallocwrap="$define" ;;
6705 *)
6706         usemallocwrap="$undef" ;;
6707 esac
6708
6709 : determine which malloc to compile in
6710 echo " "
6711 case "$usemymalloc" in
6712 [yY]*|true|$define)     dflt='y' ;;
6713 [nN]*|false|$undef)     dflt='n' ;;
6714 *)      case "$ptrsize" in
6715         4) dflt='y' ;;
6716         *) dflt='n' ;;
6717         esac
6718         ;;
6719 esac
6720 rp="Do you wish to attempt to use the malloc that comes with $package?"
6721 . ./myread
6722 usemymalloc="$ans"
6723 case "$ans" in
6724 y*|true)
6725         usemymalloc='y'
6726         mallocsrc='malloc.c'
6727         mallocobj="malloc$_o"
6728         d_mymalloc="$define"
6729         case "$libs" in
6730         *-lmalloc*)
6731                 : Remove malloc from list of libraries to use
6732                 echo "Removing unneeded -lmalloc from library list" >&4
6733                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6734                 shift
6735                 libs="$*"
6736                 echo "libs = $libs" >&4
6737                 ;;
6738         esac
6739         ;;
6740 *)
6741         usemymalloc='n'
6742         mallocsrc=''
6743         mallocobj=''
6744         d_mymalloc="$undef"
6745         ;;
6746 esac
6747
6748 : compute the return types of malloc and free
6749 echo " "
6750 $cat >malloc.c <<END
6751 #$i_malloc I_MALLOC
6752 #$i_stdlib I_STDLIB
6753 #include <stdio.h>
6754 #include <sys/types.h>
6755 #ifdef I_MALLOC
6756 #include <malloc.h>
6757 #endif
6758 #ifdef I_STDLIB
6759 #include <stdlib.h>
6760 #endif
6761 #ifdef TRY_MALLOC
6762 void *malloc();
6763 #endif
6764 #ifdef TRY_FREE
6765 void free();
6766 #endif
6767 END
6768 case "$malloctype" in
6769 '')
6770         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6771                 malloctype='void *'
6772         else
6773                 malloctype='char *'
6774         fi
6775         ;;
6776 esac
6777 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6778
6779 case "$freetype" in
6780 '')
6781         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6782                 freetype='void'
6783         else
6784                 freetype='int'
6785         fi
6786         ;;
6787 esac
6788 echo "Your system uses $freetype free(), it would seem." >&4
6789 $rm -f malloc.[co]
6790 : determine where site specific architecture-dependent libraries go.
6791 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6792 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6793 : sitelib may have an optional trailing /share.
6794 case "$sitearch" in
6795 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6796         dflt="$dflt/$archname"
6797         ;;
6798 *)      dflt="$sitearch"
6799         ;;
6800 esac
6801 set sitearch sitearch none
6802 eval $prefixit
6803 $cat <<EOM
6804
6805 The installation process will also create a directory for
6806 architecture-dependent site-specific extensions and modules.
6807
6808 EOM
6809 fn=d~+
6810 rp='Pathname for the site-specific architecture-dependent library files?'
6811 . ./getfile
6812 prefixvar=sitearch
6813 . ./setprefixvar
6814 if $test X"$sitearch" = X"$sitelib"; then
6815         d_sitearch="$undef"
6816 else
6817         d_sitearch="$define"
6818 fi
6819
6820 $cat <<EOM
6821
6822 The installation process will also create a directory for
6823 vendor-supplied add-ons.  Vendors who supply perl with their system
6824 may find it convenient to place all vendor-supplied files in this
6825 directory rather than in the main distribution directory.  This will
6826 ease upgrades between binary-compatible maintenance versions of perl.
6827
6828 Of course you may also use these directories in whatever way you see
6829 fit.  For example, you might use them to access modules shared over a
6830 company-wide network.
6831
6832 The default answer should be fine for most people.
6833 This causes further questions about vendor add-ons to be skipped
6834 and no vendor-specific directories will be configured for perl.
6835
6836 EOM
6837 rp='Do you want to configure vendor-specific add-on directories?'
6838 case "$usevendorprefix" in
6839 define|true|[yY]*) dflt=y ;;
6840 *)      : User may have set vendorprefix directly on Configure command line.
6841         case "$vendorprefix" in
6842         ''|' ') dflt=n ;;
6843         *)      dflt=y ;;
6844         esac
6845         ;;
6846 esac
6847 . ./myread
6848 case "$ans" in
6849 [yY]*)  fn=d~+
6850         rp='Installation prefix to use for vendor-supplied add-ons?'
6851         case "$vendorprefix" in
6852         '') dflt='' ;;
6853         *)  dflt=$vendorprefix ;;
6854         esac
6855         . ./getfile
6856         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6857         oldvendorprefix=''
6858         case "$vendorprefix" in
6859         '') ;;
6860         *)      case "$ans" in
6861                 "$prefix") ;;
6862                 *) oldvendorprefix="$prefix";;
6863                 esac
6864                 ;;
6865         esac
6866         usevendorprefix="$define"
6867         vendorprefix="$ans"
6868         vendorprefixexp="$ansexp"
6869         ;;
6870 *)      usevendorprefix="$undef"
6871         vendorprefix=''
6872         vendorprefixexp=''
6873         ;;
6874 esac
6875
6876 case "$vendorprefix" in
6877 '')     d_vendorlib="$undef"
6878         vendorlib=''
6879         vendorlibexp=''
6880         ;;
6881 *)      d_vendorlib="$define"
6882         : determine where vendor-supplied modules go.
6883         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6884         case "$vendorlib" in
6885         '')
6886                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6887                 case "$installstyle" in
6888                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6889                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6890                 esac
6891                 ;;
6892         *)      dflt="$vendorlib"
6893                 ;;
6894         esac
6895         fn=d~+
6896         rp='Pathname for the vendor-supplied library files?'
6897         . ./getfile
6898         vendorlib="$ans"
6899         vendorlibexp="$ansexp"
6900         ;;
6901 esac
6902 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6903 prefixvar=vendorlib
6904 . ./installprefix
6905
6906 case "$vendorprefix" in
6907 '')     d_vendorarch="$undef"
6908         vendorarch=''
6909         vendorarchexp=''
6910         ;;
6911 *)      d_vendorarch="$define"
6912         : determine where vendor-supplied architecture-dependent libraries go.
6913         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6914         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6915         : vendorlib may have an optional trailing /share.
6916         case "$vendorarch" in
6917         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6918                 dflt="$dflt/$archname"
6919                 ;;
6920         *)      dflt="$vendorarch" ;;
6921         esac
6922         fn=d~+
6923         rp='Pathname for vendor-supplied architecture-dependent files?'
6924         . ./getfile
6925         vendorarch="$ans"
6926         vendorarchexp="$ansexp"
6927         ;;
6928 esac
6929 prefixvar=vendorarch
6930 . ./installprefix
6931
6932 : Final catch-all directories to search
6933 $cat <<EOM
6934
6935 Lastly, you can have perl look in other directories for extensions and
6936 modules in addition to those already specified.
6937 These directories will be searched after 
6938         $sitearch 
6939         $sitelib 
6940 EOM
6941 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6942 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6943 echo ' '
6944 case "$otherlibdirs" in
6945 ''|' ') dflt='none' ;;
6946 *)      dflt="$otherlibdirs" ;;
6947 esac
6948 $cat <<EOM
6949 Enter a colon-separated set of extra paths to include in perl's @INC
6950 search path, or enter 'none' for no extra paths.
6951
6952 EOM
6953
6954 rp='Colon-separated list of additional directories for perl to search?'
6955 . ./myread
6956 case "$ans" in
6957 ' '|''|none)    otherlibdirs=' ' ;;     
6958 *)      otherlibdirs="$ans" ;;
6959 esac
6960 case "$otherlibdirs" in
6961 ' ') val=$undef ;;
6962 *)      val=$define ;;
6963 esac
6964 set d_perl_otherlibdirs
6965 eval $setvar
6966
6967 : Cruising for prototypes
6968 echo " "
6969 echo "Checking out function prototypes..." >&4
6970 $cat >prototype.c <<EOCP
6971 #$i_stdlib I_STDLIB
6972 #ifdef I_STDLIB
6973 #include <stdlib.h>
6974 #endif
6975 int main(int argc, char *argv[]) {
6976         exit(0);}
6977 EOCP
6978 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6979         echo "Your C compiler appears to support function prototypes."
6980         val="$define"
6981 else
6982         echo "Your C compiler doesn't seem to understand function prototypes."
6983         val="$undef"
6984 fi
6985 set prototype
6986 eval $setvar
6987 $rm -f prototype*
6988
6989 case "$prototype" in
6990 "$define") ;;
6991 *)      ansi2knr='ansi2knr'
6992         echo " "
6993         cat <<EOM >&4
6994
6995 $me:  FATAL ERROR:
6996 This version of $package can only be compiled by a compiler that 
6997 understands function prototypes.  Unfortunately, your C compiler 
6998         $cc $ccflags
6999 doesn't seem to understand them.  Sorry about that.
7000
7001 If GNU cc is available for your system, perhaps you could try that instead.  
7002
7003 Eventually, we hope to support building Perl with pre-ANSI compilers.
7004 If you would like to help in that effort, please contact <perlbug@perl.org>.
7005
7006 Aborting Configure now.
7007 EOM
7008         exit 2
7009         ;;
7010 esac
7011
7012 echo " "
7013 case "$extras" in
7014 '') dflt='n';;
7015 *) dflt='y';;
7016 esac
7017 cat <<EOM
7018 Perl can be built with extra modules or bundles of modules which
7019 will be fetched from the CPAN and installed alongside Perl.
7020
7021 Notice that you will need access to the CPAN; either via the Internet,
7022 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7023 be asked later to configure the CPAN.pm module which will in turn do
7024 the installation of the rest of the extra modules or bundles.)
7025
7026 Notice also that if the modules require any external software such as
7027 libraries and headers (the libz library and the zlib.h header for the
7028 Compress::Zlib module, for example) you MUST have any such software
7029 already installed, this configuration process will NOT install such
7030 things for you.
7031
7032 If this doesn't make any sense to you, just accept the default '$dflt'.
7033 EOM
7034 rp='Install any extra modules (y or n)?'
7035 . ./myread
7036 case "$ans" in
7037 y|Y)
7038         cat <<EOM
7039
7040 Please list any extra modules or bundles to be installed from CPAN,
7041 with spaces between the names.  The names can be in any format the
7042 'install' command of CPAN.pm will understand.  (Answer 'none',
7043 without the quotes, to install no extra modules or bundles.)
7044 EOM
7045         rp='Extras?'
7046         dflt="$extras"
7047         . ./myread
7048         extras="$ans"
7049 esac
7050 case "$extras" in
7051 ''|'none')
7052         val=''
7053         $rm -f ../extras.lst
7054         ;;
7055 *)      echo "(Saving the list of extras for later...)"
7056         echo "$extras" > ../extras.lst
7057         val="'$extras'"
7058         ;;
7059 esac
7060 set extras
7061 eval $setvar
7062 echo " "
7063
7064 : determine where html pages for programs go
7065 set html1dir html1dir none
7066 eval $prefixit
7067 $cat <<EOM
7068
7069 If you wish to install html files for programs in $spackage, indicate
7070 the appropriate directory here.  To skip installing html files,
7071 answer "none".
7072 EOM
7073 case "$html1dir" in
7074 ''|none|$undef|' ') dflt=none ;;
7075 *) dflt=$html1dir ;;
7076 esac
7077 fn=dn+~
7078 rp="Directory for the main $spackage html pages?"
7079 . ./getfile
7080 prefixvar=html1dir
7081 . ./setprefixvar
7082 : Use ' ' for none so value is preserved next time through Configure
7083 $test X"$html1dir" = "X" && html1dir=' '
7084
7085 : determine where html pages for libraries and modules go
7086 set html3dir html3dir none
7087 eval $prefixit
7088 $cat <<EOM
7089
7090 If you wish to install html files for modules associated with $spackage,
7091 indicate the appropriate directory here.  To skip installing html files,
7092 answer "none".
7093 EOM
7094 : There is no obvious default.  If they have specified html1dir, then
7095 : try to key off that, possibly changing .../html1 into .../html3.
7096 case "$html3dir" in
7097 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7098 *) dflt=$html3dir ;;
7099 esac
7100 fn=dn+~
7101 rp="Directory for the $spackage module html pages?"
7102 . ./getfile
7103 prefixvar=html3dir
7104 . ./setprefixvar
7105 : Use ' ' for none so value is preserved next time through Configure
7106 $test X"$html3dir" = "X" && html3dir=' '
7107
7108 : determine whether to install perl also as /usr/bin/perl
7109
7110 echo " "
7111 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7112         $cat <<EOM
7113 Many scripts expect perl to be installed as /usr/bin/perl.
7114
7115 If you want to, I can install the perl you are about to compile
7116 as /usr/bin/perl (in addition to $bin/perl).
7117 EOM
7118         if test -f /usr/bin/perl; then
7119             $cat <<EOM
7120
7121 However, please note that because you already have a /usr/bin/perl,
7122 overwriting that with a new Perl would very probably cause problems.
7123 Therefore I'm assuming you don't want to do that (unless you insist).
7124
7125 EOM
7126             case "$installusrbinperl" in
7127             "$define"|[yY]*)    dflt='y';;
7128             *)                  dflt='n';;
7129             esac
7130         else
7131             $cat <<EOM
7132
7133 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7134
7135 EOM
7136             case "$installusrbinperl" in
7137             "$undef"|[nN]*)     dflt='n';;
7138             *)                  dflt='y';;
7139             esac
7140         fi
7141         rp="Do you want to install perl as /usr/bin/perl?"
7142         . ./myread
7143         case "$ans" in
7144         [yY]*)  val="$define";;
7145         *)      val="$undef" ;;
7146         esac
7147 else
7148         val="$undef"
7149 fi
7150 set installusrbinperl
7151 eval $setvar
7152
7153 echo " "
7154 echo "Checking for GNU C Library..." >&4
7155 cat >try.c <<'EOCP'
7156 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7157    alone are insufficient to distinguish different versions, such as
7158    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7159    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7160 */
7161 #include <stdio.h>
7162 int main(void)
7163 {
7164 #ifdef __GLIBC__
7165 #   ifdef __GLIBC_MINOR__
7166 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7167 #           include <gnu/libc-version.h>
7168             printf("%s\n",  gnu_get_libc_version());
7169 #       else
7170             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7171 #       endif
7172 #   else
7173         printf("%d\n",  __GLIBC__);
7174 #   endif
7175     return 0;
7176 #else
7177     return 1;
7178 #endif
7179 }
7180 EOCP
7181 set try
7182 if eval $compile_ok && $run ./try > glibc.ver; then
7183         val="$define"
7184         gnulibc_version=`$cat glibc.ver`
7185         echo "You are using the GNU C Library version $gnulibc_version"
7186 else
7187         val="$undef"
7188         gnulibc_version=''
7189         echo "You are not using the GNU C Library"
7190 fi
7191 $rm_try glibc.ver
7192 set d_gnulibc
7193 eval $setvar
7194
7195 : see if nm is to be used to determine whether a symbol is defined or not
7196 case "$usenm" in
7197 '')
7198         dflt=''
7199         case "$d_gnulibc" in
7200         "$define")
7201                 echo " "
7202                 echo "nm probably won't work on the GNU C Library." >&4
7203                 dflt=n
7204                 ;;
7205         esac
7206         case "$dflt" in
7207         '') 
7208                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7209                         echo " "
7210                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7211                         echo "'nm' won't be sufficient on this sytem." >&4
7212                         dflt=n
7213                 fi
7214                 ;;
7215         esac
7216         case "$dflt" in
7217         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7218                 if $test $dflt -gt 20; then
7219                         dflt=y
7220                 else
7221                         dflt=n
7222                 fi
7223                 ;;
7224         esac
7225         ;;
7226 *)
7227         case "$usenm" in
7228         true|$define) dflt=y;;
7229         *) dflt=n;;
7230         esac
7231         ;;
7232 esac
7233 $cat <<EOM
7234
7235 I can use $nm to extract the symbols from your C libraries. This
7236 is a time consuming task which may generate huge output on the disk (up
7237 to 3 megabytes) but that should make the symbols extraction faster. The
7238 alternative is to skip the 'nm' extraction part and to compile a small
7239 test program instead to determine whether each symbol is present. If
7240 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7241 this may be the best solution.
7242
7243 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7244
7245 EOM
7246 rp="Shall I use $nm to extract C symbols from the libraries?"
7247 . ./myread
7248 case "$ans" in
7249 [Nn]*) usenm=false;;
7250 *) usenm=true;;
7251 esac
7252
7253 runnm=$usenm
7254 case "$reuseval" in
7255 true) runnm=false;;
7256 esac
7257
7258 : nm options which may be necessary
7259 case "$nm_opt" in
7260 '') if $test -f /mach_boot; then
7261                 nm_opt=''       # Mach
7262         elif $test -d /usr/ccs/lib; then
7263                 nm_opt='-p'     # Solaris (and SunOS?)
7264         elif $test -f /dgux; then
7265                 nm_opt='-p'     # DG-UX
7266         elif $test -f /lib64/rld; then
7267                 nm_opt='-p'     # 64-bit Irix
7268         else
7269                 nm_opt=''
7270         fi;;
7271 esac
7272
7273 : nm options which may be necessary for shared libraries but illegal
7274 : for archive libraries.  Thank you, Linux.
7275 case "$nm_so_opt" in
7276 '')     case "$myuname" in
7277         *linux*|gnu*)
7278                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7279                         nm_so_opt='--dynamic'
7280                 fi
7281                 ;;
7282         esac
7283         ;;
7284 esac
7285
7286 case "$runnm" in
7287 true)
7288 : get list of predefined functions in a handy place
7289 echo " "
7290 case "$libc" in
7291 '') libc=unknown
7292         case "$libs" in
7293         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7294         esac
7295         ;;
7296 esac
7297 case "$libs" in
7298 '') ;;
7299 *)  for thislib in $libs; do
7300         case "$thislib" in
7301         -lc|-lc_s)
7302                 : Handle C library specially below.
7303                 ;;
7304         -l*)
7305                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7306                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7307                         :
7308                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7309                         :
7310                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7311                         :
7312                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7313                         :
7314                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7315                         :
7316                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7317                         :
7318                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7319                         :
7320                 else
7321                         try=''
7322                 fi
7323                 libnames="$libnames $try"
7324                 ;;
7325         *) libnames="$libnames $thislib" ;;
7326         esac
7327         done
7328         ;;
7329 esac
7330 xxx=normal
7331 case "$libc" in
7332 unknown)
7333         set /lib/libc.$so
7334         for xxx in $libpth; do
7335                 $test -r $1 || set $xxx/libc.$so
7336                 : The messy sed command sorts on library version numbers.
7337                 $test -r $1 || \
7338                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7339                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7340                                 h
7341                                 s/[0-9][0-9]*/0000&/g
7342                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7343                                 G
7344                                 s/\n/ /' | \
7345                          $sort | $sed -e 's/^.* //'`
7346                 eval set \$$#
7347         done
7348         $test -r $1 || set /usr/ccs/lib/libc.$so
7349         $test -r $1 || set /lib/libsys_s$_a
7350         ;;
7351 *)
7352         set blurfl
7353         ;;
7354 esac
7355 if $test -r "$1"; then
7356         echo "Your (shared) C library seems to be in $1."
7357         libc="$1"
7358 elif $test -r /lib/libc && $test -r /lib/clib; then
7359         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7360         xxx=apollo
7361         libc='/lib/clib /lib/libc'
7362         if $test -r /lib/syslib; then
7363                 echo "(Your math library is in /lib/syslib.)"
7364                 libc="$libc /lib/syslib"
7365         fi
7366 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7367         echo "Your C library seems to be in $libc, as you said before."
7368 elif $test -r $incpath/usr/lib/libc$_a; then
7369         libc=$incpath/usr/lib/libc$_a;
7370         echo "Your C library seems to be in $libc.  That's fine."
7371 elif $test -r /lib/libc$_a; then
7372         libc=/lib/libc$_a;
7373         echo "Your C library seems to be in $libc.  You're normal."
7374 else
7375         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7376                 :
7377         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7378                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7379         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7380                 :
7381         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7382                 :
7383         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7384                 :
7385         else
7386                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7387         fi
7388         if $test -r "$tans"; then
7389                 echo "Your C library seems to be in $tans, of all places."
7390                 libc=$tans
7391         else
7392                 libc='blurfl'
7393         fi
7394 fi
7395 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7396         dflt="$libc"
7397         cat <<EOM
7398
7399 If the guess above is wrong (which it might be if you're using a strange
7400 compiler, or your machine supports multiple models), you can override it here.
7401
7402 EOM
7403 else
7404         dflt=''
7405         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7406         cat >&4 <<EOM
7407 I can't seem to find your C library.  I've looked in the following places:
7408
7409 EOM
7410         $sed 's/^/      /' libpath
7411         cat <<EOM
7412
7413 None of these seems to contain your C library. I need to get its name...
7414
7415 EOM
7416 fi
7417 fn=f
7418 rp='Where is your C library?'
7419 . ./getfile
7420 libc="$ans"
7421
7422 echo " "
7423 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7424 set X `cat libnames`
7425 shift
7426 xxx=files
7427 case $# in 1) xxx=file; esac
7428 echo "Extracting names from the following $xxx for later perusal:" >&4
7429 echo " "
7430 $sed 's/^/      /' libnames >&4
7431 echo " "
7432 $echo $n "This may take a while...$c" >&4
7433
7434 for file in $*; do
7435         case $file in
7436         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7437         *) $nm $nm_opt $file 2>/dev/null;;
7438         esac
7439 done >libc.tmp
7440
7441 $echo $n ".$c"
7442 $grep fprintf libc.tmp > libc.ptf
7443 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7444 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7445 xxx='[ADTSIW]'
7446 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7447         eval $xscan;\
7448         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7449                 eval $xrun
7450 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7451         eval $xscan;\
7452         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7453                 eval $xrun
7454 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7455         eval $xscan;\
7456         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7457                 eval $xrun
7458 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //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.*text.*/\1/p'";\
7463         eval $xscan;\
7464         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7465                 eval $xrun
7466 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7467         eval $xscan;\
7468         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7469                 eval $xrun
7470 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7471                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7472         eval $xscan;\
7473         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7474                 eval $xrun
7475 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7476         eval $xscan;\
7477         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7478                 eval $xrun
7479 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7480         eval $xscan;\
7481         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7482                 eval $xrun
7483 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7484         eval $xscan;\
7485         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7486                 eval $xrun
7487 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7488         eval $xscan;\
7489         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7490                 eval $xrun
7491 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7492         eval $xscan;\
7493         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7494                 eval $xrun
7495 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7496         eval $xscan;\
7497         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7498                 eval $xrun
7499 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7500         eval $xscan;\
7501         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7502                 eval $xrun
7503 else
7504         $nm -p $* 2>/dev/null >libc.tmp
7505         $grep fprintf libc.tmp > libc.ptf
7506         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7507                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7508         then
7509                 nm_opt='-p'
7510                 eval $xrun
7511         else
7512                 echo " "
7513                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7514                 com=''
7515                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7516                         for thisname in $libnames $libc; do
7517                                 $ar t $thisname >>libc.tmp
7518                         done
7519                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7520                         echo "Ok." >&4
7521                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7522                         # Repeat libc to extract forwarders to DLL entries too
7523                         for thisname in $libnames $libc; do
7524                                 $ar tv $thisname >>libc.tmp
7525                                 # Revision 50 of EMX has bug in $ar.
7526                                 # it will not extract forwarders to DLL entries
7527                                 # Use emximp which will extract exactly them.
7528                                 emximp -o tmp.imp $thisname \
7529                                     2>/dev/null && \
7530                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7531                                     < tmp.imp >>libc.tmp
7532                                 $rm tmp.imp
7533                         done
7534                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7535                         echo "Ok." >&4
7536                 else
7537                         echo "$ar didn't seem to work right." >&4
7538                         echo "Maybe this is a Cray...trying bld instead..." >&4
7539                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7540                         then
7541                                 for thisname in $libnames; do
7542                                         bld t $libnames | \
7543                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7544                                         $ar t $thisname >>libc.tmp
7545                                 done
7546                                 echo "Ok." >&4
7547                         else
7548                                 echo "That didn't work either.  Giving up." >&4
7549                                 exit 1
7550                         fi
7551                 fi
7552         fi
7553 fi
7554 nm_extract="$com"
7555 case "$PASE" in
7556 define)
7557     echo " "
7558     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7559     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7560     ;;
7561 *)  if $test -f /lib/syscalls.exp; then
7562         echo " "
7563         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7564         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7565     fi
7566     ;;
7567 esac
7568 ;;
7569 esac
7570 $rm -f libnames libpath
7571
7572 : see if dld is available
7573 set dld.h i_dld
7574 eval $inhdr
7575
7576
7577 echo " "
7578 echo "Checking for C++..." >&4
7579 $cat >try.c <<'EOCP'
7580 #include <stdio.h>
7581 int main(void)
7582 {
7583 #ifdef __cplusplus
7584     return 0;
7585 #else
7586     return 1;
7587 #endif
7588 }
7589 EOCP
7590 set try
7591 if eval $compile_ok && $run ./try; then
7592         val="$define"
7593         echo "You are using a C++ compiler."
7594 else
7595         val="$undef"
7596         echo "You are not using a C++ compiler."
7597 fi
7598 $rm_try cplusplus$$
7599 set d_cplusplus
7600 eval $setvar
7601
7602 : is a C symbol defined?
7603 csym='tlook=$1;
7604 case "$3" in
7605 -v) tf=libc.tmp; tdc="";;
7606 -a) tf=libc.tmp; tdc="[]";;
7607 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7608 esac;
7609 tx=yes;
7610 case "$reuseval-$4" in
7611 true-) ;;
7612 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7613 esac;
7614 case "$tx" in
7615 yes)
7616         tval=false;
7617         case "$d_cplusplus" in
7618                 $define) extern_C=\"C\";;
7619         esac;
7620         if $test "$runnm" = true; then
7621                 if $contains $tlook $tf >/dev/null 2>&1; then
7622                         tval=true;
7623                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7624                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7625                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7626                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7627                         $rm_try;
7628                 fi;
7629         else
7630                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7631                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7632                 $rm_try;
7633         fi;
7634         ;;
7635 *)
7636         case "$tval" in
7637         $define) tval=true;;
7638         *) tval=false;;
7639         esac;
7640         ;;
7641 esac;
7642 eval "$2=$tval"'
7643
7644 : define an is-in-libc? function
7645 inlibc='echo " "; td=$define; tu=$undef;
7646 sym=$1; var=$2; eval "was=\$$2";
7647 tx=yes;
7648 case "$reuseval$was" in
7649 true) ;;
7650 true*) tx=no;;
7651 esac;
7652 case "$tx" in
7653 yes)
7654         set $sym tres -f;
7655         eval $csym;
7656         case "$tres" in
7657         true)
7658                 echo "$sym() found." >&4;
7659                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7660         *)
7661                 echo "$sym() NOT found." >&4;
7662                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7663         esac;;
7664 *)
7665         case "$was" in
7666         $define) echo "$sym() found." >&4;;
7667         *) echo "$sym() NOT found." >&4;;
7668         esac;;
7669 esac'
7670
7671 : see if dlopen exists
7672 xxx_runnm="$runnm"
7673 xxx_ccflags="$ccflags"
7674 runnm=false
7675 : with g++ one needs -shared to get is-in-libc to work for dlopen
7676 case "$gccversion" in
7677 '')     ;;
7678 *)      case "$d_cplusplus" in
7679         "$define") ccflags="$ccflags -shared" ;;
7680         esac
7681         ;;
7682 esac
7683 set dlopen d_dlopen
7684 eval $inlibc
7685 runnm="$xxx_runnm"
7686 ccflags="$xxx_ccflags"
7687
7688 : see if this is a unistd.h system
7689 set unistd.h i_unistd
7690 eval $inhdr
7691
7692 : determine which dynamic loading, if any, to compile in
7693 echo " "
7694 dldir="ext/DynaLoader"
7695 case "$usedl" in
7696 $define|y|true)
7697         dflt='y'
7698         usedl="$define"
7699         ;;
7700 $undef|n|false)
7701         dflt='n'
7702         usedl="$undef"
7703         ;;
7704 *)
7705         dflt='n'
7706         case "$d_dlopen" in
7707             $define) dflt='y' ;;
7708         esac
7709         case "$i_dld" in
7710             $define) dflt='y' ;;
7711         esac
7712         : Does a dl_xxx.xs file exist for this operating system
7713         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7714         ;;
7715 esac
7716 rp="Do you wish to use dynamic loading?"
7717 . ./myread
7718 usedl="$ans"
7719 case "$ans" in
7720 y*) usedl="$define"
7721         case "$dlsrc" in
7722         '')
7723                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7724                         dflt="$dldir/dl_${osname}.xs"
7725                 elif $test "$d_dlopen" = "$define" ; then
7726                         dflt="$dldir/dl_dlopen.xs"
7727                 elif $test "$i_dld" = "$define" ; then
7728                         dflt="$dldir/dl_dld.xs"
7729                 else
7730                         dflt=''
7731                 fi
7732                 ;;
7733         *)      dflt="$dldir/$dlsrc"
7734                 ;;
7735         esac
7736     echo "The following dynamic loading files are available:"
7737         : Can not go over to $dldir because getfile has path hard-coded in.
7738         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7739         rp="Source file to use for dynamic loading"
7740         fn="fne"
7741         gfpth="$src"
7742         . ./getfile
7743         usedl="$define"
7744         : emulate basename
7745         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7746
7747         $cat << EOM
7748
7749 Some systems may require passing special flags to $cc -c to
7750 compile modules that will be used to create a shared library.
7751 To use no flags, say "none".
7752
7753 EOM
7754     case "$cccdlflags" in
7755     '') case "$gccversion" in
7756                 '') case "$osname" in
7757                         hpux)   dflt='+z' ;;
7758                         next)   dflt='none' ;;
7759                         irix*)  dflt='-KPIC' ;;
7760                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7761                         sunos)  dflt='-pic' ;;
7762                         *)      dflt='none' ;;
7763                     esac
7764                         ;;
7765                 *)  case "$osname" in
7766                         darwin) dflt='none' ;;
7767                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7768                         *)      dflt='-fpic' ;;
7769                     esac ;;
7770             esac ;;
7771         ' ') dflt='none' ;;
7772     *)  dflt="$cccdlflags" ;;
7773     esac
7774     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7775     . ./myread
7776     case "$ans" in
7777     none) cccdlflags=' ' ;;
7778     *) cccdlflags="$ans" ;;
7779     esac
7780
7781     cat << EOM
7782
7783 Some systems use ld to create libraries that can be dynamically loaded,
7784 while other systems (such as those using ELF) use $cc.
7785
7786 EOM
7787         case "$ld" in
7788         '')     $cat >try.c <<EOM
7789 /* Test for whether ELF binaries are produced */
7790 #include <fcntl.h>
7791 #$i_stdlib I_STDLIB
7792 #ifdef I_STDLIB
7793 #include <stdlib.h>
7794 #endif
7795 #$i_unistd I_UNISTD
7796 #ifdef I_UNISTD
7797 #include <unistd.h>
7798 #endif
7799 int main() {
7800         char b[4];
7801         int i = open("a.out",O_RDONLY);
7802         if(i == -1)
7803                 exit(1); /* fail */
7804         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7805                 exit(0); /* succeed (yes, it's ELF) */
7806         else
7807                 exit(1); /* fail */
7808 }
7809 EOM
7810                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7811                         cat <<EOM
7812 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7813 EOM
7814                         dflt="$cc"
7815                 else
7816                         echo "I'll use ld to build dynamic libraries."
7817                         dflt='ld'
7818                 fi
7819                 $rm_try
7820                 ;;
7821         *)      dflt="$ld"
7822                 ;;
7823         esac
7824
7825     rp="What command should be used to create dynamic libraries?"
7826     . ./myread
7827         ld="$ans"
7828
7829     cat << EOM
7830
7831 Some systems may require passing special flags to $ld to create a
7832 library that can be dynamically loaded.  If your ld flags include
7833 -L/other/path options to locate libraries outside your loader's normal
7834 search path, you may need to specify those -L options here as well.  To
7835 use no flags, say "none".
7836
7837 EOM
7838     case "$lddlflags" in
7839     '') case "$osname" in
7840                         beos) dflt='-nostart' ;;
7841                         hpux) dflt='-b';
7842                               case "$gccversion" in
7843                               '') dflt="$dflt +vnocompatwarnings" ;;
7844                               esac
7845                               ;;
7846                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7847                         next)  dflt='none' ;;
7848                         solaris) dflt='-G' ;;
7849                         sunos) dflt='-assert nodefinitions' ;;
7850                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7851                 *)     dflt='none' ;;
7852                         esac
7853                         ;;
7854     *) dflt="$lddlflags" ;;
7855     esac
7856
7857         : Try to guess additional flags to pick up local libraries.
7858         : Be careful not to append to a plain 'none'
7859         case "$dflt" in
7860         none) dflt='' ;;
7861         esac
7862         for thisflag in $ldflags; do
7863                 case "$thisflag" in
7864                 -L*|-R*|-Wl,-R*)
7865                         case " $dflt " in
7866                         *" $thisflag "*) ;;
7867                         *) dflt="$dflt $thisflag" ;;
7868                         esac
7869                         ;;
7870                 esac
7871         done
7872
7873         case "$dflt" in
7874         ''|' ') dflt='none' ;;
7875         esac
7876
7877     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7878     . ./myread
7879     case "$ans" in
7880     none) lddlflags=' ' ;;
7881     *) lddlflags="$ans" ;;
7882     esac
7883
7884         cat <<EOM
7885
7886 Some systems may require passing special flags to $cc to indicate that
7887 the resulting executable will use dynamic linking.  To use no flags,
7888 say "none".
7889
7890 EOM
7891     case "$ccdlflags" in
7892     '') case "$osname" in
7893             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7894             next|sunos) dflt='none' ;;
7895             *)          dflt='none' ;;
7896             esac ;;
7897     ' ')  dflt='none' ;;
7898     *)  dflt="$ccdlflags" ;;
7899     esac
7900     rp="Any special flags to pass to $cc to use dynamic linking?"
7901     . ./myread
7902     case "$ans" in
7903     none) ccdlflags=' ' ;;
7904     *) ccdlflags="$ans" ;;
7905     esac
7906     ;;
7907 *)  usedl="$undef"
7908         ld='ld'
7909     dlsrc='dl_none.xs'
7910     lddlflags=''
7911     ccdlflags=''
7912     ;;
7913 esac
7914
7915 also=''
7916 case "$usedl" in
7917 $undef)
7918         # No dynamic loading being used, so don't bother even to prompt.
7919         useshrplib='false'
7920         ;;
7921 *)      case "$useshrplib" in
7922         '')     case "$osname" in
7923                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7924                         dflt=y
7925                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7926                         ;;
7927                 next*)
7928                         case "$osvers" in
7929                         4*)     dflt=y
7930                                 also='Building a shared libperl is needed for MAB support.'
7931                                 ;;
7932                         *)      dflt=n
7933                                 ;;
7934                         esac
7935                         ;;
7936                 *)      dflt=n
7937                         ;;
7938                 esac
7939                 ;;
7940         $define|true|[Yy]*)
7941                 dflt=y
7942                 ;;
7943         *)      dflt=n
7944                 ;;
7945         esac
7946         $cat << EOM
7947
7948 The perl executable is normally obtained by linking perlmain.c with
7949 libperl${_a}, any static extensions (usually just DynaLoader), and
7950 any other libraries needed on this system (such as -lm, etc.).  Since
7951 your system supports dynamic loading, it is probably possible to build
7952 a shared libperl.$so.  If you will have more than one executable linked
7953 to libperl.$so, this will significantly reduce the size of each
7954 executable, but it may have a noticeable effect on performance.  The
7955 default is probably sensible for your system.
7956 $also
7957
7958 EOM
7959         rp="Build a shared libperl.$so (y/n)"
7960         . ./myread
7961         case "$ans" in
7962         true|$define|[Yy]*)
7963                 useshrplib='true'  ;;
7964         *)      useshrplib='false' ;;
7965         esac
7966         ;;
7967 esac
7968
7969 case "$useshrplib" in
7970 true)
7971         case "$libperl" in
7972         '')
7973                 # Figure out a good name for libperl.so.  Since it gets stored in
7974                 # a version-specific architecture-dependent library, the version
7975                 # number isn't really that important, except for making cc/ld happy.
7976                 #
7977                 # A name such as libperl.so.3.1
7978                 majmin="libperl.$so.$patchlevel.$subversion"
7979                 # A name such as libperl.so.301
7980                 majonly=`echo $patchlevel $subversion |
7981                         $awk '{printf "%d%02d", $1, $2}'`
7982                 majonly=libperl.$so.$majonly
7983                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7984                 # rely on figuring it out from the naming of libc.
7985                 case "${osname}${osvers}" in
7986                 next4*)
7987                         dflt=libperl.5.$so
7988                         # XXX How handle the --version stuff for MAB?
7989                         ;;
7990                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7991                         dflt=libperl.$so
7992                         ;;
7993                 cygwin*) # ld links against an importlib
7994                         dflt=libperl$lib_ext
7995                         ;;
7996                 *)      # Try to guess based on whether libc has major.minor.
7997                         case "$libc" in
7998                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7999                         *libc.$so.[0-9]*) dflt=$majonly ;;
8000                         *)      dflt=libperl.$so ;;
8001                         esac
8002                         ;;
8003                 esac
8004                 ;;
8005         *)      dflt=$libperl
8006                 ;;
8007         esac
8008         cat << EOM
8009
8010 I need to select a good name for the shared libperl.  If your system uses
8011 library names with major and minor numbers, then you might want something
8012 like $majmin.  Alternatively, if your system uses a single version
8013 number for shared libraries, then you might want to use $majonly.
8014 Or, your system might be quite happy with a simple libperl.$so.
8015
8016 Since the shared libperl will get installed into a version-specific
8017 architecture-dependent directory, the version number of the shared perl
8018 library probably isn't important, so the default should be o.k.
8019
8020 EOM
8021         rp='What name do you want to give to the shared libperl?'
8022         . ./myread
8023         libperl=$ans
8024         echo "Ok, I'll use $libperl"
8025         ;;
8026 *)
8027         libperl="libperl${_a}"
8028         ;;
8029 esac
8030
8031 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8032 case "$shrpdir" in
8033 '') ;;
8034 *)      $cat >&4 <<EOM
8035 WARNING:  Use of the shrpdir variable for the installation location of
8036 the shared $libperl is not supported.  It was never documented and
8037 will not work in this version.  Let me (perlbug@perl.org)
8038 know of any problems this may cause.
8039
8040 EOM
8041         case "$shrpdir" in
8042         "$archlibexp/CORE")
8043                 $cat >&4 <<EOM
8044 But your current setting of $shrpdir is
8045 the default anyway, so it's harmless.
8046 EOM
8047                 ;;
8048         *)
8049                 $cat >&4 <<EOM
8050 Further, your current attempted setting of $shrpdir
8051 conflicts with the value of $archlibexp/CORE
8052 that installperl will use.
8053 EOM
8054                 ;;
8055         esac
8056         ;;
8057 esac
8058
8059 # How will the perl executable find the installed shared $libperl?
8060 # Add $xxx to ccdlflags.
8061 # If we can't figure out a command-line option, use $shrpenv to
8062 # set env LD_RUN_PATH.  The main perl makefile uses this.
8063 shrpdir=$archlibexp/CORE
8064 xxx=''
8065 tmp_shrpenv=''
8066 if "$useshrplib"; then
8067     case "$osname" in 
8068         aix)
8069                 # We'll set it in Makefile.SH...
8070                 ;;
8071         solaris)
8072                 xxx="-R $shrpdir"
8073                 ;;
8074         freebsd|netbsd|openbsd|interix|dragonfly)
8075                 xxx="-Wl,-R$shrpdir"
8076                 ;;
8077         bsdos|linux|irix*|dec_osf|gnu*)
8078                 xxx="-Wl,-rpath,$shrpdir"
8079                 ;;
8080         next)
8081                 # next doesn't like the default...
8082                 ;;
8083         beos)
8084                 # beos doesn't like the default, either.
8085                 ;;
8086         hpux*)
8087                 # hpux doesn't like the default, either.
8088                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8089                 ;;
8090         *)
8091                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8092                 ;;
8093         esac
8094         case "$xxx" in
8095         '') ;;
8096         *)      
8097                 # Only add $xxx if it isn't already in ccdlflags.
8098                 case " $ccdlflags " in
8099                 *" $xxx "*)     ;;
8100                 *)      ccdlflags="$ccdlflags $xxx"
8101                         cat <<EOM >&4
8102
8103 Adding $xxx to the flags
8104 passed to $ld so that the perl executable will find the 
8105 installed shared $libperl.
8106
8107 EOM
8108                         ;;
8109                 esac
8110                 ;;
8111         esac
8112 fi
8113 # Fix ccdlflags in AIX for building external extensions.
8114 # (For building Perl itself bare -bE:perl.exp is needed,
8115 #  Makefile.SH takes care of this.)
8116 case "$osname" in
8117 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8118 esac
8119 # Respect a hint or command-line value.
8120 case "$shrpenv" in
8121 '') shrpenv="$tmp_shrpenv" ;;
8122 esac
8123 case "$ldlibpthname" in
8124 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8125 none)   ldlibpthname='' ;;
8126 esac
8127
8128 : determine where manual pages are on this system
8129 echo " "
8130 case "$sysman" in
8131 '') 
8132         syspath='/usr/share/man/man1 /usr/man/man1'
8133         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8134         syspath="$syspath /usr/man/u_man/man1"
8135         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8136         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8137         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8138         sysman=`./loc . /usr/man/man1 $syspath`
8139         ;;
8140 esac
8141 if $test -d "$sysman"; then
8142         echo "System manual is in $sysman." >&4
8143 else
8144         echo "Could not find manual pages in source form." >&4
8145 fi
8146
8147 : determine where manual pages go
8148 set man1dir man1dir none
8149 eval $prefixit
8150 $cat <<EOM
8151
8152 $spackage has manual pages available in source form.
8153 EOM
8154 case "$nroff" in
8155 nroff)
8156         echo "However, you don't have nroff, so they're probably useless to you."
8157         case "$man1dir" in
8158         '') man1dir="none";;
8159         esac;;
8160 esac
8161 echo "If you don't want the manual sources installed, answer 'none'."
8162 case "$man1dir" in
8163 ' ') dflt=none
8164         ;;
8165 '')
8166         lookpath="$prefixexp/share/man/man1"
8167         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8168         lookpath="$lookpath $prefixexp/man/p_man/man1"
8169         lookpath="$lookpath $prefixexp/man/u_man/man1"
8170         lookpath="$lookpath $prefixexp/man/man.1"
8171         case "$sysman" in
8172         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8173         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8174         esac
8175         set dflt
8176         eval $prefixup
8177         ;;
8178 *)  dflt="$man1dir"
8179         ;;
8180 esac
8181 echo " "
8182 fn=dn+~
8183 rp="Where do the main $spackage manual pages (source) go?"
8184 . ./getfile
8185 if $test "X$man1direxp" != "X$ansexp"; then
8186         installman1dir=''
8187 fi
8188 prefixvar=man1dir
8189 . ./setprefixvar
8190
8191 case "$man1dir" in
8192 '')     man1dir=' '
8193         installman1dir='';;
8194 esac
8195
8196 : What suffix to use on installed man pages
8197
8198 case "$man1dir" in
8199 ' ')
8200         man1ext='0'
8201         ;;
8202 *)
8203         rp="What suffix should be used for the main $spackage man pages?"
8204         case "$man1ext" in
8205         '')     case "$man1dir" in
8206                 *1)  dflt=1 ;;
8207                 *1p) dflt=1p ;;
8208                 *1pm) dflt=1pm ;;
8209                 *l) dflt=l;;
8210                 *n) dflt=n;;
8211                 *o) dflt=o;;
8212                 *p) dflt=p;;
8213                 *C) dflt=C;;
8214                 *L) dflt=L;;
8215                 *L1) dflt=L1;;
8216                 *) dflt=1;;
8217                 esac
8218                 ;;
8219         *)      dflt="$man1ext";;
8220         esac
8221         . ./myread
8222         man1ext="$ans"
8223         ;;
8224 esac
8225
8226 : see if we can have long filenames
8227 echo " "
8228 first=123456789abcdef
8229 $rm -f $first
8230 if (echo hi >$first) 2>/dev/null; then
8231         if $test -f 123456789abcde; then
8232                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8233                 val="$undef"
8234         else
8235                 echo 'You can have filenames longer than 14 characters.'>&4
8236                 val="$define"
8237         fi
8238 else
8239         $cat <<'EOM'
8240 You can't have filenames longer than 14 chars.
8241 You can't even think about them!
8242 EOM
8243         val="$undef"
8244 fi 
8245 set d_flexfnam
8246 eval $setvar
8247 $rm -rf 123456789abcde*
8248
8249 : determine where library module manual pages go
8250 set man3dir man3dir none
8251 eval $prefixit
8252 $cat <<EOM
8253
8254 $spackage has manual pages for many of the library modules.
8255 EOM
8256
8257 case "$nroff" in
8258 nroff)
8259         $cat <<'EOM'
8260 However, you don't have nroff, so they're probably useless to you.
8261 EOM
8262         case "$man3dir" in
8263         '') man3dir="none";;
8264         esac;;
8265 esac
8266
8267 case "$d_flexfnam" in
8268 undef)
8269         $cat <<'EOM'
8270 However, your system can't handle the long file names like File::Basename.3.
8271 EOM
8272         case "$man3dir" in
8273         '') man3dir="none";;
8274         esac;;
8275 esac
8276
8277 echo "If you don't want the manual sources installed, answer 'none'."
8278 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8279 case "$man3dir" in
8280 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8281         if $test -d "$privlib/man/man3"; then
8282                 cat <<EOM >&4
8283
8284 WARNING:  Previous versions of perl installed man3 pages into
8285 $privlib/man/man3.  This version will suggest a
8286 new default of $dflt.
8287 EOM
8288                 tdflt=$dflt
8289                 dflt='n'
8290                 rp='Do you wish to preserve the old behavior?(y/n)'
8291                 . ./myread
8292                 case "$ans" in
8293                 y*) dflt="$privlib/man/man3" ;;
8294                 *)  dflt=$tdflt ;;
8295                 esac
8296     fi
8297         ;;
8298 *)      dflt="$man3dir" ;;
8299 esac
8300 case "$dflt" in
8301 ' ') dflt=none ;;
8302 esac
8303 echo " "
8304 fn=dn+~
8305 rp="Where do the $package library man pages (source) go?"
8306 . ./getfile
8307 prefixvar=man3dir
8308 . ./setprefixvar
8309
8310 case "$man3dir" in
8311 '')     man3dir=' '
8312         installman3dir='';;
8313 esac
8314
8315 : What suffix to use on installed man pages
8316 case "$man3dir" in
8317 ' ')
8318         man3ext='0'
8319         ;;
8320 *)
8321         rp="What suffix should be used for the $package library man pages?"
8322         case "$man3ext" in
8323         '')     case "$man3dir" in
8324                 *3)  dflt=3 ;;
8325                 *3p) dflt=3p ;;
8326                 *3pm) dflt=3pm ;;
8327                 *l) dflt=l;;
8328                 *n) dflt=n;;
8329                 *o) dflt=o;;
8330                 *p) dflt=p;;
8331                 *C) dflt=C;;
8332                 *L) dflt=L;;
8333                 *L3) dflt=L3;;
8334                 *) dflt=3;;
8335                 esac
8336                 ;;
8337         *)      dflt="$man3ext";;
8338         esac
8339         . ./myread
8340         man3ext="$ans"
8341         ;;
8342 esac
8343
8344 : see if we have to deal with yellow pages, now NIS.
8345 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8346         if $test -f /usr/etc/nibindd; then
8347                 echo " "
8348                 echo "I'm fairly confident you're on a NeXT."
8349                 echo " "
8350                 rp='Do you get the hosts file via NetInfo?'
8351                 dflt=y
8352                 case "$hostcat" in
8353                 nidump*) ;;
8354                 '') ;;
8355                 *) dflt=n;;
8356                 esac
8357                 . ./myread
8358                 case "$ans" in
8359                 y*) hostcat='nidump hosts .';;
8360                 *)      case "$hostcat" in
8361                         nidump*) hostcat='';;
8362                         esac
8363                         ;;
8364                 esac
8365         fi
8366         case "$hostcat" in
8367         nidump*) ;;
8368         *)
8369                 case "$hostcat" in
8370                 *ypcat*) dflt=y;;
8371                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8372                                 dflt=y
8373                         else
8374                                 dflt=n
8375                         fi;;
8376                 *) dflt=n;;
8377                 esac
8378                 echo " "
8379                 rp='Are you getting the hosts file via yellow pages?'
8380                 . ./myread
8381                 case "$ans" in
8382                 y*) hostcat='ypcat hosts';;
8383                 *) hostcat='cat /etc/hosts';;
8384                 esac
8385                 ;;
8386         esac
8387 fi
8388 case "$hostcat" in
8389 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8390 esac
8391 case "$groupcat" in
8392 '') test -f /etc/group && groupcat='cat /etc/group';;
8393 esac
8394 case "$passcat" in
8395 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8396 esac
8397
8398 : now get the host name
8399 echo " "
8400 echo "Figuring out host name..." >&4
8401 case "$myhostname" in
8402 '') cont=true
8403         echo 'Maybe "hostname" will work...'
8404         if tans=`sh -c hostname 2>&1` ; then
8405                 myhostname=$tans
8406                 phostname=hostname
8407                 cont=''
8408         fi
8409         ;;
8410 *) cont='';;
8411 esac
8412 if $test "$cont"; then
8413         if ./xenix; then
8414                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8415                 if tans=`cat /etc/systemid 2>&1` ; then
8416                         myhostname=$tans
8417                         phostname='cat /etc/systemid'
8418                         echo "Whadyaknow.  Xenix always was a bit strange..."
8419                         cont=''
8420                 fi
8421         elif $test -r /etc/systemid; then
8422                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8423         fi
8424 fi
8425 if $test "$cont"; then
8426         echo 'No, maybe "uuname -l" will work...'
8427         if tans=`sh -c 'uuname -l' 2>&1` ; then
8428                 myhostname=$tans
8429                 phostname='uuname -l'
8430         else
8431                 echo 'Strange.  Maybe "uname -n" will work...'
8432                 if tans=`sh -c 'uname -n' 2>&1` ; then
8433                         myhostname=$tans
8434                         phostname='uname -n'
8435                 else
8436                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8437                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8438                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8439                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8440                         else
8441                                 case "$myhostname" in
8442                                 '') echo "Does this machine have an identity crisis or something?"
8443                                         phostname='';;
8444                                 *)
8445                                         echo "Well, you said $myhostname before..."
8446                                         phostname='echo $myhostname';;
8447                                 esac
8448                         fi
8449                 fi
8450         fi
8451 fi
8452 case "$myhostname" in
8453 '') myhostname=noname ;;
8454 esac
8455 : you do not want to know about this
8456 set $myhostname
8457 myhostname=$1
8458
8459 : verify guess
8460 if $test "$myhostname" ; then
8461         dflt=y
8462         rp='Your host name appears to be "'$myhostname'".'" Right?"
8463         . ./myread
8464         case "$ans" in
8465         y*) ;;
8466         *) myhostname='';;
8467         esac
8468 fi
8469
8470 : bad guess or no guess
8471 while $test "X$myhostname" = X ; do
8472         dflt=''
8473         rp="Please type the (one word) name of your host:"
8474         . ./myread
8475         myhostname="$ans"
8476 done
8477
8478 : translate upper to lower if necessary
8479 case "$myhostname" in
8480 *[A-Z]*)
8481         echo "(Normalizing case in your host name)"
8482         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8483         ;;
8484 esac
8485
8486 case "$myhostname" in
8487 *.*)
8488         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8489         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8490         echo "(Trimming domain name from host name--host name is now $myhostname)"
8491         ;;
8492 *) case "$mydomain" in
8493         '')
8494                 {
8495                         test "X$hostcat" = "Xypcat hosts" &&
8496                         ypmatch "$myhostname" hosts 2>/dev/null |\
8497                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8498                         $test -s hosts
8499                 } || {
8500                         test "X$hostcat" != "X" &&
8501                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8502                                         /[       ]$myhostname[  . ]/p" > hosts
8503                 }
8504                 tmp_re="[       . ]"
8505                 if $test -f hosts; then
8506                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8507                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8508                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8509                                 hosts | $sort | $uniq | \
8510                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8511                         case `$echo X$dflt` in
8512                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8513                                 dflt=.
8514                                 ;;
8515                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8516                                 ;;
8517                         esac
8518                 else
8519                         echo "(I cannot locate a hosts database anywhere)"
8520                         dflt=.
8521                 fi
8522                 case "$dflt" in
8523                 .)
8524                         tans=`./loc resolv.conf X /etc /usr/etc`
8525                         if $test -f "$tans"; then
8526                                 echo "(Attempting domain name extraction from $tans)"
8527                                 dflt=.`$sed -n -e 's/   / /g' \
8528                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8529                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8530                                 case "$dflt" in
8531                                 .) dflt=.`$sed -n -e 's/        / /g' \
8532                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8533                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8534                                         ;;
8535                                 esac
8536                         fi
8537                         ;;
8538                 esac
8539                 case "$dflt" in
8540                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8541                         dflt=.`sh -c domainname 2>/dev/null`
8542                         case "$dflt" in
8543                         '') dflt='.';;
8544                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8545                         esac
8546                         ;;
8547                 esac
8548                 case "$dflt$osname" in
8549                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8550                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8551                         ;;
8552                 esac
8553                 case "$dflt" in
8554                 .) echo "(Lost all hope -- silly guess then)"
8555                         dflt='.nonet'
8556                         ;;
8557                 esac
8558                 $rm -f hosts
8559                 ;;
8560         *) dflt="$mydomain";;
8561         esac;;
8562 esac
8563 echo " "
8564 rp="What is your domain name?"
8565 . ./myread
8566 tans="$ans"
8567 case "$ans" in
8568 '') ;;
8569 .*) ;;
8570 *) tans=".$tans";;
8571 esac
8572 mydomain="$tans"
8573
8574 : translate upper to lower if necessary
8575 case "$mydomain" in
8576 *[A-Z]*)
8577         echo "(Normalizing case in your domain name)"
8578         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8579         ;;
8580 esac
8581
8582 : a little sanity check here
8583 case "$phostname" in
8584 '') ;;
8585 *)
8586         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8587         $myhostname$mydomain|$myhostname) ;;
8588         *)
8589                 case "$phostname" in
8590                 sed*)
8591                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8592                         ;;
8593                 *)
8594                         echo "(That doesn't agree with your $phostname command, by the way.)"
8595                         ;;
8596                 esac
8597         ;;
8598         esac
8599         ;;
8600 esac
8601
8602 $cat <<EOM
8603
8604 I need to get your e-mail address in Internet format if possible, i.e.
8605 something like user@host.domain. Please answer accurately since I have
8606 no easy means to double check it. The default value provided below
8607 is most probably close to reality but may not be valid from outside
8608 your organization...
8609
8610 EOM
8611 cont=x
8612 while test "$cont"; do
8613         case "$cf_email" in
8614         '') dflt="$cf_by@$myhostname$mydomain";;
8615         *) dflt="$cf_email";;
8616         esac
8617         rp='What is your e-mail address?'
8618         . ./myread
8619         cf_email="$ans"
8620         case "$cf_email" in
8621         *@*.*) cont='' ;;
8622         *)
8623                 rp='Address does not look like an Internet one.  Use it anyway?'
8624                 case "$fastread" in
8625                 yes) dflt=y ;;
8626                 *) dflt=n ;;
8627                 esac
8628                 . ./myread
8629                 case "$ans" in
8630                 y*) cont='' ;;
8631                 *) echo " " ;;
8632                 esac
8633                 ;;
8634         esac
8635 done
8636
8637 $cat <<EOM
8638
8639 If you or somebody else will be maintaining perl at your site, please
8640 fill in the correct e-mail address here so that they may be contacted
8641 if necessary. Currently, the "perlbug" program included with perl
8642 will send mail to this address in addition to perlbug@perl.org. You may
8643 enter "none" for no administrator.
8644
8645 EOM
8646 case "$perladmin" in
8647 '') dflt="$cf_email";;
8648 *) dflt="$perladmin";;
8649 esac
8650 rp='Perl administrator e-mail address'
8651 . ./myread
8652 perladmin="$ans"
8653
8654 : determine whether to only install version-specific parts.
8655 echo " "
8656 $cat <<EOM
8657 Do you want to install only the version-specific parts of the perl
8658 distribution?  Usually you do *not* want to do this.
8659 EOM
8660 case "$versiononly" in
8661 "$define"|[Yy]*|true) dflt='y' ;;
8662 *) dflt='n';
8663 esac
8664 rp="Do you want to install only the version-specific parts of perl?"
8665 . ./myread
8666 case "$ans" in
8667 [yY]*)  val="$define";;
8668 *)      val="$undef" ;;
8669 esac
8670 set versiononly
8671 eval $setvar
8672
8673 case "$versiononly" in
8674 "$define") inc_version_list=''
8675            inc_version_list_init=0
8676            ;;
8677 esac
8678
8679 : figure out how to guarantee perl startup
8680 : XXX Note that this currently takes advantage of the bug that binexp ignores
8681 :     the Configure -Dinstallprefix setting, which in turn means that under
8682 :     relocatable @INC, initialinstalllocation is what binexp started as.
8683 case "$startperl" in
8684 '')
8685         case "$sharpbang" in
8686         *!)
8687                 $cat <<EOH
8688
8689 I can use the #! construct to start perl on your system. This will
8690 make startup of perl scripts faster, but may cause problems if you
8691 want to share those scripts and perl is not in a standard place
8692 ($initialinstalllocation/perl) on all your platforms. The alternative
8693 is to force a shell by starting the script with a single ':' character.
8694
8695 EOH
8696                 case "$versiononly" in
8697                 "$define")      dflt="$initialinstalllocation/perl$version";;
8698                 *)              dflt="$initialinstalllocation/perl";;
8699                 esac
8700                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8701                 . ./myread
8702                 case "$ans" in
8703                 none)   startperl=": # use perl";;
8704                 *)      startperl="#!$ans"
8705                         if $test 30 -lt `echo "$ans" | wc -c`; then
8706                                 $cat >&4 <<EOM
8707
8708 WARNING:  Some systems limit the #! command to 32 characters.
8709 If you experience difficulty running Perl scripts with #!, try
8710 installing Perl in a directory with a shorter pathname.
8711
8712 EOM
8713                         fi ;;
8714                 esac
8715                 ;;
8716         *) startperl=": # use perl"
8717                 ;;
8718         esac
8719         ;;
8720 esac
8721 echo "I'll use $startperl to start perl scripts."
8722
8723 : figure best path for perl in scripts
8724 case "$perlpath" in
8725 '')
8726         case "$versiononly" in
8727         "$define")      perlpath="$initialinstalllocation/perl$version";;
8728         *)              perlpath="$initialinstalllocation/perl";;
8729         esac
8730         case "$startperl" in
8731         *!*) ;;
8732         *)
8733                 $cat <<EOH
8734
8735 I will use the "eval 'exec'" idiom to start Perl on your system.
8736 I can use the full path of your Perl binary for this purpose, but
8737 doing so may cause problems if you want to share those scripts and
8738 Perl is not always in a standard place ($initialinstalllocation/perl).
8739
8740 EOH
8741                 dflt="$initialinstalllocation/perl"
8742                 rp="What path shall I use in \"eval 'exec'\"?"
8743                 . ./myread
8744                 perlpath="$ans"
8745                 ;;
8746         esac
8747         ;;
8748 esac
8749 case "$startperl" in
8750 *!*)    ;;
8751 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8752 esac
8753
8754 : determine where public executable scripts go
8755 set scriptdir scriptdir
8756 eval $prefixit
8757 case "$scriptdir" in
8758 '')
8759         dflt="$bin"
8760         : guess some guesses
8761         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8762         $test -d /usr/share/bin     && dflt=/usr/share/bin
8763         $test -d /usr/local/script  && dflt=/usr/local/script
8764         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8765         $test -d $prefixexp/script  && dflt=$prefixexp/script
8766         set dflt
8767         eval $prefixup
8768         ;;
8769 *)  dflt="$scriptdir"
8770         ;;
8771 esac
8772 $cat <<EOM
8773
8774 Some installations have a separate directory just for executable scripts so
8775 that they can mount it across multiple architectures but keep the scripts in
8776 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8777 Or you might just lump your scripts in with all your other executables.
8778
8779 EOM
8780 fn=d~
8781 rp='Where do you keep publicly executable scripts?'
8782 . ./getfile
8783 if $test "X$ansexp" != "X$scriptdirexp"; then
8784         installscript=''
8785 fi
8786 installscriptdir=''
8787 prefixvar=scriptdir
8788 . ./setprefixvar
8789 : A little fix up for an irregularly named variable.
8790 installscript="$installscriptdir"
8791
8792 : determine where add-on public executables go
8793 case "$sitebin" in
8794 '')     dflt=$siteprefix/bin ;;
8795 *)      dflt=$sitebin ;;
8796 esac
8797 fn=d~
8798 rp='Pathname where the add-on public executables should be installed?'
8799 . ./getfile
8800 prefixvar=sitebin
8801 . ./setprefixvar
8802
8803 : determine where add-on html pages go
8804 : There is no standard location, so try to copy the previously-selected
8805 : directory structure for the core html pages.
8806 case "$sitehtml1dir" in
8807 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8808 *)     dflt=$sitehtml1dir ;;
8809 esac
8810 case "$dflt" in
8811 ''|' ') dflt=none ;;
8812 esac
8813 fn=dn+~
8814 rp='Pathname where the site-specific html pages should be installed?'
8815 . ./getfile
8816 prefixvar=sitehtml1dir
8817 . ./setprefixvar
8818
8819 : determine where add-on library html pages go
8820 : There is no standard location, so try to copy the previously-selected
8821 : directory structure for the core html pages.
8822 case "$sitehtml3dir" in
8823 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8824 *)     dflt=$sitehtml3dir ;;
8825 esac
8826 case "$dflt" in
8827 ''|' ') dflt=none ;;
8828 esac
8829 fn=dn+~
8830 rp='Pathname where the site-specific library html pages should be installed?'
8831 . ./getfile
8832 prefixvar=sitehtml3dir
8833 . ./setprefixvar
8834
8835 : determine where add-on manual pages go
8836 case "$siteman1dir" in
8837 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8838 *)      dflt=$siteman1dir ;;
8839 esac
8840 case "$dflt" in
8841 ''|' ') dflt=none ;;
8842 esac
8843 fn=dn+~
8844 rp='Pathname where the site-specific manual pages should be installed?'
8845 . ./getfile
8846 prefixvar=siteman1dir
8847 . ./setprefixvar
8848
8849 : determine where add-on library man pages go
8850 case "$siteman3dir" in
8851 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8852 *)      dflt=$siteman3dir ;;
8853 esac
8854 case "$dflt" in
8855 ''|' ') dflt=none ;;
8856 esac
8857 fn=dn+~
8858 rp='Pathname where the site-specific library manual pages should be installed?'
8859 . ./getfile
8860 prefixvar=siteman3dir
8861 . ./setprefixvar
8862
8863 : determine where add-on public executable scripts go
8864 case "$sitescript" in
8865 '')     dflt=$siteprefix/script
8866         $test -d $dflt || dflt=$sitebin ;;
8867 *)  dflt="$sitescript" ;;
8868 esac
8869 fn=d~+
8870 rp='Pathname where add-on public executable scripts should be installed?'
8871 . ./getfile
8872 prefixvar=sitescript
8873 . ./setprefixvar
8874
8875 case "$usefaststdio" in
8876 $define|true|[yY]*|'')
8877         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8878         case "$xversion" in
8879         [68])   dflt='y' ;;
8880         *)      dflt='n' ;;
8881         esac
8882         ;;
8883 *) dflt='n';;
8884 esac
8885 cat <<EOM
8886
8887 Perl can be built to use 'fast stdio', which means using the stdio
8888 library but also directly manipulating the stdio buffers to enable
8889 faster I/O.  Using stdio is better for backward compatibility (especially
8890 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8891 interface has been preferred instead of stdio.
8892
8893 If this doesn't make any sense to you, just accept the default '$dflt'.
8894 EOM
8895 rp='Use the "fast stdio" if available?'
8896 . ./myread
8897 case "$ans" in
8898 y|Y)    val="$define" ;;     
8899 *)      val="$undef" ;;
8900 esac
8901 set usefaststdio
8902 eval $setvar
8903
8904
8905 : define an is-a-typedef? function
8906 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8907 case "$inclist" in
8908 "") inclist="sys/types.h";;
8909 esac;
8910 eval "varval=\$$var";
8911 case "$varval" in
8912 "")
8913         $rm -f temp.c;
8914         for inc in $inclist; do
8915                 echo "#include <$inc>" >>temp.c;
8916         done;
8917         echo "#ifdef $type" >> temp.c;
8918         echo "printf(\"We have $type\");" >> temp.c;
8919         echo "#endif" >> temp.c;
8920         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8921         if $contains $type temp.E >/dev/null 2>&1; then
8922                 eval "$var=\$type";
8923         else
8924                 eval "$var=\$def";
8925         fi;
8926         $rm -f temp.?;;
8927 *) eval "$var=\$varval";;
8928 esac'
8929
8930 : define an is-a-typedef? function that prompts if the type is not available.
8931 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8932 case "$inclist" in
8933 "") inclist="sys/types.h";;
8934 esac;
8935 eval "varval=\$$var";
8936 case "$varval" in
8937 "")
8938         $rm -f temp.c;
8939         for inc in $inclist; do
8940                 echo "#include <$inc>" >>temp.c;
8941         done;
8942         echo "#ifdef $type" >> temp.c;
8943         echo "printf(\"We have $type\");" >> temp.c;
8944         echo "#endif" >> temp.c;
8945         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8946         echo " " ;
8947         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8948         if $contains $type temp.E >/dev/null 2>&1; then
8949                 echo "$type found." >&4;
8950                 eval "$var=\$type";
8951         else
8952                 echo "$type NOT found." >&4;
8953                 dflt="$def";
8954                 . ./myread ;
8955                 eval "$var=\$ans";
8956         fi;
8957         $rm -f temp.?;;
8958 *) eval "$var=\$varval";;
8959 esac'
8960
8961 : see what type lseek is declared as in the kernel
8962 rp="What is the type used for lseek's offset on this system?"
8963 set off_t lseektype long stdio.h sys/types.h
8964 eval $typedef_ask
8965
8966 echo " "
8967 echo "Checking to see how big your file offsets are..." >&4
8968 $cat >try.c <<EOCP
8969 #include <sys/types.h>
8970 #include <stdio.h>
8971 int main()
8972 {
8973     printf("%d\n", (int)sizeof($lseektype));
8974     return(0);
8975 }
8976 EOCP
8977 set try
8978 if eval $compile_ok; then
8979         lseeksize=`$run ./try`
8980         echo "Your file offsets are $lseeksize bytes long."
8981 else
8982         dflt=$longsize
8983         echo " "
8984         echo "(I can't seem to compile the test program.  Guessing...)"
8985         rp="What is the size of your file offsets (in bytes)?"
8986         . ./myread
8987         lseeksize="$ans"
8988 fi
8989 $rm_try
8990
8991 : see what type file positions are declared as in the library
8992 rp="What is the type for file position used by fsetpos()?"
8993 set fpos_t fpostype long stdio.h sys/types.h
8994 eval $typedef_ask
8995
8996 echo " "
8997 case "$fpostype" in
8998 *_t) zzz="$fpostype"    ;;
8999 *)   zzz="fpos_t"       ;;
9000 esac
9001 echo "Checking the size of $zzz..." >&4 
9002 cat > try.c <<EOCP
9003 #include <sys/types.h>
9004 #include <stdio.h>
9005 #$i_stdlib I_STDLIB
9006 #ifdef I_STDLIB
9007 #include <stdlib.h>
9008 #endif
9009 int main() {
9010     printf("%d\n", (int)sizeof($fpostype));
9011     exit(0);
9012 }
9013 EOCP
9014 set try
9015 if eval $compile_ok; then
9016         yyy=`$run ./try`
9017         case "$yyy" in
9018         '')     fpossize=4
9019                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9020                 ;;
9021         *)      fpossize=$yyy
9022                 echo "Your $zzz is $fpossize bytes long."
9023                 ;;
9024         esac
9025 else
9026         dflt="$longsize"
9027         echo " " >&4
9028         echo "(I can't compile the test program.  Guessing...)" >&4
9029         rp="What is the size of your file positions (in bytes)?"
9030         . ./myread
9031         fpossize="$ans"
9032 fi
9033
9034 # Backward compatibility (uselfs is deprecated).
9035 case "$uselfs" in
9036 "$define"|true|[yY]*)
9037         cat <<EOM >&4
9038
9039 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9040 EOM
9041         uselargefiles="$define"
9042         ;;
9043 esac
9044
9045 case "$lseeksize:$fpossize" in
9046 8:8) cat <<EOM
9047
9048 You can have files larger than 2 gigabytes.
9049 EOM
9050    val="$define" ;;
9051 *)    case "$uselargefiles" in
9052    "$undef"|false|[nN]*) dflt='n' ;;
9053    *)   dflt='y' ;;
9054    esac
9055    cat <<EOM
9056
9057 Perl can be built to understand large files (files larger than 2 gigabytes)
9058 on some systems.  To do so, Configure can be run with -Duselargefiles.
9059
9060 If this doesn't make any sense to you, just accept the default '$dflt'.
9061 EOM
9062    rp='Try to understand large files, if available?'
9063    . ./myread
9064    case "$ans" in
9065    y|Y)         val="$define" ;;
9066    *)           val="$undef"  ;;
9067    esac
9068    ;;
9069 esac
9070 set uselargefiles
9071 eval $setvar
9072 : Look for a hint-file generated 'call-back-unit'.  If the
9073 : user has specified that a large files perl is to be built,
9074 : we may need to set or change some other defaults.
9075 if $test -f uselargefiles.cbu; then
9076         echo "Your platform has some specific hints regarding large file builds, using them..."
9077         . ./uselargefiles.cbu
9078 fi
9079 case "$uselargefiles" in
9080 "$define")
9081         if $test -f uselargefiles.cbu; then
9082                 echo " "
9083                 echo "Rechecking to see how big your file offsets are..." >&4
9084                 $cat >try.c <<EOCP
9085 #include <sys/types.h>
9086 #include <stdio.h>
9087 int main()
9088 {
9089     printf("%d\n", (int)sizeof($lseektype));
9090     return(0);
9091 }
9092 EOCP
9093                 set try
9094                 if eval $compile_ok; then
9095                         lseeksize=`$run ./try`
9096                         $echo "Your file offsets are now $lseeksize bytes long."
9097                 else
9098                         dflt="$lseeksize"
9099                         echo " "
9100                         echo "(I can't seem to compile the test program.  Guessing...)"
9101                         rp="What is the size of your file offsets (in bytes)?"
9102                         . ./myread
9103                         lseeksize="$ans"
9104                 fi
9105                 case "$fpostype" in
9106                 *_t) zzz="$fpostype"    ;;
9107                 *)   zzz="fpos_t"       ;;
9108                 esac
9109                 $echo $n "Rechecking the size of $zzz...$c" >&4
9110                 $cat > try.c <<EOCP
9111 #include <sys/types.h>
9112 #include <stdio.h>
9113 #$i_stdlib I_STDLIB
9114 #ifdef I_STDLIB
9115 #include <stdlib.h>
9116 #endif
9117 int main() {
9118     printf("%d\n", (int)sizeof($fpostype));
9119     return(0);
9120 }
9121 EOCP
9122                 set try
9123                 if eval $compile_ok; then
9124                         yyy=`$run ./try`
9125                         dflt="$lseeksize"
9126                         case "$yyy" in
9127                         '')     echo " "
9128                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9129                                 ;;
9130                         *)      fpossize=$yyy
9131                                 echo " $fpossize bytes." >&4
9132                                 ;;
9133                         esac
9134                 else
9135                         dflt="$fpossize"
9136                         echo " "
9137                         echo "(I can't compile the test program.  Guessing...)" >&4
9138                         rp="What is the size of your file positions (in bytes)?"
9139                         . ./myread
9140                         fpossize="$ans"
9141                 fi
9142                 $rm_try
9143         fi
9144         ;;
9145 esac
9146
9147 case "$vendorprefix" in
9148 '')     d_vendorbin="$undef"
9149         vendorbin=''
9150         vendorbinexp=''
9151         ;;
9152 *)      d_vendorbin="$define"
9153         : determine where vendor-supplied executables go.
9154         case "$vendorbin" in
9155         '') dflt=$vendorprefix/bin ;;
9156         *)      dflt="$vendorbin" ;;
9157         esac
9158         fn=d~+
9159         rp='Pathname for the vendor-supplied executables directory?'
9160         . ./getfile
9161         vendorbin="$ans"
9162         vendorbinexp="$ansexp"
9163         ;;
9164 esac
9165 prefixvar=vendorbin
9166 . ./installprefix
9167
9168 case "$vendorprefix" in
9169 '')     vendorhtml1dir=''
9170         vendorhtml1direxp=''
9171         ;;
9172 *)      : determine where vendor-supplied html pages go.
9173         : There is no standard location, so try to copy the previously-selected
9174         : directory structure for the core html pages.
9175         : XXX Better default suggestions would be welcome.
9176         case "$vendorhtml1dir" in
9177         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9178         *)      dflt=$vendorhtml1dir ;;
9179         esac
9180         case "$dflt" in
9181         ''|' ') dflt=none ;;
9182         esac
9183         fn=dn+~
9184         rp='Pathname for the vendor-supplied html pages?'
9185         . ./getfile
9186         vendorhtml1dir="$ans"
9187         vendorhtml1direxp="$ansexp"
9188         ;;
9189 esac
9190 : Use ' ' for none so value is preserved next time through Configure
9191 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9192 prefixvar=vendorhtml1dir
9193 . ./installprefix
9194
9195 case "$vendorprefix" in
9196 '')     vendorhtml3dir=''
9197         vendorhtml3direxp=''
9198         ;;
9199 *)      : determine where vendor-supplied module html pages go.
9200         : There is no standard location, so try to copy the previously-selected
9201         : directory structure for the core html pages.
9202         : XXX Better default suggestions would be welcome.
9203         case "$vendorhtml3dir" in
9204         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9205         *)      dflt=$vendorhtml3dir ;;
9206         esac
9207         case "$dflt" in
9208         ''|' ') dflt=none ;;
9209         esac
9210         fn=dn+~
9211         rp='Pathname for the vendor-supplied html pages?'
9212         . ./getfile
9213         vendorhtml3dir="$ans"
9214         vendorhtml3direxp="$ansexp"
9215         ;;
9216 esac
9217 : Use ' ' for none so value is preserved next time through Configure
9218 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9219 prefixvar=vendorhtml3dir
9220 . ./installprefix
9221
9222 case "$vendorprefix" in
9223 '')     vendorman1dir=''
9224         vendorman1direxp=''
9225         ;;
9226 *)      : determine where vendor-supplied manual pages go.
9227         case "$vendorman1dir" in
9228         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9229         *)      dflt=$vendorman1dir ;;
9230         esac
9231         case "$dflt" in
9232         ''|' ') dflt=none ;;
9233         esac
9234         fn=nd~+
9235         rp='Pathname for the vendor-supplied manual section 1 pages?'
9236         . ./getfile
9237         vendorman1dir="$ans"
9238         vendorman1direxp="$ansexp"
9239         ;;
9240 esac
9241 : Use ' ' for none so value is preserved next time through Configure
9242 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9243 prefixvar=vendorman1dir
9244 . ./installprefix
9245
9246 case "$vendorprefix" in
9247 '')     vendorman3dir=''
9248         vendorman3direxp=''
9249         ;;
9250 *)      : determine where vendor-supplied module manual pages go.
9251         case "$vendorman3dir" in
9252         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9253         *)      dflt=$vendorman3dir ;;
9254         esac
9255         case "$dflt" in
9256         ''|' ') dflt=none ;;
9257         esac
9258         fn=nd~+
9259         rp='Pathname for the vendor-supplied manual section 3 pages?'
9260         . ./getfile
9261         vendorman3dir="$ans"
9262         vendorman3direxp="$ansexp"
9263         ;;
9264 esac
9265 : Use ' ' for none so value is preserved next time through Configure
9266 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9267 prefixvar=vendorman3dir
9268 . ./installprefix
9269
9270 case "$vendorprefix" in
9271 '')     d_vendorscript="$undef"
9272         vendorscript=''
9273         vendorscriptexp=''
9274         ;;
9275 *)      d_vendorscript="$define"
9276         : determine where vendor-supplied scripts go.
9277         case "$vendorscript" in
9278         '')     dflt=$vendorprefix/script
9279                 $test -d $dflt || dflt=$vendorbin ;;
9280         *)  dflt="$vendorscript" ;;
9281         esac
9282         $cat <<EOM
9283
9284 The installation process will create a directory for
9285 vendor-supplied scripts.
9286
9287 EOM
9288         fn=d~+
9289         rp='Pathname for the vendor-supplied scripts directory?'
9290         . ./getfile
9291         vendorscript="$ans"
9292         vendorscriptexp="$ansexp"
9293         ;;
9294 esac
9295 prefixvar=vendorscript
9296 . ./installprefix
9297
9298 : see if qgcvt exists
9299 set qgcvt d_qgcvt
9300 eval $inlibc
9301
9302 echo " "
9303
9304 if $test X"$d_longdbl" = X"$define"; then
9305
9306 echo "Checking how to print long doubles..." >&4
9307
9308 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9309         $cat >try.c <<'EOCP'
9310 #include <sys/types.h>
9311 #include <stdio.h>
9312 int main() {
9313   double d = 123.456;
9314   printf("%.3f\n", d);
9315 }
9316 EOCP
9317         set try
9318         if eval $compile; then
9319                 yyy=`$run ./try`
9320                 case "$yyy" in
9321                 123.456)
9322                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9323                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9324                         echo "We will use %f."
9325                         ;;
9326                 esac
9327         fi
9328 fi
9329
9330 if $test X"$sPRIfldbl" = X; then
9331         $cat >try.c <<'EOCP'
9332 #include <sys/types.h>
9333 #include <stdio.h>
9334 int main() {
9335   long double d = 123.456;
9336   printf("%.3Lf\n", d);
9337 }
9338 EOCP
9339         set try
9340         if eval $compile; then
9341                 yyy=`$run ./try`
9342                 case "$yyy" in
9343                 123.456)
9344                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9345                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9346                         echo "We will use %Lf."
9347                         ;;
9348                 esac
9349         fi
9350 fi
9351
9352 if $test X"$sPRIfldbl" = X; then
9353         $cat >try.c <<'EOCP'
9354 #include <sys/types.h>
9355 #include <stdio.h>
9356 int main() {
9357   long double d = 123.456;
9358   printf("%.3llf\n", d);
9359 }
9360 EOCP
9361         set try
9362         if eval $compile; then
9363                 yyy=`$run ./try`
9364                 case "$yyy" in
9365                 123.456)
9366                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9367                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9368                         echo "We will use %llf."
9369                         ;;
9370                 esac
9371         fi
9372 fi
9373
9374 if $test X"$sPRIfldbl" = X; then
9375         $cat >try.c <<'EOCP'
9376 #include <sys/types.h>
9377 #include <stdio.h>
9378 int main() {
9379   long double d = 123.456;
9380   printf("%.3lf\n", d);
9381 }
9382 EOCP
9383         set try
9384         if eval $compile; then
9385                 yyy=`$run ./try`
9386                 case "$yyy" in
9387                 123.456)
9388                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9389                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9390                         echo "We will use %lf."
9391                         ;;
9392                 esac
9393         fi
9394 fi
9395
9396 if $test X"$sPRIfldbl" = X; then
9397         echo "Cannot figure out how to print long doubles." >&4
9398 else
9399         sSCNfldbl=$sPRIfldbl    # expect consistency
9400 fi
9401
9402 $rm_try
9403
9404 fi # d_longdbl
9405
9406 case "$sPRIfldbl" in
9407 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9408         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9409         d_SCNfldbl="$undef";
9410         ;;
9411 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9412         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9413         d_SCNfldbl="$define";
9414         ;;
9415 esac
9416
9417 : Check how to convert floats to strings.
9418
9419 if test "X$d_Gconvert" = X; then
9420
9421 echo " "
9422 echo "Checking for an efficient way to convert floats to strings."
9423 echo " " > try.c
9424 case "$uselongdouble" in
9425 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9426 esac
9427 case "$d_longdbl" in
9428 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9429 esac
9430 case "$d_PRIgldbl" in
9431 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9432 esac
9433 $cat >>try.c <<EOP
9434 #ifdef TRY_gconvert
9435 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9436 char *myname = "gconvert";
9437 #endif
9438 #ifdef TRY_gcvt
9439 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9440 char *myname = "gcvt";
9441 #endif
9442 #ifdef TRY_qgcvt
9443 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9444 char *myname = "qgcvt";
9445 #define DOUBLETYPE long double
9446 #endif
9447 #ifdef TRY_sprintf
9448 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9449 #ifdef HAS_PRIgldbl
9450 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9451 #else
9452 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9453 #endif
9454 #else
9455 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9456 #endif
9457 char *myname = "sprintf";
9458 #endif
9459
9460 #ifndef DOUBLETYPE
9461 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9462 #define DOUBLETYPE long double
9463 #else
9464 #define DOUBLETYPE double
9465 #endif
9466 #endif
9467
9468 #include <stdio.h>
9469
9470 #define I_STDLIB $i_stdlib
9471 #ifdef I_STDLIB
9472 #include <stdlib.h>
9473 #endif
9474
9475 int
9476 checkit(expect, got)
9477 char *expect;
9478 char *got;
9479 {
9480     if (strcmp(expect, got)) {
9481                 printf("%s oddity:  Expected %s, got %s\n",
9482                         myname, expect, got);
9483                 exit(1);
9484         }
9485 }
9486
9487 int main()
9488 {
9489         char buf[64];
9490         buf[63] = '\0';
9491
9492         /* This must be 1st test on (which?) platform */
9493         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9494         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9495         checkit("0.1", buf);
9496
9497         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9498         checkit("0.01", buf);
9499
9500         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9501         checkit("0.001", buf);
9502
9503         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9504         checkit("0.0001", buf);
9505
9506         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9507         if (strlen(buf) > 5)
9508             checkit("9e-005", buf); /* for Microsoft ?? */
9509         else
9510             checkit("9e-05", buf);
9511
9512         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9513         checkit("1", buf);
9514
9515         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9516         checkit("1.1", buf);
9517
9518         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9519         checkit("1.01", buf);
9520
9521         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9522         checkit("1.001", buf);
9523
9524         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9525         checkit("1.0001", buf);
9526
9527         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9528         checkit("1.00001", buf);
9529
9530         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9531         checkit("1.000001", buf);
9532
9533         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9534         checkit("0", buf);
9535
9536         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9537         checkit("-1", buf);
9538
9539         /* Some Linux gcvt's give 1.e+5 here. */
9540         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9541         checkit("100000", buf);
9542
9543         /* Some Linux gcvt's give -1.e+5 here. */
9544         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9545         checkit("-100000", buf);
9546
9547         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9548         checkit("123.456", buf);
9549
9550         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9551         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9552         /* 34 should be enough to scare even long double
9553          * places into using the e notation. */
9554         if (strlen(buf) > 5)
9555             checkit("1e+034", buf); /* for Microsoft */
9556         else
9557             checkit("1e+34", buf);
9558
9559         /* For Perl, if you add additional tests here, also add them to
9560          * t/base/num.t for benefit of platforms not using Configure or
9561          * overriding d_Gconvert */
9562
9563         exit(0);
9564 }
9565 EOP
9566 : first add preferred functions to our list
9567 xxx_list=""
9568 for xxx_convert in $gconvert_preference; do
9569     case $xxx_convert in
9570     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9571     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9572     esac
9573 done
9574 : then add any others
9575 for xxx_convert in gconvert gcvt sprintf; do
9576     case "$xxx_list" in
9577     *$xxx_convert*) ;;
9578     *) xxx_list="$xxx_list $xxx_convert" ;;
9579     esac
9580 done
9581
9582 case "$d_longdbl$uselongdouble" in
9583 "$define$define")
9584     : again, add prefered functions to our list first
9585     xxx_ld_list=""
9586     for xxx_convert in $gconvert_ld_preference; do
9587         case $xxx_convert in
9588         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9589         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9590         esac
9591     done
9592     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9593     for xxx_convert in qgcvt sprintf $xxx_list; do
9594         case "$xxx_ld_list" in
9595         $xxx_convert*|*" $xxx_convert"*) ;;
9596         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9597         esac
9598     done
9599     : if sprintf cannot do long doubles, move it to the end
9600     if test "$d_PRIgldbl" != "$define"; then
9601         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9602     fi
9603     : if no qgcvt, remove it
9604     if test "$d_qgcvt" != "$define"; then
9605         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9606     fi
9607     : use the ld_list
9608     xxx_list="$xxx_ld_list"
9609     ;;
9610 esac
9611
9612 for xxx_convert in $xxx_list; do
9613         echo "Trying $xxx_convert..."
9614         $rm -f try try$_o core
9615         set try -DTRY_$xxx_convert
9616         if eval $compile; then
9617                 echo "$xxx_convert() found." >&4
9618                 if $run ./try; then
9619                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9620                         break;
9621                 else
9622                         echo "...But $xxx_convert didn't work as I expected."
9623                         xxx_convert=''
9624                 fi
9625         else
9626                 echo "$xxx_convert NOT found." >&4
9627         fi
9628 done
9629
9630 if test X$xxx_convert = X; then
9631     echo "*** WHOA THERE!!! ***" >&4
9632     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9633     xxx_convert=sprintf
9634 fi
9635
9636 case "$xxx_convert" in
9637 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9638 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9639 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9640 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9641    "$define$define$define")
9642       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9643    "$define$define$undef")
9644       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9645    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9646    esac
9647    ;;
9648 esac
9649
9650 fi
9651 $rm_try
9652
9653 : see if _fwalk exists
9654 set fwalk d__fwalk
9655 eval $inlibc
9656
9657 : Initialize h_fcntl
9658 h_fcntl=false
9659
9660 : Initialize h_sysfile
9661 h_sysfile=false
9662
9663 : access call always available on UNIX
9664 set access d_access
9665 eval $inlibc
9666
9667 : locate the flags for 'access()'
9668 case "$d_access" in
9669 "$define")
9670         echo " "
9671         $cat >access.c <<EOCP
9672 #include <sys/types.h>
9673 #ifdef I_FCNTL
9674 #include <fcntl.h>
9675 #endif
9676 #ifdef I_SYS_FILE
9677 #include <sys/file.h>
9678 #endif
9679 #ifdef I_UNISTD
9680 #include <unistd.h>
9681 #endif
9682 #$i_stdlib I_STDLIB
9683 #ifdef I_STDLIB
9684 #include <stdlib.h>
9685 #endif
9686 int main() {
9687         exit(R_OK);
9688 }
9689 EOCP
9690         : check sys/file.h first, no particular reason here
9691         if $test `./findhdr sys/file.h` && \
9692                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9693                 h_sysfile=true;
9694                 echo "<sys/file.h> defines the *_OK access constants." >&4
9695         elif $test `./findhdr fcntl.h` && \
9696                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9697                 h_fcntl=true;
9698                 echo "<fcntl.h> defines the *_OK access constants." >&4
9699         elif $test `./findhdr unistd.h` && \
9700                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9701                 echo "<unistd.h> defines the *_OK access constants." >&4
9702         else
9703                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9704         fi
9705         ;;
9706 esac
9707 $rm -f access*
9708
9709 : see if accessx exists
9710 set accessx d_accessx
9711 eval $inlibc
9712
9713 : see if aintl exists
9714 set aintl d_aintl
9715 eval $inlibc
9716
9717 : see if alarm exists
9718 set alarm d_alarm
9719 eval $inlibc
9720
9721 : see if POSIX threads are available
9722 set pthread.h i_pthread
9723 eval $inhdr
9724
9725 : define a fucntion to check prototypes
9726 $cat > protochk <<EOSH
9727 $startsh
9728 cc="$cc"
9729 optimize="$optimize"
9730 ccflags="$ccflags"
9731 prototype="$prototype"
9732 define="$define"
9733 rm_try="$rm_try"
9734 usethreads=$usethreads
9735 i_pthread=$i_pthread
9736 pthread_h_first=$pthread_h_first
9737 EOSH
9738
9739 $cat >> protochk <<'EOSH'
9740
9741 $rm_try
9742 foo="$1"
9743 shift
9744 while test $# -ge 2; do
9745         case "$1" in
9746                 $define) echo "#include <$2>" >> try.c ;;
9747                 literal) echo "$2" >> try.c ;;
9748         esac
9749     # Extra magic for the benefit of systems that need pthread.h
9750     # to be included early to correctly detect threadsafe functions.
9751     # Such functions must guarantee themselves, though, that the usethreads
9752     # and i_pthread have been defined, before calling protochk.
9753     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9754         echo "#include <pthread.h>" >> try.c
9755         pthread_h_done=yes
9756     fi
9757     shift 2
9758 done
9759 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9760 cat >> try.c <<'EOCP'
9761 #ifdef CAN_PROTOTYPE
9762 #define _(args) args
9763 #else
9764 #define _(args) ()
9765 #endif
9766 EOCP
9767 echo "$foo" >> try.c
9768 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9769 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9770 status=$?
9771 $rm_try
9772 exit $status
9773 EOSH
9774 chmod +x protochk
9775 $eunicefix protochk
9776
9777 hasproto='varname=$1; func=$2; shift; shift;
9778 while $test $# -ge 2; do
9779         case "$1" in
9780         $define) echo "#include <$2>";;
9781         esac ;
9782     shift 2;
9783 done > try.c;
9784 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9785 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9786         echo "$func() prototype found.";
9787         val="$define";
9788 else
9789         echo "$func() prototype NOT found.";
9790         val="$undef";
9791 fi;
9792 set $varname;
9793 eval $setvar;
9794 $rm_try tryout.c'
9795
9796 : see if sys/types.h has to be included
9797 set sys/types.h i_systypes
9798 eval $inhdr
9799
9800 : see if sys/select.h has to be included
9801 set sys/select.h i_sysselct
9802 eval $inhdr
9803
9804 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9805 while $test $# -ge 2; do
9806         case "$1" in
9807         $define) echo "#include <$2>";;
9808         esac ;
9809     shift 2;
9810 done > try.c;
9811 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9812 set try;
9813 if eval $compile; then
9814         val="$define";
9815 else
9816         val="$undef";
9817 fi;
9818 set $varname;
9819 eval $setvar;
9820 $rm_try'
9821
9822 : see if we should include time.h, sys/time.h, or both
9823 echo " "
9824 if test "X$timeincl" = X; then
9825         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9826         $echo $n "I'm now running the test program...$c"
9827         $cat >try.c <<EOCP
9828 #include <sys/types.h>
9829 #ifdef I_TIME
9830 #include <time.h>
9831 #endif
9832 #ifdef I_SYSTIME
9833 #ifdef SYSTIMEKERNEL
9834 #define KERNEL
9835 #endif
9836 #include <sys/time.h>
9837 #endif
9838 #ifdef I_SYSSELECT
9839 #include <sys/select.h>
9840 #endif
9841 #$i_stdlib I_STDLIB
9842 #ifdef I_STDLIB
9843 #include <stdlib.h>
9844 #endif
9845 int main()
9846 {
9847         struct tm foo;
9848 #ifdef S_TIMEVAL
9849         struct timeval bar;
9850 #endif
9851 #ifdef S_TIMEZONE
9852         struct timezone tzp;
9853 #endif
9854         if (foo.tm_sec == foo.tm_sec)
9855                 exit(0);
9856 #ifdef S_TIMEVAL
9857         if (bar.tv_sec == bar.tv_sec)
9858                 exit(0);
9859 #endif
9860         exit(1);
9861 }
9862 EOCP
9863         flags=''
9864         for s_timezone in '-DS_TIMEZONE' ''; do
9865         sysselect=''
9866         for s_timeval in '-DS_TIMEVAL' ''; do
9867         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9868         for i_time in '' '-DI_TIME'; do
9869         for i_systime in '-DI_SYSTIME' ''; do
9870                 case "$flags" in
9871                 '') $echo $n ".$c"
9872                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9873                         if eval $compile; then
9874                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9875                                 shift
9876                                 flags="$*"
9877                                 echo " "
9878                                 $echo $n "Succeeded with $flags$c"
9879                         fi
9880                         ;;
9881                 esac
9882         done
9883         done
9884         done
9885         done
9886         done
9887         timeincl=''
9888         echo " "
9889         case "$flags" in
9890         *SYSTIMEKERNEL*) i_systimek="$define"
9891                 timeincl=`./findhdr sys/time.h`
9892                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9893         *) i_systimek="$undef";;
9894         esac
9895         case "$flags" in
9896         *I_TIME*) i_time="$define"
9897                 timeincl=`./findhdr time.h`" $timeincl"
9898                 echo "We'll include <time.h>." >&4;;
9899         *) i_time="$undef";;
9900         esac
9901         case "$flags" in
9902         *I_SYSTIME*) i_systime="$define"
9903                 timeincl=`./findhdr sys/time.h`" $timeincl"
9904                 echo "We'll include <sys/time.h>." >&4;;
9905         *) i_systime="$undef";;
9906         esac
9907         $rm_try
9908 fi
9909 : see if struct tm knows about tm_zone
9910 case "$i_systime$i_time" in
9911 *$define*)
9912         echo " "
9913         echo "Checking to see if your struct tm has tm_zone field..." >&4
9914         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9915         eval $hasfield
9916         ;;
9917 *)      val="$undef"
9918         set d_tm_tm_zone
9919         eval $setvar
9920         ;;
9921 esac
9922 case "$d_tm_tm_zone" in
9923 "$define")      echo "Yes, it does."   ;;
9924 *)              echo "No, it doesn't." ;;
9925 esac
9926 : see if struct tm knows about tm_gmtoff
9927 case "$i_systime$i_time" in
9928 *$define*)
9929         echo " "
9930         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9931         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9932         eval $hasfield
9933         ;;
9934 *)      val="$undef"
9935         set d_tm_tm_gmtoff
9936         eval $setvar
9937         ;;
9938 esac
9939 case "$d_tm_tm_gmtoff" in
9940 "$define")      echo "Yes, it does."   ;;
9941 *)              echo "No, it doesn't." ;;
9942 esac
9943
9944 : see if asctime_r exists
9945 set asctime_r d_asctime_r
9946 eval $inlibc
9947 case "$d_asctime_r" in
9948 "$define")
9949         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9950         case "$d_asctime_r_proto:$usethreads" in
9951         ":define")      d_asctime_r_proto=define
9952                 set d_asctime_r_proto asctime_r $hdrs
9953                 eval $hasproto ;;
9954         *)      ;;
9955         esac
9956         case "$d_asctime_r_proto" in
9957         define)
9958         case "$asctime_r_proto" in
9959         ''|0) try='char* asctime_r(const struct tm*, char*);'
9960         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9961         esac
9962         case "$asctime_r_proto" in
9963         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9964         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9965         esac
9966         case "$asctime_r_proto" in
9967         ''|0) try='int asctime_r(const struct tm*, char*);'
9968         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9969         esac
9970         case "$asctime_r_proto" in
9971         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9972         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9973         esac
9974         case "$asctime_r_proto" in
9975         ''|0)   d_asctime_r=undef
9976                 asctime_r_proto=0
9977                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9978         * )     case "$asctime_r_proto" in
9979                 REENTRANT_PROTO*) ;;
9980                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9981                 esac
9982                 echo "Prototype: $try" ;;
9983         esac
9984         ;;
9985         *)      case "$usethreads" in
9986                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9987                 esac
9988                 d_asctime_r=undef
9989                 asctime_r_proto=0
9990                 ;;
9991         esac
9992         ;;
9993 *)      asctime_r_proto=0
9994         ;;
9995 esac
9996
9997 : see if atolf exists
9998 set atolf d_atolf
9999 eval $inlibc
10000
10001 : see if atoll exists
10002 set atoll d_atoll
10003 eval $inlibc
10004
10005 : Look for GCC-style attribute format
10006 case "$d_attribute_format" in
10007 '')
10008 echo " "
10009 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10010 $cat >attrib.c <<'EOCP'
10011 #include <stdio.h>
10012 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10013 EOCP
10014 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10015         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10016                 echo "Your C compiler doesn't support __attribute__((format))."
10017                 val="$undef"
10018         else
10019                 echo "Your C compiler supports __attribute__((format))."
10020                 val="$define"
10021         fi
10022 else
10023         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10024         val="$undef"
10025 fi
10026 ;;
10027 *) val="$d_attribute_format" ;;
10028 esac
10029 set d_attribute_format
10030 eval $setvar
10031 $rm -f attrib*
10032
10033 : Look for GCC-style attribute format with null format allowed
10034 case "$d_printf_format_null" in
10035 '') case "$d_attribute_format" in
10036     $define)
10037         echo " "
10038         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10039 $cat >attrib.c <<EOCP
10040 #include <stdio.h>
10041 #$i_stdlib I_STDLIB
10042 #ifdef I_STDLIB
10043 #include <stdlib.h>
10044 #endif
10045 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10046 int null_printf (char* pat,...) { return (int)pat; }
10047 int main () { exit(null_printf(NULL)); }
10048 EOCP
10049         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10050             : run the executable in case it produces a run-time warning
10051             if $run ./attrib >>attrib.out 2>&1; then
10052                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10053                     echo "Your C compiler doesn't allow __printf__ format to be null."
10054                     val="$undef"
10055                 else
10056                     echo "Your C compiler allows __printf__ format to be null."
10057                     val="$define"
10058                 fi
10059             else
10060             echo "Your C compiler executable failed with __printf__ format null."
10061             val="$undef"
10062         fi
10063     else
10064         echo "Your C compiler fails with __printf__ format null."
10065         val="$undef"
10066     fi
10067     ;;
10068     *)  val="$undef" ;;
10069     esac
10070 ;;
10071 *)  val="$d_printf_format_null" ;;
10072 esac
10073 set d_printf_format_null
10074 eval $setvar
10075 $rm -f attrib*
10076
10077 : Look for GCC-style attribute malloc
10078 case "$d_attribute_malloc" in
10079 '')
10080 echo " "
10081 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10082 $cat >attrib.c <<'EOCP'
10083 #include <stdio.h>
10084 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10085 EOCP
10086 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10087         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10088                 echo "Your C compiler doesn't support __attribute__((malloc))."
10089                 val="$undef"
10090         else
10091                 echo "Your C compiler supports __attribute__((malloc))."
10092                 val="$define"
10093         fi
10094 else
10095         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10096         val="$undef"
10097 fi
10098 ;;
10099 *) val="$d_attribute_malloc" ;;
10100 esac
10101 set d_attribute_malloc
10102 eval $setvar
10103 $rm -f attrib*
10104
10105 : Look for GCC-style attribute nonnull
10106 case "$d_attribute_nonnull" in
10107 '')
10108 echo " "
10109 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10110 $cat >attrib.c <<'EOCP'
10111 #include <stdio.h>
10112 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10113 EOCP
10114 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10115         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10116                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10117                 val="$undef"
10118         else
10119                 echo "Your C compiler supports __attribute__((nonnull))."
10120                 val="$define"
10121         fi
10122 else
10123         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10124         val="$undef"
10125 fi
10126 ;;
10127 *) val="$d_attribute_nonnull" ;;
10128 esac
10129 set d_attribute_nonnull
10130 eval $setvar
10131 $rm -f attrib*
10132
10133 : Look for GCC-style attribute noreturn
10134 case "$d_attribute_noreturn" in
10135 '')
10136 echo " "
10137 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10138 $cat >attrib.c <<'EOCP'
10139 #include <stdio.h>
10140 void fall_over_dead( void ) __attribute__((noreturn));
10141 EOCP
10142 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10143         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10144                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10145                 val="$undef"
10146         else
10147                 echo "Your C compiler supports __attribute__((noreturn))."
10148                 val="$define"
10149         fi
10150 else
10151         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10152         val="$undef"
10153 fi
10154 ;;
10155 *) val="$d_attribute_noreturn" ;;
10156 esac
10157 set d_attribute_noreturn
10158 eval $setvar
10159 $rm -f attrib*
10160
10161 : Look for GCC-style attribute pure
10162 case "$d_attribute_pure" in
10163 '')
10164 echo " "
10165 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10166 $cat >attrib.c <<'EOCP'
10167 #include <stdio.h>
10168 int square( int n ) __attribute__((pure));
10169 EOCP
10170 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10171         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10172                 echo "Your C compiler doesn't support __attribute__((pure))."
10173                 val="$undef"
10174         else
10175                 echo "Your C compiler supports __attribute__((pure))."
10176                 val="$define"
10177         fi
10178 else
10179         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10180         val="$undef"
10181 fi
10182 ;;
10183 *) val="$d_attribute_pure" ;;
10184 esac
10185 set d_attribute_pure
10186 eval $setvar
10187 $rm -f attrib*
10188
10189 : Look for GCC-style attribute unused
10190 case "$d_attribute_unused" in
10191 '')
10192 echo " "
10193 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10194 $cat >attrib.c <<'EOCP'
10195 #include <stdio.h>
10196 int do_something( int dummy __attribute__((unused)), int n );
10197 EOCP
10198 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10199         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10200                 echo "Your C compiler doesn't support __attribute__((unused))."
10201                 val="$undef"
10202         else
10203                 echo "Your C compiler supports __attribute__((unused))."
10204                 val="$define"
10205         fi
10206 else
10207         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10208         val="$undef"
10209 fi
10210 ;;
10211 *) val="$d_attribute_unused" ;;
10212 esac
10213 set d_attribute_unused
10214 eval $setvar
10215 $rm -f attrib*
10216
10217 : Look for GCC-style attribute warn_unused_result
10218 case "$d_attribute_warn_unused_result" in
10219 '')
10220 echo " "
10221 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10222 $cat >attrib.c <<'EOCP'
10223 #include <stdio.h>
10224 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10225 EOCP
10226 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10227         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10228                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10229                 val="$undef"
10230         else
10231                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10232                 val="$define"
10233         fi
10234 else
10235         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10236         val="$undef"
10237 fi
10238 ;;
10239 *) val="$d_attribute_warn_unused_result" ;;
10240 esac
10241 set d_attribute_warn_unused_result
10242 eval $setvar
10243 $rm -f attrib*
10244
10245 : see if bcmp exists
10246 set bcmp d_bcmp
10247 eval $inlibc
10248
10249 : see if bcopy exists
10250 set bcopy d_bcopy
10251 eval $inlibc
10252
10253 : see if getpgrp exists
10254 set getpgrp d_getpgrp
10255 eval $inlibc
10256
10257 case "$d_getpgrp" in
10258 "$define")
10259         echo " "
10260         echo "Checking to see which flavor of getpgrp is in use..."
10261         $cat >try.c <<EOP
10262 #$i_unistd I_UNISTD
10263 #include <sys/types.h>
10264 #ifdef I_UNISTD
10265 #  include <unistd.h>
10266 #endif
10267 #$i_stdlib I_STDLIB
10268 #ifdef I_STDLIB
10269 #include <stdlib.h>
10270 #endif
10271 int main()
10272 {
10273         if (getuid() == 0) {
10274                 printf("(I see you are running Configure as super-user...)\n");
10275                 setuid(1);
10276         }
10277 #ifdef TRY_BSD_PGRP
10278         if (getpgrp(1) == 0)
10279                 exit(0);
10280 #else
10281         if (getpgrp() > 0)
10282                 exit(0);
10283 #endif
10284         exit(1);
10285 }
10286 EOP
10287         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10288                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10289                 val="$define"
10290         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10291                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10292                 val="$undef"
10293         else
10294                 echo "I can't seem to compile and run the test program."
10295                 if ./usg; then
10296                         xxx="a USG one, i.e. you use getpgrp()."
10297                 else
10298                         # SVR4 systems can appear rather BSD-ish.
10299                         case "$i_unistd" in
10300                         $undef)
10301                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10302                                 val="$define"
10303                                 ;;
10304                         $define)
10305                                 xxx="probably a USG one, i.e. you use getpgrp()."
10306                                 val="$undef"
10307                                 ;;
10308                         esac
10309                 fi
10310                 echo "Assuming your getpgrp is $xxx" >&4
10311         fi
10312         ;;
10313 *) val="$undef";;
10314 esac
10315 set d_bsdgetpgrp
10316 eval $setvar
10317 $rm_try
10318
10319 : see if setpgrp exists
10320 set setpgrp d_setpgrp
10321 eval $inlibc
10322
10323 case "$d_setpgrp" in
10324 "$define")
10325         echo " "
10326         echo "Checking to see which flavor of setpgrp is in use..."
10327         $cat >try.c <<EOP
10328 #$i_unistd I_UNISTD
10329 #include <sys/types.h>
10330 #ifdef I_UNISTD
10331 #  include <unistd.h>
10332 #endif
10333 #$i_stdlib I_STDLIB
10334 #ifdef I_STDLIB
10335 #include <stdlib.h>
10336 #endif
10337 int main()
10338 {
10339         if (getuid() == 0) {
10340                 printf("(I see you are running Configure as super-user...)\n");
10341                 setuid(1);
10342         }
10343 #ifdef TRY_BSD_PGRP
10344         if (-1 == setpgrp(1, 1))
10345                 exit(0);
10346 #else
10347         if (setpgrp() != -1)
10348                 exit(0);
10349 #endif
10350         exit(1);
10351 }
10352 EOP
10353         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10354                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10355                 val="$define"
10356         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10357                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10358                 val="$undef"
10359         else
10360                 echo "(I can't seem to compile and run the test program.)"
10361                 if ./usg; then
10362                         xxx="a USG one, i.e. you use setpgrp()."
10363                 else
10364                         # SVR4 systems can appear rather BSD-ish.
10365                         case "$i_unistd" in
10366                         $undef)
10367                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10368                                 val="$define"
10369                                 ;;
10370                         $define)
10371                                 xxx="probably a USG one, i.e. you use setpgrp()."
10372                                 val="$undef"
10373                                 ;;
10374                         esac
10375                 fi
10376                 echo "Assuming your setpgrp is $xxx" >&4
10377         fi
10378         ;;
10379 *) val="$undef";;
10380 esac
10381 set d_bsdsetpgrp
10382 eval $setvar
10383 $rm_try
10384
10385 : Look for GCC-style __builtin_choose_expr
10386 case "$d_builtin_choose_expr" in
10387 '')
10388     echo " "
10389     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10390     $cat >try.c <<'EOCP'
10391 #include <assert.h>
10392 #include <stdlib.h>
10393 #include <stdio.h>
10394
10395 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10396
10397 int main(void) {
10398     assert( SYRINX(1) == 2112 );
10399     assert( SYRINX(1) != 5150 );
10400     assert( SYRINX(0) == 5150 );
10401     assert( SYRINX(0) != 2112 );
10402     puts( "All good!" );
10403     exit(0);
10404 }
10405
10406 EOCP
10407     set try
10408     if eval $compile; then
10409         echo "Your C compiler supports __builtin_choose_expr."
10410         val="$define"
10411     else
10412         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10413         val="$undef"
10414     fi
10415 ;;
10416 *) val="$d_builtin_choose_expr" ;;
10417 esac
10418
10419 set d_builtin_choose_expr
10420 eval $setvar
10421 $rm_try
10422
10423 : Look for GCC-style __builtin_expect
10424 case "$d_builtin_expect" in
10425 '')
10426     echo " "
10427     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10428     $cat >builtin.c <<'EOCP'
10429 int main(void) {
10430     int n = 50;
10431     if ( __builtin_expect(n, 0) ) n = 1;
10432 }
10433 EOCP
10434     set try
10435     if eval $compile; then
10436         echo "Your C compiler supports __builtin_choose_expr."
10437         val="$define"
10438     else
10439         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10440         val="$undef"
10441     fi
10442     ;;
10443 *) val="$d_builtin_expect" ;;
10444 esac
10445
10446 set d_builtin_expect
10447 eval $setvar
10448 $rm_try
10449
10450 : see if bzero exists
10451 set bzero d_bzero
10452 eval $inlibc
10453
10454 : see if stdarg is available
10455 echo " "
10456 if $test `./findhdr stdarg.h`; then
10457         echo "<stdarg.h> found." >&4
10458         valstd="$define"
10459 else
10460         echo "<stdarg.h> NOT found." >&4
10461         valstd="$undef"
10462 fi
10463
10464 : see if varags is available
10465 echo " "
10466 if $test `./findhdr varargs.h`; then
10467         echo "<varargs.h> found." >&4
10468 else
10469         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10470 fi
10471
10472 : set up the varargs testing programs
10473 $cat > varargs.c <<EOP
10474 #ifdef I_STDARG
10475 #include <stdarg.h>
10476 #endif
10477 #ifdef I_VARARGS
10478 #include <varargs.h>
10479 #endif
10480
10481 #ifdef I_STDARG
10482 int f(char *p, ...)
10483 #else
10484 int f(va_alist)
10485 va_dcl
10486 #endif
10487 {
10488         va_list ap;
10489 #ifndef I_STDARG
10490         char *p;
10491 #endif
10492 #ifdef I_STDARG
10493         va_start(ap,p);
10494 #else
10495         va_start(ap);
10496         p = va_arg(ap, char *);
10497 #endif
10498         va_end(ap);
10499         return 0;
10500 }
10501 EOP
10502 $cat > varargs <<EOP
10503 $startsh
10504 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10505         echo "true"
10506 else
10507         echo "false"
10508 fi
10509 $rm -f varargs$_o
10510 EOP
10511 chmod +x varargs
10512
10513 : now check which varargs header should be included
10514 echo " "
10515 i_varhdr=''
10516 case "$valstd" in
10517 "$define")
10518         if `./varargs I_STDARG`; then
10519                 val='stdarg.h'
10520         elif `./varargs I_VARARGS`; then
10521                 val='varargs.h'
10522         fi
10523         ;;
10524 *)
10525         if `./varargs I_VARARGS`; then
10526                 val='varargs.h'
10527         fi
10528         ;;
10529 esac
10530 case "$val" in
10531 '')
10532 echo "I could not find the definition for va_dcl... You have problems..." >&4
10533         val="$undef"; set i_stdarg; eval $setvar
10534         val="$undef"; set i_varargs; eval $setvar
10535         ;;
10536 *) 
10537         set i_varhdr
10538         eval $setvar
10539         case "$i_varhdr" in
10540         stdarg.h)
10541                 val="$define"; set i_stdarg; eval $setvar
10542                 val="$undef"; set i_varargs; eval $setvar
10543                 ;;
10544         varargs.h)
10545                 val="$undef"; set i_stdarg; eval $setvar
10546                 val="$define"; set i_varargs; eval $setvar
10547                 ;;
10548         esac
10549         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10550 esac
10551 $rm -f varargs*
10552
10553 : see if the Compiler supports C99 variadic macros
10554 case "$i_stdarg$i_stdlib" in
10555     "$define$define")
10556     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10557     $cat >try.c <<EOCP
10558 #include <stdio.h>
10559 #include <stdarg.h>
10560
10561 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10562
10563 int main() {
10564   char buf[20];
10565   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10566   puts(buf);
10567   return 0;
10568 }
10569 EOCP
10570     set try
10571     if eval $compile && $run ./try 2>&1 >/dev/null; then
10572         case "`$run ./try`" in
10573             "123 456 789")
10574             echo "You have C99 variadic macros." >&4
10575             d_c99_variadic_macros="$define"
10576             ;;
10577             *)
10578             echo "You don't have functional C99 variadic macros." >&4
10579             d_c99_variadic_macros="$undef"
10580             ;;
10581         esac
10582     else
10583         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10584         d_c99_variadic_macros="$undef"
10585     fi
10586     $rm_try
10587     ;;
10588     *)
10589     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10590     d_c99_variadic_macros="$undef"
10591     ;;
10592 esac
10593
10594 : see if signal is declared as pointer to function returning int or void
10595 echo " "
10596 xxx=`./findhdr signal.h`
10597 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10598 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10599         echo "You have int (*signal())() instead of void." >&4
10600         val="$undef"
10601 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10602         echo "You have void (*signal())()." >&4
10603         val="$define"
10604 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10605         echo "You have int (*signal())() instead of void." >&4
10606         val="$undef"
10607 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10608         echo "You have void (*signal())()." >&4
10609         val="$define"
10610 else
10611         case "$d_voidsig" in
10612         '')
10613         echo "I can't determine whether signal handler returns void or int..." >&4
10614                 dflt=void
10615                 rp="What type does your signal handler return?"
10616                 . ./myread
10617                 case "$ans" in
10618                 v*) val="$define";;
10619                 *) val="$undef";;
10620                 esac;;
10621         "$define")
10622                 echo "As you already told me, signal handler returns void." >&4
10623                 val="$define"
10624                 ;;
10625         *)      echo "As you already told me, signal handler returns int." >&4
10626                 val="$undef"
10627                 ;;
10628         esac
10629 fi
10630 set d_voidsig
10631 eval $setvar
10632 case "$d_voidsig" in
10633 "$define") signal_t="void";;
10634 *) signal_t="int";;
10635 esac
10636 $rm -f $$.tmp
10637
10638 : check for ability to cast large floats to 32-bit ints.
10639 echo " "
10640 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10641 if $test "$intsize" -ge 4; then
10642         xxx=int
10643 else
10644         xxx=long
10645 fi
10646 $cat >try.c <<EOCP
10647 #include <stdio.h>
10648 #$i_stdlib I_STDLIB
10649 #ifdef I_STDLIB
10650 #include <stdlib.h>
10651 #endif
10652 #include <sys/types.h>
10653 #include <signal.h>
10654 $signal_t blech(int s) { exit(3); }
10655 int main()
10656 {
10657         $xxx i32;
10658         double f, g;
10659         int result = 0;
10660         char str[16];
10661         signal(SIGFPE, blech);
10662
10663         /* Don't let compiler optimize the test away.  Store the number
10664            in a writable string for gcc to pass to sscanf under HP/UX.
10665         */
10666         sprintf(str, "2147483647");
10667         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10668         g = 10 * f;
10669         i32  = ($xxx) g;
10670
10671         /* x86 processors will probably give 0x8000 0000, which is a
10672            sign change.  We don't want that.  We want to mimic SPARC
10673            behavior here, which is to preserve the sign and give
10674            back 0x7fff ffff.
10675         */
10676         if (i32 != ($xxx) f)
10677                 result |= 1;
10678         exit(result);
10679 }
10680 EOCP
10681 set try
10682 if eval $compile_ok; then
10683         $run ./try
10684         yyy=$?
10685 else
10686         echo "(I can't seem to compile the test program--assuming it can't)"
10687         yyy=1
10688 fi
10689 case "$yyy" in
10690 0)      val="$define"
10691         echo "Yup, it can."
10692         ;;
10693 *)      val="$undef"
10694         echo "Nope, it can't."
10695         ;;
10696 esac
10697 set d_casti32
10698 eval $setvar
10699 $rm_try
10700
10701 : check for ability to cast negative floats to unsigned
10702 echo " "
10703 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10704 $cat >try.c <<EOCP
10705 #include <stdio.h>
10706 #$i_stdlib I_STDLIB
10707 #ifdef I_STDLIB
10708 #include <stdlib.h>
10709 #endif
10710 #include <sys/types.h>
10711 #include <signal.h>
10712 $signal_t blech(int s) { exit(7); }
10713 $signal_t blech_in_list(int s) { exit(4); }
10714 unsigned long dummy_long(unsigned long p) { return p; }
10715 unsigned int dummy_int(unsigned int p) { return p; }
10716 unsigned short dummy_short(unsigned short p) { return p; }
10717 int main()
10718 {
10719         double f;
10720         unsigned long along;
10721         unsigned int aint;
10722         unsigned short ashort;
10723         int result = 0;
10724         char str[16];
10725
10726         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10727            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10728            optimized the whole file away
10729         */
10730         /* Store the number in a writable string for gcc to pass to
10731            sscanf under HP/UX.
10732         */
10733         sprintf(str, "-123");
10734         sscanf(str, "%lf", &f);  /* f = -123.; */
10735
10736         signal(SIGFPE, blech);
10737         along = (unsigned long)f;
10738         aint = (unsigned int)f;
10739         ashort = (unsigned short)f;
10740         if (along != (unsigned long)-123)
10741                 result |= 1;
10742         if (aint != (unsigned int)-123)
10743                 result |= 1;
10744         if (ashort != (unsigned short)-123)
10745                 result |= 1;
10746         sprintf(str, "1073741824.");
10747         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10748         f = f + f;
10749         along = 0;
10750         along = (unsigned long)f;
10751         if (along != 0x80000000)
10752                 result |= 2;
10753         f -= 1.;
10754         along = 0;
10755         along = (unsigned long)f;
10756         if (along != 0x7fffffff)
10757                 result |= 1;
10758         f += 2.;
10759         along = 0;
10760         along = (unsigned long)f;
10761         if (along != 0x80000001)
10762                 result |= 2;
10763         if (result)
10764                 exit(result);
10765         signal(SIGFPE, blech_in_list);
10766         sprintf(str, "123.");
10767         sscanf(str, "%lf", &f);  /* f = 123.; */
10768         along = dummy_long((unsigned long)f);
10769         aint = dummy_int((unsigned int)f);
10770         ashort = dummy_short((unsigned short)f);
10771         if (along != (unsigned long)123)
10772                 result |= 4;
10773         if (aint != (unsigned int)123)
10774                 result |= 4;
10775         if (ashort != (unsigned short)123)
10776                 result |= 4;
10777         exit(result);
10778
10779 }
10780 EOCP
10781 set try
10782 if eval $compile_ok; then
10783         $run ./try
10784         castflags=$?
10785 else
10786         echo "(I can't seem to compile the test program--assuming it can't)"
10787         castflags=7
10788 fi
10789 case "$castflags" in
10790 0)      val="$define"
10791         echo "Yup, it can."
10792         ;;
10793 *)      val="$undef"
10794         echo "Nope, it can't."
10795         ;;
10796 esac
10797 set d_castneg
10798 eval $setvar
10799 $rm_try
10800
10801 : see if vprintf exists
10802 echo " "
10803 if set vprintf val -f d_vprintf; eval $csym; $val; then
10804         echo 'vprintf() found.' >&4
10805         val="$define"
10806         $cat >try.c <<EOF
10807 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10808 #$i_varargs I_VARARGS
10809
10810 #$i_stdlib I_STDLIB
10811 #$i_unistd I_UNISTD
10812
10813 #ifdef I_STDARG
10814 #  include <stdarg.h>
10815 #else /* I_VARARGS */
10816 #  include <varargs.h>
10817 #endif
10818
10819 #ifdef I_UNISTD
10820 #  include <unistd.h>
10821 #endif
10822
10823 #ifdef I_STDLIB
10824 #  include <stdlib.h>
10825 #endif
10826
10827 #include <stdio.h> /* vsprintf prototype */
10828
10829 #ifdef I_STDARG
10830 void xxx(int n, ...)
10831 {
10832     va_list args;
10833     char buf[10];
10834     va_start(args, n);
10835     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10836 }
10837 int main() { xxx(1, "foo"); }
10838
10839 #else /* I_VARARGS */
10840
10841 xxx(va_alist)
10842 va_dcl
10843 {
10844     va_list args;
10845     char buf[10];
10846     va_start(args);
10847     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10848 }
10849 int main() { xxx("foo"); }
10850
10851 #endif
10852
10853 EOF
10854         set try
10855         if eval $compile_ok; then
10856                 if $run ./try; then
10857                         echo "Your vsprintf() returns (int)." >&4
10858                         val2="$undef"
10859                 else
10860                         echo "Your vsprintf() returns (char*)." >&4
10861                         val2="$define"
10862                 fi
10863         else
10864                 echo 'I am unable to compile the vsprintf() test program.' >&4
10865                 # We shouldn't get here.  If we do, assume the standard signature,
10866                 # not the old BSD one.
10867                 echo 'Guessing that vsprintf() returns (int).' >&4
10868                 val2="$undef"
10869         fi
10870 else
10871         echo 'vprintf() NOT found.' >&4
10872         val="$undef"
10873         val2="$undef"
10874 fi
10875 $rm_try
10876 set d_vprintf
10877 eval $setvar
10878 val=$val2
10879 set d_charvspr
10880 eval $setvar
10881
10882 : see if chown exists
10883 set chown d_chown
10884 eval $inlibc
10885
10886 : see if chroot exists
10887 set chroot d_chroot
10888 eval $inlibc
10889
10890 : see if chsize exists
10891 set chsize d_chsize
10892 eval $inlibc
10893
10894 : see if class exists
10895 set class d_class
10896 eval $inlibc
10897
10898 : see if clearenv exists
10899 set clearenv d_clearenv
10900 eval $inlibc
10901
10902 hasstruct='varname=$1; struct=$2; shift; shift;
10903 while $test $# -ge 2; do
10904         case "$1" in
10905         $define) echo "#include <$2>";;
10906         esac ;
10907     shift 2;
10908 done > try.c;
10909 echo "int main () { struct $struct foo; }" >> try.c;
10910 set try;
10911 if eval $compile; then
10912         val="$define";
10913 else
10914         val="$undef";
10915 fi;
10916 set $varname;
10917 eval $setvar;
10918 $rm_try'
10919
10920 socketlib=''
10921 sockethdr=''
10922 : see whether socket exists
10923 echo " "
10924 $echo $n "Hmm... $c" >&4
10925 if set socket val -f d_socket; eval $csym; $val; then
10926         echo "Looks like you have Berkeley networking support." >&4
10927         d_socket="$define"
10928         if set setsockopt val -f; eval $csym; $val; then
10929                 d_oldsock="$undef"
10930         else
10931                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10932                 d_oldsock="$define"
10933         fi
10934 else
10935         if $contains socklib libc.list >/dev/null 2>&1; then
10936                 echo "Looks like you have Berkeley networking support." >&4
10937                 d_socket="$define"
10938                 : we will have to assume that it supports the 4.2 BSD interface
10939                 d_oldsock="$undef"
10940         else
10941                 echo "You don't have Berkeley networking in libc$_a..." >&4
10942                 if test "X$d_socket" = "X$define"; then
10943                    echo "...but you seem to believe that you have sockets." >&4
10944                 else
10945                         for net in net socket
10946                         do
10947                                 if test -f /usr/lib/lib$net$_a; then
10948                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10949                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10950                                         if $contains socket libc.list >/dev/null 2>&1; then
10951                                                 d_socket="$define"
10952                                                 socketlib="-l$net"
10953                                                 case "$net" in
10954                                                 net)
10955                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10956                                                         sockethdr="-I/usr/netinclude"
10957                                                         ;;
10958                                                 esac
10959                                                 echo "Found Berkeley sockets interface in lib$net." >&4
10960                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10961                                                         d_oldsock="$undef"
10962                                                 else
10963                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10964                                                         d_oldsock="$define"
10965                                                 fi
10966                                                 break
10967                                         fi
10968                                 fi
10969                         done
10970                         if test "X$d_socket" != "X$define"; then
10971                            echo "or anywhere else I see." >&4
10972                            d_socket="$undef"
10973                            d_oldsock="$undef"
10974                         fi
10975                 fi
10976         fi
10977 fi
10978
10979 : see if socketpair exists
10980 set socketpair d_sockpair
10981 eval $inlibc
10982
10983
10984 echo " "
10985 echo "Checking the availability of certain socket constants..." >&4
10986 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10987         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10988         $cat >try.c <<EOF
10989 #include <sys/types.h>
10990 #include <sys/socket.h>
10991 int main() {
10992     int i = $ENUM;
10993 }
10994 EOF
10995         val="$undef"
10996         set try; if eval $compile; then
10997                 val="$define"
10998         fi
10999         set d_${enum}; eval $setvar
11000         $rm_try
11001 done
11002
11003 : see if this is a sys/uio.h system
11004 set sys/uio.h i_sysuio
11005 eval $inhdr
11006
11007
11008 echo " "
11009 echo "Checking to see if your system supports struct cmsghdr..." >&4
11010 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11011 eval $hasstruct
11012 case "$d_cmsghdr_s" in
11013 "$define")      echo "Yes, it does."   ;;
11014 *)              echo "No, it doesn't." ;;
11015 esac
11016
11017
11018 : check for const keyword
11019 echo " "
11020 echo 'Checking to see if your C compiler knows about "const"...' >&4
11021 $cat >const.c <<'EOCP'
11022 typedef struct spug { int drokk; } spug;
11023 int main()
11024 {
11025         const char *foo;
11026         const spug y = { 0 };
11027 }
11028 EOCP
11029 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11030         val="$define"
11031         echo "Yup, it does."
11032 else
11033         val="$undef"
11034         echo "Nope, it doesn't."
11035 fi
11036 set d_const
11037 eval $setvar
11038
11039 : see if copysignl exists
11040 set copysignl d_copysignl
11041 eval $inlibc
11042
11043 : see if crypt exists
11044 echo " "
11045 set crypt d_crypt
11046 eval $inlibc
11047 case "$d_crypt" in
11048 $define) cryptlib='' ;;
11049 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11050                 echo 'crypt() found.' >&4
11051                 val="$define"
11052                 cryptlib=''
11053         else
11054                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11055                 if $test -z "$cryptlib"; then
11056                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11057                 else
11058                         cryptlib=-lcrypt
11059                 fi
11060                 if $test -z "$cryptlib"; then
11061                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11062                 else
11063                         cryptlib=-lcrypt
11064                 fi
11065                 if $test -z "$cryptlib"; then
11066                         cryptlib=`./loc libcrypt$_a "" $libpth`
11067                 else
11068                         cryptlib=-lcrypt
11069                 fi
11070                 if $test -z "$cryptlib"; then
11071                         echo 'crypt() NOT found.' >&4
11072                         val="$undef"
11073                 else
11074                         val="$define"
11075                 fi
11076         fi
11077         set d_crypt
11078         eval $setvar
11079         ;;
11080 esac
11081
11082 : see if this is a crypt.h system
11083 set crypt.h i_crypt
11084 eval $inhdr
11085
11086 : see if crypt_r exists
11087 set crypt_r d_crypt_r
11088 eval $inlibc
11089 case "$d_crypt_r" in
11090 "$define")
11091         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11092         case "$d_crypt_r_proto:$usethreads" in
11093         ":define")      d_crypt_r_proto=define
11094                 set d_crypt_r_proto crypt_r $hdrs
11095                 eval $hasproto ;;
11096         *)      ;;
11097         esac
11098         case "$d_crypt_r_proto" in
11099         define)
11100         case "$crypt_r_proto" in
11101         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11102         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11103         esac
11104         case "$crypt_r_proto" in
11105         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11106         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11107         esac
11108         case "$crypt_r_proto" in
11109         ''|0)   d_crypt_r=undef
11110                 crypt_r_proto=0
11111                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11112         * )     case "$crypt_r_proto" in
11113                 REENTRANT_PROTO*) ;;
11114                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11115                 esac
11116                 echo "Prototype: $try" ;;
11117         esac
11118         ;;
11119         *)      case "$usethreads" in
11120                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11121                 esac
11122                 d_crypt_r=undef
11123                 crypt_r_proto=0
11124                 ;;
11125         esac
11126         ;;
11127 *)      crypt_r_proto=0
11128         ;;
11129 esac
11130
11131 : get csh whereabouts
11132 case "$csh" in
11133 'csh') val="$undef" ;;
11134 *) val="$define" ;;
11135 esac
11136 set d_csh
11137 eval $setvar
11138 : Respect a hint or command line value for full_csh.
11139 case "$full_csh" in
11140 '') full_csh=$csh ;;
11141 esac
11142
11143 : see if ctermid exists
11144 set ctermid d_ctermid
11145 eval $inlibc
11146
11147 : see if ctermid_r exists
11148 set ctermid_r d_ctermid_r
11149 eval $inlibc
11150 case "$d_ctermid_r" in
11151 "$define")
11152         hdrs="$i_systypes sys/types.h define stdio.h "
11153         case "$d_ctermid_r_proto:$usethreads" in
11154         ":define")      d_ctermid_r_proto=define
11155                 set d_ctermid_r_proto ctermid_r $hdrs
11156                 eval $hasproto ;;
11157         *)      ;;
11158         esac
11159         case "$d_ctermid_r_proto" in
11160         define)
11161         case "$ctermid_r_proto" in
11162         ''|0) try='char* ctermid_r(char*);'
11163         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11164         esac
11165         case "$ctermid_r_proto" in
11166         ''|0)   d_ctermid_r=undef
11167                 ctermid_r_proto=0
11168                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11169         * )     case "$ctermid_r_proto" in
11170                 REENTRANT_PROTO*) ;;
11171                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11172                 esac
11173                 echo "Prototype: $try" ;;
11174         esac
11175         ;;
11176         *)      case "$usethreads" in
11177                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11178                 esac
11179                 d_ctermid_r=undef
11180                 ctermid_r_proto=0
11181                 ;;
11182         esac
11183         ;;
11184 *)      ctermid_r_proto=0
11185         ;;
11186 esac
11187
11188 : see if ctime_r exists
11189 set ctime_r d_ctime_r
11190 eval $inlibc
11191 case "$d_ctime_r" in
11192 "$define")
11193         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11194         case "$d_ctime_r_proto:$usethreads" in
11195         ":define")      d_ctime_r_proto=define
11196                 set d_ctime_r_proto ctime_r $hdrs
11197                 eval $hasproto ;;
11198         *)      ;;
11199         esac
11200         case "$d_ctime_r_proto" in
11201         define)
11202         case "$ctime_r_proto" in
11203         ''|0) try='char* ctime_r(const time_t*, char*);'
11204         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11205         esac
11206         case "$ctime_r_proto" in
11207         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11208         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11209         esac
11210         case "$ctime_r_proto" in
11211         ''|0) try='int ctime_r(const time_t*, char*);'
11212         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11213         esac
11214         case "$ctime_r_proto" in
11215         ''|0) try='int ctime_r(const time_t*, char*, int);'
11216         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11217         esac
11218         case "$ctime_r_proto" in
11219         ''|0)   d_ctime_r=undef
11220                 ctime_r_proto=0
11221                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11222         * )     case "$ctime_r_proto" in
11223                 REENTRANT_PROTO*) ;;
11224                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11225                 esac
11226                 echo "Prototype: $try" ;;
11227         esac
11228         ;;
11229         *)      case "$usethreads" in
11230                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11231                 esac
11232                 d_ctime_r=undef
11233                 ctime_r_proto=0
11234                 ;;
11235         esac
11236         ;;
11237 *)      ctime_r_proto=0
11238         ;;
11239 esac
11240
11241 : see if cuserid exists
11242 set cuserid d_cuserid
11243 eval $inlibc
11244
11245 : see if this is a limits.h system
11246 set limits.h i_limits
11247 eval $inhdr
11248
11249 : see if this is a float.h system
11250 set float.h i_float
11251 eval $inhdr
11252
11253 : See if number of significant digits in a double precision number is known
11254 echo " "
11255 $cat >dbl_dig.c <<EOM
11256 #$i_limits I_LIMITS
11257 #$i_float I_FLOAT
11258 #ifdef I_LIMITS
11259 #include <limits.h>
11260 #endif
11261 #ifdef I_FLOAT
11262 #include <float.h>
11263 #endif
11264 #ifdef DBL_DIG
11265 printf("Contains DBL_DIG");
11266 #endif
11267 EOM
11268 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11269 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11270         echo "DBL_DIG found." >&4
11271         val="$define"
11272 else
11273         echo "DBL_DIG NOT found." >&4
11274         val="$undef"
11275 fi
11276 $rm -f dbl_dig.?
11277 set d_dbl_dig
11278 eval $setvar
11279
11280 : see if dbm.h is available
11281 : see if dbmclose exists
11282 set dbmclose d_dbmclose
11283 eval $inlibc
11284
11285 case "$d_dbmclose" in
11286 $define)
11287         set dbm.h i_dbm
11288         eval $inhdr
11289         case "$i_dbm" in
11290         $define)
11291                 val="$undef"
11292                 set i_rpcsvcdbm
11293                 eval $setvar
11294                 ;;
11295         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11296                 eval $inhdr
11297                 ;;
11298         esac
11299         ;;
11300 *)      echo "We won't be including <dbm.h>"
11301         val="$undef"
11302         set i_dbm
11303         eval $setvar
11304         val="$undef"
11305         set i_rpcsvcdbm
11306         eval $setvar
11307         ;;
11308 esac
11309
11310 : see if prototype for dbminit is available
11311 echo " "
11312 set d_dbminitproto dbminit $i_dbm dbm.h
11313 eval $hasproto
11314
11315 : see if difftime exists
11316 set difftime d_difftime
11317 eval $inlibc
11318
11319 : see if this is a dirent system
11320 echo " "
11321 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11322         val="$define"
11323         echo "<dirent.h> found." >&4
11324 else
11325         val="$undef"
11326         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11327                 echo "<sys/dir.h> found." >&4
11328                 echo " "
11329         else
11330                 xinc=`./findhdr sys/ndir.h`
11331         fi
11332         echo "<dirent.h> NOT found." >&4
11333 fi
11334 set i_dirent
11335 eval $setvar
11336
11337 : Look for type of directory structure.
11338 echo " "
11339 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11340
11341 case "$direntrytype" in
11342 ''|' ')
11343         case "$i_dirent" in
11344         $define) guess1='struct dirent' ;;
11345         *) guess1='struct direct'  ;;
11346         esac
11347         ;;
11348 *)      guess1="$direntrytype"
11349         ;;
11350 esac
11351
11352 case "$guess1" in
11353 'struct dirent') guess2='struct direct' ;;
11354 *) guess2='struct dirent' ;;
11355 esac
11356
11357 if $contains "$guess1" try.c >/dev/null 2>&1; then
11358         direntrytype="$guess1"
11359         echo "Your directory entries are $direntrytype." >&4
11360 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11361         direntrytype="$guess2"
11362         echo "Your directory entries seem to be $direntrytype." >&4
11363 else
11364         echo "I don't recognize your system's directory entries." >&4
11365         rp="What type is used for directory entries on this system?"
11366         dflt="$guess1"
11367         . ./myread
11368         direntrytype="$ans"
11369 fi
11370 $rm_try
11371
11372 : see if the directory entry stores field length
11373 echo " "
11374 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11375 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11376         echo "Good, your directory entry keeps length information in d_namlen." >&4
11377         val="$define"
11378 else
11379         echo "Your directory entry does not know about the d_namlen field." >&4
11380         val="$undef"
11381 fi
11382 set d_dirnamlen
11383 eval $setvar
11384 $rm_try
11385
11386 : Look for DIR.dd_fd
11387 case "$i_dirent" in
11388 "$define")
11389     echo "Checking to see if DIR has a dd_fd member variable" >&4
11390     $cat >try.c <<EOCP
11391 #$i_stdlib I_STDLIB
11392 #ifdef I_STDLIB
11393 #include <stdlib.h>
11394 #endif
11395 #include <dirent.h>
11396
11397 int main() {
11398     DIR dir;
11399     dir.dd_fd = 1;
11400     return 0;
11401 }
11402 EOCP
11403     val=$undef
11404     set try
11405     if eval $compile; then
11406         echo "Yes, it does."
11407         val="$define"
11408     else
11409         echo "No, it does not."
11410         val="$undef"
11411     fi
11412     ;;
11413 *)
11414     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11415     val="$undef"
11416     ;;
11417 esac
11418 set d_dir_dd_fd
11419 eval $setvar
11420 $rm_try
11421
11422 : see if this is an sysdir system
11423 set sys/dir.h i_sysdir
11424 eval $inhdr
11425
11426 : see if this is an sysndir system
11427 set sys/ndir.h i_sysndir
11428 eval $inhdr
11429
11430 : Look for dirfd
11431 echo " "
11432 $cat >dirfd.c <<EOM
11433 #include <stdio.h>
11434 #$i_stdlib I_STDLIB
11435 #ifdef I_STDLIB
11436 #include <stdlib.h>
11437 #endif
11438 #$i_dirent I_DIRENT             /**/
11439 #$i_sysdir I_SYS_DIR            /**/
11440 #$i_sysndir I_SYS_NDIR          /**/
11441 #$i_systypes I_SYS_TYPES        /**/
11442 #if defined(I_SYS_TYPES)
11443 #include <sys/types.h>
11444 #endif
11445 #if defined(I_DIRENT)
11446 #include <dirent.h>
11447 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11448 #include <sys/dir.h>
11449 #endif
11450 #else
11451 #ifdef I_SYS_NDIR
11452 #include <sys/ndir.h>
11453 #else
11454 #ifdef I_SYS_DIR
11455 #ifdef hp9000s500
11456 #include <ndir.h>       /* may be wrong in the future */
11457 #else
11458 #include <sys/dir.h>
11459 #endif
11460 #endif
11461 #endif
11462 #endif 
11463 int main() {
11464         DIR *dirp = opendir(".");
11465         if (dirfd(dirp) >= 0)
11466                 exit(0);
11467         else
11468                 exit(1);
11469 }
11470 EOM
11471 val=$undef
11472 set dirfd
11473 if eval $compile; then
11474         val="$define"
11475 fi
11476 case "$val" in
11477 $define)        echo "dirfd() found." >&4       ;;
11478 *)              echo "dirfd() NOT found." >&4   ;;
11479 esac
11480 set d_dirfd
11481 eval $setvar
11482 $rm -f dirfd*
11483
11484 : see if dlerror exists
11485 xxx_runnm="$runnm"
11486 runnm=false
11487 set dlerror d_dlerror
11488 eval $inlibc
11489 runnm="$xxx_runnm"
11490
11491 : see if dlfcn is available
11492 set dlfcn.h i_dlfcn
11493 eval $inhdr
11494
11495 case "$usedl" in
11496 $define|y|true)
11497         $cat << EOM
11498
11499 On a few systems, the dynamically loaded modules that perl generates and uses
11500 will need a different extension than shared libs. The default will probably
11501 be appropriate.
11502
11503 EOM
11504         case "$dlext" in
11505         '')     dflt="$so" ;;
11506         *)      dflt="$dlext" ;;
11507         esac
11508         rp='What is the extension of dynamically loaded modules'
11509         . ./myread
11510         dlext="$ans"
11511         ;;
11512 *)
11513         dlext="none"
11514         ;;
11515 esac
11516
11517 : Check if dlsym need a leading underscore
11518 echo " "
11519 val="$undef"
11520
11521 case "$dlsrc" in
11522 dl_dlopen.xs)
11523         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11524         $cat >dyna.c <<'EOM'
11525 fred () { }
11526 EOM
11527
11528 $cat >fred.c<<EOM
11529
11530 #include <stdio.h>
11531 #$i_stdlib I_STDLIB
11532 #ifdef I_STDLIB
11533 #include <stdlib.h>
11534 #endif
11535 #$i_dlfcn I_DLFCN
11536 #ifdef I_DLFCN
11537 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11538 #else
11539 #include <sys/types.h>
11540 #include <nlist.h>
11541 #include <link.h>
11542 #endif
11543
11544 extern int fred() ;
11545
11546 int main()
11547 {
11548     void * handle ;
11549     void * symbol ;
11550 #ifndef RTLD_LAZY
11551     int mode = 1 ;
11552 #else
11553     int mode = RTLD_LAZY ;
11554 #endif
11555     handle = dlopen("./dyna.$dlext", mode) ;
11556     if (handle == NULL) {
11557         printf ("1\n") ;
11558         fflush (stdout) ;
11559         exit(0);
11560     }
11561     symbol = dlsym(handle, "fred") ;
11562     if (symbol == NULL) {
11563         /* try putting a leading underscore */
11564         symbol = dlsym(handle, "_fred") ;
11565         if (symbol == NULL) {
11566             printf ("2\n") ;
11567             fflush (stdout) ;
11568             exit(0);
11569         }
11570         printf ("3\n") ;
11571     }
11572     else
11573         printf ("4\n") ;
11574     fflush (stdout) ;
11575     exit(0);
11576 }
11577 EOM
11578         : Call the object file tmp-dyna.o in case dlext=o.
11579         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11580                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11581                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11582                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11583                 xxx=`$run ./fred`
11584                 case $xxx in
11585                 1)      echo "Test program failed using dlopen." >&4
11586                         echo "Perhaps you should not use dynamic loading." >&4;;
11587                 2)      echo "Test program failed using dlsym." >&4
11588                         echo "Perhaps you should not use dynamic loading." >&4;;
11589                 3)      echo "dlsym needs a leading underscore" >&4
11590                         val="$define" ;;
11591                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11592                 esac
11593         else
11594                 echo "I can't compile and run the test program." >&4
11595                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11596         fi
11597         ;;
11598 esac
11599                 
11600 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11601
11602 set d_dlsymun
11603 eval $setvar
11604
11605 : see if drand48_r exists
11606 set drand48_r d_drand48_r
11607 eval $inlibc
11608 case "$d_drand48_r" in
11609 "$define")
11610         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11611         case "$d_drand48_r_proto:$usethreads" in
11612         ":define")      d_drand48_r_proto=define
11613                 set d_drand48_r_proto drand48_r $hdrs
11614                 eval $hasproto ;;
11615         *)      ;;
11616         esac
11617         case "$d_drand48_r_proto" in
11618         define)
11619         case "$drand48_r_proto" in
11620         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11621         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11622         esac
11623         case "$drand48_r_proto" in
11624         ''|0)   d_drand48_r=undef
11625                 drand48_r_proto=0
11626                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11627         * )     case "$drand48_r_proto" in
11628                 REENTRANT_PROTO*) ;;
11629                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11630                 esac
11631                 echo "Prototype: $try" ;;
11632         esac
11633         ;;
11634         *)      case "$usethreads" in
11635                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11636                 esac
11637                 d_drand48_r=undef
11638                 drand48_r_proto=0
11639                 ;;
11640         esac
11641         ;;
11642 *)      drand48_r_proto=0
11643         ;;
11644 esac
11645
11646 : see if prototype for drand48 is available
11647 echo " "
11648 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11649 eval $hasproto
11650
11651 : see if dup2 exists
11652 set dup2 d_dup2
11653 eval $inlibc
11654
11655 : see if eaccess exists
11656 set eaccess d_eaccess
11657 eval $inlibc
11658
11659 : see if endgrent exists
11660 set endgrent d_endgrent
11661 eval $inlibc
11662
11663 : see if this is an grp system
11664 set grp.h i_grp
11665 eval $inhdr
11666
11667 case "$i_grp" in
11668 $define)
11669         xxx=`./findhdr grp.h`
11670         $cppstdin $cppflags $cppminus < $xxx >$$.h
11671
11672         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11673                 val="$define"
11674         else
11675                 val="$undef"
11676         fi
11677         set d_grpasswd
11678         eval $setvar
11679
11680         $rm -f $$.h
11681         ;;
11682 *)
11683         val="$undef";
11684         set d_grpasswd; eval $setvar
11685         ;;
11686 esac
11687
11688 : see if endgrent_r exists
11689 set endgrent_r d_endgrent_r
11690 eval $inlibc
11691 case "$d_endgrent_r" in
11692 "$define")
11693         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11694         case "$d_endgrent_r_proto:$usethreads" in
11695         ":define")      d_endgrent_r_proto=define
11696                 set d_endgrent_r_proto endgrent_r $hdrs
11697                 eval $hasproto ;;
11698         *)      ;;
11699         esac
11700         case "$d_endgrent_r_proto" in
11701         define)
11702         case "$endgrent_r_proto" in
11703         ''|0) try='int endgrent_r(FILE**);'
11704         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11705         esac
11706         case "$endgrent_r_proto" in
11707         ''|0) try='void endgrent_r(FILE**);'
11708         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11709         esac
11710         case "$endgrent_r_proto" in
11711         ''|0)   d_endgrent_r=undef
11712                 endgrent_r_proto=0
11713                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11714         * )     case "$endgrent_r_proto" in
11715                 REENTRANT_PROTO*) ;;
11716                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11717                 esac
11718                 echo "Prototype: $try" ;;
11719         esac
11720         ;;
11721         *)      case "$usethreads" in
11722                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11723                 esac
11724                 d_endgrent_r=undef
11725                 endgrent_r_proto=0
11726                 ;;
11727         esac
11728         ;;
11729 *)      endgrent_r_proto=0
11730         ;;
11731 esac
11732
11733 : see if endhostent exists
11734 set endhostent d_endhent
11735 eval $inlibc
11736
11737 : see if this is a netdb.h system
11738 set netdb.h i_netdb
11739 eval $inhdr
11740
11741 : see if endhostent_r exists
11742 set endhostent_r d_endhostent_r
11743 eval $inlibc
11744 case "$d_endhostent_r" in
11745 "$define")
11746         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11747         case "$d_endhostent_r_proto:$usethreads" in
11748         ":define")      d_endhostent_r_proto=define
11749                 set d_endhostent_r_proto endhostent_r $hdrs
11750                 eval $hasproto ;;
11751         *)      ;;
11752         esac
11753         case "$d_endhostent_r_proto" in
11754         define)
11755         case "$endhostent_r_proto" in
11756         ''|0) try='int endhostent_r(struct hostent_data*);'
11757         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11758         esac
11759         case "$endhostent_r_proto" in
11760         ''|0) try='void endhostent_r(struct hostent_data*);'
11761         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11762         esac
11763         case "$endhostent_r_proto" in
11764         ''|0)   d_endhostent_r=undef
11765                 endhostent_r_proto=0
11766                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11767         * )     case "$endhostent_r_proto" in
11768                 REENTRANT_PROTO*) ;;
11769                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11770                 esac
11771                 echo "Prototype: $try" ;;
11772         esac
11773         ;;
11774         *)      case "$usethreads" in
11775                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11776                 esac
11777                 d_endhostent_r=undef
11778                 endhostent_r_proto=0
11779                 ;;
11780         esac
11781         ;;
11782 *)      endhostent_r_proto=0
11783         ;;
11784 esac
11785
11786 : see if endnetent exists
11787 set endnetent d_endnent
11788 eval $inlibc
11789
11790 : see if endnetent_r exists
11791 set endnetent_r d_endnetent_r
11792 eval $inlibc
11793 case "$d_endnetent_r" in
11794 "$define")
11795         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11796         case "$d_endnetent_r_proto:$usethreads" in
11797         ":define")      d_endnetent_r_proto=define
11798                 set d_endnetent_r_proto endnetent_r $hdrs
11799                 eval $hasproto ;;
11800         *)      ;;
11801         esac
11802         case "$d_endnetent_r_proto" in
11803         define)
11804         case "$endnetent_r_proto" in
11805         ''|0) try='int endnetent_r(struct netent_data*);'
11806         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11807         esac
11808         case "$endnetent_r_proto" in
11809         ''|0) try='void endnetent_r(struct netent_data*);'
11810         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11811         esac
11812         case "$endnetent_r_proto" in
11813         ''|0)   d_endnetent_r=undef
11814                 endnetent_r_proto=0
11815                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11816         * )     case "$endnetent_r_proto" in
11817                 REENTRANT_PROTO*) ;;
11818                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11819                 esac
11820                 echo "Prototype: $try" ;;
11821         esac
11822         ;;
11823         *)      case "$usethreads" in
11824                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11825                 esac
11826                 d_endnetent_r=undef
11827                 endnetent_r_proto=0
11828                 ;;
11829         esac
11830         ;;
11831 *)      endnetent_r_proto=0
11832         ;;
11833 esac
11834
11835 : see if endprotoent exists
11836 set endprotoent d_endpent
11837 eval $inlibc
11838
11839 : see if endprotoent_r exists
11840 set endprotoent_r d_endprotoent_r
11841 eval $inlibc
11842 case "$d_endprotoent_r" in
11843 "$define")
11844         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11845         case "$d_endprotoent_r_proto:$usethreads" in
11846         ":define")      d_endprotoent_r_proto=define
11847                 set d_endprotoent_r_proto endprotoent_r $hdrs
11848                 eval $hasproto ;;
11849         *)      ;;
11850         esac
11851         case "$d_endprotoent_r_proto" in
11852         define)
11853         case "$endprotoent_r_proto" in
11854         ''|0) try='int endprotoent_r(struct protoent_data*);'
11855         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11856         esac
11857         case "$endprotoent_r_proto" in
11858         ''|0) try='void endprotoent_r(struct protoent_data*);'
11859         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11860         esac
11861         case "$endprotoent_r_proto" in
11862         ''|0)   d_endprotoent_r=undef
11863                 endprotoent_r_proto=0
11864                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11865         * )     case "$endprotoent_r_proto" in
11866                 REENTRANT_PROTO*) ;;
11867                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11868                 esac
11869                 echo "Prototype: $try" ;;
11870         esac
11871         ;;
11872         *)      case "$usethreads" in
11873                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11874                 esac
11875                 d_endprotoent_r=undef
11876                 endprotoent_r_proto=0
11877                 ;;
11878         esac
11879         ;;
11880 *)      endprotoent_r_proto=0
11881         ;;
11882 esac
11883
11884 : see if endpwent exists
11885 set endpwent d_endpwent
11886 eval $inlibc
11887
11888 : see if this is a pwd.h system
11889 set pwd.h i_pwd
11890 eval $inhdr
11891
11892 case "$i_pwd" in
11893 $define)
11894         xxx=`./findhdr pwd.h`
11895         $cppstdin $cppflags $cppminus < $xxx >$$.h
11896
11897         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11898                 val="$define"
11899         else
11900                 val="$undef"
11901         fi
11902         set d_pwquota
11903         eval $setvar
11904
11905         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11906                 val="$define"
11907         else
11908                 val="$undef"
11909         fi
11910         set d_pwage
11911         eval $setvar
11912
11913         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11914                 val="$define"
11915         else
11916                 val="$undef"
11917         fi
11918         set d_pwchange
11919         eval $setvar
11920
11921         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11922                 val="$define"
11923         else
11924                 val="$undef"
11925         fi
11926         set d_pwclass
11927         eval $setvar
11928
11929         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11930                 val="$define"
11931         else
11932                 val="$undef"
11933         fi
11934         set d_pwexpire
11935         eval $setvar
11936
11937         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11938                 val="$define"
11939         else
11940                 val="$undef"
11941         fi
11942         set d_pwcomment
11943         eval $setvar
11944
11945         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11946                 val="$define"
11947         else
11948                 val="$undef"
11949         fi
11950         set d_pwgecos
11951         eval $setvar
11952
11953         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11954                 val="$define"
11955         else
11956                 val="$undef"
11957         fi
11958         set d_pwpasswd
11959         eval $setvar
11960
11961         $rm -f $$.h
11962         ;;
11963 *)
11964         val="$undef"; 
11965         set d_pwquota; eval $setvar
11966         set d_pwage; eval $setvar
11967         set d_pwchange; eval $setvar
11968         set d_pwclass; eval $setvar
11969         set d_pwexpire; eval $setvar
11970         set d_pwcomment; eval $setvar
11971         set d_pwgecos; eval $setvar
11972         set d_pwpasswd; eval $setvar
11973         ;;
11974 esac
11975
11976 : see if endpwent_r exists
11977 set endpwent_r d_endpwent_r
11978 eval $inlibc
11979 case "$d_endpwent_r" in
11980 "$define")
11981         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11982         case "$d_endpwent_r_proto:$usethreads" in
11983         ":define")      d_endpwent_r_proto=define
11984                 set d_endpwent_r_proto endpwent_r $hdrs
11985                 eval $hasproto ;;
11986         *)      ;;
11987         esac
11988         case "$d_endpwent_r_proto" in
11989         define)
11990         case "$endpwent_r_proto" in
11991         ''|0) try='int endpwent_r(FILE**);'
11992         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11993         esac
11994         case "$endpwent_r_proto" in
11995         ''|0) try='void endpwent_r(FILE**);'
11996         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11997         esac
11998         case "$endpwent_r_proto" in
11999         ''|0)   d_endpwent_r=undef
12000                 endpwent_r_proto=0
12001                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12002         * )     case "$endpwent_r_proto" in
12003                 REENTRANT_PROTO*) ;;
12004                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12005                 esac
12006                 echo "Prototype: $try" ;;
12007         esac
12008         ;;
12009         *)      case "$usethreads" in
12010                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12011                 esac
12012                 d_endpwent_r=undef
12013                 endpwent_r_proto=0
12014                 ;;
12015         esac
12016         ;;
12017 *)      endpwent_r_proto=0
12018         ;;
12019 esac
12020
12021 : see if endservent exists
12022 set endservent d_endsent
12023 eval $inlibc
12024
12025 : see if endservent_r exists
12026 set endservent_r d_endservent_r
12027 eval $inlibc
12028 case "$d_endservent_r" in
12029 "$define")
12030         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12031         case "$d_endservent_r_proto:$usethreads" in
12032         ":define")      d_endservent_r_proto=define
12033                 set d_endservent_r_proto endservent_r $hdrs
12034                 eval $hasproto ;;
12035         *)      ;;
12036         esac
12037         case "$d_endservent_r_proto" in
12038         define)
12039         case "$endservent_r_proto" in
12040         ''|0) try='int endservent_r(struct servent_data*);'
12041         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12042         esac
12043         case "$endservent_r_proto" in
12044         ''|0) try='void endservent_r(struct servent_data*);'
12045         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12046         esac
12047         case "$endservent_r_proto" in
12048         ''|0)   d_endservent_r=undef
12049                 endservent_r_proto=0
12050                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12051         * )     case "$endservent_r_proto" in
12052                 REENTRANT_PROTO*) ;;
12053                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12054                 esac
12055                 echo "Prototype: $try" ;;
12056         esac
12057         ;;
12058         *)      case "$usethreads" in
12059                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12060                 esac
12061                 d_endservent_r=undef
12062                 endservent_r_proto=0
12063                 ;;
12064         esac
12065         ;;
12066 *)      endservent_r_proto=0
12067         ;;
12068 esac
12069
12070 : Locate the flags for 'open()'
12071 echo " "
12072 $cat >try.c <<EOCP
12073 #include <sys/types.h>
12074 #ifdef I_FCNTL
12075 #include <fcntl.h>
12076 #endif
12077 #ifdef I_SYS_FILE
12078 #include <sys/file.h>
12079 #endif
12080 #$i_stdlib I_STDLIB
12081 #ifdef I_STDLIB
12082 #include <stdlib.h>
12083 #endif
12084 int main() {
12085         if(O_RDONLY);
12086 #ifdef O_TRUNC
12087         exit(0);
12088 #else
12089         exit(1);
12090 #endif
12091 }
12092 EOCP
12093 : check sys/file.h first to get FREAD on Sun
12094 if $test `./findhdr sys/file.h` && \
12095                 set try -DI_SYS_FILE && eval $compile; then
12096         h_sysfile=true;
12097         echo "<sys/file.h> defines the O_* constants..." >&4
12098         if $run ./try; then
12099                 echo "and you have the 3 argument form of open()." >&4
12100                 val="$define"
12101         else
12102                 echo "but not the 3 argument form of open().  Oh, well." >&4
12103                 val="$undef"
12104         fi
12105 elif $test `./findhdr fcntl.h` && \
12106                 set try -DI_FCNTL && eval $compile; then
12107         h_fcntl=true;
12108         echo "<fcntl.h> defines the O_* constants..." >&4
12109         if $run ./try; then
12110                 echo "and you have the 3 argument form of open()." >&4
12111                 val="$define"
12112         else
12113                 echo "but not the 3 argument form of open().  Oh, well." >&4
12114                 val="$undef"
12115         fi
12116 else
12117         val="$undef"
12118         echo "I can't find the O_* constant definitions!  You got problems." >&4
12119 fi
12120 set d_open3
12121 eval $setvar
12122 $rm_try
12123
12124 : see which of string.h or strings.h is needed
12125 echo " "
12126 strings=`./findhdr string.h`
12127 if $test "$strings" && $test -r "$strings"; then
12128         echo "Using <string.h> instead of <strings.h>." >&4
12129         val="$define"
12130 else
12131         val="$undef"
12132         strings=`./findhdr strings.h`
12133         if $test "$strings" && $test -r "$strings"; then
12134                 echo "Using <strings.h> instead of <string.h>." >&4
12135         else
12136                 echo "No string header found -- You'll surely have problems." >&4
12137         fi
12138 fi
12139 set i_string
12140 eval $setvar
12141 case "$i_string" in
12142 "$undef") strings=`./findhdr strings.h`;;
12143 *)        strings=`./findhdr string.h`;;
12144 esac
12145
12146 : see if this is a sys/file.h system
12147 val=''
12148 set sys/file.h val
12149 eval $inhdr
12150
12151 : do we need to include sys/file.h ?
12152 case "$val" in
12153 "$define")
12154         echo " "
12155         if $h_sysfile; then
12156                 val="$define"
12157                 echo "We'll be including <sys/file.h>." >&4
12158         else
12159                 val="$undef"
12160                 echo "We won't be including <sys/file.h>." >&4
12161         fi
12162         ;;
12163 *)
12164         h_sysfile=false
12165         ;;
12166 esac
12167 set i_sysfile
12168 eval $setvar
12169
12170 : see if fcntl.h is there
12171 val=''
12172 set fcntl.h val
12173 eval $inhdr
12174
12175 : see if we can include fcntl.h
12176 case "$val" in
12177 "$define")
12178         echo " "
12179         if $h_fcntl; then
12180                 val="$define"
12181                 echo "We'll be including <fcntl.h>." >&4
12182         else
12183                 val="$undef"
12184                 if $h_sysfile; then
12185         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12186                 else
12187                         echo "We won't be including <fcntl.h>." >&4
12188                 fi
12189         fi
12190         ;;
12191 *)
12192         h_fcntl=false
12193         val="$undef"
12194         ;;
12195 esac
12196 set i_fcntl
12197 eval $setvar
12198
12199 : see if fork exists
12200 set fork d_fork
12201 eval $inlibc
12202
12203 : see if pipe exists
12204 set pipe d_pipe
12205 eval $inlibc
12206
12207 : check for non-blocking I/O stuff
12208 case "$h_sysfile" in
12209 true) echo "#include <sys/file.h>" > head.c;;
12210 *)
12211        case "$h_fcntl" in
12212        true) echo "#include <fcntl.h>" > head.c;;
12213        *) echo "#include <sys/fcntl.h>" > head.c;;
12214        esac
12215        ;;
12216 esac
12217 echo " "
12218 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12219 case "$o_nonblock" in
12220 '')
12221         $cat head.c > try.c
12222         $cat >>try.c <<EOCP
12223 #include <stdio.h>
12224 #$i_stdlib I_STDLIB
12225 #ifdef I_STDLIB
12226 #include <stdlib.h>
12227 #endif
12228 #$i_fcntl I_FCNTL
12229 #ifdef I_FCNTL
12230 #include <fcntl.h>
12231 #endif
12232 int main() {
12233 #ifdef O_NONBLOCK
12234         printf("O_NONBLOCK\n");
12235         exit(0);
12236 #endif
12237 #ifdef O_NDELAY
12238         printf("O_NDELAY\n");
12239         exit(0);
12240 #endif
12241 #ifdef FNDELAY
12242         printf("FNDELAY\n");
12243         exit(0);
12244 #endif
12245         exit(0);
12246 }
12247 EOCP
12248         set try
12249         if eval $compile_ok; then
12250                 o_nonblock=`$run ./try`
12251                 case "$o_nonblock" in
12252                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12253                 *) echo "Seems like we can use $o_nonblock.";;
12254                 esac
12255         else
12256                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12257         fi
12258         ;;
12259 *) echo "Using $hint value $o_nonblock.";;
12260 esac
12261 $rm_try
12262
12263 echo " "
12264 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12265 case "$eagain" in
12266 '')
12267         case "$d_fork:$d_pipe" in
12268         define:define)
12269         $cat head.c > try.c
12270         $cat >>try.c <<EOCP
12271 #include <errno.h>
12272 #include <sys/types.h>
12273 #include <signal.h>
12274 #include <stdio.h>
12275 #$i_stdlib I_STDLIB
12276 #ifdef I_STDLIB
12277 #include <stdlib.h>
12278 #endif
12279 #$i_fcntl I_FCNTL
12280 #ifdef I_FCNTL
12281 #include <fcntl.h>
12282 #endif
12283 #define MY_O_NONBLOCK $o_nonblock
12284 #ifndef errno  /* XXX need better Configure test */
12285 extern int errno;
12286 #endif
12287 #$i_unistd I_UNISTD
12288 #ifdef I_UNISTD
12289 #include <unistd.h>
12290 #endif
12291 #$i_string I_STRING
12292 #ifdef I_STRING
12293 #include <string.h>
12294 #else
12295 #include <strings.h>
12296 #endif
12297 $signal_t blech(int x) { exit(3); }
12298 EOCP
12299         $cat >> try.c <<'EOCP'
12300 int main()
12301 {
12302         int pd[2];
12303         int pu[2];
12304         char buf[1];
12305         char string[100];
12306
12307         pipe(pd);       /* Down: child -> parent */
12308         pipe(pu);       /* Up: parent -> child */
12309         if (0 != fork()) {
12310                 int ret;
12311                 close(pd[1]);   /* Parent reads from pd[0] */
12312                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12313 #ifdef F_SETFL
12314                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12315                         exit(1);
12316 #else
12317                 exit(4);
12318 #endif
12319                 signal(SIGALRM, blech);
12320                 alarm(5);
12321                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12322                         exit(2);
12323                 sprintf(string, "%d\n", ret);
12324                 write(2, string, strlen(string));
12325                 alarm(0);
12326 #ifdef EAGAIN
12327                 if (errno == EAGAIN) {
12328                         printf("EAGAIN\n");
12329                         goto ok;
12330                 }
12331 #endif
12332 #ifdef EWOULDBLOCK
12333                 if (errno == EWOULDBLOCK)
12334                         printf("EWOULDBLOCK\n");
12335 #endif
12336         ok:
12337                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12338                 sleep(2);                               /* Give it time to close our pipe */
12339                 alarm(5);
12340                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12341                 alarm(0);
12342                 sprintf(string, "%d\n", ret);
12343                 write(4, string, strlen(string));
12344                 exit(0);
12345         }
12346
12347         close(pd[0]);                   /* We write to pd[1] */
12348         close(pu[1]);                   /* We read from pu[0] */
12349         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12350         close(pd[1]);                   /* Pipe pd is now fully closed! */
12351         exit(0);                                /* Bye bye, thank you for playing! */
12352 }
12353 EOCP
12354         set try
12355         if eval $compile_ok; then
12356                 echo "$startsh" >mtry
12357                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12358                 chmod +x mtry
12359                 ./mtry >/dev/null 2>&1
12360                 case $? in
12361                 0) eagain=`$cat try.out`;;
12362                 1) echo "Could not perform non-blocking setting!";;
12363                 2) echo "I did a successful read() for something that was not there!";;
12364                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12365                 4) echo "Could not find F_SETFL!";;
12366                 *) echo "Something terribly wrong happened during testing.";;
12367                 esac
12368                 rd_nodata=`$cat try.ret`
12369                 echo "A read() system call with no data present returns $rd_nodata."
12370                 case "$rd_nodata" in
12371                 0|-1) ;;
12372                 *)
12373                         echo "(That's peculiar, fixing that to be -1.)"
12374                         rd_nodata=-1
12375                         ;;
12376                 esac
12377                 case "$eagain" in
12378                 '')
12379                         echo "Forcing errno EAGAIN on read() with no data available."
12380                         eagain=EAGAIN
12381                         ;;
12382                 *)
12383                         echo "Your read() sets errno to $eagain when no data is available."
12384                         ;;
12385                 esac
12386                 status=`$cat try.err`
12387                 case "$status" in
12388                 0) echo "And it correctly returns 0 to signal EOF.";;
12389                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12390                 *) echo "However, your read() returns '$status' on EOF??";;
12391                 esac
12392                 val="$define"
12393                 if test "$status" = "$rd_nodata"; then
12394                         echo "WARNING: you can't distinguish between EOF and no data!"
12395                         val="$undef"
12396                 fi
12397         else
12398                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12399                 eagain=EAGAIN
12400         fi
12401         ;;
12402         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12403                 eagain=EAGAIN
12404                 val="$define"
12405                 ;;
12406         esac
12407         set d_eofnblk
12408         eval $setvar
12409         ;;
12410 *)
12411         echo "Using $hint value $eagain."
12412         echo "Your read() returns $rd_nodata when no data is present."
12413         case "$d_eofnblk" in
12414         "$define") echo "And you can see EOF because read() returns 0.";;
12415         "$undef") echo "But you can't see EOF status from read() returned value.";;
12416         *)
12417                 echo "(Assuming you can't see EOF status from read anyway.)"
12418                 d_eofnblk=$undef
12419                 ;;
12420         esac
12421         ;;
12422 esac
12423 $rm_try head.c mtry
12424
12425 : see if _ptr and _cnt from stdio act std
12426 echo " "
12427
12428 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12429         echo "(Looks like you have stdio.h from BSD.)"
12430         case "$stdio_ptr" in
12431         '') stdio_ptr='((fp)->_p)'
12432                 ptr_lval=$define
12433                 ;;
12434         *)      ptr_lval=$d_stdio_ptr_lval;;
12435         esac
12436         case "$stdio_cnt" in
12437         '') stdio_cnt='((fp)->_r)'
12438                 cnt_lval=$define
12439                 ;;
12440         *)      cnt_lval=$d_stdio_cnt_lval;;
12441         esac
12442         case "$stdio_base" in
12443         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12444         esac
12445         case "$stdio_bufsiz" in
12446         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12447         esac
12448 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12449         echo "(Looks like you have stdio.h from Linux.)"
12450         case "$stdio_ptr" in
12451         '') stdio_ptr='((fp)->_IO_read_ptr)'
12452                 ptr_lval=$define
12453                 ;;
12454         *)      ptr_lval=$d_stdio_ptr_lval;;
12455         esac
12456         case "$stdio_cnt" in
12457         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12458                 cnt_lval=$undef
12459                 ;;
12460         *)      cnt_lval=$d_stdio_cnt_lval;;
12461         esac
12462         case "$stdio_base" in
12463         '') stdio_base='((fp)->_IO_read_base)';;
12464         esac
12465         case "$stdio_bufsiz" in
12466         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12467         esac
12468 else
12469         case "$stdio_ptr" in
12470         '') stdio_ptr='((fp)->_ptr)'
12471                 ptr_lval=$define
12472                 ;;
12473         *)      ptr_lval=$d_stdio_ptr_lval;;
12474         esac
12475         case "$stdio_cnt" in
12476         '') stdio_cnt='((fp)->_cnt)'
12477                 cnt_lval=$define
12478                 ;;
12479         *)      cnt_lval=$d_stdio_cnt_lval;;
12480         esac
12481         case "$stdio_base" in
12482         '') stdio_base='((fp)->_base)';;
12483         esac
12484         case "$stdio_bufsiz" in
12485         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12486         esac
12487 fi
12488
12489 : test whether _ptr and _cnt really work
12490 echo "Checking how std your stdio is..." >&4
12491 $cat >try.c <<EOP
12492 #include <stdio.h>
12493 #$i_stdlib I_STDLIB
12494 #ifdef I_STDLIB
12495 #include <stdlib.h>
12496 #endif
12497 #define FILE_ptr(fp)    $stdio_ptr
12498 #define FILE_cnt(fp)    $stdio_cnt
12499 int main() {
12500         FILE *fp = fopen("try.c", "r");
12501         char c = getc(fp);
12502         if (
12503                 18 <= FILE_cnt(fp) &&
12504                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12505         )
12506                 exit(0);
12507         exit(1);
12508 }
12509 EOP
12510 val="$undef"
12511 set try
12512 if eval $compile && $to try.c; then
12513         if $run ./try; then
12514                 echo "Your stdio acts pretty std."
12515                 val="$define"
12516         else
12517                 echo "Your stdio isn't very std."
12518         fi
12519 else
12520         echo "Your stdio doesn't appear very std."
12521 fi
12522 $rm_try
12523
12524 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12525 # direct buffer manipulation no longer works.  The Configure tests
12526 # should be changed to correctly detect this, but until then,
12527 # the following check should at least let perl compile and run.
12528 # (This quick fix should be updated before 5.8.1.)
12529 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12530 # A. Dougherty, June 3, 2002.
12531 case "$d_gnulibc" in
12532 $define)
12533         case "$gnulibc_version" in
12534         2.[01]*)  ;;
12535         2.2) ;;
12536         2.2.[0-9]) ;;
12537         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12538                 val="$undef"
12539                 ;;
12540         esac
12541         ;;
12542 esac
12543 set d_stdstdio
12544 eval $setvar
12545
12546 : Can _ptr be used as an lvalue?
12547 case "$d_stdstdio$ptr_lval" in
12548 $define$define) val=$define ;;
12549 *) val=$undef ;;
12550 esac
12551 set d_stdio_ptr_lval
12552 eval $setvar
12553
12554 : Can _cnt be used as an lvalue?
12555 case "$d_stdstdio$cnt_lval" in
12556 $define$define) val=$define ;;
12557 *) val=$undef ;;
12558 esac
12559 set d_stdio_cnt_lval
12560 eval $setvar
12561
12562
12563 : test whether setting _ptr sets _cnt as a side effect
12564 d_stdio_ptr_lval_sets_cnt="$undef"
12565 d_stdio_ptr_lval_nochange_cnt="$undef"
12566 case "$d_stdio_ptr_lval$d_stdstdio" in
12567 $define$define)
12568         echo "Checking to see what happens if we set the stdio ptr..." >&4
12569 $cat >try.c <<EOP
12570 #include <stdio.h>
12571 /* Can we scream? */
12572 /* Eat dust sed :-) */
12573 /* In the buffer space, no one can hear you scream. */
12574 #$i_stdlib I_STDLIB
12575 #ifdef I_STDLIB
12576 #include <stdlib.h>
12577 #endif
12578 #define FILE_ptr(fp)    $stdio_ptr
12579 #define FILE_cnt(fp)    $stdio_cnt
12580 #include <sys/types.h>
12581 int main() {
12582         FILE *fp = fopen("try.c", "r");
12583         int c;
12584         char *ptr;
12585         size_t cnt;
12586         if (!fp) {
12587             puts("Fail even to read");
12588             exit(1);
12589         }
12590         c = getc(fp); /* Read away the first # */
12591         if (c == EOF) {
12592             puts("Fail even to read");
12593             exit(1);
12594         }
12595         if (!(
12596                 18 <= FILE_cnt(fp) &&
12597                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12598         )) {
12599                 puts("Fail even to read");
12600                 exit (1);
12601         }
12602         ptr = (char*) FILE_ptr(fp);
12603         cnt = (size_t)FILE_cnt(fp);
12604
12605         FILE_ptr(fp) += 42;
12606
12607         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12608                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12609                 exit (1);
12610         }
12611         if (FILE_cnt(fp) <= 20) {
12612                 printf ("Fail (<20 chars to test)");
12613                 exit (1);
12614         }
12615         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12616                 puts("Fail compare");
12617                 exit (1);
12618         }
12619         if (cnt == FILE_cnt(fp)) {
12620                 puts("Pass_unchanged");
12621                 exit (0);
12622         }
12623         if (FILE_cnt(fp) == (cnt - 42)) {
12624                 puts("Pass_changed");
12625                 exit (0);
12626         }
12627         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12628         return 1;
12629
12630 }
12631 EOP
12632         set try
12633         if eval $compile && $to try.c; then
12634                 case `$run ./try` in
12635                 Pass_changed)
12636                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12637                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12638                 Pass_unchanged)
12639                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12640                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12641                 Fail*)
12642                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12643                 *)
12644                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12645         esac
12646         else
12647                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12648         fi
12649         $rm_try
12650         ;;
12651 esac
12652
12653 : see if _base is also standard
12654 val="$undef"
12655 case "$d_stdstdio" in
12656 $define)
12657         $cat >try.c <<EOP
12658 #include <stdio.h>
12659 #$i_stdlib I_STDLIB
12660 #ifdef I_STDLIB
12661 #include <stdlib.h>
12662 #endif
12663 #define FILE_base(fp)   $stdio_base
12664 #define FILE_bufsiz(fp) $stdio_bufsiz
12665 int main() {
12666         FILE *fp = fopen("try.c", "r");
12667         char c = getc(fp);
12668         if (
12669                 19 <= FILE_bufsiz(fp) &&
12670                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12671         )
12672                 exit(0);
12673         exit(1);
12674 }
12675 EOP
12676         set try
12677         if eval $compile && $to try.c; then
12678                 if $run ./try; then
12679                         echo "And its _base field acts std."
12680                         val="$define"
12681                 else
12682                         echo "But its _base field isn't std."
12683                 fi
12684         else
12685                 echo "However, it seems to be lacking the _base field."
12686         fi
12687         $rm_try
12688         ;;
12689 esac
12690 set d_stdiobase
12691 eval $setvar
12692
12693 : see if fast_stdio exists
12694 val="$undef"
12695 case "$d_stdstdio:$d_stdio_ptr_lval" in
12696 "$define:$define")
12697         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12698         *$define*)
12699                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12700                 val="$define"
12701                 ;;
12702         esac
12703         ;;
12704 esac
12705 set d_faststdio
12706 eval $setvar
12707
12708
12709
12710 : see if fchdir exists
12711 set fchdir d_fchdir
12712 eval $inlibc
12713
12714 : see if fchmod exists
12715 set fchmod d_fchmod
12716 eval $inlibc
12717
12718 : see if fchown exists
12719 set fchown d_fchown
12720 eval $inlibc
12721
12722 : see if this is an fcntl system
12723 set fcntl d_fcntl
12724 eval $inlibc
12725
12726 echo " "
12727 : See if fcntl-based locking works.
12728 $cat >try.c <<EOCP
12729 #$i_stdlib I_STDLIB
12730 #ifdef I_STDLIB
12731 #include <stdlib.h>
12732 #endif
12733 #include <unistd.h>
12734 #include <fcntl.h>
12735 #include <signal.h>
12736 $signal_t blech(int x) { exit(3); }
12737 int main() {
12738 #if defined(F_SETLK) && defined(F_SETLKW)
12739      struct flock flock;
12740      int retval, fd;
12741      fd = open("try.c", O_RDONLY);
12742      flock.l_type = F_RDLCK;
12743      flock.l_whence = SEEK_SET;
12744      flock.l_start = flock.l_len = 0;
12745      signal(SIGALRM, blech);
12746      alarm(10);
12747      retval = fcntl(fd, F_SETLK, &flock);
12748      close(fd);
12749      (retval < 0 ? exit(2) : exit(0));
12750 #else
12751      exit(2);
12752 #endif
12753 }
12754 EOCP
12755 echo "Checking if fcntl-based file locking works... "
12756 case "$d_fcntl" in
12757 "$define")
12758         set try
12759         if eval $compile_ok; then
12760                 if $run ./try; then
12761                         echo "Yes, it seems to work."
12762                         val="$define"
12763                 else
12764                         echo "Nope, it didn't work."
12765                         val="$undef"
12766                         case "$?" in
12767                         3) $cat >&4 <<EOM
12768 ***
12769 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12770 *** This is (almost) impossible.
12771 *** If your NFS lock daemons are not feeling well, something like
12772 *** this may happen, please investigate.  Cannot continue, aborting.
12773 ***
12774 EOM
12775                                 exit 1
12776                                 ;;
12777                         esac
12778                 fi
12779         else
12780                 echo "I'm unable to compile the test program, so I'll assume not."
12781                 val="$undef"
12782         fi
12783         ;;
12784 *) val="$undef";
12785         echo "Nope, since you don't even have fcntl()."
12786         ;;
12787 esac
12788 set d_fcntl_can_lock
12789 eval $setvar
12790 $rm_try
12791
12792 : check for fd_set items
12793 $cat <<EOM
12794
12795 Checking to see how well your C compiler handles fd_set and friends ...
12796 EOM
12797 $cat >try.c <<EOCP
12798 #$i_stdlib I_STDLIB
12799 #ifdef I_STDLIB
12800 #include <stdlib.h>
12801 #endif
12802 #$i_systime I_SYS_TIME
12803 #$i_sysselct I_SYS_SELECT
12804 #$d_socket HAS_SOCKET
12805 #include <sys/types.h>
12806 #ifdef HAS_SOCKET
12807 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12808 #endif
12809 #ifdef I_SYS_TIME
12810 #include <sys/time.h>
12811 #endif
12812 #ifdef I_SYS_SELECT
12813 #include <sys/select.h>
12814 #endif
12815 int main() {
12816         fd_set fds;
12817
12818 #ifdef TRYBITS
12819         if(fds.fds_bits);
12820 #endif
12821
12822 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12823         exit(0);
12824 #else
12825         exit(1);
12826 #endif
12827 }
12828 EOCP
12829 set try -DTRYBITS
12830 if eval $compile; then
12831         d_fds_bits="$define"
12832         d_fd_set="$define"
12833         echo "Well, your system knows about the normal fd_set typedef..." >&4
12834         if $run ./try; then
12835                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12836                 d_fd_macros="$define"
12837         else
12838                 $cat >&4 <<'EOM'
12839 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12840 EOM
12841                 d_fd_macros="$undef"
12842         fi
12843 else
12844         $cat <<'EOM'
12845 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12846 EOM
12847         set try
12848         if eval $compile; then
12849                 d_fds_bits="$undef"
12850                 d_fd_set="$define"
12851                 echo "Well, your system has some sort of fd_set available..." >&4
12852                 if $run ./try; then
12853                         echo "and you have the normal fd_set macros." >&4
12854                         d_fd_macros="$define"
12855                 else
12856                         $cat <<'EOM'
12857 but not the normal fd_set macros!  Gross!  More work for me...
12858 EOM
12859                         d_fd_macros="$undef"
12860                 fi
12861         else
12862         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12863                 d_fd_set="$undef"
12864                 d_fds_bits="$undef"
12865                 d_fd_macros="$undef"
12866         fi
12867 fi
12868 $rm_try
12869
12870 : see if fgetpos exists
12871 set fgetpos d_fgetpos
12872 eval $inlibc
12873
12874 : see if finite exists
12875 set finite d_finite
12876 eval $inlibc
12877
12878 : see if finitel exists
12879 set finitel d_finitel
12880 eval $inlibc
12881
12882 : see if flock exists
12883 set flock d_flock
12884 eval $inlibc
12885
12886 : see if prototype for flock is available
12887 echo " "
12888 set d_flockproto flock $i_sysfile sys/file.h
12889 eval $hasproto
12890
12891 : see if fp_class exists
12892 set fp_class d_fp_class
12893 eval $inlibc
12894
12895 : see if pathconf exists
12896 set pathconf d_pathconf
12897 eval $inlibc
12898
12899 : see if fpathconf exists
12900 set fpathconf d_fpathconf
12901 eval $inlibc
12902
12903 : see if fpclass exists
12904 set fpclass d_fpclass
12905 eval $inlibc
12906
12907 : see if fpclassify exists
12908 set fpclassify d_fpclassify
12909 eval $inlibc
12910
12911 : see if fpclassl exists
12912 set fpclassl d_fpclassl
12913 eval $inlibc
12914
12915
12916 : check for fpos64_t
12917 echo " "
12918 echo "Checking to see if you have fpos64_t..." >&4
12919 $cat >try.c <<EOCP
12920 #include <stdio.h>
12921 int main() { fpos64_t x = 7; }
12922 EOCP
12923 set try
12924 if eval $compile; then
12925         val="$define"
12926         echo "You have fpos64_t."
12927 else
12928         val="$undef"
12929         echo "You do not have fpos64_t."
12930         case "$fpossize" in
12931         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12932         esac
12933 fi
12934 $rm_try
12935 set d_fpos64_t
12936 eval $setvar
12937
12938 : see if frexpl exists
12939 set frexpl d_frexpl
12940 eval $inlibc
12941
12942 : see if this is a sys/param system
12943 set sys/param.h i_sysparam
12944 eval $inhdr
12945
12946 : see if this is a sys/mount.h system
12947 set sys/mount.h i_sysmount
12948 eval $inhdr
12949
12950
12951 echo " "
12952 echo "Checking to see if your system supports struct fs_data..." >&4
12953 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12954 eval $hasstruct
12955 case "$d_fs_data_s" in
12956 "$define")      echo "Yes, it does."   ;;
12957 *)              echo "No, it doesn't." ;;
12958 esac
12959
12960 : see if fseeko exists
12961 set fseeko d_fseeko
12962 eval $inlibc
12963 case "$longsize" in
12964 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12965 esac
12966
12967 : see if fsetpos exists
12968 set fsetpos d_fsetpos
12969 eval $inlibc
12970
12971
12972 : see if fstatfs exists
12973 set fstatfs d_fstatfs
12974 eval $inlibc
12975
12976
12977 : see if statvfs exists
12978 set statvfs d_statvfs
12979 eval $inlibc
12980
12981 : see if fstatvfs exists
12982 set fstatvfs d_fstatvfs
12983 eval $inlibc
12984
12985
12986 : see if fsync exists
12987 set fsync d_fsync
12988 eval $inlibc
12989
12990 : see if ftello exists
12991 set ftello d_ftello
12992 eval $inlibc
12993 case "$longsize" in
12994 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12995 esac
12996
12997 d_futimes="$undef"
12998 : check for a working futimes
12999 echo " "
13000 echo "Checking if you have a working futimes()" >&4
13001 $cat >try.c <<EOCP
13002 #include <stdio.h>
13003 #include <sys/time.h>
13004 #include <errno.h>
13005 #include <fcntl.h>
13006
13007 int main ()
13008 {
13009     int fd, rv;
13010     fd = open ("try.c", O_RDWR);
13011     if (-1 == fd) exit (1);
13012     rv = futimes (fd, NULL);
13013     exit (rv == -1 ? errno : 0);
13014 }
13015 EOCP
13016 set try
13017 if eval $compile; then
13018     `$run ./try`
13019     rc=$?
13020     case "$rc" in
13021         0)  echo "Yes, you have" >&4
13022             d_futimes="$define"
13023             ;;
13024         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13025             ;;
13026     esac
13027 else
13028     echo "No, it does not (probably harmless)" >&4
13029 fi
13030 $rm_try
13031
13032 : see if getcwd exists
13033 set getcwd d_getcwd
13034 eval $inlibc
13035
13036 : see if getespwnam exists
13037 set getespwnam d_getespwnam
13038 eval $inlibc
13039
13040
13041 : see if getfsstat exists
13042 set getfsstat d_getfsstat
13043 eval $inlibc
13044
13045 : see if getgrent exists
13046 set getgrent d_getgrent
13047 eval $inlibc
13048
13049 : see if getgrent_r exists
13050 set getgrent_r d_getgrent_r
13051 eval $inlibc
13052 case "$d_getgrent_r" in
13053 "$define")
13054         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13055         case "$d_getgrent_r_proto:$usethreads" in
13056         ":define")      d_getgrent_r_proto=define
13057                 set d_getgrent_r_proto getgrent_r $hdrs
13058                 eval $hasproto ;;
13059         *)      ;;
13060         esac
13061         case "$d_getgrent_r_proto" in
13062         define)
13063         case "$getgrent_r_proto" in
13064         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13065         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13066         esac
13067         case "$getgrent_r_proto" in
13068         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13069         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13070         esac
13071         case "$getgrent_r_proto" in
13072         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13073         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13074         esac
13075         case "$getgrent_r_proto" in
13076         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13077         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13078         esac
13079         case "$getgrent_r_proto" in
13080         ''|0) try='int getgrent_r(struct group*, char*, int);'
13081         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13082         esac
13083         case "$getgrent_r_proto" in
13084         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13085         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13086         esac
13087         case "$getgrent_r_proto" in
13088         ''|0)   d_getgrent_r=undef
13089                 getgrent_r_proto=0
13090                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13091         * )     case "$getgrent_r_proto" in
13092                 REENTRANT_PROTO*) ;;
13093                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13094                 esac
13095                 echo "Prototype: $try" ;;
13096         esac
13097         ;;
13098         *)      case "$usethreads" in
13099                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13100                 esac
13101                 d_getgrent_r=undef
13102                 getgrent_r_proto=0
13103                 ;;
13104         esac
13105         ;;
13106 *)      getgrent_r_proto=0
13107         ;;
13108 esac
13109
13110 : see if getgrgid_r exists
13111 set getgrgid_r d_getgrgid_r
13112 eval $inlibc
13113 case "$d_getgrgid_r" in
13114 "$define")
13115         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13116         case "$d_getgrgid_r_proto:$usethreads" in
13117         ":define")      d_getgrgid_r_proto=define
13118                 set d_getgrgid_r_proto getgrgid_r $hdrs
13119                 eval $hasproto ;;
13120         *)      ;;
13121         esac
13122         case "$d_getgrgid_r_proto" in
13123         define)
13124         case "$getgrgid_r_proto" in
13125         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13126         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13127         esac
13128         case "$getgrgid_r_proto" in
13129         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13130         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13131         esac
13132         case "$getgrgid_r_proto" in
13133         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13134         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13135         esac
13136         case "$getgrgid_r_proto" in
13137         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13138         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13139         esac
13140         case "$getgrgid_r_proto" in
13141         ''|0)   d_getgrgid_r=undef
13142                 getgrgid_r_proto=0
13143                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13144         * )     case "$getgrgid_r_proto" in
13145                 REENTRANT_PROTO*) ;;
13146                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13147                 esac
13148                 echo "Prototype: $try" ;;
13149         esac
13150         ;;
13151         *)      case "$usethreads" in
13152                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13153                 esac
13154                 d_getgrgid_r=undef
13155                 getgrgid_r_proto=0
13156                 ;;
13157         esac
13158         ;;
13159 *)      getgrgid_r_proto=0
13160         ;;
13161 esac
13162
13163 : see if getgrnam_r exists
13164 set getgrnam_r d_getgrnam_r
13165 eval $inlibc
13166 case "$d_getgrnam_r" in
13167 "$define")
13168         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13169         case "$d_getgrnam_r_proto:$usethreads" in
13170         ":define")      d_getgrnam_r_proto=define
13171                 set d_getgrnam_r_proto getgrnam_r $hdrs
13172                 eval $hasproto ;;
13173         *)      ;;
13174         esac
13175         case "$d_getgrnam_r_proto" in
13176         define)
13177         case "$getgrnam_r_proto" in
13178         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13179         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13180         esac
13181         case "$getgrnam_r_proto" in
13182         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13183         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13184         esac
13185         case "$getgrnam_r_proto" in
13186         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13187         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13188         esac
13189         case "$getgrnam_r_proto" in
13190         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13191         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13192         esac
13193         case "$getgrnam_r_proto" in
13194         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13195         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13196         esac
13197         case "$getgrnam_r_proto" in
13198         ''|0)   d_getgrnam_r=undef
13199                 getgrnam_r_proto=0
13200                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13201         * )     case "$getgrnam_r_proto" in
13202                 REENTRANT_PROTO*) ;;
13203                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13204                 esac
13205                 echo "Prototype: $try" ;;
13206         esac
13207         ;;
13208         *)      case "$usethreads" in
13209                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13210                 esac
13211                 d_getgrnam_r=undef
13212                 getgrnam_r_proto=0
13213                 ;;
13214         esac
13215         ;;
13216 *)      getgrnam_r_proto=0
13217         ;;
13218 esac
13219
13220 : see if gethostbyaddr exists
13221 set gethostbyaddr d_gethbyaddr
13222 eval $inlibc
13223
13224 : see if gethostbyname exists
13225 set gethostbyname d_gethbyname
13226 eval $inlibc
13227
13228 : see if gethostent exists
13229 set gethostent d_gethent
13230 eval $inlibc
13231
13232 : see how we will look up host name
13233 echo " "
13234 call=''
13235 if set gethostname val -f d_gethname; eval $csym; $val; then
13236         echo 'gethostname() found.' >&4
13237         d_gethname="$define"
13238         call=gethostname
13239 fi
13240 if set uname val -f d_uname; eval $csym; $val; then
13241         if ./xenix; then
13242                 $cat <<'EOM'
13243 uname() was found, but you're running xenix, and older versions of xenix
13244 have a broken uname(). If you don't really know whether your xenix is old
13245 enough to have a broken system call, use the default answer.
13246
13247 EOM
13248                 dflt=y
13249                 case "$d_uname" in
13250                 "$define") dflt=n;;
13251                 esac
13252                 rp='Is your uname() broken?'
13253                 . ./myread
13254                 case "$ans" in
13255                 n*) d_uname="$define"; call=uname;;
13256                 esac
13257         else
13258                 echo 'uname() found.' >&4
13259                 d_uname="$define"
13260                 case "$call" in
13261                 '') call=uname ;;
13262                 esac
13263         fi
13264 fi
13265 case "$d_gethname" in
13266 '') d_gethname="$undef";;
13267 esac
13268 case "$d_uname" in
13269 '') d_uname="$undef";;
13270 esac
13271 case "$d_uname$d_gethname" in
13272 *define*)
13273         dflt=n
13274         cat <<EOM
13275  
13276 Every now and then someone has a $call() that lies about the hostname
13277 but can't be fixed for political or economic reasons.  If you wish, I can
13278 pretend $call() isn't there and maybe compute hostname at run-time
13279 thanks to the '$phostname' command.
13280
13281 EOM
13282         rp="Shall I ignore $call() from now on?"
13283         . ./myread
13284         case "$ans" in
13285         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13286         esac;;
13287 esac
13288 case "$phostname" in
13289 '') aphostname='';;
13290 *) case "$aphostname" in
13291         /*) ;;
13292         *) set X $phostname
13293                 shift
13294                 file=$1
13295                 shift
13296                 file=`./loc $file $file $pth`
13297                 aphostname=`echo $file $*`
13298                 ;;
13299         esac
13300         ;;
13301 esac
13302 case "$d_uname$d_gethname" in
13303 *define*) ;;
13304 *)
13305         case "$phostname" in
13306         '')
13307                 echo "There will be no way for $package to get your hostname." >&4;;
13308         *)
13309         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13310                 ;;
13311         esac;;
13312 esac
13313 case "$d_phostname" in
13314 '') d_phostname="$undef";;
13315 esac
13316
13317 : see if gethostbyaddr_r exists
13318 set gethostbyaddr_r d_gethostbyaddr_r
13319 eval $inlibc
13320 case "$d_gethostbyaddr_r" in
13321 "$define")
13322         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13323         case "$d_gethostbyaddr_r_proto:$usethreads" in
13324         ":define")      d_gethostbyaddr_r_proto=define
13325                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13326                 eval $hasproto ;;
13327         *)      ;;
13328         esac
13329         case "$d_gethostbyaddr_r_proto" in
13330         define)
13331         case "$gethostbyaddr_r_proto" in
13332         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13333         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13334         esac
13335         case "$gethostbyaddr_r_proto" in
13336         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13337         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13338         esac
13339         case "$gethostbyaddr_r_proto" in
13340         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13341         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13342         esac
13343         case "$gethostbyaddr_r_proto" in
13344         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13345         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13346         esac
13347         case "$gethostbyaddr_r_proto" in
13348         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13349         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13350         esac
13351         case "$gethostbyaddr_r_proto" in
13352         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13353         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13354         esac
13355         case "$gethostbyaddr_r_proto" in
13356         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13357         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13358         esac
13359         case "$gethostbyaddr_r_proto" in
13360         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13361         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13362         esac
13363         case "$gethostbyaddr_r_proto" in
13364         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13365         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13366         esac
13367         case "$gethostbyaddr_r_proto" in
13368         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13369         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13370         esac
13371         case "$gethostbyaddr_r_proto" in
13372         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13373         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13374         esac
13375         case "$gethostbyaddr_r_proto" in
13376         ''|0)   d_gethostbyaddr_r=undef
13377                 gethostbyaddr_r_proto=0
13378                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13379         * )     case "$gethostbyaddr_r_proto" in
13380                 REENTRANT_PROTO*) ;;
13381                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13382                 esac
13383                 echo "Prototype: $try" ;;
13384         esac
13385         ;;
13386         *)      case "$usethreads" in
13387                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13388                 esac
13389                 d_gethostbyaddr_r=undef
13390                 gethostbyaddr_r_proto=0
13391                 ;;
13392         esac
13393         ;;
13394 *)      gethostbyaddr_r_proto=0
13395         ;;
13396 esac
13397
13398 : see if gethostbyname_r exists
13399 set gethostbyname_r d_gethostbyname_r
13400 eval $inlibc
13401 case "$d_gethostbyname_r" in
13402 "$define")
13403         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13404         case "$d_gethostbyname_r_proto:$usethreads" in
13405         ":define")      d_gethostbyname_r_proto=define
13406                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13407                 eval $hasproto ;;
13408         *)      ;;
13409         esac
13410         case "$d_gethostbyname_r_proto" in
13411         define)
13412         case "$gethostbyname_r_proto" in
13413         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13414         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13415         esac
13416         case "$gethostbyname_r_proto" in
13417         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13418         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13419         esac
13420         case "$gethostbyname_r_proto" in
13421         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13422         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13423         esac
13424         case "$gethostbyname_r_proto" in
13425         ''|0)   d_gethostbyname_r=undef
13426                 gethostbyname_r_proto=0
13427                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13428         * )     case "$gethostbyname_r_proto" in
13429                 REENTRANT_PROTO*) ;;
13430                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13431                 esac
13432                 echo "Prototype: $try" ;;
13433         esac
13434         ;;
13435         *)      case "$usethreads" in
13436                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13437                 esac
13438                 d_gethostbyname_r=undef
13439                 gethostbyname_r_proto=0
13440                 ;;
13441         esac
13442         ;;
13443 *)      gethostbyname_r_proto=0
13444         ;;
13445 esac
13446
13447 : see if gethostent_r exists
13448 set gethostent_r d_gethostent_r
13449 eval $inlibc
13450 case "$d_gethostent_r" in
13451 "$define")
13452         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13453         case "$d_gethostent_r_proto:$usethreads" in
13454         ":define")      d_gethostent_r_proto=define
13455                 set d_gethostent_r_proto gethostent_r $hdrs
13456                 eval $hasproto ;;
13457         *)      ;;
13458         esac
13459         case "$d_gethostent_r_proto" in
13460         define)
13461         case "$gethostent_r_proto" in
13462         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13463         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13464         esac
13465         case "$gethostent_r_proto" in
13466         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13467         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13468         esac
13469         case "$gethostent_r_proto" in
13470         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13471         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13472         esac
13473         case "$gethostent_r_proto" in
13474         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13475         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13476         esac
13477         case "$gethostent_r_proto" in
13478         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13479         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13480         esac
13481         case "$gethostent_r_proto" in
13482         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13483         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13484         esac
13485         case "$gethostent_r_proto" in
13486         ''|0)   d_gethostent_r=undef
13487                 gethostent_r_proto=0
13488                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13489         * )     case "$gethostent_r_proto" in
13490                 REENTRANT_PROTO*) ;;
13491                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13492                 esac
13493                 echo "Prototype: $try" ;;
13494         esac
13495         ;;
13496         *)      case "$usethreads" in
13497                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13498                 esac
13499                 d_gethostent_r=undef
13500                 gethostent_r_proto=0
13501                 ;;
13502         esac
13503         ;;
13504 *)      gethostent_r_proto=0
13505         ;;
13506 esac
13507
13508 : see if prototypes for various gethostxxx netdb.h functions are available
13509 echo " "
13510 set d_gethostprotos gethostent $i_netdb netdb.h
13511 eval $hasproto
13512
13513 : see if getitimer exists
13514 set getitimer d_getitimer
13515 eval $inlibc
13516
13517 : see if getlogin exists
13518 set getlogin d_getlogin
13519 eval $inlibc
13520
13521 : see if getlogin_r exists
13522 set getlogin_r d_getlogin_r
13523 eval $inlibc
13524 case "$d_getlogin_r" in
13525 "$define")
13526         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13527         case "$d_getlogin_r_proto:$usethreads" in
13528         ":define")      d_getlogin_r_proto=define
13529                 set d_getlogin_r_proto getlogin_r $hdrs
13530                 eval $hasproto ;;
13531         *)      ;;
13532         esac
13533         case "$d_getlogin_r_proto" in
13534         define)
13535         case "$getlogin_r_proto" in
13536         ''|0) try='int getlogin_r(char*, size_t);'
13537         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13538         esac
13539         case "$getlogin_r_proto" in
13540         ''|0) try='int getlogin_r(char*, int);'
13541         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13542         esac
13543         case "$getlogin_r_proto" in
13544         ''|0) try='char* getlogin_r(char*, size_t);'
13545         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13546         esac
13547         case "$getlogin_r_proto" in
13548         ''|0) try='char* getlogin_r(char*, int);'
13549         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13550         esac
13551         case "$getlogin_r_proto" in
13552         ''|0)   d_getlogin_r=undef
13553                 getlogin_r_proto=0
13554                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13555         * )     case "$getlogin_r_proto" in
13556                 REENTRANT_PROTO*) ;;
13557                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13558                 esac
13559                 echo "Prototype: $try" ;;
13560         esac
13561         ;;
13562         *)      case "$usethreads" in
13563                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13564                 esac
13565                 d_getlogin_r=undef
13566                 getlogin_r_proto=0
13567                 ;;
13568         esac
13569         ;;
13570 *)      getlogin_r_proto=0
13571         ;;
13572 esac
13573
13574 : see if getmnt exists
13575 set getmnt d_getmnt
13576 eval $inlibc
13577
13578 : see if getmntent exists
13579 set getmntent d_getmntent
13580 eval $inlibc
13581
13582 : see if getnetbyaddr exists
13583 set getnetbyaddr d_getnbyaddr
13584 eval $inlibc
13585
13586 : see if getnetbyname exists
13587 set getnetbyname d_getnbyname
13588 eval $inlibc
13589
13590 : see if getnetent exists
13591 set getnetent d_getnent
13592 eval $inlibc
13593
13594 : see if getnetbyaddr_r exists
13595 set getnetbyaddr_r d_getnetbyaddr_r
13596 eval $inlibc
13597 case "$d_getnetbyaddr_r" in
13598 "$define")
13599         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13600         case "$d_getnetbyaddr_r_proto:$usethreads" in
13601         ":define")      d_getnetbyaddr_r_proto=define
13602                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13603                 eval $hasproto ;;
13604         *)      ;;
13605         esac
13606         case "$d_getnetbyaddr_r_proto" in
13607         define)
13608         case "$getnetbyaddr_r_proto" in
13609         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13610         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13611         esac
13612         case "$getnetbyaddr_r_proto" in
13613         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13614         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13615         esac
13616         case "$getnetbyaddr_r_proto" in
13617         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13618         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13619         esac
13620         case "$getnetbyaddr_r_proto" in
13621         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13622         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13623         esac
13624         case "$getnetbyaddr_r_proto" in
13625         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13626         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13627         esac
13628         case "$getnetbyaddr_r_proto" in
13629         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13630         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13631         esac
13632         case "$getnetbyaddr_r_proto" in
13633         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13634         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13635         esac
13636         case "$getnetbyaddr_r_proto" in
13637         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13638         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13639         esac
13640         case "$getnetbyaddr_r_proto" in
13641         ''|0)   d_getnetbyaddr_r=undef
13642                 getnetbyaddr_r_proto=0
13643                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13644         * )     case "$getnetbyaddr_r_proto" in
13645                 REENTRANT_PROTO*) ;;
13646                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13647                 esac
13648                 echo "Prototype: $try" ;;
13649         esac
13650         ;;
13651         *)      case "$usethreads" in
13652                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13653                 esac
13654                 d_getnetbyaddr_r=undef
13655                 getnetbyaddr_r_proto=0
13656                 ;;
13657         esac
13658         ;;
13659 *)      getnetbyaddr_r_proto=0
13660         ;;
13661 esac
13662
13663 : see if getnetbyname_r exists
13664 set getnetbyname_r d_getnetbyname_r
13665 eval $inlibc
13666 case "$d_getnetbyname_r" in
13667 "$define")
13668         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13669         case "$d_getnetbyname_r_proto:$usethreads" in
13670         ":define")      d_getnetbyname_r_proto=define
13671                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13672                 eval $hasproto ;;
13673         *)      ;;
13674         esac
13675         case "$d_getnetbyname_r_proto" in
13676         define)
13677         case "$getnetbyname_r_proto" in
13678         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13679         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13680         esac
13681         case "$getnetbyname_r_proto" in
13682         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13683         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13684         esac
13685         case "$getnetbyname_r_proto" in
13686         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13687         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13688         esac
13689         case "$getnetbyname_r_proto" in
13690         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13691         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13692         esac
13693         case "$getnetbyname_r_proto" in
13694         ''|0)   d_getnetbyname_r=undef
13695                 getnetbyname_r_proto=0
13696                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13697         * )     case "$getnetbyname_r_proto" in
13698                 REENTRANT_PROTO*) ;;
13699                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13700                 esac
13701                 echo "Prototype: $try" ;;
13702         esac
13703         ;;
13704         *)      case "$usethreads" in
13705                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13706                 esac
13707                 d_getnetbyname_r=undef
13708                 getnetbyname_r_proto=0
13709                 ;;
13710         esac
13711         ;;
13712 *)      getnetbyname_r_proto=0
13713         ;;
13714 esac
13715
13716 : see if getnetent_r exists
13717 set getnetent_r d_getnetent_r
13718 eval $inlibc
13719 case "$d_getnetent_r" in
13720 "$define")
13721         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13722         case "$d_getnetent_r_proto:$usethreads" in
13723         ":define")      d_getnetent_r_proto=define
13724                 set d_getnetent_r_proto getnetent_r $hdrs
13725                 eval $hasproto ;;
13726         *)      ;;
13727         esac
13728         case "$d_getnetent_r_proto" in
13729         define)
13730         case "$getnetent_r_proto" in
13731         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13732         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13733         esac
13734         case "$getnetent_r_proto" in
13735         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13736         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13737         esac
13738         case "$getnetent_r_proto" in
13739         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13740         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13741         esac
13742         case "$getnetent_r_proto" in
13743         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13744         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13745         esac
13746         case "$getnetent_r_proto" in
13747         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13748         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13749         esac
13750         case "$getnetent_r_proto" in
13751         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13752         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13753         esac
13754         case "$getnetent_r_proto" in
13755         ''|0)   d_getnetent_r=undef
13756                 getnetent_r_proto=0
13757                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13758         * )     case "$getnetent_r_proto" in
13759                 REENTRANT_PROTO*) ;;
13760                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13761                 esac
13762                 echo "Prototype: $try" ;;
13763         esac
13764         ;;
13765         *)      case "$usethreads" in
13766                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13767                 esac
13768                 d_getnetent_r=undef
13769                 getnetent_r_proto=0
13770                 ;;
13771         esac
13772         ;;
13773 *)      getnetent_r_proto=0
13774         ;;
13775 esac
13776
13777 : see if prototypes for various getnetxxx netdb.h functions are available
13778 echo " "
13779 set d_getnetprotos getnetent $i_netdb netdb.h
13780 eval $hasproto
13781
13782 : see if getpagesize exists
13783 set getpagesize d_getpagsz
13784 eval $inlibc
13785
13786
13787 : see if getprotobyname exists
13788 set getprotobyname d_getpbyname
13789 eval $inlibc
13790
13791 : see if getprotobynumber exists
13792 set getprotobynumber d_getpbynumber
13793 eval $inlibc
13794
13795 : see if getprotoent exists
13796 set getprotoent d_getpent
13797 eval $inlibc
13798
13799 : see if getpgid exists
13800 set getpgid d_getpgid
13801 eval $inlibc
13802
13803 : see if getpgrp2 exists
13804 set getpgrp2 d_getpgrp2
13805 eval $inlibc
13806
13807 : see if getppid exists
13808 set getppid d_getppid
13809 eval $inlibc
13810
13811 : see if getpriority exists
13812 set getpriority d_getprior
13813 eval $inlibc
13814
13815 : see if getprotobyname_r exists
13816 set getprotobyname_r d_getprotobyname_r
13817 eval $inlibc
13818 case "$d_getprotobyname_r" in
13819 "$define")
13820         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13821         case "$d_getprotobyname_r_proto:$usethreads" in
13822         ":define")      d_getprotobyname_r_proto=define
13823                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13824                 eval $hasproto ;;
13825         *)      ;;
13826         esac
13827         case "$d_getprotobyname_r_proto" in
13828         define)
13829         case "$getprotobyname_r_proto" in
13830         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13831         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13832         esac
13833         case "$getprotobyname_r_proto" in
13834         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13835         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13836         esac
13837         case "$getprotobyname_r_proto" in
13838         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13839         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13840         esac
13841         case "$getprotobyname_r_proto" in
13842         ''|0)   d_getprotobyname_r=undef
13843                 getprotobyname_r_proto=0
13844                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13845         * )     case "$getprotobyname_r_proto" in
13846                 REENTRANT_PROTO*) ;;
13847                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13848                 esac
13849                 echo "Prototype: $try" ;;
13850         esac
13851         ;;
13852         *)      case "$usethreads" in
13853                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13854                 esac
13855                 d_getprotobyname_r=undef
13856                 getprotobyname_r_proto=0
13857                 ;;
13858         esac
13859         ;;
13860 *)      getprotobyname_r_proto=0
13861         ;;
13862 esac
13863
13864 : see if getprotobynumber_r exists
13865 set getprotobynumber_r d_getprotobynumber_r
13866 eval $inlibc
13867 case "$d_getprotobynumber_r" in
13868 "$define")
13869         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13870         case "$d_getprotobynumber_r_proto:$usethreads" in
13871         ":define")      d_getprotobynumber_r_proto=define
13872                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13873                 eval $hasproto ;;
13874         *)      ;;
13875         esac
13876         case "$d_getprotobynumber_r_proto" in
13877         define)
13878         case "$getprotobynumber_r_proto" in
13879         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13880         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13881         esac
13882         case "$getprotobynumber_r_proto" in
13883         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13884         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13885         esac
13886         case "$getprotobynumber_r_proto" in
13887         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13888         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13889         esac
13890         case "$getprotobynumber_r_proto" in
13891         ''|0)   d_getprotobynumber_r=undef
13892                 getprotobynumber_r_proto=0
13893                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13894         * )     case "$getprotobynumber_r_proto" in
13895                 REENTRANT_PROTO*) ;;
13896                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13897                 esac
13898                 echo "Prototype: $try" ;;
13899         esac
13900         ;;
13901         *)      case "$usethreads" in
13902                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13903                 esac
13904                 d_getprotobynumber_r=undef
13905                 getprotobynumber_r_proto=0
13906                 ;;
13907         esac
13908         ;;
13909 *)      getprotobynumber_r_proto=0
13910         ;;
13911 esac
13912
13913 : see if getprotoent_r exists
13914 set getprotoent_r d_getprotoent_r
13915 eval $inlibc
13916 case "$d_getprotoent_r" in
13917 "$define")
13918         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13919         case "$d_getprotoent_r_proto:$usethreads" in
13920         ":define")      d_getprotoent_r_proto=define
13921                 set d_getprotoent_r_proto getprotoent_r $hdrs
13922                 eval $hasproto ;;
13923         *)      ;;
13924         esac
13925         case "$d_getprotoent_r_proto" in
13926         define)
13927         case "$getprotoent_r_proto" in
13928         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13929         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13930         esac
13931         case "$getprotoent_r_proto" in
13932         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13933         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13934         esac
13935         case "$getprotoent_r_proto" in
13936         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13937         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13938         esac
13939         case "$getprotoent_r_proto" in
13940         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13941         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13942         esac
13943         case "$getprotoent_r_proto" in
13944         ''|0)   d_getprotoent_r=undef
13945                 getprotoent_r_proto=0
13946                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13947         * )     case "$getprotoent_r_proto" in
13948                 REENTRANT_PROTO*) ;;
13949                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13950                 esac
13951                 echo "Prototype: $try" ;;
13952         esac
13953         ;;
13954         *)      case "$usethreads" in
13955                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13956                 esac
13957                 d_getprotoent_r=undef
13958                 getprotoent_r_proto=0
13959                 ;;
13960         esac
13961         ;;
13962 *)      getprotoent_r_proto=0
13963         ;;
13964 esac
13965
13966 : see if prototypes for various getprotoxxx netdb.h functions are available
13967 echo " "
13968 set d_getprotoprotos getprotoent $i_netdb netdb.h
13969 eval $hasproto
13970
13971 : see if getprpwnam exists
13972 set getprpwnam d_getprpwnam
13973 eval $inlibc
13974
13975 : see if getpwent exists
13976 set getpwent d_getpwent
13977 eval $inlibc
13978
13979 : see if getpwent_r exists
13980 set getpwent_r d_getpwent_r
13981 eval $inlibc
13982 case "$d_getpwent_r" in
13983 "$define")
13984         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13985         case "$d_getpwent_r_proto:$usethreads" in
13986         ":define")      d_getpwent_r_proto=define
13987                 set d_getpwent_r_proto getpwent_r $hdrs
13988                 eval $hasproto ;;
13989         *)      ;;
13990         esac
13991         case "$d_getpwent_r_proto" in
13992         define)
13993         case "$getpwent_r_proto" in
13994         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13995         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13996         esac
13997         case "$getpwent_r_proto" in
13998         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13999         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14000         esac
14001         case "$getpwent_r_proto" in
14002         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14003         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14004         esac
14005         case "$getpwent_r_proto" in
14006         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14007         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14008         esac
14009         case "$getpwent_r_proto" in
14010         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14011         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14012         esac
14013         case "$getpwent_r_proto" in
14014         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14015         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14016         esac
14017         case "$getpwent_r_proto" in
14018         ''|0)   d_getpwent_r=undef
14019                 getpwent_r_proto=0
14020                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14021         * )     case "$getpwent_r_proto" in
14022                 REENTRANT_PROTO*) ;;
14023                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14024                 esac
14025                 echo "Prototype: $try" ;;
14026         esac
14027         ;;
14028         *)      case "$usethreads" in
14029                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14030                 esac
14031                 d_getpwent_r=undef
14032                 getpwent_r_proto=0
14033                 ;;
14034         esac
14035         ;;
14036 *)      getpwent_r_proto=0
14037         ;;
14038 esac
14039
14040 : see if getpwnam_r exists
14041 set getpwnam_r d_getpwnam_r
14042 eval $inlibc
14043 case "$d_getpwnam_r" in
14044 "$define")
14045         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14046         case "$d_getpwnam_r_proto:$usethreads" in
14047         ":define")      d_getpwnam_r_proto=define
14048                 set d_getpwnam_r_proto getpwnam_r $hdrs
14049                 eval $hasproto ;;
14050         *)      ;;
14051         esac
14052         case "$d_getpwnam_r_proto" in
14053         define)
14054         case "$getpwnam_r_proto" in
14055         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14056         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14057         esac
14058         case "$getpwnam_r_proto" in
14059         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14060         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14061         esac
14062         case "$getpwnam_r_proto" in
14063         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14064         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14065         esac
14066         case "$getpwnam_r_proto" in
14067         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14068         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14069         esac
14070         case "$getpwnam_r_proto" in
14071         ''|0)   d_getpwnam_r=undef
14072                 getpwnam_r_proto=0
14073                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14074         * )     case "$getpwnam_r_proto" in
14075                 REENTRANT_PROTO*) ;;
14076                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14077                 esac
14078                 echo "Prototype: $try" ;;
14079         esac
14080         ;;
14081         *)      case "$usethreads" in
14082                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14083                 esac
14084                 d_getpwnam_r=undef
14085                 getpwnam_r_proto=0
14086                 ;;
14087         esac
14088         ;;
14089 *)      getpwnam_r_proto=0
14090         ;;
14091 esac
14092
14093 : see if getpwuid_r exists
14094 set getpwuid_r d_getpwuid_r
14095 eval $inlibc
14096 case "$d_getpwuid_r" in
14097 "$define")
14098         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14099         case "$d_getpwuid_r_proto:$usethreads" in
14100         ":define")      d_getpwuid_r_proto=define
14101                 set d_getpwuid_r_proto getpwuid_r $hdrs
14102                 eval $hasproto ;;
14103         *)      ;;
14104         esac
14105         case "$d_getpwuid_r_proto" in
14106         define)
14107         case "$getpwuid_r_proto" in
14108         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14109         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14110         esac
14111         case "$getpwuid_r_proto" in
14112         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14113         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14114         esac
14115         case "$getpwuid_r_proto" in
14116         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14117         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14118         esac
14119         case "$getpwuid_r_proto" in
14120         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14121         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14122         esac
14123         case "$getpwuid_r_proto" in
14124         ''|0)   d_getpwuid_r=undef
14125                 getpwuid_r_proto=0
14126                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14127         * )     case "$getpwuid_r_proto" in
14128                 REENTRANT_PROTO*) ;;
14129                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14130                 esac
14131                 echo "Prototype: $try" ;;
14132         esac
14133         ;;
14134         *)      case "$usethreads" in
14135                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14136                 esac
14137                 d_getpwuid_r=undef
14138                 getpwuid_r_proto=0
14139                 ;;
14140         esac
14141         ;;
14142 *)      getpwuid_r_proto=0
14143         ;;
14144 esac
14145
14146
14147 : see if getservbyname exists
14148 set getservbyname d_getsbyname
14149 eval $inlibc
14150
14151 : see if getservbyport exists
14152 set getservbyport d_getsbyport
14153 eval $inlibc
14154
14155 : see if getservent exists
14156 set getservent d_getsent
14157 eval $inlibc
14158
14159 : see if getservbyname_r exists
14160 set getservbyname_r d_getservbyname_r
14161 eval $inlibc
14162 case "$d_getservbyname_r" in
14163 "$define")
14164         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14165         case "$d_getservbyname_r_proto:$usethreads" in
14166         ":define")      d_getservbyname_r_proto=define
14167                 set d_getservbyname_r_proto getservbyname_r $hdrs
14168                 eval $hasproto ;;
14169         *)      ;;
14170         esac
14171         case "$d_getservbyname_r_proto" in
14172         define)
14173         case "$getservbyname_r_proto" in
14174         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14175         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14176         esac
14177         case "$getservbyname_r_proto" in
14178         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14179         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14180         esac
14181         case "$getservbyname_r_proto" in
14182         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14183         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14184         esac
14185         case "$getservbyname_r_proto" in
14186         ''|0)   d_getservbyname_r=undef
14187                 getservbyname_r_proto=0
14188                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14189         * )     case "$getservbyname_r_proto" in
14190                 REENTRANT_PROTO*) ;;
14191                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14192                 esac
14193                 echo "Prototype: $try" ;;
14194         esac
14195         ;;
14196         *)      case "$usethreads" in
14197                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14198                 esac
14199                 d_getservbyname_r=undef
14200                 getservbyname_r_proto=0
14201                 ;;
14202         esac
14203         ;;
14204 *)      getservbyname_r_proto=0
14205         ;;
14206 esac
14207
14208 : see if getservbyport_r exists
14209 set getservbyport_r d_getservbyport_r
14210 eval $inlibc
14211 case "$d_getservbyport_r" in
14212 "$define")
14213         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14214         case "$d_getservbyport_r_proto:$usethreads" in
14215         ":define")      d_getservbyport_r_proto=define
14216                 set d_getservbyport_r_proto getservbyport_r $hdrs
14217                 eval $hasproto ;;
14218         *)      ;;
14219         esac
14220         case "$d_getservbyport_r_proto" in
14221         define)
14222         case "$getservbyport_r_proto" in
14223         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14224         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14225         esac
14226         case "$getservbyport_r_proto" in
14227         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14228         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14229         esac
14230         case "$getservbyport_r_proto" in
14231         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14232         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14233         esac
14234         case "$getservbyport_r_proto" in
14235         ''|0)   d_getservbyport_r=undef
14236                 getservbyport_r_proto=0
14237                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14238         * )     case "$getservbyport_r_proto" in
14239                 REENTRANT_PROTO*) ;;
14240                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14241                 esac
14242                 echo "Prototype: $try" ;;
14243         esac
14244         ;;
14245         *)      case "$usethreads" in
14246                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14247                 esac
14248                 d_getservbyport_r=undef
14249                 getservbyport_r_proto=0
14250                 ;;
14251         esac
14252         ;;
14253 *)      getservbyport_r_proto=0
14254         ;;
14255 esac
14256
14257 : see if getservent_r exists
14258 set getservent_r d_getservent_r
14259 eval $inlibc
14260 case "$d_getservent_r" in
14261 "$define")
14262         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14263         case "$d_getservent_r_proto:$usethreads" in
14264         ":define")      d_getservent_r_proto=define
14265                 set d_getservent_r_proto getservent_r $hdrs
14266                 eval $hasproto ;;
14267         *)      ;;
14268         esac
14269         case "$d_getservent_r_proto" in
14270         define)
14271         case "$getservent_r_proto" in
14272         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14273         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14274         esac
14275         case "$getservent_r_proto" in
14276         ''|0) try='int getservent_r(struct servent*, char*, int);'
14277         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14278         esac
14279         case "$getservent_r_proto" in
14280         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14281         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14282         esac
14283         case "$getservent_r_proto" in
14284         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14285         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14286         esac
14287         case "$getservent_r_proto" in
14288         ''|0)   d_getservent_r=undef
14289                 getservent_r_proto=0
14290                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14291         * )     case "$getservent_r_proto" in
14292                 REENTRANT_PROTO*) ;;
14293                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14294                 esac
14295                 echo "Prototype: $try" ;;
14296         esac
14297         ;;
14298         *)      case "$usethreads" in
14299                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14300                 esac
14301                 d_getservent_r=undef
14302                 getservent_r_proto=0
14303                 ;;
14304         esac
14305         ;;
14306 *)      getservent_r_proto=0
14307         ;;
14308 esac
14309
14310 : see if prototypes for various getservxxx netdb.h functions are available
14311 echo " "
14312 set d_getservprotos getservent $i_netdb netdb.h
14313 eval $hasproto
14314
14315 : see if getspnam exists
14316 set getspnam d_getspnam
14317 eval $inlibc
14318
14319 : see if this is a shadow.h system
14320 set shadow.h i_shadow
14321 eval $inhdr
14322
14323 : see if getspnam_r exists
14324 set getspnam_r d_getspnam_r
14325 eval $inlibc
14326 case "$d_getspnam_r" in
14327 "$define")
14328         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14329         case "$d_getspnam_r_proto:$usethreads" in
14330         ":define")      d_getspnam_r_proto=define
14331                 set d_getspnam_r_proto getspnam_r $hdrs
14332                 eval $hasproto ;;
14333         *)      ;;
14334         esac
14335         case "$d_getspnam_r_proto" in
14336         define)
14337         case "$getspnam_r_proto" in
14338         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14339         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14340         esac
14341         case "$getspnam_r_proto" in
14342         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14343         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14344         esac
14345         case "$getspnam_r_proto" in
14346         ''|0)   d_getspnam_r=undef
14347                 getspnam_r_proto=0
14348                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14349         * )     case "$getspnam_r_proto" in
14350                 REENTRANT_PROTO*) ;;
14351                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14352                 esac
14353                 echo "Prototype: $try" ;;
14354         esac
14355         ;;
14356         *)      case "$usethreads" in
14357                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14358                 esac
14359                 d_getspnam_r=undef
14360                 getspnam_r_proto=0
14361                 ;;
14362         esac
14363         ;;
14364 *)      getspnam_r_proto=0
14365         ;;
14366 esac
14367
14368 : see if gettimeofday or ftime exists
14369 set gettimeofday d_gettimeod
14370 eval $inlibc
14371 case "$d_gettimeod" in
14372 "$undef")
14373         set ftime d_ftime 
14374         eval $inlibc
14375         ;;
14376 *)
14377         val="$undef"; set d_ftime; eval $setvar
14378         ;;
14379 esac
14380 case "$d_gettimeod$d_ftime" in
14381 "$undef$undef")
14382         echo " "
14383         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14384         ;;
14385 esac
14386
14387 : see if gmtime_r exists
14388 set gmtime_r d_gmtime_r
14389 eval $inlibc
14390 case "$d_gmtime_r" in
14391 "$define")
14392         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14393         case "$d_gmtime_r_proto:$usethreads" in
14394         ":define")      d_gmtime_r_proto=define
14395                 set d_gmtime_r_proto gmtime_r $hdrs
14396                 eval $hasproto ;;
14397         *)      ;;
14398         esac
14399         case "$d_gmtime_r_proto" in
14400         define)
14401         case "$gmtime_r_proto" in
14402         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14403         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14404         esac
14405         case "$gmtime_r_proto" in
14406         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14407         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14408         esac
14409         case "$gmtime_r_proto" in
14410         ''|0)   d_gmtime_r=undef
14411                 gmtime_r_proto=0
14412                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14413         * )     case "$gmtime_r_proto" in
14414                 REENTRANT_PROTO*) ;;
14415                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14416                 esac
14417                 echo "Prototype: $try" ;;
14418         esac
14419         ;;
14420         *)      case "$usethreads" in
14421                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14422                 esac
14423                 d_gmtime_r=undef
14424                 gmtime_r_proto=0
14425                 ;;
14426         esac
14427         ;;
14428 *)      gmtime_r_proto=0
14429         ;;
14430 esac
14431
14432 : see if hasmntopt exists
14433 set hasmntopt d_hasmntopt
14434 eval $inlibc
14435
14436 : see if this is a netinet/in.h or sys/in.h system
14437 set netinet/in.h i_niin sys/in.h i_sysin
14438 eval $inhdr
14439
14440 : see if arpa/inet.h has to be included
14441 set arpa/inet.h i_arpainet
14442 eval $inhdr
14443
14444 : see if htonl --and friends-- exists
14445 val=''
14446 set htonl val
14447 eval $inlibc
14448
14449 : Maybe they are macros.
14450 case "$val" in
14451 $undef)
14452         $cat >htonl.c <<EOM
14453 #include <stdio.h>
14454 #include <sys/types.h>
14455 #$i_niin I_NETINET_IN
14456 #$i_sysin I_SYS_IN
14457 #$i_arpainet I_ARPA_INET
14458 #ifdef I_NETINET_IN
14459 #include <netinet/in.h>
14460 #endif
14461 #ifdef I_SYS_IN
14462 #include <sys/in.h>
14463 #endif
14464 #ifdef I_ARPA_INET
14465 #include <arpa/inet.h>
14466 #endif
14467 #ifdef htonl
14468 printf("Defined as a macro.");
14469 #endif
14470 EOM
14471         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14472         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14473                 val="$define"
14474                 echo "But it seems to be defined as a macro." >&4
14475         fi
14476         $rm -f htonl.?
14477         ;;
14478 esac
14479 set d_htonl
14480 eval $setvar
14481
14482 : see if ilogbl exists
14483 set ilogbl d_ilogbl
14484 eval $inlibc
14485
14486 : index or strchr
14487 echo " "
14488 if set index val -f; eval $csym; $val; then
14489         if set strchr val -f d_strchr; eval $csym; $val; then
14490                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14491                         val="$define"
14492                         vali="$undef"
14493                         echo "strchr() found." >&4
14494                 else
14495                         val="$undef"
14496                         vali="$define"
14497                         echo "index() found." >&4
14498                 fi
14499         else
14500                 val="$undef"
14501                 vali="$define"
14502                 echo "index() found." >&4
14503         fi
14504 else
14505         if set strchr val -f d_strchr; eval $csym; $val; then
14506                 val="$define"
14507                 vali="$undef"
14508                 echo "strchr() found." >&4
14509         else
14510                 echo "No index() or strchr() found!" >&4
14511                 val="$undef"
14512                 vali="$undef"
14513         fi
14514 fi
14515 set d_strchr; eval $setvar
14516 val="$vali"
14517 set d_index; eval $setvar
14518
14519 : check whether inet_aton exists
14520 set inet_aton d_inetaton
14521 eval $inlibc
14522
14523 : Look for isascii
14524 echo " "
14525 $cat >isascii.c <<EOCP
14526 #include <stdio.h>
14527 #include <ctype.h>
14528 #$i_stdlib I_STDLIB
14529 #ifdef I_STDLIB
14530 #include <stdlib.h>
14531 #endif
14532 int main() {
14533         int c = 'A';
14534         if (isascii(c))
14535                 exit(0);
14536         else
14537                 exit(1);
14538 }
14539 EOCP
14540 set isascii
14541 if eval $compile; then
14542         echo "isascii() found." >&4
14543         val="$define"
14544 else
14545         echo "isascii() NOT found." >&4
14546         val="$undef"
14547 fi
14548 set d_isascii
14549 eval $setvar
14550 $rm -f isascii*
14551
14552 : see if isfinite exists
14553 set isfinite d_isfinite
14554 eval $inlibc
14555
14556 : see if isinf exists
14557 set isinf d_isinf
14558 eval $inlibc
14559
14560 : see if isnan exists
14561 set isnan d_isnan
14562 eval $inlibc
14563
14564 : see if isnanl exists
14565 set isnanl d_isnanl
14566 eval $inlibc
14567
14568 : see if killpg exists
14569 set killpg d_killpg
14570 eval $inlibc
14571
14572 : see if lchown exists
14573 echo " "
14574 $cat > try.c <<'EOCP'
14575 /* System header to define __stub macros and hopefully few prototypes,
14576     which can conflict with char lchown(); below.  */
14577 #include <assert.h>
14578 /* Override any gcc2 internal prototype to avoid an error.  */
14579 /* We use char because int might match the return type of a gcc2
14580    builtin and then its argument prototype would still apply.  */
14581 char lchown();
14582 int main() {
14583     /*  The GNU C library defines this for functions which it implements
14584         to always fail with ENOSYS.  Some functions are actually named
14585         something starting with __ and the normal name is an alias.  */
14586 #if defined (__stub_lchown) || defined (__stub___lchown)
14587 choke me
14588 #else
14589 lchown();
14590 #endif
14591 ; return 0; }
14592 EOCP
14593 set try
14594 if eval $compile; then
14595     $echo "lchown() found." >&4
14596     val="$define"
14597 else
14598     $echo "lchown() NOT found." >&4
14599     val="$undef"
14600 fi
14601 set d_lchown
14602 eval $setvar
14603
14604 : See if number of significant digits in a double precision number is known
14605 echo " "
14606 $cat >ldbl_dig.c <<EOM
14607 #$i_limits I_LIMITS
14608 #$i_float I_FLOAT
14609 #ifdef I_LIMITS
14610 #include <limits.h>
14611 #endif
14612 #ifdef I_FLOAT
14613 #include <float.h>
14614 #endif
14615 #ifdef LDBL_DIG
14616 printf("Contains LDBL_DIG");
14617 #endif
14618 EOM
14619 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14620 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14621         echo "LDBL_DIG found." >&4
14622         val="$define"
14623 else
14624         echo "LDBL_DIG NOT found." >&4
14625         val="$undef"
14626 fi
14627 $rm -f ldbl_dig.?
14628 set d_ldbl_dig
14629 eval $setvar
14630
14631 : see if this is a math.h system
14632 set math.h i_math
14633 eval $inhdr
14634
14635 d_libm_lib_version="$undef"
14636 case $i_math in
14637     $define)
14638         : check to see if math.h defines _LIB_VERSION
14639         echo " "
14640         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14641         $cat >try.c <<EOCP
14642 #include <unistd.h>
14643 #include <math.h>
14644 int main (int argc, char *argv[])
14645 {
14646     printf ("%d\n", _LIB_VERSION);
14647     return (0);
14648     } /* main */
14649 EOCP
14650         set try
14651         if eval $compile; then
14652             foo=`$run ./try`
14653             echo "Yes, it does ($foo)" >&4
14654             d_libm_lib_version="$define"
14655         else
14656             echo "No, it does not (probably harmless)" >&4
14657             fi
14658         $rm_try
14659         ;;
14660
14661     esac
14662
14663 : see if link exists
14664 set link d_link
14665 eval $inlibc
14666
14667 : see if localtime_r exists
14668 set localtime_r d_localtime_r
14669 eval $inlibc
14670 case "$d_localtime_r" in
14671 "$define")
14672         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14673         case "$d_localtime_r_proto:$usethreads" in
14674         ":define")      d_localtime_r_proto=define
14675                 set d_localtime_r_proto localtime_r $hdrs
14676                 eval $hasproto ;;
14677         *)      ;;
14678         esac
14679         case "$d_localtime_r_proto" in
14680         define)
14681         case "$localtime_r_proto" in
14682         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14683         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14684         esac
14685         case "$localtime_r_proto" in
14686         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14687         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14688         esac
14689         case "$localtime_r_proto" in
14690         ''|0)   d_localtime_r=undef
14691                 localtime_r_proto=0
14692                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14693         * )     case "$localtime_r_proto" in
14694                 REENTRANT_PROTO*) ;;
14695                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14696                 esac
14697                 echo "Prototype: $try" ;;
14698         esac
14699         ;;
14700         *)      case "$usethreads" in
14701                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14702                 esac
14703                 d_localtime_r=undef
14704                 localtime_r_proto=0
14705                 ;;
14706         esac
14707         ;;
14708 *)      localtime_r_proto=0
14709         ;;
14710 esac
14711
14712 : see if localtime_r calls tzset
14713 case "$localtime_r_proto" in
14714 REENTRANT_PROTO*)
14715         $cat >try.c <<EOCP
14716 /*  Does our libc's localtime_r call tzset ?
14717  *  return 0 if so, 1 otherwise.
14718  */
14719 #include <sys/types.h>
14720 #include <unistd.h>
14721 #include <time.h>
14722 #include <string.h>
14723 #include <malloc.h>
14724 int main()
14725 {
14726     time_t t = time(0L);
14727     char w_tz[]="TZ" "=GMT+5",
14728          e_tz[]="TZ" "=GMT-5",
14729         *tz_e = (char*)malloc(16),
14730         *tz_w = (char*)malloc(16);
14731     struct tm tm_e, tm_w;
14732     memset(&tm_e,'\0',sizeof(struct tm));
14733     memset(&tm_w,'\0',sizeof(struct tm));
14734     strcpy(tz_e,e_tz);
14735     strcpy(tz_w,w_tz);
14736
14737     putenv(tz_e);
14738     localtime_r(&t, &tm_e);
14739
14740     putenv(tz_w);
14741     localtime_r(&t, &tm_w);
14742
14743     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14744         return 1;
14745     return 0;
14746 }
14747 EOCP
14748         set try
14749         if eval $compile; then
14750             if $run ./try; then
14751                 d_localtime_r_needs_tzset=undef;
14752             else
14753                 d_localtime_r_needs_tzset=define;
14754             fi;
14755         else
14756             d_localtime_r_needs_tzset=undef;
14757         fi;
14758      ;;
14759   *)
14760      d_localtime_r_needs_tzset=undef;
14761      ;;
14762 esac
14763 $rm_try
14764
14765 : see if localeconv exists
14766 set localeconv d_locconv
14767 eval $inlibc
14768
14769 : see if lockf exists
14770 set lockf d_lockf
14771 eval $inlibc
14772
14773 : see if prototype for lseek is available
14774 echo " "
14775 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14776 eval $hasproto
14777
14778 : see if lstat exists
14779 set lstat d_lstat
14780 eval $inlibc
14781
14782 : see if madvise exists
14783 set madvise d_madvise
14784 eval $inlibc
14785
14786 : see if malloc_size exists
14787 set malloc_size d_malloc_size
14788 eval $inlibc
14789
14790 : see if malloc_size_good exists
14791 set malloc_good_size d_malloc_good_size
14792 eval $inlibc
14793
14794 : see if mblen exists
14795 set mblen d_mblen
14796 eval $inlibc
14797
14798 : see if mbstowcs exists
14799 set mbstowcs d_mbstowcs
14800 eval $inlibc
14801
14802 : see if mbtowc exists
14803 set mbtowc d_mbtowc
14804 eval $inlibc
14805
14806 : see if memchr exists
14807 set memchr d_memchr
14808 eval $inlibc
14809
14810 : see if memcmp exists
14811 set memcmp d_memcmp
14812 eval $inlibc
14813
14814 : see if memcpy exists
14815 set memcpy d_memcpy
14816 eval $inlibc
14817
14818 : see if memmove exists
14819 set memmove d_memmove
14820 eval $inlibc
14821
14822 : see if memset exists
14823 set memset d_memset
14824 eval $inlibc
14825
14826 : see if mkdir exists
14827 set mkdir d_mkdir
14828 eval $inlibc
14829
14830 : see if mkdtemp exists
14831 set mkdtemp d_mkdtemp
14832 eval $inlibc
14833
14834 : see if mkfifo exists
14835 set mkfifo d_mkfifo
14836 eval $inlibc
14837
14838 : see if mkstemp exists
14839 set mkstemp d_mkstemp
14840 eval $inlibc
14841
14842 : see if mkstemps exists
14843 set mkstemps d_mkstemps
14844 eval $inlibc
14845
14846 : see if mktime exists
14847 set mktime d_mktime
14848 eval $inlibc
14849
14850 : see if this is a sys/mman.h system
14851 set sys/mman.h i_sysmman
14852 eval $inhdr
14853
14854 : see if mmap exists
14855 set mmap d_mmap
14856 eval $inlibc
14857 : see what shmat returns
14858 : default to something harmless
14859 mmaptype='void *'
14860 case "$i_sysmman$d_mmap" in
14861 "$define$define")
14862         $cat >mmap.c <<'END'
14863 #include <sys/mman.h>
14864 void *mmap();
14865 END
14866         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14867                 mmaptype='void *'
14868         else
14869                 mmaptype='caddr_t'
14870         fi
14871         echo "and it returns ($mmaptype)." >&4
14872         ;;
14873 esac
14874
14875
14876
14877 : see if sqrtl exists
14878 set sqrtl d_sqrtl
14879 eval $inlibc
14880
14881 : see if scalbnl exists
14882 set scalbnl d_scalbnl
14883 eval $inlibc
14884
14885 : see if modfl exists
14886 set modfl d_modfl
14887 eval $inlibc
14888
14889 : see if prototype for modfl is available
14890 echo " "
14891 set d_modflproto modfl $i_math math.h
14892 eval $hasproto
14893
14894 d_modfl_pow32_bug="$undef"
14895
14896 case "$d_longdbl$d_modfl" in
14897 $define$define)
14898         $cat <<EOM
14899 Checking to see whether your modfl() is okay for large values...
14900 EOM
14901 $cat >try.c <<EOCP
14902 #include <math.h>
14903 #include <stdio.h>
14904 EOCP
14905 if $test "X$d_modflproto" != "X$define"; then
14906         $cat >>try.c <<EOCP
14907 /* Sigh. many current glibcs provide the function, but do not prototype it. */
14908 long double modfl (long double, long double *);
14909 EOCP
14910 fi
14911 $cat >>try.c <<EOCP
14912 int main() {
14913     long double nv = 4294967303.15;
14914     long double v, w;
14915     v = modfl(nv, &w);
14916 #ifdef __GLIBC__
14917     printf("glibc");
14918 #endif
14919     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14920     return 0;
14921 }
14922 EOCP
14923         case "$osname:$gccversion" in
14924         aix:)   saveccflags="$ccflags"
14925                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14926         esac
14927         set try
14928         if eval $compile; then
14929                 foo=`$run ./try`
14930                 case "$foo" in
14931                 *" 4294967303.150000 1.150000 4294967302.000000")
14932                         echo >&4 "Your modfl() is broken for large values."
14933                         d_modfl_pow32_bug="$define"
14934                         case "$foo" in
14935                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14936                         ;;
14937                         esac
14938                         ;;
14939                 *" 4294967303.150000 0.150000 4294967303.000000")
14940                         echo >&4 "Your modfl() seems okay for large values."
14941                         ;;
14942                 *)      echo >&4 "I don't understand your modfl() at all."
14943                         d_modfl="$undef"
14944                         ;;
14945                 esac
14946                 $rm_try
14947         else
14948                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14949                 d_modfl="$undef"
14950         fi
14951         case "$osname:$gccversion" in
14952         aix:)   ccflags="$saveccflags" ;; # restore
14953         esac
14954         ;;
14955 esac
14956
14957 if $test "$uselongdouble" = "$define"; then
14958     message=""
14959     if $test "$d_sqrtl" != "$define"; then
14960         message="$message sqrtl"
14961     fi
14962     if $test "$d_modfl" != "$define"; then
14963         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14964             echo "You have both aintl and copysignl, so I can emulate modfl."
14965         else
14966             message="$message modfl"
14967         fi
14968     fi
14969     if $test "$d_frexpl" != "$define"; then
14970         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14971             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14972         else
14973             message="$message frexpl"
14974         fi
14975     fi
14976
14977     if $test "$message" != ""; then
14978         $cat <<EOM >&4
14979
14980 *** You requested the use of long doubles but you do not seem to have
14981 *** the following mathematical functions needed for long double support:
14982 ***    $message
14983 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14984 *** Cannot continue, aborting.
14985
14986 EOM
14987
14988         exit 1
14989     fi
14990 fi
14991
14992 : see if mprotect exists
14993 set mprotect d_mprotect
14994 eval $inlibc
14995
14996 : see if msgctl exists
14997 set msgctl d_msgctl
14998 eval $inlibc
14999
15000 : see if msgget exists
15001 set msgget d_msgget
15002 eval $inlibc
15003
15004 : see if msgsnd exists
15005 set msgsnd d_msgsnd
15006 eval $inlibc
15007
15008 : see if msgrcv exists
15009 set msgrcv d_msgrcv
15010 eval $inlibc
15011
15012 : see how much of the 'msg*(2)' library is present.
15013 h_msg=true
15014 echo " "
15015 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15016 *"$undef"*) h_msg=false;;
15017 esac
15018 case "$osname" in
15019 freebsd)
15020     case "`ipcs 2>&1`" in
15021     "SVID messages"*"not configured"*)
15022         echo "Your $osname does not have the msg*(2) configured." >&4
15023         h_msg=false
15024         val="$undef"
15025         set msgctl d_msgctl
15026         eval $setvar
15027         set msgget d_msgget
15028         eval $setvar
15029         set msgsnd d_msgsnd
15030         eval $setvar
15031         set msgrcv d_msgrcv
15032         eval $setvar
15033         ;;
15034     esac
15035     ;;
15036 esac
15037 : we could also check for sys/ipc.h ...
15038 if $h_msg && $test `./findhdr sys/msg.h`; then
15039         echo "You have the full msg*(2) library." >&4
15040         val="$define"
15041 else
15042         echo "You don't have the full msg*(2) library." >&4
15043         val="$undef"
15044 fi
15045 set d_msg
15046 eval $setvar
15047
15048
15049 echo " "
15050 echo "Checking to see if your system supports struct msghdr..." >&4
15051 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15052 eval $hasstruct
15053 case "$d_msghdr_s" in
15054 "$define")      echo "Yes, it does."   ;;
15055 *)              echo "No, it doesn't." ;;
15056 esac
15057
15058
15059 : see if msync exists
15060 set msync d_msync
15061 eval $inlibc
15062
15063 : see if munmap exists
15064 set munmap d_munmap
15065 eval $inlibc
15066
15067 : see if nice exists
15068 set nice d_nice
15069 eval $inlibc
15070
15071 : see if this is a langinfo.h system
15072 set langinfo.h i_langinfo
15073 eval $inhdr
15074
15075 : see if nl_langinfo exists
15076 set nl_langinfo d_nl_langinfo
15077 eval $inlibc
15078
15079 : check for length of character
15080 echo " "
15081 case "$charsize" in
15082 '')
15083         echo "Checking to see how big your characters are (hey, you never know)..." >&4
15084         $cat >try.c <<EOCP
15085 #include <stdio.h>
15086 #$i_stdlib I_STDLIB
15087 #ifdef I_STDLIB
15088 #include <stdlib.h>
15089 #endif
15090 int main()
15091 {
15092     printf("%d\n", (int)sizeof(char));
15093     exit(0);
15094 }
15095 EOCP
15096         set try
15097         if eval $compile_ok; then
15098                 dflt=`$run ./try`
15099         else
15100                 dflt='1'
15101                 echo "(I can't seem to compile the test program.  Guessing...)"
15102         fi
15103         ;;
15104 *)
15105         dflt="$charsize"
15106         ;;
15107 esac
15108 rp="What is the size of a character (in bytes)?"
15109 . ./myread
15110 charsize="$ans"
15111 $rm_try
15112
15113 : check for volatile keyword
15114 echo " "
15115 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15116 $cat >try.c <<'EOCP'
15117 int main()
15118 {
15119         typedef struct _goo_struct goo_struct;
15120         goo_struct * volatile goo = ((goo_struct *)0);
15121         struct _goo_struct {
15122                 long long_int;
15123                 int reg_int;
15124                 char char_var;
15125         };
15126         typedef unsigned short foo_t;
15127         char *volatile foo;
15128         volatile int bar;
15129         volatile foo_t blech;
15130         foo = foo;
15131 }
15132 EOCP
15133 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15134         val="$define"
15135         echo "Yup, it does."
15136 else
15137         val="$undef"
15138         echo "Nope, it doesn't."
15139 fi
15140 set d_volatile
15141 eval $setvar
15142 $rm_try
15143
15144
15145 echo " "
15146 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15147
15148 case "$use64bitint:$d_quad:$quadtype" in
15149 define:define:?*)
15150         ivtype="$quadtype"
15151         uvtype="$uquadtype"
15152         ivsize=8
15153         uvsize=8
15154         ;;
15155 *)      ivtype="long"
15156         uvtype="unsigned long"
15157         ivsize=$longsize
15158         uvsize=$longsize
15159         ;;
15160 esac
15161
15162 case "$uselongdouble:$d_longdbl" in
15163 define:define)
15164         nvtype="long double"
15165         nvsize=$longdblsize
15166         ;;
15167 *)      nvtype=double
15168         nvsize=$doublesize
15169         ;;
15170 esac
15171
15172 $echo "(IV will be "$ivtype", $ivsize bytes)"
15173 $echo "(UV will be "$uvtype", $uvsize bytes)"
15174 $echo "(NV will be "$nvtype", $nvsize bytes)"
15175
15176 $cat >try.c <<EOCP
15177 #$i_inttypes I_INTTYPES
15178 #ifdef I_INTTYPES
15179 #include <inttypes.h>
15180 #endif
15181 #include <stdio.h>
15182 int main() {
15183 #ifdef INT8
15184    int8_t i =  INT8_MAX;
15185   uint8_t u = UINT8_MAX;
15186   printf("int8_t\n");
15187 #endif
15188 #ifdef INT16
15189    int16_t i =  INT16_MAX;
15190   uint16_t i = UINT16_MAX;
15191   printf("int16_t\n");
15192 #endif
15193 #ifdef INT32
15194    int32_t i =  INT32_MAX;
15195   uint32_t u = UINT32_MAX;
15196   printf("int32_t\n");
15197 #endif
15198 }
15199 EOCP
15200
15201 case "$i8type" in
15202 '')     case "$charsize" in
15203         1)      i8type=char
15204                 u8type="unsigned char"
15205                 i8size=$charsize
15206                 u8size=$charsize
15207                 ;;
15208         esac
15209         ;;
15210 esac
15211 case "$i8type" in
15212 '')     set try -DINT8
15213         if eval $compile; then
15214                 case "`$run ./try`" in
15215                 int8_t) i8type=int8_t
15216                         u8type=uint8_t
15217                         i8size=1
15218                         u8size=1
15219                         ;;
15220                 esac
15221         fi
15222         ;;
15223 esac
15224 case "$i8type" in
15225 '')     if $test $charsize -ge 1; then
15226                 i8type=char
15227                 u8type="unsigned char"
15228                 i8size=$charsize
15229                 u8size=$charsize
15230         fi
15231         ;;
15232 esac
15233
15234 case "$i16type" in
15235 '')     case "$shortsize" in
15236         2)      i16type=short
15237                 u16type="unsigned short"
15238                 i16size=$shortsize
15239                 u16size=$shortsize
15240                 ;;
15241         esac
15242         ;;
15243 esac
15244 case "$i16type" in
15245 '')     set try -DINT16
15246         if eval $compile; then
15247                 case "`$run ./try`" in
15248                 int16_t)
15249                         i16type=int16_t
15250                         u16type=uint16_t
15251                         i16size=2
15252                         u16size=2
15253                         ;;
15254                 esac
15255         fi
15256         ;;
15257 esac
15258 case "$i16type" in
15259 '')     if $test $shortsize -ge 2; then
15260                 i16type=short
15261                 u16type="unsigned short"
15262                 i16size=$shortsize
15263                 u16size=$shortsize
15264         fi
15265         ;;
15266 esac
15267
15268 case "$i32type" in
15269 '')     case "$longsize" in
15270         4)      i32type=long
15271                 u32type="unsigned long"
15272                 i32size=$longsize
15273                 u32size=$longsize
15274                 ;;
15275         *)      case "$intsize" in
15276                 4)      i32type=int
15277                         u32type="unsigned int"
15278                         i32size=$intsize
15279                         u32size=$intsize
15280                         ;;
15281                 esac
15282                 ;;
15283         esac
15284         ;;
15285 esac
15286 case "$i32type" in
15287 '')     set try -DINT32
15288         if eval $compile; then
15289                 case "`$run ./try`" in
15290                 int32_t)
15291                         i32type=int32_t
15292                         u32type=uint32_t
15293                         i32size=4
15294                         u32size=4
15295                         ;;
15296                 esac
15297         fi
15298         ;;
15299 esac
15300 case "$i32type" in
15301 '')     if $test $intsize -ge 4; then
15302                 i32type=int
15303                 u32type="unsigned int"
15304                 i32size=$intsize
15305                 u32size=$intsize
15306         fi
15307         ;;
15308 esac
15309
15310 case "$i64type" in
15311 '')     case "$d_quad:$quadtype" in
15312         define:?*)
15313                 i64type="$quadtype"
15314                 u64type="$uquadtype"
15315                 i64size=8
15316                 u64size=8
15317                 ;;
15318         esac
15319         ;;
15320 esac
15321
15322 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15323 : volatile so that the compiler has to store it out to memory.
15324 if test X"$d_volatile" = X"$define"; then
15325         volatile=volatile
15326 fi
15327 $cat <<EOP >try.c
15328 #include <stdio.h>
15329 #$i_stdlib I_STDLIB
15330 #ifdef I_STDLIB
15331 #include <stdlib.h>
15332 #endif
15333 #include <sys/types.h>
15334 #include <signal.h>
15335 #ifdef SIGFPE
15336 $volatile int bletched = 0;
15337 $signal_t blech(int s) { bletched = 1; }
15338 #endif
15339 int main() {
15340     $uvtype u = 0;
15341     $nvtype d;
15342     int     n = 8 * $uvsize;
15343     int     i;
15344 #ifdef SIGFPE
15345     signal(SIGFPE, blech);
15346 #endif
15347
15348     for (i = 0; i < n; i++) {
15349       u = u << 1 | ($uvtype)1;
15350       d = ($nvtype)u;
15351       if (($uvtype)d != u)
15352         break;
15353       if (d <= 0)
15354         break;
15355       d = ($nvtype)(u - 1);
15356       if (($uvtype)d != (u - 1))
15357         break;
15358 #ifdef SIGFPE
15359       if (bletched)
15360         break;
15361 #endif
15362     }
15363     printf("%d\n", ((i == n) ? -n : i));
15364     exit(0);
15365 }
15366 EOP
15367 set try
15368
15369 d_nv_preserves_uv="$undef"
15370 if eval $compile; then
15371         nv_preserves_uv_bits="`$run ./try`"
15372 fi
15373 case "$nv_preserves_uv_bits" in
15374 \-[1-9]*)
15375         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15376         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15377         d_nv_preserves_uv="$define"
15378         ;;
15379 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15380         d_nv_preserves_uv="$undef" ;;
15381 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15382         nv_preserves_uv_bits="0" ;;
15383 esac
15384 $rm_try
15385
15386 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15387 : volatile so that the compiler has to store it out to memory.
15388 if test X"$d_volatile" = X"$define"; then
15389         volatile=volatile
15390 fi
15391 $cat <<EOP >try.c
15392 #include <stdio.h>
15393 #$i_stdlib I_STDLIB
15394 #ifdef I_STDLIB
15395 #include <stdlib.h>
15396 #endif
15397 #$i_string I_STRING
15398 #ifdef I_STRING
15399 #  include <string.h>
15400 #else
15401 #  include <strings.h>
15402 #endif
15403 #include <sys/types.h>
15404 #include <signal.h>
15405 #ifdef SIGFPE
15406 $volatile int bletched = 0;
15407 $signal_t blech(int s) { bletched = 1; }
15408 #endif
15409
15410 int checkit($nvtype d, char *where) {
15411     unsigned char *p = (char *)&d;
15412     unsigned char *end = p + sizeof(d);
15413     int fail = 0;
15414
15415     while (p < end)
15416         fail += *p++;
15417
15418     if (!fail)
15419         return 0;
15420
15421     p = (char *)&d;
15422     printf("No - %s: 0x", where);
15423     while (p < end)
15424         printf ("%02X", *p++);
15425     printf("\n");
15426     return 1;
15427 }
15428
15429 int main(int argc, char **argv) {
15430     $nvtype d = 0.0;
15431     int fail = 0;
15432     fail += checkit(d, "0.0");
15433
15434     /* The compiler shouldn't be assuming that bletched is 0  */
15435     d = bletched;
15436
15437     fail += checkit(d, "bleched");
15438
15439 #ifdef SIGFPE
15440     signal(SIGFPE, blech);
15441 #endif
15442
15443     /* Paranoia - the compiler should have no way of knowing that ANSI says
15444        that argv[argc] will always be NULL.  Actually, if it did assume this it
15445        would be buggy, as this is C and main() can be called from elsewhere in
15446        the program.  */
15447     d = argv[argc] ? 1 : 0;
15448
15449     if (d) {
15450         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15451     }
15452
15453     fail += checkit(d, "ternary");
15454
15455     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15456
15457     if (d != 0.0) {
15458         printf("No - memset doesn't give 0.0\n");
15459         /* This might just blow up:  */
15460         printf("(gives %g)\n", d);
15461         return 1;
15462     }
15463
15464 #ifdef SIGFPE
15465     if (bletched) {
15466         printf("No - something bleched\n");
15467         return 1;
15468     }
15469 #endif
15470     if (fail) {
15471       printf("No - %d fail(s)\n", fail);
15472       return 1;
15473     }
15474     printf("Yes\n");
15475     return 0;
15476 }
15477 EOP
15478 set try
15479
15480 d_nv_zero_is_allbits_zero="$undef"
15481 if eval $compile; then
15482     xxx="`$run ./try`"
15483     case "$?" in
15484         0)
15485             case "$xxx" in
15486                 Yes)  cat >&4 <<EOM
15487 0.0 is represented as all bits zero in memory
15488 EOM
15489                     d_nv_zero_is_allbits_zero="$define"
15490                     ;;
15491                 *)  cat >&4 <<EOM
15492 0.0 is not represented as all bits zero in memory
15493 EOM
15494                     d_nv_zero_is_allbits_zero="$undef"
15495                     ;;
15496             esac
15497             ;;
15498         *)  cat >&4 <<EOM
15499 0.0 is not represented as all bits zero in memory
15500 EOM
15501             d_nv_zero_is_allbits_zero="$undef"
15502             ;;
15503     esac
15504 fi
15505 $rm_try
15506
15507 : check for off64_t
15508 echo " "
15509 echo "Checking to see if you have off64_t..." >&4
15510 $cat >try.c <<EOCP
15511 #include <sys/types.h>
15512 #include <unistd.h>
15513 int main() { off64_t x = 7; }
15514 EOCP
15515 set try
15516 if eval $compile; then
15517         val="$define"
15518         echo "You have off64_t."
15519 else
15520         val="$undef"
15521         echo "You do not have off64_t."
15522         case "$lseeksize" in
15523         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15524         esac
15525 fi
15526 $rm_try
15527 set d_off64_t
15528 eval $setvar
15529
15530 : how to create joinable pthreads
15531 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15532         echo " "
15533         echo "Checking what constant to use for creating joinable pthreads..." >&4
15534         $cat >try.c <<'EOCP'
15535 #include <pthread.h>
15536 int main() {
15537     int detachstate = JOINABLE;
15538 }
15539 EOCP
15540         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15541         if eval $compile; then
15542                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15543                 val="$undef" # Yes, undef.
15544                 set d_old_pthread_create_joinable
15545                 eval $setvar
15546                 val=""
15547                 set old_pthread_create_joinable
15548                 eval $setvar
15549         else
15550                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15551                 if eval $compile; then
15552                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15553                         val="$define"
15554                         set d_old_pthread_create_joinable
15555                         eval $setvar
15556                         val=PTHREAD_CREATE_UNDETACHED
15557                         set old_pthread_create_joinable
15558                         eval $setvar
15559                 else
15560                         set try -DJOINABLE=__UNDETACHED
15561                         if eval $compile; then
15562                                 echo "You seem to use __UNDETACHED." >&4
15563                                 val="$define"
15564                                 set d_old_pthread_create_joinable
15565                                 eval $setvar
15566                                 val=__UNDETACHED
15567                                 set old_pthread_create_joinable
15568                                 eval $setvar
15569                         else
15570                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15571                                 val="$define"
15572                                 set d_old_pthread_create_joinable
15573                                 eval $setvar
15574                                 val=0
15575                                 set old_pthread_create_joinable
15576                                 eval $setvar
15577                         fi
15578                 fi
15579         fi
15580         $rm_try
15581 else
15582     d_old_pthread_create_joinable="$undef"
15583     old_pthread_create_joinable=""
15584 fi
15585
15586 : see if pause exists
15587 set pause d_pause
15588 eval $inlibc
15589
15590 : see if poll exists
15591 set poll d_poll
15592 eval $inlibc
15593
15594 : see if readlink exists
15595 set readlink d_readlink
15596 eval $inlibc
15597
15598 echo " "
15599 procselfexe=''
15600 val="$undef"
15601 case "$d_readlink" in
15602 "$define")
15603         if $issymlink /proc/self/exe ; then
15604                 $ls -l /proc/self/exe > reflect
15605                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15606                         echo "You have Linux-like /proc/self/exe."
15607                         procselfexe='"/proc/self/exe"'
15608                         val="$define"
15609                 fi
15610         fi
15611         if $issymlink /proc/curproc/file ; then
15612                 $ls -l /proc/curproc/file > reflect
15613                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15614                         echo "You have BSD-like /proc/curproc/file."
15615                         procselfexe='"/proc/curproc/file"'
15616                         val="$define"
15617                 fi
15618         fi
15619         ;;
15620 esac
15621 $rm -f reflect
15622 set d_procselfexe
15623 eval $setvar
15624
15625 : backward compatibility for d_hvfork
15626 if test X$d_hvfork != X; then
15627         d_vfork="$d_hvfork"
15628         d_hvfork=''
15629 fi
15630 : see if there is a vfork
15631 val=''
15632 set vfork val
15633 eval $inlibc
15634
15635 d_pseudofork=$undef
15636
15637 : Ok, but do we want to use it. vfork is reportedly unreliable in
15638 : perl on Solaris 2.x, and probably elsewhere.
15639 case "$val" in
15640 $define)
15641         echo " "
15642         case "$usevfork" in
15643         false) dflt='n';;
15644         *) dflt='y';;
15645         esac
15646         cat <<'EOM'
15647
15648 Perl can only use a vfork() that doesn't suffer from strict
15649 restrictions on calling functions or modifying global data in
15650 the child.  For example, glibc-2.1 contains such a vfork()
15651 that is unsuitable.  If your system provides a proper fork()
15652 call, chances are that you do NOT want perl to use vfork().
15653
15654 EOM
15655         rp="Do you still want to use vfork()?"
15656         . ./myread
15657         case "$ans" in
15658         y|Y) ;;
15659         *)
15660                 echo "Ok, we won't use vfork()."
15661                 val="$undef"
15662                 ;;
15663         esac
15664         ;;
15665 esac
15666 set d_vfork
15667 eval $setvar
15668 case "$d_vfork" in
15669 $define) usevfork='true';;
15670 *) usevfork='false';;
15671 esac
15672
15673 : see whether the pthread_atfork exists
15674 $cat >try.c <<EOP
15675 #include <pthread.h>
15676 #include <stdio.h>
15677 int main() {
15678 #ifdef  PTHREAD_ATFORK
15679         pthread_atfork(NULL,NULL,NULL);
15680 #endif
15681 }
15682 EOP
15683
15684 : see if pthread_atfork exists
15685 set try -DPTHREAD_ATFORK
15686 if eval $compile; then
15687     val="$define"
15688 else
15689     val="$undef"
15690 fi
15691 case "$usethreads" in
15692 $define)
15693         case "$val" in
15694         $define) echo 'pthread_atfork found.' >&4        ;;
15695         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15696         esac
15697 esac
15698 set d_pthread_atfork
15699 eval $setvar
15700
15701 : see if pthread_attr_setscope exists
15702 set pthread_attr_setscope d_pthread_attr_setscope
15703 eval $inlibc
15704
15705
15706 : see whether the various POSIXish _yields exist
15707 $cat >try.c <<EOP
15708 #include <pthread.h>
15709 #include <stdio.h>
15710 int main() {
15711 #ifdef SCHED_YIELD
15712         sched_yield();
15713 #else
15714 #ifdef PTHREAD_YIELD
15715         pthread_yield();
15716 #else
15717 #ifdef PTHREAD_YIELD_NULL
15718         pthread_yield(NULL);
15719 #endif
15720 #endif
15721 #endif
15722 }
15723 EOP
15724 : see if sched_yield exists
15725 set try -DSCHED_YIELD
15726 if eval $compile; then
15727     val="$define"
15728     sched_yield='sched_yield()'
15729 else
15730     val="$undef"
15731 fi
15732 case "$usethreads" in
15733 $define)
15734         case "$val" in
15735         $define) echo 'sched_yield() found.' >&4        ;;
15736         *)       echo 'sched_yield() NOT found.' >&4    ;;
15737         esac
15738 esac
15739 set d_sched_yield
15740 eval $setvar
15741
15742 : see if pthread_yield exists
15743 set try -DPTHREAD_YIELD
15744 if eval $compile; then
15745     val="$define"
15746     case "$sched_yield" in
15747     '') sched_yield='pthread_yield()' ;;
15748     esac
15749 else
15750     set try -DPTHREAD_YIELD_NULL
15751     if eval $compile; then
15752         val="$define"
15753         case "$sched_yield" in
15754         '') sched_yield='pthread_yield(NULL)' ;;
15755         esac
15756     else
15757         val="$undef"
15758     fi
15759 fi
15760 case "$usethreads" in
15761 $define)
15762         case "$val" in
15763         $define) echo 'pthread_yield() found.' >&4      ;;
15764         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15765         esac
15766         ;;
15767 esac
15768 set d_pthread_yield
15769 eval $setvar
15770 case "$sched_yield" in
15771 '') sched_yield=undef ;;
15772 esac
15773 $rm_try
15774
15775 : see if random_r exists
15776 set random_r d_random_r
15777 eval $inlibc
15778 case "$d_random_r" in
15779 "$define")
15780         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15781         case "$d_random_r_proto:$usethreads" in
15782         ":define")      d_random_r_proto=define
15783                 set d_random_r_proto random_r $hdrs
15784                 eval $hasproto ;;
15785         *)      ;;
15786         esac
15787         case "$d_random_r_proto" in
15788         define)
15789         case "$random_r_proto" in
15790         ''|0) try='int random_r(int*, struct random_data*);'
15791         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15792         esac
15793         case "$random_r_proto" in
15794         ''|0) try='int random_r(long*, struct random_data*);'
15795         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15796         esac
15797         case "$random_r_proto" in
15798         ''|0) try='int random_r(struct random_data*, int32_t*);'
15799         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15800         esac
15801         case "$random_r_proto" in
15802         ''|0)   d_random_r=undef
15803                 random_r_proto=0
15804                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15805         * )     case "$random_r_proto" in
15806                 REENTRANT_PROTO*) ;;
15807                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15808                 esac
15809                 echo "Prototype: $try" ;;
15810         esac
15811         ;;
15812         *)      case "$usethreads" in
15813                 define) echo "random_r has no prototype, not using it." >&4 ;;
15814                 esac
15815                 d_random_r=undef
15816                 random_r_proto=0
15817                 ;;
15818         esac
15819         ;;
15820 *)      random_r_proto=0
15821         ;;
15822 esac
15823
15824 : see if readdir and friends exist
15825 set readdir d_readdir
15826 eval $inlibc
15827 set seekdir d_seekdir
15828 eval $inlibc
15829 set telldir d_telldir
15830 eval $inlibc
15831 set rewinddir d_rewinddir
15832 eval $inlibc
15833
15834 : see if readdir64_r exists
15835 set readdir64_r d_readdir64_r
15836 eval $inlibc
15837 case "$d_readdir64_r" in
15838 "$define")
15839         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15840         case "$d_readdir64_r_proto:$usethreads" in
15841         ":define")      d_readdir64_r_proto=define
15842                 set d_readdir64_r_proto readdir64_r $hdrs
15843                 eval $hasproto ;;
15844         *)      ;;
15845         esac
15846         case "$d_readdir64_r_proto" in
15847         define)
15848         case "$readdir64_r_proto" in
15849         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15850         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15851         esac
15852         case "$readdir64_r_proto" in
15853         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15854         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15855         esac
15856         case "$readdir64_r_proto" in
15857         ''|0)   d_readdir64_r=undef
15858                 readdir64_r_proto=0
15859                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15860         * )     case "$readdir64_r_proto" in
15861                 REENTRANT_PROTO*) ;;
15862                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15863                 esac
15864                 echo "Prototype: $try" ;;
15865         esac
15866         ;;
15867         *)      case "$usethreads" in
15868                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15869                 esac
15870                 d_readdir64_r=undef
15871                 readdir64_r_proto=0
15872                 ;;
15873         esac
15874         ;;
15875 *)      readdir64_r_proto=0
15876         ;;
15877 esac
15878
15879 : see if readdir_r exists
15880 set readdir_r d_readdir_r
15881 eval $inlibc
15882 case "$d_readdir_r" in
15883 "$define")
15884         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15885         case "$d_readdir_r_proto:$usethreads" in
15886         ":define")      d_readdir_r_proto=define
15887                 set d_readdir_r_proto readdir_r $hdrs
15888                 eval $hasproto ;;
15889         *)      ;;
15890         esac
15891         case "$d_readdir_r_proto" in
15892         define)
15893         case "$readdir_r_proto" in
15894         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15895         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15896         esac
15897         case "$readdir_r_proto" in
15898         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15899         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15900         esac
15901         case "$readdir_r_proto" in
15902         ''|0)   d_readdir_r=undef
15903                 readdir_r_proto=0
15904                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15905         * )     case "$readdir_r_proto" in
15906                 REENTRANT_PROTO*) ;;
15907                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15908                 esac
15909                 echo "Prototype: $try" ;;
15910         esac
15911         ;;
15912         *)      case "$usethreads" in
15913                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15914                 esac
15915                 d_readdir_r=undef
15916                 readdir_r_proto=0
15917                 ;;
15918         esac
15919         ;;
15920 *)      readdir_r_proto=0
15921         ;;
15922 esac
15923
15924 : see if readv exists
15925 set readv d_readv
15926 eval $inlibc
15927
15928 : see if recvmsg exists
15929 set recvmsg d_recvmsg
15930 eval $inlibc
15931
15932 : see if rename exists
15933 set rename d_rename
15934 eval $inlibc
15935
15936 : see if rmdir exists
15937 set rmdir d_rmdir
15938 eval $inlibc
15939
15940 : see if memory.h is available.
15941 val=''
15942 set memory.h val
15943 eval $inhdr
15944
15945 : See if it conflicts with string.h
15946 case "$val" in
15947 $define)
15948         case "$strings" in
15949         '') ;;
15950         *)
15951                 $cppstdin $cppflags $cppminus < $strings > mem.h
15952                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15953                         echo " "
15954                         echo "We won't be including <memory.h>."
15955                         val="$undef"
15956                 fi
15957                 $rm -f mem.h
15958                 ;;
15959         esac
15960 esac
15961 set i_memory
15962 eval $setvar
15963
15964 : can bcopy handle overlapping blocks?
15965 echo " "
15966 val="$undef"
15967 case "$d_memmove" in
15968 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15969 *)      case "$d_bcopy" in
15970         "$define")
15971                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15972                 $cat >try.c <<EOCP
15973 #$i_memory I_MEMORY
15974 #$i_stdlib I_STDLIB
15975 #$i_string I_STRING
15976 #$i_unistd I_UNISTD
15977 EOCP
15978         $cat >>try.c <<'EOCP'
15979 #include <stdio.h>
15980 #ifdef I_MEMORY
15981 #  include <memory.h>
15982 #endif
15983 #ifdef I_STDLIB
15984 #  include <stdlib.h>
15985 #endif
15986 #ifdef I_STRING
15987 #  include <string.h>
15988 #else
15989 #  include <strings.h>
15990 #endif
15991 #ifdef I_UNISTD
15992 #  include <unistd.h>  /* Needed for NetBSD */
15993 #endif
15994 int main()
15995 {
15996 char buf[128], abc[128];
15997 char *b;
15998 int len;
15999 int off;
16000 int align;
16001
16002 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16003    try to store the string in read-only memory. */
16004 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16005
16006 for (align = 7; align >= 0; align--) {
16007         for (len = 36; len; len--) {
16008                 b = buf+align;
16009                 bcopy(abc, b, len);
16010                 for (off = 1; off <= len; off++) {
16011                         bcopy(b, b+off, len);
16012                         bcopy(b+off, b, len);
16013                         if (bcmp(b, abc, len))
16014                                 exit(1);
16015                 }
16016         }
16017 }
16018 exit(0);
16019 }
16020 EOCP
16021                 set try
16022                 if eval $compile_ok; then
16023                         if $run ./try 2>/dev/null; then
16024                                 echo "Yes, it can."
16025                                 val="$define"
16026                         else
16027                                 echo "It can't, sorry."
16028                         fi
16029                 else
16030                         echo "(I can't compile the test program, so we'll assume not...)"
16031                 fi
16032                 ;;
16033         esac
16034         $rm_try
16035         ;;
16036 esac
16037 set d_safebcpy
16038 eval $setvar
16039
16040 : can memcpy handle overlapping blocks?
16041 echo " "
16042 val="$undef"
16043 case "$d_memmove" in
16044 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16045 *)      case "$d_memcpy" in
16046         "$define")
16047                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16048                 $cat >try.c <<EOCP
16049 #$i_memory I_MEMORY
16050 #$i_stdlib I_STDLIB
16051 #$i_string I_STRING
16052 #$i_unistd I_UNISTD
16053 EOCP
16054         $cat >>try.c <<'EOCP'
16055 #include <stdio.h>
16056 #ifdef I_MEMORY
16057 #  include <memory.h>
16058 #endif
16059 #ifdef I_STDLIB
16060 #  include <stdlib.h>
16061 #endif
16062 #ifdef I_STRING
16063 #  include <string.h>
16064 #else
16065 #  include <strings.h>
16066 #endif
16067 #ifdef I_UNISTD
16068 #  include <unistd.h>  /* Needed for NetBSD */
16069 #endif
16070 int main()
16071 {
16072 char buf[128], abc[128];
16073 char *b;
16074 int len;
16075 int off;
16076 int align;
16077
16078 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16079    try to store the string in read-only memory. */
16080 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16081
16082 for (align = 7; align >= 0; align--) {
16083         for (len = 36; len; len--) {
16084                 b = buf+align;
16085                 memcpy(b, abc, len);
16086                 for (off = 1; off <= len; off++) {
16087                         memcpy(b+off, b, len);
16088                         memcpy(b, b+off, len);
16089                         if (memcmp(b, abc, len))
16090                                 exit(1);
16091                 }
16092         }
16093 }
16094 exit(0);
16095 }
16096 EOCP
16097                 set try
16098                 if eval $compile_ok; then
16099                         if $run ./try 2>/dev/null; then
16100                                 echo "Yes, it can."
16101                                 val="$define"
16102                         else
16103                                 echo "It can't, sorry."
16104                         fi
16105                 else
16106                         echo "(I can't compile the test program, so we'll assume not...)"
16107                 fi
16108                 ;;
16109         esac
16110         $rm_try
16111         ;;
16112 esac
16113 set d_safemcpy
16114 eval $setvar
16115
16116 : can memcmp be trusted to compare relative magnitude?
16117 val="$undef"
16118 case "$d_memcmp" in
16119 "$define")
16120         echo " "
16121         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16122         $cat >try.c <<EOCP
16123 #$i_memory I_MEMORY
16124 #$i_stdlib I_STDLIB
16125 #$i_string I_STRING
16126 #$i_unistd I_UNISTD
16127 EOCP
16128         $cat >>try.c <<'EOCP'
16129 #include <stdio.h>
16130 #ifdef I_MEMORY
16131 #  include <memory.h>
16132 #endif
16133 #ifdef I_STDLIB
16134 #  include <stdlib.h>
16135 #endif
16136 #ifdef I_STRING
16137 #  include <string.h>
16138 #else
16139 #  include <strings.h>
16140 #endif
16141 #ifdef I_UNISTD
16142 #  include <unistd.h>  /* Needed for NetBSD */
16143 #endif
16144 int main()
16145 {
16146 char a = -1;
16147 char b = 0;
16148 if ((a < b) && memcmp(&a, &b, 1) < 0)
16149         exit(1);
16150 exit(0);
16151 }
16152 EOCP
16153         set try
16154         if eval $compile_ok; then
16155                 if $run ./try 2>/dev/null; then
16156                         echo "Yes, it can."
16157                         val="$define"
16158                 else
16159                         echo "No, it can't (it uses signed chars)."
16160                 fi
16161         else
16162                 echo "(I can't compile the test program, so we'll assume not...)"
16163         fi
16164         ;;
16165 esac
16166 $rm_try
16167 set d_sanemcmp
16168 eval $setvar
16169
16170 : see if prototype for sbrk is available
16171 echo " "
16172 set d_sbrkproto sbrk $i_unistd unistd.h
16173 eval $hasproto
16174
16175 : see if select exists
16176 set select d_select
16177 eval $inlibc
16178
16179 : see if semctl exists
16180 set semctl d_semctl
16181 eval $inlibc
16182
16183 : see if semget exists
16184 set semget d_semget
16185 eval $inlibc
16186
16187 : see if semop exists
16188 set semop d_semop
16189 eval $inlibc
16190
16191 : see how much of the 'sem*(2)' library is present.
16192 h_sem=true
16193 echo " "
16194 case "$d_semctl$d_semget$d_semop" in
16195 *"$undef"*) h_sem=false;;
16196 esac
16197 case "$osname" in
16198 freebsd)
16199     case "`ipcs 2>&1`" in
16200     "SVID messages"*"not configured"*)
16201         echo "Your $osname does not have the sem*(2) configured." >&4
16202         h_sem=false
16203         val="$undef"
16204         set semctl d_semctl
16205         eval $setvar
16206         set semget d_semget
16207         eval $setvar
16208         set semop d_semop
16209         eval $setvar
16210         ;;
16211     esac
16212     ;;
16213 esac
16214 : we could also check for sys/ipc.h ...
16215 if $h_sem && $test `./findhdr sys/sem.h`; then
16216         echo "You have the full sem*(2) library." >&4
16217         val="$define"
16218 else
16219         echo "You don't have the full sem*(2) library." >&4
16220         val="$undef"
16221 fi
16222 set d_sem
16223 eval $setvar
16224
16225 : see whether sys/sem.h defines union semun
16226 echo " "
16227 $cat > try.c <<'END'
16228 #include <sys/types.h>
16229 #include <sys/ipc.h>
16230 #include <sys/sem.h>
16231 int main () { union semun semun; semun.buf = 0; }
16232 END
16233 set try
16234 if eval $compile; then
16235     echo "You have union semun in <sys/sem.h>." >&4
16236     val="$define"
16237 else
16238     echo "You do not have union semun in <sys/sem.h>." >&4
16239     val="$undef"
16240 fi
16241 $rm_try
16242 set d_union_semun
16243 eval $setvar
16244
16245 : see how to do semctl IPC_STAT
16246 case "$d_sem" in
16247 $define)
16248     echo " "
16249     $cat > tryh.h <<END
16250 #ifndef S_IRUSR
16251 #   ifdef S_IREAD
16252 #       define S_IRUSR S_IREAD
16253 #       define S_IWUSR S_IWRITE
16254 #       define S_IXUSR S_IEXEC
16255 #   else
16256 #       define S_IRUSR 0400
16257 #       define S_IWUSR 0200
16258 #       define S_IXUSR 0100
16259 #   endif
16260 #   define S_IRGRP (S_IRUSR>>3)
16261 #   define S_IWGRP (S_IWUSR>>3)
16262 #   define S_IXGRP (S_IXUSR>>3)
16263 #   define S_IROTH (S_IRUSR>>6)
16264 #   define S_IWOTH (S_IWUSR>>6)
16265 #   define S_IXOTH (S_IXUSR>>6)
16266 #endif
16267 #ifndef S_IRWXU
16268 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16269 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16270 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16271 #endif
16272 END
16273     : see whether semctl IPC_STAT can use union semun
16274     case "$d_semctl_semun" in
16275     '')
16276       val="$undef"
16277       $cat > try.c <<END
16278 #include <sys/types.h>
16279 #include <sys/ipc.h>
16280 #include <sys/sem.h>
16281 #include <sys/stat.h>
16282 #include <stdio.h>
16283 #include <errno.h>
16284 #include "tryh.h"
16285 #ifndef errno
16286 extern int errno;
16287 #endif
16288 #$d_union_semun HAS_UNION_SEMUN
16289 int main() {
16290     union semun
16291 #ifndef HAS_UNION_SEMUN
16292     {
16293         int val;
16294         struct semid_ds *buf;
16295         unsigned short *array;
16296     }
16297 #endif
16298     arg;
16299     int sem, st;
16300
16301 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16302     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16303     if (sem > -1) {
16304         struct semid_ds argbuf;
16305         arg.buf = &argbuf;
16306 #       ifdef IPC_STAT
16307         st = semctl(sem, 0, IPC_STAT, arg);
16308         if (st == 0)
16309             printf("semun\n");
16310         else
16311 #       endif /* IPC_STAT */
16312             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16313 #       ifdef IPC_RMID
16314         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16315 #       endif /* IPC_RMID */
16316             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16317     } else
16318 #endif /* IPC_PRIVATE && ... */
16319         printf("semget failed: errno = %d\n", errno);
16320   return 0;
16321 }
16322 END
16323       set try
16324       if eval $compile; then
16325           xxx=`$run ./try`
16326           case "$xxx" in
16327           semun) val="$define" ;;
16328           esac
16329       fi
16330       $rm_try
16331       set d_semctl_semun
16332       eval $setvar
16333       ;;
16334     esac
16335     case "$d_semctl_semun" in
16336     $define)
16337         echo "You can use union semun for semctl IPC_STAT." >&4
16338         also='also'
16339         ;;
16340     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16341         also=''
16342         ;;
16343     esac
16344
16345     : see whether semctl IPC_STAT can use struct semid_ds pointer
16346     case "$d_semctl_semid_ds" in
16347     '')
16348       val="$undef"
16349       $cat > try.c <<'END'
16350 #include <sys/types.h>
16351 #include <sys/ipc.h>
16352 #include <sys/sem.h>
16353 #include <sys/stat.h>
16354 #include "tryh.h"
16355 #include <stdio.h>
16356 #include <errno.h>
16357 #ifndef errno
16358 extern int errno;
16359 #endif
16360 int main() {
16361     struct semid_ds arg;
16362     int sem, st;
16363
16364 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16365     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16366     if (sem > -1) {
16367 #       ifdef IPC_STAT
16368         st = semctl(sem, 0, IPC_STAT, &arg);
16369         if (st == 0)
16370             printf("semid_ds\n");
16371         else
16372 #       endif /* IPC_STAT */
16373             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16374 #       ifdef IPC_RMID
16375         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16376 #       endif /* IPC_RMID */
16377             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16378     } else
16379 #endif /* IPC_PRIVATE && ... */
16380         printf("semget failed: errno = %d\n", errno);
16381
16382     return 0;
16383 }
16384 END
16385       set try
16386       if eval $compile; then
16387           xxx=`$run ./try`
16388           case "$xxx" in
16389           semid_ds) val="$define" ;;
16390           esac
16391       fi
16392       $rm_try
16393       set d_semctl_semid_ds
16394       eval $setvar
16395       ;;
16396     esac
16397     case "$d_semctl_semid_ds" in
16398     $define)
16399         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16400         ;;
16401     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16402         ;;
16403     esac
16404     ;;
16405 *)  val="$undef"
16406
16407     # We do not have the full sem*(2) library, so assume we can not
16408     # use either.
16409
16410     set d_semctl_semun
16411     eval $setvar
16412
16413     set d_semctl_semid_ds
16414     eval $setvar
16415     ;;
16416 esac
16417 $rm_try tryh.h
16418
16419 : see if sendmsg exists
16420 set sendmsg d_sendmsg
16421 eval $inlibc
16422
16423 : see if setegid exists
16424 set setegid d_setegid
16425 eval $inlibc
16426
16427 : see if seteuid exists
16428 set seteuid d_seteuid
16429 eval $inlibc
16430
16431 : see if setgrent exists
16432 set setgrent d_setgrent
16433 eval $inlibc
16434
16435 : see if setgrent_r exists
16436 set setgrent_r d_setgrent_r
16437 eval $inlibc
16438 case "$d_setgrent_r" in
16439 "$define")
16440         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16441         case "$d_setgrent_r_proto:$usethreads" in
16442         ":define")      d_setgrent_r_proto=define
16443                 set d_setgrent_r_proto setgrent_r $hdrs
16444                 eval $hasproto ;;
16445         *)      ;;
16446         esac
16447         case "$d_setgrent_r_proto" in
16448         define)
16449         case "$setgrent_r_proto" in
16450         ''|0) try='int setgrent_r(FILE**);'
16451         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16452         esac
16453         case "$setgrent_r_proto" in
16454         ''|0) try='void setgrent_r(FILE**);'
16455         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16456         esac
16457         case "$setgrent_r_proto" in
16458         ''|0)   d_setgrent_r=undef
16459                 setgrent_r_proto=0
16460                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16461         * )     case "$setgrent_r_proto" in
16462                 REENTRANT_PROTO*) ;;
16463                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16464                 esac
16465                 echo "Prototype: $try" ;;
16466         esac
16467         ;;
16468         *)      case "$usethreads" in
16469                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16470                 esac
16471                 d_setgrent_r=undef
16472                 setgrent_r_proto=0
16473                 ;;
16474         esac
16475         ;;
16476 *)      setgrent_r_proto=0
16477         ;;
16478 esac
16479
16480 : see if sethostent exists
16481 set sethostent d_sethent
16482 eval $inlibc
16483
16484 : see if sethostent_r exists
16485 set sethostent_r d_sethostent_r
16486 eval $inlibc
16487 case "$d_sethostent_r" in
16488 "$define")
16489         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16490         case "$d_sethostent_r_proto:$usethreads" in
16491         ":define")      d_sethostent_r_proto=define
16492                 set d_sethostent_r_proto sethostent_r $hdrs
16493                 eval $hasproto ;;
16494         *)      ;;
16495         esac
16496         case "$d_sethostent_r_proto" in
16497         define)
16498         case "$sethostent_r_proto" in
16499         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16500         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16501         esac
16502         case "$sethostent_r_proto" in
16503         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16504         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16505         esac
16506         case "$sethostent_r_proto" in
16507         ''|0)   d_sethostent_r=undef
16508                 sethostent_r_proto=0
16509                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16510         * )     case "$sethostent_r_proto" in
16511                 REENTRANT_PROTO*) ;;
16512                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16513                 esac
16514                 echo "Prototype: $try" ;;
16515         esac
16516         ;;
16517         *)      case "$usethreads" in
16518                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16519                 esac
16520                 d_sethostent_r=undef
16521                 sethostent_r_proto=0
16522                 ;;
16523         esac
16524         ;;
16525 *)      sethostent_r_proto=0
16526         ;;
16527 esac
16528
16529 : see if setitimer exists
16530 set setitimer d_setitimer
16531 eval $inlibc
16532
16533 : see if setlinebuf exists
16534 set setlinebuf d_setlinebuf
16535 eval $inlibc
16536
16537 : see if setlocale exists
16538 set setlocale d_setlocale
16539 eval $inlibc
16540
16541 : see if locale.h is available
16542 set locale.h i_locale
16543 eval $inhdr
16544
16545 : see if setlocale_r exists
16546 set setlocale_r d_setlocale_r
16547 eval $inlibc
16548 case "$d_setlocale_r" in
16549 "$define")
16550         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16551         case "$d_setlocale_r_proto:$usethreads" in
16552         ":define")      d_setlocale_r_proto=define
16553                 set d_setlocale_r_proto setlocale_r $hdrs
16554                 eval $hasproto ;;
16555         *)      ;;
16556         esac
16557         case "$d_setlocale_r_proto" in
16558         define)
16559         case "$setlocale_r_proto" in
16560         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16561         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16562         esac
16563         case "$setlocale_r_proto" in
16564         ''|0)   d_setlocale_r=undef
16565                 setlocale_r_proto=0
16566                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16567         * )     case "$setlocale_r_proto" in
16568                 REENTRANT_PROTO*) ;;
16569                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16570                 esac
16571                 echo "Prototype: $try" ;;
16572         esac
16573         ;;
16574         *)      case "$usethreads" in
16575                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16576                 esac
16577                 d_setlocale_r=undef
16578                 setlocale_r_proto=0
16579                 ;;
16580         esac
16581         ;;
16582 *)      setlocale_r_proto=0
16583         ;;
16584 esac
16585
16586 : see if setnetent exists
16587 set setnetent d_setnent
16588 eval $inlibc
16589
16590 : see if setnetent_r exists
16591 set setnetent_r d_setnetent_r
16592 eval $inlibc
16593 case "$d_setnetent_r" in
16594 "$define")
16595         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16596         case "$d_setnetent_r_proto:$usethreads" in
16597         ":define")      d_setnetent_r_proto=define
16598                 set d_setnetent_r_proto setnetent_r $hdrs
16599                 eval $hasproto ;;
16600         *)      ;;
16601         esac
16602         case "$d_setnetent_r_proto" in
16603         define)
16604         case "$setnetent_r_proto" in
16605         ''|0) try='int setnetent_r(int, struct netent_data*);'
16606         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16607         esac
16608         case "$setnetent_r_proto" in
16609         ''|0) try='void setnetent_r(int, struct netent_data*);'
16610         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16611         esac
16612         case "$setnetent_r_proto" in
16613         ''|0)   d_setnetent_r=undef
16614                 setnetent_r_proto=0
16615                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16616         * )     case "$setnetent_r_proto" in
16617                 REENTRANT_PROTO*) ;;
16618                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16619                 esac
16620                 echo "Prototype: $try" ;;
16621         esac
16622         ;;
16623         *)      case "$usethreads" in
16624                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16625                 esac
16626                 d_setnetent_r=undef
16627                 setnetent_r_proto=0
16628                 ;;
16629         esac
16630         ;;
16631 *)      setnetent_r_proto=0
16632         ;;
16633 esac
16634
16635 : see if setprotoent exists
16636 set setprotoent d_setpent
16637 eval $inlibc
16638
16639 : see if setpgid exists
16640 set setpgid d_setpgid
16641 eval $inlibc
16642
16643 : see if setpgrp2 exists
16644 set setpgrp2 d_setpgrp2
16645 eval $inlibc
16646
16647 : see if setpriority exists
16648 set setpriority d_setprior
16649 eval $inlibc
16650
16651 : see if setproctitle exists
16652 set setproctitle d_setproctitle
16653 eval $inlibc
16654
16655 : see if setprotoent_r exists
16656 set setprotoent_r d_setprotoent_r
16657 eval $inlibc
16658 case "$d_setprotoent_r" in
16659 "$define")
16660         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16661         case "$d_setprotoent_r_proto:$usethreads" in
16662         ":define")      d_setprotoent_r_proto=define
16663                 set d_setprotoent_r_proto setprotoent_r $hdrs
16664                 eval $hasproto ;;
16665         *)      ;;
16666         esac
16667         case "$d_setprotoent_r_proto" in
16668         define)
16669         case "$setprotoent_r_proto" in
16670         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16671         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16672         esac
16673         case "$setprotoent_r_proto" in
16674         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16675         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16676         esac
16677         case "$setprotoent_r_proto" in
16678         ''|0)   d_setprotoent_r=undef
16679                 setprotoent_r_proto=0
16680                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16681         * )     case "$setprotoent_r_proto" in
16682                 REENTRANT_PROTO*) ;;
16683                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16684                 esac
16685                 echo "Prototype: $try" ;;
16686         esac
16687         ;;
16688         *)      case "$usethreads" in
16689                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16690                 esac
16691                 d_setprotoent_r=undef
16692                 setprotoent_r_proto=0
16693                 ;;
16694         esac
16695         ;;
16696 *)      setprotoent_r_proto=0
16697         ;;
16698 esac
16699
16700 : see if setpwent exists
16701 set setpwent d_setpwent
16702 eval $inlibc
16703
16704 : see if setpwent_r exists
16705 set setpwent_r d_setpwent_r
16706 eval $inlibc
16707 case "$d_setpwent_r" in
16708 "$define")
16709         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16710         case "$d_setpwent_r_proto:$usethreads" in
16711         ":define")      d_setpwent_r_proto=define
16712                 set d_setpwent_r_proto setpwent_r $hdrs
16713                 eval $hasproto ;;
16714         *)      ;;
16715         esac
16716         case "$d_setpwent_r_proto" in
16717         define)
16718         case "$setpwent_r_proto" in
16719         ''|0) try='int setpwent_r(FILE**);'
16720         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16721         esac
16722         case "$setpwent_r_proto" in
16723         ''|0) try='void setpwent_r(FILE**);'
16724         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16725         esac
16726         case "$setpwent_r_proto" in
16727         ''|0)   d_setpwent_r=undef
16728                 setpwent_r_proto=0
16729                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16730         * )     case "$setpwent_r_proto" in
16731                 REENTRANT_PROTO*) ;;
16732                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16733                 esac
16734                 echo "Prototype: $try" ;;
16735         esac
16736         ;;
16737         *)      case "$usethreads" in
16738                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16739                 esac
16740                 d_setpwent_r=undef
16741                 setpwent_r_proto=0
16742                 ;;
16743         esac
16744         ;;
16745 *)      setpwent_r_proto=0
16746         ;;
16747 esac
16748
16749 : see if setregid exists
16750 set setregid d_setregid
16751 eval $inlibc
16752 set setresgid d_setresgid
16753 eval $inlibc
16754
16755 : see if setreuid exists
16756 set setreuid d_setreuid
16757 eval $inlibc
16758 set setresuid d_setresuid
16759 eval $inlibc
16760
16761 : see if setrgid exists
16762 set setrgid d_setrgid
16763 eval $inlibc
16764
16765 : see if setruid exists
16766 set setruid d_setruid
16767 eval $inlibc
16768
16769 : see if setservent exists
16770 set setservent d_setsent
16771 eval $inlibc
16772
16773 : see if setservent_r exists
16774 set setservent_r d_setservent_r
16775 eval $inlibc
16776 case "$d_setservent_r" in
16777 "$define")
16778         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16779         case "$d_setservent_r_proto:$usethreads" in
16780         ":define")      d_setservent_r_proto=define
16781                 set d_setservent_r_proto setservent_r $hdrs
16782                 eval $hasproto ;;
16783         *)      ;;
16784         esac
16785         case "$d_setservent_r_proto" in
16786         define)
16787         case "$setservent_r_proto" in
16788         ''|0) try='int setservent_r(int, struct servent_data*);'
16789         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16790         esac
16791         case "$setservent_r_proto" in
16792         ''|0) try='void setservent_r(int, struct servent_data*);'
16793         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16794         esac
16795         case "$setservent_r_proto" in
16796         ''|0)   d_setservent_r=undef
16797                 setservent_r_proto=0
16798                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16799         * )     case "$setservent_r_proto" in
16800                 REENTRANT_PROTO*) ;;
16801                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16802                 esac
16803                 echo "Prototype: $try" ;;
16804         esac
16805         ;;
16806         *)      case "$usethreads" in
16807                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16808                 esac
16809                 d_setservent_r=undef
16810                 setservent_r_proto=0
16811                 ;;
16812         esac
16813         ;;
16814 *)      setservent_r_proto=0
16815         ;;
16816 esac
16817
16818 : see if setsid exists
16819 set setsid d_setsid
16820 eval $inlibc
16821
16822 : see if setvbuf exists
16823 set setvbuf d_setvbuf
16824 eval $inlibc
16825
16826 : see if sfio.h is available
16827 set sfio.h i_sfio
16828 eval $inhdr
16829
16830
16831 : see if sfio library is available
16832 case "$i_sfio" in
16833 $define)
16834         val=''
16835         set sfreserve val
16836         eval $inlibc
16837         ;;
16838 *)
16839         val="$undef"
16840         ;;
16841 esac
16842 : Ok, but do we want to use it.
16843 case "$val" in
16844 $define)
16845         case "$usesfio" in
16846         true|$define|[yY]*) dflt='y';;
16847         *) dflt='n';;
16848         esac
16849         echo "$package can use the sfio library, but it is experimental."
16850         case "$useperlio" in
16851         "$undef")
16852             echo "For sfio also the PerlIO abstraction layer is needed."
16853             echo "Earlier you said you wouldn't want that."
16854             ;;
16855         esac
16856         rp="You seem to have sfio available, do you want to try using it?"
16857         . ./myread
16858         case "$ans" in
16859         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16860                 useperlio="$define"
16861                 val="$define"
16862                 ;;
16863         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16864                 val="$undef"
16865                 ;;
16866         esac
16867         ;;
16868 *)      case "$usesfio" in
16869         true|$define|[yY]*)
16870                 echo "Sorry, cannot find sfio on this machine." >&4
16871                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16872                 val="$undef"
16873                 ;;
16874         esac
16875         ;;
16876 esac
16877 set d_sfio
16878 eval $setvar
16879 case "$d_sfio" in
16880 $define) usesfio='true';;
16881 *) usesfio='false';;
16882 esac
16883 case "$d_sfio" in
16884 $define) ;;
16885 *)      : Remove sfio from list of libraries to use
16886         case "$libs" in
16887         *-lsfio*)
16888                 echo "Removing unneeded -lsfio from library list" >&4
16889                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16890                 shift
16891                 libs="$*"
16892                 echo "libs = $libs" >&4
16893                 ;;
16894         esac
16895 ;;
16896 esac
16897
16898
16899 : see if shmctl exists
16900 set shmctl d_shmctl
16901 eval $inlibc
16902
16903 : see if shmget exists
16904 set shmget d_shmget
16905 eval $inlibc
16906
16907 : see if shmat exists
16908 set shmat d_shmat
16909 eval $inlibc
16910 : see what shmat returns
16911 case "$d_shmat" in
16912 "$define")
16913         $cat >shmat.c <<'END'
16914 #include <sys/shm.h>
16915 void *shmat();
16916 END
16917         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16918                 shmattype='void *'
16919         else
16920                 shmattype='char *'
16921         fi
16922         echo "and it returns ($shmattype)." >&4
16923         : see if a prototype for shmat is available
16924         xxx=`./findhdr sys/shm.h`
16925         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16926         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16927                 val="$define"
16928         else
16929                 val="$undef"
16930         fi
16931         $rm -f shmat.[co]
16932         ;;
16933 *)
16934         val="$undef"
16935         ;;
16936 esac
16937 set d_shmatprototype
16938 eval $setvar
16939
16940 : see if shmdt exists
16941 set shmdt d_shmdt
16942 eval $inlibc
16943
16944 : see how much of the 'shm*(2)' library is present.
16945 h_shm=true
16946 echo " "
16947 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16948 *"$undef"*) h_shm=false;;
16949 esac
16950 case "$osname" in
16951 freebsd)
16952     case "`ipcs 2>&1`" in
16953     "SVID shared memory"*"not configured"*)
16954         echo "Your $osname does not have the shm*(2) configured." >&4
16955         h_shm=false
16956         val="$undef"
16957         set shmctl d_shmctl
16958         evat $setvar
16959         set shmget d_shmget
16960         evat $setvar
16961         set shmat d_shmat
16962         evat $setvar
16963         set shmdt d_shmdt
16964         evat $setvar
16965         ;;
16966     esac
16967     ;;
16968 esac
16969 : we could also check for sys/ipc.h ...
16970 if $h_shm && $test `./findhdr sys/shm.h`; then
16971         echo "You have the full shm*(2) library." >&4
16972         val="$define"
16973 else
16974         echo "You don't have the full shm*(2) library." >&4
16975         val="$undef"
16976 fi
16977 set d_shm
16978 eval $setvar
16979
16980 echo " "
16981 : see if we have sigaction
16982 if set sigaction val -f d_sigaction; eval $csym; $val; then
16983         echo 'sigaction() found.' >&4
16984         $cat > try.c <<EOP
16985 #include <stdio.h>
16986 #include <sys/types.h>
16987 #include <signal.h>
16988 #$i_stdlib I_STDLIB
16989 #ifdef I_STDLIB
16990 #include <stdlib.h>
16991 #endif
16992 int main()
16993 {
16994     struct sigaction act, oact;
16995     act.sa_flags = 0;
16996     oact.sa_handler = 0;
16997     /* so that act and oact are used */
16998     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16999 }
17000 EOP
17001         set try
17002         if eval $compile_ok; then
17003                 val="$define"
17004         else
17005                 echo "But you don't seem to have a useable struct sigaction." >&4
17006                 val="$undef"
17007         fi
17008 else
17009         echo 'sigaction NOT found.' >&4
17010         val="$undef"
17011 fi
17012 set d_sigaction; eval $setvar
17013 $rm_try
17014
17015 : see if this is a sunmath.h system
17016 set sunmath.h i_sunmath
17017 eval $inhdr
17018
17019 : see if signbit exists
17020 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17021 $cat >try.c <<EOCP
17022 #$i_math I_MATH
17023 #$i_sunmath I_SUNMATH
17024 #ifdef I_MATH
17025 #  include <math.h>
17026 #endif
17027 #ifdef I_SUNMATH  /* Solaris special math library */
17028 #  include <sunmath.h>
17029 #endif
17030 #define NV $nvtype
17031 int main(int argc, char **argv)
17032 {
17033     NV x = 0.0;
17034     NV y = -0.0;
17035     if ((signbit(x) == 0) && (signbit(y) != 0))
17036         return 0;
17037     else
17038         return 1;
17039 }
17040 EOCP
17041 val="$undef"
17042 set try
17043 if eval $compile; then
17044     if $run ./try; then
17045         $echo "Yes." >&4
17046         val="$define"
17047     else
17048         $echo "Signbit seems to be available, but doesn't work as I expected."
17049         $echo "I won't use it." >&4
17050         val="$undef"
17051     fi
17052 else
17053     $echo "Nope." >&4
17054     dflt="$undef"
17055 fi
17056 set d_signbit
17057 eval $setvar
17058 $rm_try
17059
17060 : see if sigprocmask exists
17061 set sigprocmask d_sigprocmask
17062 eval $inlibc
17063
17064 : see if sigsetjmp exists
17065 echo " "
17066 case "$d_sigsetjmp" in
17067 '')
17068         $cat >try.c <<EOP
17069 #include <setjmp.h>
17070 #$i_stdlib I_STDLIB
17071 #ifdef I_STDLIB
17072 #include <stdlib.h>
17073 #endif
17074 sigjmp_buf env;
17075 int set = 1;
17076 int main()
17077 {
17078         if (sigsetjmp(env,1))
17079                 exit(set);
17080         set = 0;
17081         siglongjmp(env, 1);
17082         exit(1);
17083 }
17084 EOP
17085         set try
17086         if eval $compile; then
17087                 if $run ./try >/dev/null 2>&1; then
17088                         echo "POSIX sigsetjmp found." >&4
17089                         val="$define"
17090                 else
17091                         $cat >&4 <<EOM
17092 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17093 I'll ignore them.
17094 EOM
17095                         val="$undef"
17096                 fi
17097         else
17098                 echo "sigsetjmp not found." >&4
17099                 val="$undef"
17100         fi
17101         ;;
17102 *) val="$d_sigsetjmp"
17103         case "$d_sigsetjmp" in
17104         $define) echo "POSIX sigsetjmp found." >&4;;
17105         $undef) echo "sigsetjmp not found." >&4;;
17106         esac
17107         ;;
17108 esac
17109 set d_sigsetjmp
17110 eval $setvar
17111 $rm_try
17112
17113 : see if snprintf exists
17114 set snprintf d_snprintf
17115 eval $inlibc
17116
17117 : see if vsnprintf exists
17118 set vsnprintf d_vsnprintf
17119 eval $inlibc
17120
17121 case "$d_snprintf-$d_vsnprintf" in
17122 "$define-$define")
17123     $cat <<EOM
17124 Checking whether your snprintf() and vsnprintf() work okay...
17125 EOM
17126     $cat >try.c <<'EOCP'
17127 /* v?snprintf testing logic courtesy of Russ Allbery.
17128  * According to C99:
17129  * - if the buffer is too short it still must be \0-terminated
17130  * - if the buffer is too short the potentially required length
17131  *   must be returned and not -1
17132  * - if the buffer is NULL the potentially required length
17133  *   must be returned and not -1 or core dump
17134  */
17135 #include <stdio.h>
17136 #include <stdarg.h>
17137
17138 char buf[2];
17139
17140 int test (char *format, ...)
17141 {
17142     va_list args;
17143     int count;
17144
17145     va_start (args, format);
17146     count = vsnprintf (buf, sizeof buf, format, args);
17147     va_end (args);
17148     return count;
17149 }
17150
17151 int main ()
17152 {
17153     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17154              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17155 }
17156 EOCP
17157     set try
17158     if eval $compile; then
17159         `$run ./try`
17160         case "$?" in
17161         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17162         *) cat <<EOM >&4
17163 Your snprintf() and snprintf() don't seem to be working okay.
17164 EOM
17165            d_snprintf="$undef"
17166            d_vsnprintf="$undef"
17167            ;;
17168         esac
17169     else
17170         echo "(I can't seem to compile the test program--assuming they don't)"
17171         d_snprintf="$undef"
17172         d_vsnprintf="$undef"
17173     fi
17174     $rm_try
17175     ;;
17176 esac
17177
17178 : see if sockatmark exists
17179 set sockatmark d_sockatmark
17180 eval $inlibc
17181
17182 : see if prototype for sockatmark is available
17183 echo " "
17184 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17185 eval $hasproto
17186
17187 : see if socks5_init exists
17188 set socks5_init d_socks5_init
17189 eval $inlibc
17190
17191 : see if sprintf returns the length of the string in the buffer as per ANSI
17192 $echo "Checking whether sprintf returns the length of the string..." >&4
17193 $cat <<EOP >try.c
17194 #include <stdio.h>
17195 #$i_stdlib I_STDLIB
17196 #ifdef I_STDLIB
17197 #include <stdlib.h>
17198 #endif
17199 #$i_string I_STRING
17200 #ifdef I_STRING
17201 #  include <string.h>
17202 #else
17203 #  include <strings.h>
17204 #endif
17205 #$i_math I_MATH
17206 #ifdef I_MATH
17207 #include <math.h>
17208 #endif
17209
17210 char buffer[256];
17211
17212 int check (size_t expect, int test) {
17213   size_t got = strlen(buffer);
17214   if (expect == got)
17215     return 0;
17216
17217   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17218        test, buffer);
17219   exit (test);
17220 }
17221
17222 int main(int argc, char **argv) {
17223   int test = 0;
17224
17225   check(sprintf(buffer, ""), ++test);
17226   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17227   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17228
17229   return 0;
17230 }
17231 EOP
17232 set try
17233
17234 d_sprintf_returns_strlen="$undef"
17235 if eval $compile; then
17236     xxx="`$run ./try`"
17237     case "$?" in
17238         0) cat >&4 <<EOM
17239 sprintf returns the length of the string (as ANSI says it should)
17240 EOM
17241         d_sprintf_returns_strlen="$define"
17242         ;;
17243         *) cat >&4 <<EOM
17244 sprintf does not return the length of the string (how old is this system?)
17245 EOM
17246         d_sprintf_returns_strlen="$undef"
17247         ;;
17248     esac
17249 fi
17250 $rm_try
17251
17252 : see if srand48_r exists
17253 set srand48_r d_srand48_r
17254 eval $inlibc
17255 case "$d_srand48_r" in
17256 "$define")
17257         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17258         case "$d_srand48_r_proto:$usethreads" in
17259         ":define")      d_srand48_r_proto=define
17260                 set d_srand48_r_proto srand48_r $hdrs
17261                 eval $hasproto ;;
17262         *)      ;;
17263         esac
17264         case "$d_srand48_r_proto" in
17265         define)
17266         case "$srand48_r_proto" in
17267         ''|0) try='int srand48_r(long, struct drand48_data*);'
17268         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17269         esac
17270         case "$srand48_r_proto" in
17271         ''|0)   d_srand48_r=undef
17272                 srand48_r_proto=0
17273                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17274         * )     case "$srand48_r_proto" in
17275                 REENTRANT_PROTO*) ;;
17276                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17277                 esac
17278                 echo "Prototype: $try" ;;
17279         esac
17280         ;;
17281         *)      case "$usethreads" in
17282                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17283                 esac
17284                 d_srand48_r=undef
17285                 srand48_r_proto=0
17286                 ;;
17287         esac
17288         ;;
17289 *)      srand48_r_proto=0
17290         ;;
17291 esac
17292
17293 : see if srandom_r exists
17294 set srandom_r d_srandom_r
17295 eval $inlibc
17296 case "$d_srandom_r" in
17297 "$define")
17298         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17299         case "$d_srandom_r_proto:$usethreads" in
17300         ":define")      d_srandom_r_proto=define
17301                 set d_srandom_r_proto srandom_r $hdrs
17302                 eval $hasproto ;;
17303         *)      ;;
17304         esac
17305         case "$d_srandom_r_proto" in
17306         define)
17307         case "$srandom_r_proto" in
17308         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17309         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17310         esac
17311         case "$srandom_r_proto" in
17312         ''|0)   d_srandom_r=undef
17313                 srandom_r_proto=0
17314                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17315         * )     case "$srandom_r_proto" in
17316                 REENTRANT_PROTO*) ;;
17317                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17318                 esac
17319                 echo "Prototype: $try" ;;
17320         esac
17321         ;;
17322         *)      case "$usethreads" in
17323                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17324                 esac
17325                 d_srandom_r=undef
17326                 srandom_r_proto=0
17327                 ;;
17328         esac
17329         ;;
17330 *)      srandom_r_proto=0
17331         ;;
17332 esac
17333
17334 : see if prototype for setresgid is available
17335 echo " "
17336 set d_sresgproto setresgid $i_unistd unistd.h
17337 eval $hasproto
17338
17339 : see if prototype for setresuid is available
17340 echo " "
17341 set d_sresuproto setresuid $i_unistd unistd.h
17342 eval $hasproto
17343
17344 : see if sys/stat.h is available
17345 set sys/stat.h i_sysstat
17346 eval $inhdr
17347
17348
17349 : see if stat knows about block sizes
17350 echo " "
17351 echo "Checking to see if your struct stat has st_blocks field..." >&4
17352 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17353 eval $hasfield
17354
17355
17356 : see if this is a sys/vfs.h system
17357 set sys/vfs.h i_sysvfs
17358 eval $inhdr
17359
17360
17361 : see if this is a sys/statfs.h system
17362 set sys/statfs.h i_sysstatfs
17363 eval $inhdr
17364
17365
17366 echo " "
17367 echo "Checking to see if your system supports struct statfs..." >&4
17368 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
17369 eval $hasstruct
17370 case "$d_statfs_s" in
17371 "$define")      echo "Yes, it does."   ;;
17372 *)              echo "No, it doesn't." ;;
17373 esac
17374
17375
17376
17377 : see if struct statfs knows about f_flags
17378 case "$d_statfs_s" in
17379 define) 
17380         echo " "
17381         echo "Checking to see if your struct statfs has f_flags field..." >&4
17382         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
17383         eval $hasfield
17384         ;;
17385 *)      val="$undef"
17386         set d_statfs_f_flags
17387         eval $setvar
17388         ;;
17389 esac
17390 case "$d_statfs_f_flags" in
17391 "$define")      echo "Yes, it does."   ;;
17392 *)              echo "No, it doesn't." ;;
17393 esac
17394
17395 $cat >&4 <<EOM
17396 Checking how to access stdio streams by file descriptor number...
17397 EOM
17398 case "$stdio_stream_array" in
17399 '')     $cat >try.c <<EOCP
17400 #include <stdio.h>
17401 int main() {
17402   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17403     printf("yes\n");
17404 }
17405 EOCP
17406         for s in _iob __iob __sF
17407         do
17408                 set try -DSTDIO_STREAM_ARRAY=$s
17409                 if eval $compile; then
17410                         case "`$run ./try`" in
17411                         yes)    stdio_stream_array=$s; break ;;
17412                         esac
17413                 fi
17414         done
17415         $rm_try
17416 esac
17417 case "$stdio_stream_array" in
17418 '')     $cat >&4 <<EOM
17419 I can't figure out how to access stdio streams by file descriptor number.
17420 EOM
17421         d_stdio_stream_array="$undef"
17422         ;;
17423 *)      $cat >&4 <<EOM
17424 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17425 EOM
17426         d_stdio_stream_array="$define"
17427         ;;
17428 esac
17429
17430 : see if strcoll exists
17431 set strcoll d_strcoll
17432 eval $inlibc
17433
17434 : check for structure copying
17435 echo " "
17436 echo "Checking to see if your C compiler can copy structs..." >&4
17437 $cat >try.c <<'EOCP'
17438 int main()
17439 {
17440         struct blurfl {
17441                 int dyick;
17442         } foo, bar;
17443
17444         foo = bar;
17445 }
17446 EOCP
17447 if $cc -c try.c >/dev/null 2>&1 ; then
17448         val="$define"
17449         echo "Yup, it can."
17450 else
17451         val="$undef"
17452         echo "Nope, it can't."
17453 fi
17454 set d_strctcpy
17455 eval $setvar
17456 $rm_try
17457
17458 : see if strerror and/or sys_errlist[] exist
17459 echo " "
17460 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17461     if set strerror val -f d_strerror; eval $csym; $val; then
17462                 echo 'strerror() found.' >&4
17463                 d_strerror="$define"
17464                 d_strerrm='strerror(e)'
17465                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17466                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17467                         d_syserrlst="$define"
17468                 else
17469                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17470                         d_syserrlst="$undef"
17471                 fi
17472     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17473                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17474                 echo 'strerror() found in string header.' >&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 "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17479                                 d_syserrlst="$define"
17480                 else
17481                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17482                         d_syserrlst="$undef"
17483                 fi
17484     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17485                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17486                 d_strerror="$undef"
17487                 d_syserrlst="$define"
17488                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17489     else
17490                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17491                 d_strerror="$undef"
17492                 d_syserrlst="$undef"
17493                 d_strerrm='"unknown"'
17494     fi
17495 fi
17496
17497 : see if strerror_r exists
17498 set strerror_r d_strerror_r
17499 eval $inlibc
17500 case "$d_strerror_r" in
17501 "$define")
17502         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17503         case "$d_strerror_r_proto:$usethreads" in
17504         ":define")      d_strerror_r_proto=define
17505                 set d_strerror_r_proto strerror_r $hdrs
17506                 eval $hasproto ;;
17507         *)      ;;
17508         esac
17509         case "$d_strerror_r_proto" in
17510         define)
17511         case "$strerror_r_proto" in
17512         ''|0) try='int strerror_r(int, char*, size_t);'
17513         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17514         esac
17515         case "$strerror_r_proto" in
17516         ''|0) try='int strerror_r(int, char*, int);'
17517         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17518         esac
17519         case "$strerror_r_proto" in
17520         ''|0) try='char* strerror_r(int, char*, size_t);'
17521         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17522         esac
17523         case "$strerror_r_proto" in
17524         ''|0)   d_strerror_r=undef
17525                 strerror_r_proto=0
17526                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17527         * )     case "$strerror_r_proto" in
17528                 REENTRANT_PROTO*) ;;
17529                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17530                 esac
17531                 echo "Prototype: $try" ;;
17532         esac
17533         ;;
17534         *)      case "$usethreads" in
17535                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17536                 esac
17537                 d_strerror_r=undef
17538                 strerror_r_proto=0
17539                 ;;
17540         esac
17541         ;;
17542 *)      strerror_r_proto=0
17543         ;;
17544 esac
17545
17546 : see if strftime exists
17547 set strftime d_strftime
17548 eval $inlibc
17549
17550 : see if strlcat exists
17551 set strlcat d_strlcat
17552 eval $inlibc
17553
17554 : see if strlcpy exists
17555 set strlcpy d_strlcpy
17556 eval $inlibc
17557
17558 : see if strtod exists
17559 set strtod d_strtod
17560 eval $inlibc
17561
17562 : see if strtol exists
17563 set strtol d_strtol
17564 eval $inlibc
17565
17566 : see if strtold exists
17567 set strtold d_strtold
17568 eval $inlibc
17569
17570 : see if strtoll exists
17571 set strtoll d_strtoll
17572 eval $inlibc
17573
17574 case "$d_longlong-$d_strtoll" in
17575 "$define-$define")
17576         $cat <<EOM
17577 Checking whether your strtoll() works okay...
17578 EOM
17579         $cat >try.c <<'EOCP'
17580 #include <errno.h>
17581 #ifdef __hpux
17582 #define strtoll __strtoll
17583 #endif
17584 #ifdef __EMX__
17585 #define strtoll _strtoll
17586 #endif
17587 #include <stdio.h>
17588 extern long long int strtoll(char *s, char **, int); 
17589 static int bad = 0;
17590 int check(char *s, long long ell, int een) {
17591         long long gll;
17592         errno = 0;
17593         gll = strtoll(s, 0, 10);
17594         if (!((gll == ell) && (errno == een)))
17595                 bad++;
17596 }
17597 int main() {
17598         check(" 1",                                      1LL, 0);
17599         check(" 0",                                      0LL, 0);
17600         check("-1",                                     -1LL, 0);
17601         check("-9223372036854775808", -9223372036854775808LL, 0);
17602         check("-9223372036854775808", -9223372036854775808LL, 0);
17603         check(" 9223372036854775807",  9223372036854775807LL, 0);
17604         check("-9223372036854775808", -9223372036854775808LL, 0);
17605         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17606         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17607         if (!bad)
17608                 printf("ok\n");
17609 }
17610 EOCP
17611         set try
17612         if eval $compile; then
17613                 yyy=`$run ./try`
17614                 case "$yyy" in
17615                 ok) echo "Your strtoll() seems to be working okay." ;;
17616                 *) cat <<EOM >&4
17617 Your strtoll() doesn't seem to be working okay.
17618 EOM
17619                    d_strtoll="$undef"
17620                    ;;
17621                 esac
17622         else
17623                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17624                 d_strtoll="$undef"
17625         fi
17626         ;;
17627 esac
17628
17629 : see if strtoq exists
17630 set strtoq d_strtoq
17631 eval $inlibc
17632
17633 : see if strtoul exists
17634 set strtoul d_strtoul
17635 eval $inlibc
17636
17637 case "$d_strtoul" in
17638 "$define")
17639         $cat <<EOM
17640 Checking whether your strtoul() works okay...
17641 EOM
17642         $cat >try.c <<'EOCP'
17643 #include <errno.h>
17644 #include <stdio.h>
17645 extern unsigned long int strtoul(char *s, char **, int); 
17646 static int bad = 0;
17647 void check(char *s, unsigned long eul, int een) {
17648         unsigned long gul;
17649         errno = 0;
17650         gul = strtoul(s, 0, 10);
17651         if (!((gul == eul) && (errno == een)))
17652                 bad++;
17653 }
17654 int main() {
17655         check(" 1", 1L, 0);
17656         check(" 0", 0L, 0);
17657 EOCP
17658         case "$longsize" in
17659         8)
17660             $cat >>try.c <<'EOCP'
17661         check("18446744073709551615", 18446744073709551615UL, 0);
17662         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17663 #if 0 /* strtoul() for /^-/ strings is undefined. */
17664         check("-1", 18446744073709551615UL, 0);
17665         check("-18446744073709551614", 2, 0);
17666         check("-18446744073709551615", 1, 0);
17667         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17668         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17669 #endif
17670 EOCP
17671                 ;;
17672         4)
17673                     $cat >>try.c <<'EOCP'
17674         check("4294967295", 4294967295UL, 0);
17675         check("4294967296", 4294967295UL, ERANGE);
17676 #if 0 /* strtoul() for /^-/ strings is undefined. */
17677         check("-1", 4294967295UL, 0);
17678         check("-4294967294", 2, 0);
17679         check("-4294967295", 1, 0);
17680         check("-4294967296", 4294967295UL, ERANGE);
17681         check("-4294967297", 4294967295UL, ERANGE);
17682 #endif
17683 EOCP
17684                 ;;
17685         *)
17686 : Should we write these tests to be more portable by sprintf-ing
17687 : ~0 and then manipulating that char string as input for strtol?
17688                 ;;
17689         esac
17690         $cat >>try.c <<'EOCP'
17691         if (!bad)
17692                 printf("ok\n");
17693         return 0;
17694 }
17695 EOCP
17696         set try
17697         if eval $compile; then
17698                 case "`$run ./try`" in
17699                 ok) echo "Your strtoul() seems to be working okay." ;;
17700                 *) cat <<EOM >&4
17701 Your strtoul() doesn't seem to be working okay.
17702 EOM
17703                    d_strtoul="$undef"
17704                    ;;
17705                 esac
17706         else
17707                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17708                 d_strtoul="$undef"
17709         fi
17710         ;;
17711 esac
17712
17713 : see if strtoull exists
17714 set strtoull d_strtoull
17715 eval $inlibc
17716
17717 case "$d_longlong-$d_strtoull" in
17718 "$define-$define")
17719         $cat <<EOM
17720 Checking whether your strtoull() works okay...
17721 EOM
17722         $cat >try.c <<'EOCP'
17723 #include <errno.h>
17724 #ifdef __hpux
17725 #define strtoull __strtoull
17726 #endif
17727 #include <stdio.h>
17728 extern unsigned long long int strtoull(char *s, char **, int); 
17729 static int bad = 0;
17730 int check(char *s, long long eull, int een) {
17731         long long gull;
17732         errno = 0;
17733         gull = strtoull(s, 0, 10);
17734         if (!((gull == eull) && (errno == een)))
17735                 bad++;
17736 }
17737 int main() {
17738         check(" 1",                                        1LL, 0);
17739         check(" 0",                                        0LL, 0);
17740         check("18446744073709551615",  18446744073709551615ULL, 0);
17741         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17742 #if 0 /* strtoull() for /^-/ strings is undefined. */
17743         check("-1",                    18446744073709551615ULL, 0);
17744         check("-18446744073709551614",                     2LL, 0);
17745         check("-18446744073709551615",                     1LL, 0);
17746         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17747         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17748 #endif
17749         if (!bad)
17750                 printf("ok\n");
17751 }
17752 EOCP
17753         set try
17754         if eval $compile; then
17755                 case "`$run ./try`" in
17756                 ok) echo "Your strtoull() seems to be working okay." ;;
17757                 *) cat <<EOM >&4
17758 Your strtoull() doesn't seem to be working okay.
17759 EOM
17760                    d_strtoull="$undef"
17761                    ;;
17762                 esac
17763         else
17764                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17765                 d_strtoull="$undef"
17766         fi
17767         ;;
17768 esac
17769
17770 : see if strtouq exists
17771 set strtouq d_strtouq
17772 eval $inlibc
17773
17774 case "$d_strtouq" in
17775 "$define")
17776         $cat <<EOM
17777 Checking whether your strtouq() works okay...
17778 EOM
17779         $cat >try.c <<'EOCP'
17780 #include <errno.h>
17781 #include <stdio.h>
17782 extern unsigned long long int strtouq(char *s, char **, int); 
17783 static int bad = 0;
17784 void check(char *s, unsigned long long eull, int een) {
17785         unsigned long long gull;
17786         errno = 0;
17787         gull = strtouq(s, 0, 10);
17788         if (!((gull == eull) && (errno == een)))
17789                 bad++;
17790 }
17791 int main() {
17792         check(" 1",                                        1LL, 0);
17793         check(" 0",                                        0LL, 0);
17794         check("18446744073709551615",  18446744073709551615ULL, 0);
17795         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17796 #if 0 /* strtouq() for /^-/ strings is undefined. */
17797         check("-1",                    18446744073709551615ULL, 0);
17798         check("-18446744073709551614",                     2LL, 0);
17799         check("-18446744073709551615",                     1LL, 0);
17800         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17801         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17802 #endif
17803         if (!bad)
17804                 printf("ok\n");
17805         return 0;
17806 }
17807 EOCP
17808         set try
17809         if eval $compile; then
17810                 case "`$run ./try`" in
17811                 ok) echo "Your strtouq() seems to be working okay." ;;
17812                 *) cat <<EOM >&4
17813 Your strtouq() doesn't seem to be working okay.
17814 EOM
17815                    d_strtouq="$undef"
17816                    ;;
17817                 esac
17818         else
17819                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17820                 d_strtouq="$undef"
17821         fi
17822         ;;
17823 esac
17824
17825 : see if strxfrm exists
17826 set strxfrm d_strxfrm
17827 eval $inlibc
17828
17829 : see if symlink exists
17830 set symlink d_symlink
17831 eval $inlibc
17832
17833 : see if syscall exists
17834 set syscall d_syscall
17835 eval $inlibc
17836
17837 : see if prototype for syscall is available
17838 echo " "
17839 set d_syscallproto syscall $i_unistd unistd.h
17840 eval $hasproto
17841
17842 : see if sysconf exists
17843 set sysconf d_sysconf
17844 eval $inlibc
17845
17846 : see if system exists
17847 set system d_system
17848 eval $inlibc
17849
17850 : see if tcgetpgrp exists
17851 set tcgetpgrp d_tcgetpgrp
17852 eval $inlibc
17853
17854 : see if tcsetpgrp exists
17855 set tcsetpgrp d_tcsetpgrp
17856 eval $inlibc
17857
17858 : see if prototype for telldir is available
17859 echo " "
17860 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17861 eval $hasproto
17862
17863 : see if time exists
17864 echo " "
17865 if test "X$d_time" = X -o X"$timetype" = X; then
17866     if set time val -f d_time; eval $csym; $val; then
17867                 echo 'time() found.' >&4
17868                 val="$define"
17869                 rp="What is the type returned by time() on this system?"
17870                 set time_t timetype long stdio.h sys/types.h
17871                 eval $typedef_ask
17872     else
17873                 echo 'time() not found, hope that will do.' >&4
17874                 val="$undef"
17875                 timetype='int';
17876     fi
17877     set d_time
17878     eval $setvar
17879 fi
17880
17881 : see if this is a sys/times.h system
17882 set sys/times.h i_systimes
17883 eval $inhdr
17884
17885 : see if times exists
17886 echo " "
17887 if set times val -f d_times; eval $csym; $val; then
17888         echo 'times() found.' >&4
17889         d_times="$define"
17890         inc=''
17891         case "$i_systimes" in
17892         "$define") inc='sys/times.h';;
17893         esac
17894         rp="What is the type returned by times() on this system?"
17895         set clock_t clocktype long stdio.h sys/types.h $inc
17896         eval $typedef_ask
17897 else
17898         echo 'times() NOT found, hope that will do.' >&4
17899         d_times="$undef"
17900         clocktype='int'
17901 fi
17902
17903 : see if tmpnam_r exists
17904 set tmpnam_r d_tmpnam_r
17905 eval $inlibc
17906 case "$d_tmpnam_r" in
17907 "$define")
17908         hdrs="$i_systypes sys/types.h define stdio.h "
17909         case "$d_tmpnam_r_proto:$usethreads" in
17910         ":define")      d_tmpnam_r_proto=define
17911                 set d_tmpnam_r_proto tmpnam_r $hdrs
17912                 eval $hasproto ;;
17913         *)      ;;
17914         esac
17915         case "$d_tmpnam_r_proto" in
17916         define)
17917         case "$tmpnam_r_proto" in
17918         ''|0) try='char* tmpnam_r(char*);'
17919         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17920         esac
17921         case "$tmpnam_r_proto" in
17922         ''|0)   d_tmpnam_r=undef
17923                 tmpnam_r_proto=0
17924                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17925         * )     case "$tmpnam_r_proto" in
17926                 REENTRANT_PROTO*) ;;
17927                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17928                 esac
17929                 echo "Prototype: $try" ;;
17930         esac
17931         ;;
17932         *)      case "$usethreads" in
17933                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17934                 esac
17935                 d_tmpnam_r=undef
17936                 tmpnam_r_proto=0
17937                 ;;
17938         esac
17939         ;;
17940 *)      tmpnam_r_proto=0
17941         ;;
17942 esac
17943
17944 : see if truncate exists
17945 set truncate d_truncate
17946 eval $inlibc
17947
17948 : see if ttyname_r exists
17949 set ttyname_r d_ttyname_r
17950 eval $inlibc
17951 case "$d_ttyname_r" in
17952 "$define")
17953         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17954         case "$d_ttyname_r_proto:$usethreads" in
17955         ":define")      d_ttyname_r_proto=define
17956                 set d_ttyname_r_proto ttyname_r $hdrs
17957                 eval $hasproto ;;
17958         *)      ;;
17959         esac
17960         case "$d_ttyname_r_proto" in
17961         define)
17962         case "$ttyname_r_proto" in
17963         ''|0) try='int ttyname_r(int, char*, size_t);'
17964         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17965         esac
17966         case "$ttyname_r_proto" in
17967         ''|0) try='int ttyname_r(int, char*, int);'
17968         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17969         esac
17970         case "$ttyname_r_proto" in
17971         ''|0) try='char* ttyname_r(int, char*, int);'
17972         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17973         esac
17974         case "$ttyname_r_proto" in
17975         ''|0)   d_ttyname_r=undef
17976                 ttyname_r_proto=0
17977                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17978         * )     case "$ttyname_r_proto" in
17979                 REENTRANT_PROTO*) ;;
17980                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17981                 esac
17982                 echo "Prototype: $try" ;;
17983         esac
17984         ;;
17985         *)      case "$usethreads" in
17986                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17987                 esac
17988                 d_ttyname_r=undef
17989                 ttyname_r_proto=0
17990                 ;;
17991         esac
17992         ;;
17993 *)      ttyname_r_proto=0
17994         ;;
17995 esac
17996
17997 : see if tzname[] exists
17998 echo " "
17999 if set tzname val -a d_tzname; eval $csym; $val; then
18000         val="$define"
18001         echo 'tzname[] found.' >&4
18002 else
18003         val="$undef"
18004         echo 'tzname[] NOT found.' >&4
18005 fi
18006 set d_tzname
18007 eval $setvar
18008
18009 case "$osname" in
18010 next|rhapsody|darwin) multiarch="$define" ;;
18011 esac
18012 case "$multiarch" in
18013 ''|[nN]*) multiarch="$undef" ;;
18014 esac
18015
18016 : check for ordering of bytes in a UV
18017 echo " "
18018 case "$usecrosscompile$multiarch" in
18019 *$define*)
18020         $cat <<EOM
18021 You seem to be either cross-compiling or doing a multiarchitecture build,
18022 skipping the byteorder check.
18023
18024 EOM
18025         byteorder='ffff'
18026         ;;
18027 *)
18028         case "$byteorder" in
18029         '')
18030                 $cat <<'EOM'
18031 In the following, larger digits indicate more significance.  A big-endian
18032 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18033 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18034 machines may have weird orders like 3412.  A Cray will report 87654321,
18035 an Alpha will report 12345678. If the test program works the default is
18036 probably right.
18037 I'm now running the test program...
18038 EOM
18039                 $cat >try.c <<EOCP
18040 #include <stdio.h>
18041 #$i_stdlib I_STDLIB
18042 #ifdef I_STDLIB
18043 #include <stdlib.h>
18044 #endif
18045 #include <sys/types.h>
18046 typedef $uvtype UV;
18047 int main()
18048 {
18049         int i;
18050         union {
18051                 UV l;
18052                 char c[$uvsize];
18053         } u;
18054
18055         if ($uvsize > 4)
18056                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18057         else
18058                 u.l = (UV)0x04030201;
18059         for (i = 0; i < $uvsize; i++)
18060                 printf("%c", u.c[i]+'0');
18061         printf("\n");
18062         exit(0);
18063 }
18064 EOCP
18065                 xxx_prompt=y
18066                 set try
18067                 if eval $compile && $run ./try > /dev/null; then
18068                         dflt=`$run ./try`
18069                         case "$dflt" in
18070                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18071                                 echo "(The test program ran ok.)"
18072                                 echo "byteorder=$dflt"
18073                                 xxx_prompt=n
18074                         ;;
18075                         ????|????????) echo "(The test program ran ok.)" ;;
18076                         *) echo "(The test program didn't run right for some reason.)" ;;
18077                         esac
18078                 else
18079                         dflt='4321'
18080                         cat <<'EOM'
18081 (I can't seem to compile the test program.  Guessing big-endian...)
18082 EOM
18083                 fi
18084                 case "$xxx_prompt" in
18085                 y)
18086                         rp="What is the order of bytes in $uvtype?"
18087                         . ./myread
18088                         byteorder="$ans"
18089                         ;;
18090                 *)      byteorder=$dflt
18091                         ;;
18092                 esac
18093                 ;;
18094         esac
18095         $rm_try
18096         ;;
18097 esac
18098
18099 $cat <<EOM
18100
18101 Checking to see whether you can access character data unalignedly...
18102 EOM
18103 case "$d_u32align" in
18104 '')   $cat >try.c <<EOCP
18105 #include <stdio.h>
18106 #$i_stdlib I_STDLIB
18107 #ifdef I_STDLIB
18108 #include <stdlib.h>
18109 #endif
18110 #define U32 $u32type
18111 #define BYTEORDER 0x$byteorder
18112 #define U8 $u8type
18113 #include <signal.h>
18114 #ifdef SIGBUS
18115 $signal_t bletch(int s) { exit(4); }
18116 #endif
18117 int main() {
18118 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18119     U8 buf[8];
18120     U32 *up;
18121     int i;
18122
18123     if (sizeof(U32) != 4) {
18124         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18125         exit(1);
18126     }
18127
18128     fflush(stdout);
18129
18130 #ifdef SIGBUS
18131     signal(SIGBUS, bletch);
18132 #endif
18133
18134     buf[0] = 0;
18135     buf[1] = 0;
18136     buf[2] = 0;
18137     buf[3] = 1;
18138     buf[4] = 0;
18139     buf[5] = 0;
18140     buf[6] = 0;
18141     buf[7] = 1;
18142
18143     for (i = 0; i < 4; i++) {
18144         up = (U32*)(buf + i);
18145         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18146                (*up == 1 << (8*(3-i)))  /* little-endian */
18147               )
18148            )
18149         {
18150             printf("read failed (%x)\n", *up);
18151             exit(2);
18152         }
18153     }
18154
18155     /* write test */
18156     for (i = 0; i < 4; i++) {
18157         up = (U32*)(buf + i);
18158         *up = 0xBeef;
18159         if (*up != 0xBeef) {
18160             printf("write failed (%x)\n", *up);
18161             exit(3);
18162         }
18163     }
18164
18165     exit(0);
18166 #else
18167     printf("1\n");
18168     exit(1);
18169 #endif
18170     return 0;
18171 }
18172 EOCP
18173 set try
18174 if eval $compile_ok; then
18175         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18176         $run ./try 2>&1 >/dev/null
18177         case "$?" in
18178         0)      cat >&4 <<EOM
18179 You can access character data pretty unalignedly.
18180 EOM
18181                 d_u32align="$undef"
18182                 ;;
18183         *)      cat >&4 <<EOM
18184 It seems that you must access character data in an aligned manner.
18185 EOM
18186                 d_u32align="$define"
18187                 ;;
18188         esac
18189 else
18190         rp='Can you access character data at unaligned addresses?'
18191         dflt='n'
18192         . ./myread
18193         case "$ans" in
18194         [yY]*)  d_u32align="$undef"  ;;
18195         *)      d_u32align="$define" ;;
18196         esac
18197 fi
18198 $rm_try
18199 ;;
18200 esac
18201
18202 : see if ualarm exists
18203 set ualarm d_ualarm
18204 eval $inlibc
18205
18206 : see if umask exists
18207 set umask d_umask
18208 eval $inlibc
18209
18210 : see if unordered exists
18211 set unordered d_unordered
18212 eval $inlibc
18213
18214 : see if unsetenv exists
18215 set unsetenv d_unsetenv
18216 eval $inlibc
18217
18218 : see if usleep exists
18219 set usleep d_usleep
18220 eval $inlibc
18221
18222 : see if prototype for usleep is available
18223 echo " "
18224 set d_usleepproto usleep $i_unistd unistd.h
18225 eval $hasproto
18226
18227 : see if ustat exists
18228 set ustat d_ustat
18229 eval $inlibc
18230
18231 : see if closedir exists
18232 set closedir d_closedir
18233 eval $inlibc
18234
18235 case "$d_closedir" in
18236 "$define")
18237         echo " "
18238         echo "Checking whether closedir() returns a status..." >&4
18239         cat > try.c <<EOM
18240 #$i_dirent I_DIRENT             /**/
18241 #$i_sysdir I_SYS_DIR            /**/
18242 #$i_sysndir I_SYS_NDIR          /**/
18243 #$i_systypes I_SYS_TYPES        /**/
18244
18245 #if defined(I_SYS_TYPES)
18246 #include <sys/types.h>
18247 #endif
18248 #if defined(I_DIRENT)
18249 #include <dirent.h>
18250 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18251 #include <sys/dir.h>
18252 #endif
18253 #else
18254 #ifdef I_SYS_NDIR
18255 #include <sys/ndir.h>
18256 #else
18257 #ifdef I_SYS_DIR
18258 #ifdef hp9000s500
18259 #include <ndir.h>       /* may be wrong in the future */
18260 #else
18261 #include <sys/dir.h>
18262 #endif
18263 #endif
18264 #endif
18265 #endif
18266 int main() { return closedir(opendir(".")); }
18267 EOM
18268         set try
18269         if eval $compile_ok; then
18270                 if $run ./try > /dev/null 2>&1 ; then
18271                         echo "Yes, it does."
18272                         val="$undef"
18273                 else
18274                         echo "No, it doesn't."
18275                         val="$define"
18276                 fi
18277         else
18278                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18279                 val="$define"
18280         fi
18281         ;;
18282 *)
18283         val="$undef";
18284         ;;
18285 esac
18286 set d_void_closedir
18287 eval $setvar
18288 $rm_try
18289
18290 : see if there is a wait4
18291 set wait4 d_wait4
18292 eval $inlibc
18293
18294 : see if waitpid exists
18295 set waitpid d_waitpid
18296 eval $inlibc
18297
18298 : see if wcstombs exists
18299 set wcstombs d_wcstombs
18300 eval $inlibc
18301
18302 : see if wctomb exists
18303 set wctomb d_wctomb
18304 eval $inlibc
18305
18306 : see if writev exists
18307 set writev d_writev
18308 eval $inlibc
18309
18310 : preserve RCS keywords in files with variable substitution, grrr
18311 Date='$Date'
18312 Id='$Id'
18313 Log='$Log'
18314 RCSfile='$RCSfile'
18315 Revision='$Revision'
18316
18317 : check for alignment requirements
18318 echo " "
18319 case "$usecrosscompile$multiarch" in
18320 *$define*)
18321         $cat <<EOM
18322 You seem to be either cross-compiling or doing a multiarchitecture build,
18323 skipping the memory alignment check.
18324
18325 EOM
18326         case "$alignbytes" in
18327         '') alignbytes=8 ;;
18328         esac
18329         ;;
18330 *)
18331         case "$alignbytes" in
18332         '') echo "Checking alignment constraints..." >&4
18333                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18334                         $cat >try.c <<'EOCP'
18335 typedef long double NV;
18336 EOCP
18337                 else
18338                         $cat >try.c <<'EOCP'
18339 typedef double NV;
18340 EOCP
18341                 fi
18342                 $cat >>try.c <<'EOCP'
18343 #include <stdio.h>
18344 struct foobar {
18345         char foo;
18346         NV bar;
18347 } try_algn;
18348 int main()
18349 {
18350     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18351     return(0);
18352 }
18353 EOCP
18354                 set try
18355                 if eval $compile_ok; then
18356                         dflt=`$run ./try`
18357                 else
18358                         dflt='8'
18359                         echo "(I can't seem to compile the test program...)"
18360                 fi
18361                 ;;
18362         *) dflt="$alignbytes"
18363                 ;;
18364         esac
18365         rp="Doubles must be aligned on a how-many-byte boundary?"
18366         . ./myread
18367         alignbytes="$ans"
18368         $rm_try
18369         ;;
18370 esac
18371
18372
18373 : set the base revision
18374 baserev=5.0
18375
18376 : how do we concatenate cpp tokens here?
18377 echo " "
18378 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18379 $cat >cpp_stuff.c <<'EOCP'
18380 #define RCAT(a,b)a/**/b
18381 #define ACAT(a,b)a ## b
18382 RCAT(Rei,ser)
18383 ACAT(Cir,cus)
18384 EOCP
18385 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18386 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18387         echo "Oh!  Smells like ANSI's been here." >&4
18388         echo "We can catify or stringify, separately or together!"
18389         cpp_stuff=42
18390 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18391         echo "Ah, yes!  The good old days!" >&4
18392         echo "However, in the good old days we don't know how to stringify and"
18393         echo "catify at the same time."
18394         cpp_stuff=1
18395 else
18396         $cat >&4 <<EOM
18397 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18398 You're going to have to edit the values of CAT[2-5] in config.h...
18399 EOM
18400         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18401 fi
18402 $rm -f cpp_stuff.*
18403
18404 : see if this is a db.h system
18405 set db.h i_db
18406 eval $inhdr
18407
18408 case "$i_db" in
18409 $define)
18410         : Check db version.
18411         echo " "
18412         echo "Checking Berkeley DB version ..." >&4
18413         $cat >try.c <<EOCP
18414 #$d_const HASCONST
18415 #ifndef HASCONST
18416 #define const
18417 #endif
18418 #include <sys/types.h>
18419 #include <stdio.h>
18420 #$i_stdlib I_STDLIB
18421 #ifdef I_STDLIB
18422 #include <stdlib.h>
18423 #endif
18424 #include <db.h>
18425 int main(int argc, char *argv[])
18426 {
18427 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18428     int Major, Minor, Patch ;
18429     unsigned long Version ;
18430     (void)db_version(&Major, &Minor, &Patch) ;
18431     if (argc == 2) {
18432         printf("%d %d %d %d %d %d\n",
18433                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18434                Major, Minor, Patch);
18435         exit(0);
18436     }
18437     printf("You have Berkeley DB Version 2 or greater.\n");
18438
18439     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18440                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18441     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18442                 Major, Minor, Patch) ;
18443
18444     /* check that db.h & libdb are compatible */
18445     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18446         printf("db.h and libdb are incompatible.\n") ;
18447         exit(3);
18448     }
18449
18450     printf("db.h and libdb are compatible.\n") ;
18451
18452     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18453                 + DB_VERSION_PATCH ;
18454
18455     /* needs to be >= 2.3.4 */
18456     if (Version < 2003004) {
18457     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18458         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18459         exit(2);
18460     }
18461
18462     exit(0);
18463 #else
18464 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18465     if (argc == 2) {
18466         printf("1 0 0\n");
18467         exit(0);
18468     }
18469     printf("You have Berkeley DB Version 1.\n");
18470     exit(0);    /* DB version < 2: the coast is clear. */
18471 #else
18472     exit(1);    /* <db.h> not Berkeley DB? */
18473 #endif
18474 #endif
18475 }
18476 EOCP
18477         set try
18478         if eval $compile_ok && $run ./try; then
18479                 echo 'Looks OK.' >&4
18480                 set `$run ./try 1`
18481                 db_version_major=$1
18482                 db_version_minor=$2
18483                 db_version_patch=$3
18484         else
18485                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18486                 i_db=$undef
18487                 case " $libs " in
18488                 *"-ldb "*)
18489                         : Remove db from list of libraries to use
18490                         echo "Removing unusable -ldb from library list" >&4
18491                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18492                         shift
18493                         libs="$*"
18494                         echo "libs = $libs" >&4
18495                         ;;
18496                 esac
18497         fi
18498         $rm_try
18499         ;;
18500 esac
18501
18502 case "$i_db" in
18503 define)
18504         : Check the return type needed for hash
18505         echo " "
18506         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18507         $cat >try.c <<EOCP
18508 #$d_const HASCONST
18509 #ifndef HASCONST
18510 #define const
18511 #endif
18512 #include <sys/types.h>
18513 #include <db.h>
18514
18515 #ifndef DB_VERSION_MAJOR
18516 u_int32_t hash_cb (ptr, size)
18517 const void *ptr;
18518 size_t size;
18519 {
18520 }
18521 HASHINFO info;
18522 int main()
18523 {
18524         info.hash = hash_cb;
18525 }
18526 #endif
18527 EOCP
18528         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18529                 if $contains warning try.out >>/dev/null 2>&1 ; then
18530                         db_hashtype='int'
18531                 else
18532                         db_hashtype='u_int32_t'
18533                 fi
18534         else
18535                 : XXX Maybe we should just give up here.
18536                 db_hashtype=u_int32_t
18537                 $cat try.out >&4
18538                 echo "Help:  I can't seem to compile the db test program." >&4
18539                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18540         fi
18541         $rm_try
18542         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18543         ;;
18544 *)      db_hashtype=u_int32_t
18545         ;;
18546 esac
18547 case "$i_db" in
18548 define)
18549         : Check the return type needed for prefix
18550         echo " "
18551         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18552         cat >try.c <<EOCP
18553 #$d_const HASCONST
18554 #ifndef HASCONST
18555 #define const
18556 #endif
18557 #include <sys/types.h>
18558 #include <db.h>
18559
18560 #ifndef DB_VERSION_MAJOR
18561 size_t prefix_cb (key1, key2)
18562 const DBT *key1;
18563 const DBT *key2;
18564 {
18565 }
18566 BTREEINFO info;
18567 int main()
18568 {
18569         info.prefix = prefix_cb;
18570 }
18571 #endif
18572 EOCP
18573         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18574                 if $contains warning try.out >>/dev/null 2>&1 ; then
18575                         db_prefixtype='int'
18576                 else
18577                         db_prefixtype='size_t'
18578                 fi
18579         else
18580                 db_prefixtype='size_t'
18581                 : XXX Maybe we should just give up here.
18582                 $cat try.out >&4
18583                 echo "Help:  I can't seem to compile the db test program." >&4
18584                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18585         fi
18586         $rm_try
18587         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18588         ;;
18589 *)      db_prefixtype='size_t'
18590         ;;
18591 esac
18592
18593 : How can we generate normalized random numbers ?
18594 echo " "
18595 echo "Looking for a random number function..." >&4
18596 case "$randfunc" in
18597 '')
18598         if set drand48 val -f; eval $csym; $val; then
18599                 dflt="drand48"
18600                 echo "Good, found drand48()." >&4
18601         elif set random val -f; eval $csym; $val; then
18602                 dflt="random"
18603                 echo "OK, found random()." >&4
18604         else
18605                 dflt="rand"
18606                 echo "Yick, looks like I have to use rand()." >&4
18607         fi
18608         echo " "
18609         ;;
18610 *)
18611         dflt="$randfunc"
18612         ;;
18613 esac
18614 cont=true
18615
18616 case "$ccflags" in
18617 *-Dmy_rand=*|*-Dmy_srand=*)
18618         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18619         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18620         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18621         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18622         ;;
18623 esac
18624
18625 while $test "$cont"; do
18626         rp="Use which function to generate random numbers?"
18627         . ./myread
18628         if $test "$ans" = "$dflt"; then
18629                 : null
18630         else
18631                 randbits=''
18632         fi
18633         randfunc="$ans"
18634         if set $ans val -f; eval $csym; $val; then
18635                 cont=''
18636         else
18637                 dflt=y
18638                 rp="I cannot find function $ans. Use that name anyway?"
18639                 . ./myread
18640                 dflt=rand
18641                 case "$ans" in
18642                         [yY]*) cont='';;
18643                 esac
18644         fi
18645         case "$cont" in
18646         '')
18647                 case "$randfunc" in
18648                 drand48)
18649                         drand01="drand48()"
18650                         seedfunc="srand48"
18651                         randbits=48
18652                         randseedtype=long
18653                         ;;
18654                 rand|random)
18655                         case "$randbits" in
18656                         '')
18657 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18658                                 $cat >try.c <<EOCP
18659 #$i_unistd I_UNISTD
18660 #$i_stdlib I_STDLIB
18661 #include <stdio.h>
18662 #ifdef I_UNISTD
18663 #  include <unistd.h>
18664 #endif
18665 #ifdef I_STDLIB
18666 #  include <stdlib.h>
18667 #endif
18668 int main()
18669 {
18670         register int i;
18671         register unsigned long tmp;
18672         register unsigned long max = 0L;
18673
18674         for (i = 1000; i; i--) {
18675                 tmp = (unsigned long) $randfunc();
18676                 if (tmp > max) max = tmp;
18677         }
18678         for (i = 0; max; i++)
18679                 max /= 2;
18680         printf("%d\n",i);
18681 }
18682 EOCP
18683                                 set try
18684                                 if eval $compile_ok; then
18685                                         dflt=`try`
18686                                 else
18687                                         dflt='?'
18688                                         echo "(I can't seem to compile the test program...)"
18689                                 fi
18690                                 ;;
18691                         *)
18692                                 dflt="$randbits"
18693                                 ;;
18694                         esac
18695                         rp="How many bits does your $randfunc() function produce?"
18696                         . ./myread
18697                         randbits="$ans"
18698                         $rm_try
18699                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18700                         seedfunc="s$randfunc"
18701                         randseedtype=unsigned
18702                         ;;
18703                 *)
18704                         dflt="31"
18705                         rp="How many bits does your $randfunc() function produce?"
18706                         . ./myread
18707                         randbits="$ans"
18708                         seedfunc="s$randfunc"
18709                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18710                         if set $seedfunc val -f; eval $csym; $val; then
18711                                 echo "(Using $seedfunc() to seed random generator)"
18712                         else
18713                                 echo "(Warning: no $seedfunc() to seed random generator)"
18714                                 seedfunc=rand
18715                         fi
18716                         randseedtype=unsigned
18717                         ;;
18718                 esac
18719                 ;;
18720         esac
18721 done
18722
18723 echo " "
18724 echo "Determining whether or not we are on an EBCDIC system..." >&4
18725 $cat >try.c <<'EOM'
18726 int main()
18727 {
18728   if ('M'==0xd4) return 0;
18729   return 1;
18730 }
18731 EOM
18732
18733 val=$undef
18734 set try
18735 if eval $compile_ok; then
18736         if $run ./try; then
18737                 echo "You seem to speak EBCDIC." >&4
18738                 val="$define"
18739         else
18740                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18741         fi
18742 else
18743         echo "I'm unable to compile the test program." >&4
18744         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18745 fi
18746 $rm_try
18747 set ebcdic
18748 eval $setvar
18749
18750 echo " "
18751 $cat >&4 <<EOM
18752 Checking how to flush all pending stdio output...
18753 EOM
18754 # I only know how to find the first 32 possibly open files on SunOS.
18755 # See also hints/sunos_4_1.sh and util.c  --AD
18756 case "$osname" in
18757 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18758 esac
18759 $cat >>try.c <<EOCP
18760 #include <stdio.h>
18761 #$i_stdlib I_STDLIB
18762 #ifdef I_STDLIB
18763 #include <stdlib.h>
18764 #endif
18765 #$i_unistd I_UNISTD
18766 #ifdef I_UNISTD
18767 # include <unistd.h>
18768 #endif
18769 #$d_sysconf HAS_SYSCONF
18770 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18771 #ifdef HAS_STDIO_STREAM_ARRAY
18772 # define STDIO_STREAM_ARRAY $stdio_stream_array
18773 #endif
18774 int main() {
18775   FILE* p;
18776   unlink("try.out");
18777   p = fopen("try.out", "w");
18778 #ifdef TRY_FPUTC
18779   fputc('x', p);
18780 #else
18781 # ifdef TRY_FPRINTF
18782   fprintf(p, "x");
18783 # endif
18784 #endif
18785 #ifdef TRY_FFLUSH_NULL
18786   fflush(NULL);
18787 #endif
18788 #ifdef TRY_FFLUSH_ALL
18789   {
18790     long open_max = -1;
18791 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18792     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18793 # else
18794 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18795     open_max = sysconf(_SC_OPEN_MAX);
18796 #  else
18797 #   ifdef FOPEN_MAX
18798     open_max = FOPEN_MAX;
18799 #   else
18800 #    ifdef OPEN_MAX
18801     open_max = OPEN_MAX;
18802 #    else
18803 #     ifdef _NFILE
18804     open_max = _NFILE;
18805 #     endif
18806 #    endif
18807 #   endif
18808 #  endif
18809 # endif
18810 # ifdef HAS_STDIO_STREAM_ARRAY
18811     if (open_max > 0) {
18812       long i;
18813       for (i = 0; i < open_max; i++)
18814             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18815                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18816                 STDIO_STREAM_ARRAY[i]._flag)
18817                 fflush(&STDIO_STREAM_ARRAY[i]);
18818     }
18819   }
18820 # endif
18821 #endif
18822   _exit(42);
18823 }
18824 EOCP
18825 : first we have to find out how _not_ to flush
18826 $to try.c
18827 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18828     output=''
18829     set try -DTRY_FPUTC
18830     if eval $compile; then
18831             $run ./try 2>/dev/null
18832             code="$?"
18833             $from try.out
18834             if $test ! -s try.out -a "X$code" = X42; then
18835                 output=-DTRY_FPUTC
18836             fi
18837     fi
18838     case "$output" in
18839     '')
18840             set try -DTRY_FPRINTF
18841             if eval $compile; then
18842                     $run ./try 2>/dev/null
18843                     code="$?"
18844                     $from try.out
18845                     if $test ! -s try.out -a "X$code" = X42; then
18846                         output=-DTRY_FPRINTF
18847                     fi
18848             fi
18849         ;;
18850     esac
18851 fi
18852 : check for fflush NULL behaviour
18853 case "$fflushNULL" in
18854 '')     set try -DTRY_FFLUSH_NULL $output
18855         if eval $compile; then
18856                 $run ./try 2>/dev/null
18857                 code="$?"
18858                 $from try.out
18859                 if $test -s try.out -a "X$code" = X42; then
18860                         fflushNULL="`$cat try.out`"
18861                 else
18862                         if $test "X$code" != X42; then
18863                                 $cat >&4 <<EOM
18864 (If this test failed, don't worry, we'll try another method shortly.)
18865 EOM
18866                         fi
18867                 fi
18868         fi
18869         $rm_try
18870         case "$fflushNULL" in
18871         x)      $cat >&4 <<EOM
18872 Your fflush(NULL) works okay for output streams.
18873 Let's see if it clobbers input pipes...
18874 EOM
18875 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18876 # bug that improperly flushes the input end of pipes.  So we avoid the
18877 # autoflush on fork/system/exec support for now. :-(
18878 $cat >tryp.c <<EOCP
18879 #include <stdio.h>
18880 int
18881 main(int argc, char **argv)
18882 {
18883     char buf[1024];
18884     int i;
18885     char *bp = buf;
18886     while (1) {
18887         while ((i = getc(stdin)) != -1
18888                && (*bp++ = i) != '\n'
18889                && bp < &buf[1024])
18890         /* DO NOTHING */ ;
18891         *bp = '\0';
18892         fprintf(stdout, "%s", buf);
18893         fflush(NULL);
18894         if (i == -1)
18895             return 0;
18896         bp = buf;
18897     }
18898 }
18899 EOCP
18900                 fflushNULL="$define"
18901                 set tryp
18902                 if eval $compile; then
18903                     $rm -f tryp.out
18904                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18905                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18906                        $cat >&4 <<EOM
18907 fflush(NULL) seems to behave okay with input streams.
18908 EOM
18909                         fflushNULL="$define"
18910                     else
18911                         $cat >&4 <<EOM
18912 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18913 EOM
18914                         fflushNULL="$undef"
18915                     fi
18916                 fi
18917                 $rm -f core tryp.c tryp.core core.tryp.*
18918                 ;;
18919         '')     $cat >&4 <<EOM
18920 Your fflush(NULL) isn't working (contrary to ANSI C).
18921 EOM
18922                 fflushNULL="$undef"
18923                 ;;
18924         *)      $cat >&4 <<EOM
18925 Cannot figure out whether your fflush(NULL) works or not.
18926 I'm assuming it doesn't (contrary to ANSI C).
18927 EOM
18928                 fflushNULL="$undef"
18929                 ;;
18930         esac
18931         ;;
18932 $define|true|[yY]*)
18933         fflushNULL="$define"
18934         ;;
18935 *)
18936         fflushNULL="$undef"
18937         ;;
18938 esac
18939 : check explicit looping only if NULL did not work, and if the pipe
18940 : bug does not show up on an explicit flush too
18941 case "$fflushNULL" in
18942 "$undef")
18943         $cat >tryp.c <<EOCP
18944 #include <stdio.h>
18945 int
18946 main(int argc, char **argv)
18947 {
18948     char buf[1024];
18949     int i;
18950     char *bp = buf;
18951     while (1) {
18952         while ((i = getc(stdin)) != -1
18953                && (*bp++ = i) != '\n'
18954                && bp < &buf[1024])
18955         /* DO NOTHING */ ;
18956         *bp = '\0';
18957         fprintf(stdout, "%s", buf);
18958         fflush(stdin);
18959         if (i == -1)
18960             return 0;
18961         bp = buf;
18962     }
18963 }
18964 EOCP
18965         set tryp
18966         if eval $compile; then
18967             $rm -f tryp.out
18968             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18969             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18970                $cat >&4 <<EOM
18971 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18972 EOM
18973                 : now check for fflushall behaviour
18974                 case "$fflushall" in
18975                 '')     set try -DTRY_FFLUSH_ALL $output
18976                         if eval $compile; then
18977                                 $cat >&4 <<EOM
18978 (Now testing the other method--but note that this also may fail.)
18979 EOM
18980                                 $run ./try 2>/dev/null
18981                                 code=$?
18982                                 $from try.out
18983                                 if $test -s try.out -a "X$code" = X42; then
18984                                         fflushall="`$cat try.out`"
18985                                 fi
18986                         fi
18987                         $rm_try
18988                         case "$fflushall" in
18989                         x)      $cat >&4 <<EOM
18990 Whew. Flushing explicitly all the stdio streams works.
18991 EOM
18992                                 fflushall="$define"
18993                                 ;;
18994                         '')     $cat >&4 <<EOM
18995 Sigh. Flushing explicitly all the stdio streams doesn't work.
18996 EOM
18997                                 fflushall="$undef"
18998                                 ;;
18999                         *)      $cat >&4 <<EOM
19000 Cannot figure out whether flushing stdio streams explicitly works or not.
19001 I'm assuming it doesn't.
19002 EOM
19003                                 fflushall="$undef"
19004                                 ;;
19005                         esac
19006                         ;;
19007                 "$define"|true|[yY]*)
19008                         fflushall="$define"
19009                         ;;
19010                 *)
19011                         fflushall="$undef"
19012                         ;;
19013                 esac
19014             else
19015                 $cat >&4 <<EOM
19016 All is futile.  Even fflush(stdin) clobbers input pipes!
19017 EOM
19018                 fflushall="$undef"
19019             fi
19020         else
19021             fflushall="$undef"
19022         fi
19023         $rm -f core tryp.c tryp.core core.tryp.*
19024         ;;
19025 *)      fflushall="$undef"
19026         ;;
19027 esac
19028
19029 case "$fflushNULL$fflushall" in
19030 undefundef)
19031         $cat <<EOM
19032 OK, I give up.  I cannot figure out how to flush pending stdio output.
19033 We won't be flushing handles at all before fork/exec/popen.
19034 EOM
19035         ;;
19036 esac
19037 $rm_try
19038
19039 : Store the full pathname to the ar program for use in the C program
19040 : Respect a hint or command line value for full_ar.
19041 case "$full_ar" in
19042 '') full_ar=$ar ;;
19043 esac
19044
19045 : Store the full pathname to the sed program for use in the C program
19046 full_sed=$sed
19047
19048 : see what type gids are declared as in the kernel
19049 echo " "
19050 echo "Looking for the type for group ids returned by getgid()."
19051 set gid_t gidtype xxx stdio.h sys/types.h
19052 eval $typedef
19053 case "$gidtype" in
19054 xxx)
19055         xxx=`./findhdr sys/user.h`
19056         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19057         case $1 in
19058         unsigned) dflt="$1 $2" ;;
19059         *) dflt="$1" ;;
19060         esac
19061         ;;
19062 *) dflt="$gidtype";;
19063 esac
19064 case "$gidtype" in
19065 gid_t) echo "gid_t found." ;;
19066 *)      rp="What is the type for group ids returned by getgid()?"
19067         . ./myread
19068         gidtype="$ans"
19069         ;;
19070 esac
19071
19072 echo " "
19073 case "$gidtype" in
19074 *_t) zzz="$gidtype"     ;;
19075 *)   zzz="gid"          ;;
19076 esac
19077 echo "Checking the size of $zzz..." >&4 
19078 cat > try.c <<EOCP
19079 #include <sys/types.h>
19080 #include <stdio.h>
19081 #$i_stdlib I_STDLIB
19082 #ifdef I_STDLIB
19083 #include <stdlib.h>
19084 #endif
19085 int main() {
19086     printf("%d\n", (int)sizeof($gidtype));
19087     exit(0);
19088 }
19089 EOCP
19090 set try
19091 if eval $compile_ok; then
19092         yyy=`$run ./try`
19093         case "$yyy" in
19094         '')     gidsize=4
19095                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19096                 ;;
19097         *)      gidsize=$yyy
19098                 echo "Your $zzz is $gidsize bytes long."
19099                 ;;
19100         esac
19101 else
19102         gidsize=4
19103         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19104 fi
19105
19106
19107 echo " "
19108 case "$gidtype" in
19109 *_t) zzz="$gidtype"     ;;
19110 *)   zzz="gid"          ;;
19111 esac
19112 echo "Checking the sign of $zzz..." >&4 
19113 cat > try.c <<EOCP
19114 #include <sys/types.h>
19115 #include <stdio.h>
19116 int main() {
19117         $gidtype foo = -1;
19118         if (foo < 0)
19119                 printf("-1\n");
19120         else
19121                 printf("1\n");
19122 }
19123 EOCP
19124 set try
19125 if eval $compile; then
19126         yyy=`$run ./try`
19127         case "$yyy" in
19128         '')     gidsign=1
19129                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19130                 ;;
19131         *)      gidsign=$yyy
19132                 case "$gidsign" in
19133                  1) echo "Your $zzz is unsigned." ;;
19134                 -1) echo "Your $zzz is signed."   ;;
19135                 esac
19136                 ;;
19137         esac
19138 else
19139         gidsign=1
19140         echo "(I can't compile the test program--guessing unsigned.)" >&4
19141 fi
19142
19143
19144 echo " "
19145
19146 if $test X"$quadtype" != X; then
19147
19148 echo "Checking how to print 64-bit integers..." >&4
19149
19150 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19151         $cat >try.c <<'EOCP'
19152 #include <sys/types.h>
19153 #include <stdio.h>
19154 int main() {
19155   int q = 12345678901;
19156   printf("%ld\n", q);
19157 }
19158 EOCP
19159         set try
19160         if eval $compile; then
19161                 yyy=`$run ./try`
19162                 case "$yyy" in
19163                 12345678901)
19164                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19165                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19166                         echo "We will use %d."
19167                         ;;
19168                 esac
19169         fi
19170 fi
19171
19172 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19173         $cat >try.c <<'EOCP'
19174 #include <sys/types.h>
19175 #include <stdio.h>
19176 int main() {
19177   long q = 12345678901;
19178   printf("%ld\n", q);
19179 }
19180 EOCP
19181         set try
19182         if eval $compile; then
19183                 yyy=`$run ./try`
19184                 case "$yyy" in
19185                 12345678901)
19186                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19187                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19188                         echo "We will use %ld."
19189                         ;;
19190                 esac
19191         fi
19192 fi
19193
19194 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19195         $cat >try.c <<'EOCP'
19196 #include <sys/types.h>
19197 #include <inttypes.h>
19198 #include <stdio.h>
19199 int main() {
19200   int64_t q = 12345678901;
19201   printf("%" PRId64 "\n", q);
19202 }
19203 EOCP
19204         set try
19205         if eval $compile; then
19206                 yyy=`$run ./try`
19207                 case "$yyy" in
19208                 12345678901)
19209                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19210                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19211                         echo "We will use the C9X style."
19212                         ;;
19213                 esac
19214         fi
19215 fi
19216
19217 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19218         $cat >try.c <<EOCP
19219 #include <sys/types.h>
19220 #include <stdio.h>
19221 int main() {
19222   $quadtype q = 12345678901;
19223   printf("%Ld\n", q);
19224 }
19225 EOCP
19226         set try
19227         if eval $compile; then
19228                 yyy=`$run ./try`
19229                 case "$yyy" in
19230                 12345678901)
19231                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19232                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19233                         echo "We will use %Ld."
19234                         ;;
19235                 esac
19236         fi
19237 fi
19238
19239 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19240         $cat >try.c <<'EOCP'
19241 #include <sys/types.h>
19242 #include <stdio.h>
19243 int main() {
19244   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19245   printf("%lld\n", q);
19246 }
19247 EOCP
19248         set try
19249         if eval $compile; then
19250                 yyy=`$run ./try`
19251                 case "$yyy" in
19252                 12345678901)
19253                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19254                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19255                         echo "We will use the %lld style."
19256                         ;;
19257                 esac
19258         fi
19259 fi
19260
19261 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19262         $cat >try.c <<EOCP
19263 #include <sys/types.h>
19264 #include <stdio.h>
19265 int main() {
19266   $quadtype q = 12345678901;
19267   printf("%qd\n", q);
19268 }
19269 EOCP
19270         set try
19271         if eval $compile; then
19272                 yyy=`$run ./try`
19273                 case "$yyy" in
19274                 12345678901)
19275                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19276                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19277                         echo "We will use %qd."
19278                         ;;
19279                 esac
19280         fi
19281 fi
19282
19283 if $test X"$sPRId64" = X; then
19284         echo "Cannot figure out how to print 64-bit integers." >&4
19285 fi
19286 $rm_try
19287
19288 fi
19289
19290 case "$sPRId64" in
19291 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19292         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19293         ;;
19294 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19295         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19296         ;;
19297 esac
19298
19299
19300 echo " "
19301 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19302
19303 if $test X"$ivsize" = X8; then
19304         ivdformat="$sPRId64"
19305         uvuformat="$sPRIu64"
19306         uvoformat="$sPRIo64"
19307         uvxformat="$sPRIx64"
19308         uvXUformat="$sPRIXU64"
19309 else
19310         if $test X"$ivsize" = X"$longsize"; then
19311                 ivdformat='"ld"'
19312                 uvuformat='"lu"'
19313                 uvoformat='"lo"'
19314                 uvxformat='"lx"'
19315                 uvXUformat='"lX"'
19316         else
19317                 if $test X"$ivsize" = X"$intsize"; then
19318                         ivdformat='"d"'
19319                         uvuformat='"u"'
19320                         uvoformat='"o"'
19321                         uvxformat='"x"'
19322                         uvXUformat='"X"'
19323                 else
19324                         : far out
19325                         if $test X"$ivsize" = X"$shortsize"; then
19326                                 ivdformat='"hd"'
19327                                 uvuformat='"hu"'
19328                                 uvoformat='"ho"'
19329                                 uvxformat='"hx"'
19330                                 uvXUformat='"hX"'
19331                         fi
19332                 fi
19333         fi
19334 fi
19335
19336 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19337         nveformat="$sPRIeldbl"
19338         nvfformat="$sPRIfldbl"
19339         nvgformat="$sPRIgldbl"
19340         nvEUformat="$sPRIEUldbl"
19341         nvFUformat="$sPRIFUldbl"
19342         nvGUformat="$sPRIGUldbl"
19343 else
19344         nveformat='"e"'
19345         nvfformat='"f"'
19346         nvgformat='"g"'
19347         nvEUformat='"E"'
19348         nvFUformat='"F"'
19349         nvGUformat='"G"'
19350 fi
19351
19352 case "$ivdformat" in
19353 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19354     exit 1
19355     ;;
19356 esac
19357
19358
19359 echo " "
19360 $echo "Checking the format string to be used for gids..." >&4
19361
19362 case "$gidsign" in
19363 -1)     if $test X"$gidsize" = X"$ivsize"; then
19364                 gidformat="$ivdformat"
19365         else
19366                 if $test X"$gidsize" = X"$longsize"; then
19367                         gidformat='"ld"'
19368                 else
19369                         if $test X"$gidsize" = X"$intsize"; then
19370                                 gidformat='"d"'
19371                         else
19372                                 if $test X"$gidsize" = X"$shortsize"; then
19373                                         gidformat='"hd"'
19374                                 fi
19375                         fi
19376                 fi
19377         fi
19378         ;;
19379 *)      if $test X"$gidsize" = X"$uvsize"; then
19380                 gidformat="$uvuformat"
19381         else
19382                 if $test X"$gidsize" = X"$longsize"; then
19383                         gidformat='"lu"'
19384                 else
19385                         if $test X"$gidsize" = X"$intsize"; then
19386                                 gidformat='"u"'
19387                         else
19388                                 if $test X"$gidsize" = X"$shortsize"; then
19389                                         gidformat='"hu"'
19390                                 fi
19391                         fi
19392                 fi
19393         fi
19394         ;;
19395 esac
19396
19397 : see if getgroups exists
19398 set getgroups d_getgrps
19399 eval $inlibc
19400
19401 : see if setgroups exists
19402 set setgroups d_setgrps
19403 eval $inlibc
19404
19405
19406 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19407 echo " "
19408 case "$d_getgrps$d_setgrps" in
19409 *define*)
19410         case "$groupstype" in
19411         '') dflt="$gidtype" ;;
19412         *)  dflt="$groupstype" ;;
19413         esac
19414         $cat <<EOM
19415 What type of pointer is the second argument to getgroups() and setgroups()?
19416 Usually this is the same as group ids, $gidtype, but not always.
19417
19418 EOM
19419         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19420         . ./myread
19421         groupstype="$ans"
19422         ;;
19423 *)  groupstype="$gidtype";;
19424 esac
19425
19426
19427 if $test $patchlevel -lt 9; then
19428 : MAD is not available in 5.8.x or earlier.
19429     ans=n;
19430 else
19431     case "$mad" in
19432     $define|true|[yY]*) dflt='y' ;;
19433     *)                  dflt='n' ;;
19434     esac
19435     cat <<EOM
19436
19437 Would you like to build with Misc Attribute Decoration? This is development
19438 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19439 overhead on the interpreter.
19440
19441 If this doesn't make any sense to you, just accept the default '$dflt'.
19442 EOM
19443     rp='Build Perl with MAD?'
19444     . ./myread
19445 fi
19446 case "$ans" in
19447 y|Y)    val="$define"
19448         madlyh='madly.h madly.act madly.tab'
19449         madlysrc='madly.c'
19450         madlyobj="madly$_o" ;;
19451 *)      val="$undef"
19452         madlyh=''
19453         madlysrc=''
19454         madlyobj='' ;;
19455 esac
19456 set mad
19457 eval $setvar
19458
19459 echo " "
19460 echo "Checking if your $make program sets \$(MAKE)..." >&4
19461 case "$make_set_make" in
19462 '')
19463         $sed 's/^X //' > testmake.mak << 'EOF'
19464 Xall:
19465 X       @echo 'maketemp="$(MAKE)"'
19466 EOF
19467         case "`$make -f testmake.mak 2>/dev/null`" in
19468         *maketemp=*) make_set_make='#' ;;
19469         *)      make_set_make="MAKE=$make" ;;
19470         esac
19471         $rm -f testmake.mak
19472         ;;
19473 esac
19474 case "$make_set_make" in
19475 '#') echo "Yup, it does.";;
19476 *) echo "Nope, it doesn't.";;
19477 esac
19478
19479 : see what type is used for mode_t
19480 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19481 set mode_t modetype int stdio.h sys/types.h
19482 eval $typedef_ask
19483
19484 : see if we need va_copy
19485 echo " "
19486 case "$i_stdarg" in
19487 "$define")
19488         $cat >try.c <<EOCP
19489 #include <stdarg.h>
19490 #include <stdio.h>
19491 #$i_stdlib I_STDLIB
19492 #ifdef I_STDLIB
19493 #include <stdlib.h>
19494 #endif
19495 #include <signal.h>
19496
19497 int
19498 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19499 {
19500   return vfprintf(f, fmt, *valp);
19501 }
19502
19503 int
19504 myvfprintf(FILE *f, const  char *fmt, va_list val)
19505 {
19506   return ivfprintf(f, fmt, &val);
19507 }
19508
19509 int
19510 myprintf(char *fmt, ...)
19511 {
19512   va_list val;
19513   va_start(val, fmt);
19514   return myvfprintf(stdout, fmt, val);
19515 }
19516
19517 int
19518 main(int ac, char **av)
19519 {
19520   signal(SIGSEGV, exit);
19521
19522   myprintf("%s%cs all right, then\n", "that", '\'');
19523   exit(0);
19524 }
19525 EOCP
19526         set try
19527         if eval $compile && $run ./try 2>&1 >/dev/null; then
19528                 case "`$run ./try`" in
19529                 "that's all right, then")
19530                         okay=yes
19531                         ;;
19532                 esac
19533         fi
19534         case "$okay" in
19535         yes)    echo "It seems that you don't need va_copy()." >&4
19536                 need_va_copy="$undef"
19537                 ;;
19538         *)      echo "It seems that va_copy() or similar will be needed." >&4
19539                 need_va_copy="$define"
19540                 ;;
19541         esac
19542         $rm_try
19543         ;;
19544 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19545         ;;
19546 esac
19547
19548 : see what type is used for size_t
19549 rp="What is the type used for the length parameter for string functions?"
19550 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19551 eval $typedef_ask
19552
19553 : check for type of arguments to gethostbyaddr. 
19554 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19555         case "$d_gethbyaddr" in
19556         $define)
19557                 $cat <<EOM
19558
19559 Checking to see what type of arguments are accepted by gethostbyaddr().
19560 EOM
19561                 hdrs="$define sys/types.h
19562                         $d_socket sys/socket.h 
19563                         $i_niin netinet/in.h 
19564                         $i_netdb netdb.h
19565                         $i_unistd unistd.h"
19566                 : The first arg can 'char *' or 'void *'
19567                 : The second arg is some of integral type
19568                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19569                         for yyy in size_t long int; do
19570                                 case "$netdb_host_type" in
19571                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19572                                         if ./protochk "$try" $hdrs; then
19573                                                 echo "Your system accepts $xxx for the first arg."
19574                                                 echo "...and $yyy for the second arg."
19575                                                 netdb_host_type="$xxx"
19576                                                 netdb_hlen_type="$yyy"
19577                                         fi
19578                                         ;;
19579                                 esac
19580                         done
19581                 done
19582                 : In case none of those worked, prompt the user.
19583                 case "$netdb_host_type" in
19584                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19585                         dflt='char *'
19586                         . ./myread
19587                         netdb_host_type=$ans
19588                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19589                         dflt="$sizetype"
19590                         . ./myread
19591                         netdb_hlen_type=$ans
19592                         ;;
19593                 esac
19594                 ;;
19595         *)      : no gethostbyaddr, so pick harmless defaults
19596                 netdb_host_type='char *'
19597                 netdb_hlen_type="$sizetype"
19598                 ;;
19599         esac
19600         # Remove the "const" if needed. -- but then we'll have a 
19601         # prototype clash!
19602         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19603 fi
19604
19605 : check for type of argument to gethostbyname. 
19606 if test "X$netdb_name_type" = X ; then
19607         case "$d_gethbyname" in
19608         $define)
19609                 $cat <<EOM
19610
19611 Checking to see what type of argument is accepted by gethostbyname().
19612 EOM
19613                 hdrs="$define sys/types.h
19614                         $d_socket sys/socket.h 
19615                         $i_niin netinet/in.h 
19616                         $i_netdb netdb.h
19617                         $i_unistd unistd.h"
19618                 for xxx in "const char *" "char *"; do
19619                         case "$netdb_name_type" in
19620                         '')     try="extern struct hostent *gethostbyname($xxx);"
19621                                 if ./protochk "$try" $hdrs; then
19622                                         echo "Your system accepts $xxx."
19623                                         netdb_name_type="$xxx"
19624                                 fi
19625                                 ;;
19626                         esac
19627                 done
19628                 : In case none of those worked, prompt the user.
19629                 case "$netdb_name_type" in
19630                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19631                         dflt='char *'
19632                         . ./myread
19633                         netdb_name_type=$ans
19634                         ;;
19635                 esac
19636                 ;;
19637         *)      : no gethostbyname, so pick harmless default
19638                 netdb_name_type='char *'
19639                 ;;
19640         esac
19641 fi
19642
19643 : check for type of 1st argument to getnetbyaddr. 
19644 if test "X$netdb_net_type" = X ; then
19645         case "$d_getnbyaddr" in
19646         $define)
19647                 $cat <<EOM
19648
19649 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19650 EOM
19651                 hdrs="$define sys/types.h
19652                         $d_socket sys/socket.h 
19653                         $i_niin netinet/in.h 
19654                         $i_netdb netdb.h
19655                         $i_unistd unistd.h"
19656                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19657                         case "$netdb_net_type" in
19658                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19659                                 if ./protochk "$try" $hdrs; then
19660                                         echo "Your system accepts $xxx."
19661                                         netdb_net_type="$xxx"
19662                                 fi
19663                                 ;;
19664                         esac
19665                 done
19666                 : In case none of those worked, prompt the user.
19667                 case "$netdb_net_type" in
19668                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19669                         dflt='long'
19670                         . ./myread
19671                         netdb_net_type=$ans
19672                         ;;
19673                 esac
19674                 ;;
19675         *)      : no getnetbyaddr, so pick harmless default
19676                 netdb_net_type='long'
19677                 ;;
19678         esac
19679 fi
19680 : locate the preferred pager for this system
19681 fn=f/
19682 case "$pager" in
19683 '')
19684         dflt=''
19685         case "$pg" in
19686         /*) dflt=$pg;;
19687         [a-zA-Z]:/*) dflt=$pg;;
19688         esac
19689         case "$more" in
19690         /*) dflt=$more;;
19691         [a-zA-Z]:/*) dflt=$more;;
19692         esac
19693         case "$less" in
19694         /*) dflt=$less;;
19695         [a-zA-Z]:/*) dflt=$less;;
19696         esac
19697         case "$dflt" in
19698         '') dflt=/usr/ucb/more;;
19699         esac
19700         ;;
19701 *)      dflt="$pager"
19702         : Instruct ./getfile to trust the hinted or previous pager value,
19703         : even if it does not begin with a slash.  For example, on os2,
19704         : pager might be cmd /c more.  See comments in UU/getfile.
19705         fn="f/($pager)"
19706         ;;
19707 esac
19708 echo " "
19709 rp='What pager is used on your system?'
19710 . ./getfile
19711 pager="$ans"
19712
19713 : see what type pids are declared as in the kernel
19714 rp="What is the type of process ids on this system?"
19715 set pid_t pidtype int stdio.h sys/types.h
19716 eval $typedef_ask
19717
19718 : see if ar generates random libraries by itself
19719 echo " "
19720 echo "Checking how to generate random libraries on your machine..." >&4
19721 echo 'int bar1() { return bar2(); }' > bar1.c
19722 echo 'int bar2() { return 2; }' > bar2.c
19723 $cat > foo.c <<EOP
19724 #$i_stdlib I_STDLIB
19725 #ifdef I_STDLIB
19726 #include <stdlib.h>
19727 #endif
19728 int main() { printf("%d\n", bar1()); exit(0); }
19729 EOP
19730 $cc $ccflags -c bar1.c >/dev/null 2>&1
19731 $cc $ccflags -c bar2.c >/dev/null 2>&1
19732 $cc $ccflags -c foo.c >/dev/null 2>&1
19733 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19734 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19735         $run ./foobar >/dev/null 2>&1; then
19736         echo "$ar appears to generate random libraries itself."
19737         orderlib=false
19738         if [ "X$ranlib" = "X" ]; then
19739             ranlib=":"
19740         fi
19741 elif $ar s bar$_a >/dev/null 2>&1 &&
19742         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19743         $run ./foobar >/dev/null 2>&1; then
19744                 echo "a table of contents needs to be added with '$ar s'."
19745                 orderlib=false
19746                 ranlib="$ar s"
19747 elif $ar ts bar$_a >/dev/null 2>&1 &&
19748         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19749         $run ./foobar >/dev/null 2>&1; then
19750                 echo "a table of contents needs to be added with '$ar ts'."
19751                 orderlib=false
19752                 ranlib="$ar ts"
19753 else
19754         case "$ranlib" in
19755         :) ranlib='';;
19756         '')
19757                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19758                 $test -f $ranlib || ranlib=''
19759                 ;;
19760         esac
19761         if $test -n "$ranlib"; then
19762                 echo "your system has '$ranlib'; we'll use that."
19763                 orderlib=false
19764         else
19765                 echo "your system doesn't seem to support random libraries"
19766                 echo "so we'll use lorder and tsort to order the libraries."
19767                 orderlib=true
19768                 ranlib=":"
19769         fi
19770 fi
19771 $rm -f foo* bar*
19772
19773 : check for type of arguments to select. 
19774 case "$selecttype" in
19775 '') case "$d_select" in
19776         $define)
19777                 echo " "
19778                 $cat <<EOM
19779 Checking to see what type of arguments are accepted by select().
19780 EOM
19781                 hdrs="$define sys/types.h
19782                         $i_systime sys/time.h 
19783                         $i_sysselct sys/select.h
19784                         $d_socket sys/socket.h"
19785                 : The first arg can be int, unsigned, or size_t
19786                 : The last arg may or may not be 'const'
19787                 val=''
19788                 : void pointer has been seen but using that
19789                 : breaks the selectminbits test
19790                 for xxx in 'fd_set *' 'int *'; do
19791                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19792                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19793                                         case "$val" in
19794                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19795                                                 if ./protochk "$try" $hdrs; then
19796                                                         echo "Your system accepts $xxx."
19797                                                         val="$xxx"
19798                                                 fi
19799                                                 ;;
19800                                         esac
19801                                 done
19802                         done
19803                 done
19804                 case "$val" in
19805                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19806                         case "$d_fd_set" in
19807                                 $define) dflt="fd_set *" ;;
19808                                 *)              dflt="int *" ;;
19809                         esac
19810                         . ./myread
19811                         val=$ans
19812                         ;;
19813                 esac
19814                 selecttype="$val"
19815                 ;;
19816         *)      : no select, so pick a harmless default
19817                 selecttype='int *'
19818                 ;;
19819         esac
19820         ;;
19821 esac
19822
19823 : check for the select 'width'
19824 case "$selectminbits" in
19825 '') safebits=`expr $ptrsize \* 8`
19826     case "$d_select" in
19827         $define)
19828                 $cat <<EOM
19829
19830 Checking to see on how many bits at a time your select() operates...
19831 EOM
19832                 $cat >try.c <<EOCP
19833 #include <sys/types.h>
19834 #$i_time I_TIME
19835 #$i_systime I_SYS_TIME
19836 #$i_systimek I_SYS_TIME_KERNEL
19837 #ifdef I_TIME
19838 #   include <time.h>
19839 #endif
19840 #ifdef I_SYS_TIME
19841 #   ifdef I_SYS_TIME_KERNEL
19842 #       define KERNEL
19843 #   endif
19844 #   include <sys/time.h>
19845 #   ifdef I_SYS_TIME_KERNEL
19846 #       undef KERNEL
19847 #   endif
19848 #endif
19849 #$i_sysselct I_SYS_SELECT
19850 #ifdef I_SYS_SELECT
19851 #include <sys/select.h>
19852 #endif
19853 #$d_socket HAS_SOCKET
19854 #ifdef HAS_SOCKET
19855 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19856 #endif
19857 #include <stdio.h>
19858 #$i_stdlib I_STDLIB
19859 #ifdef I_STDLIB
19860 #include <stdlib.h>
19861 #endif
19862 $selecttype b;
19863 #define S sizeof(*(b))
19864 #define MINBITS 64
19865 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19866 #define NBITS  (NBYTES * 8)
19867 int main() {
19868     char *s = (char *)malloc(NBYTES);
19869     struct timeval t;
19870     int i;
19871     FILE* fp;
19872     int fd;
19873
19874     if (!s)
19875         exit(1);
19876     fclose(stdin);
19877     fp = fopen("try.c", "r");
19878     if (fp == 0)
19879       exit(2);
19880     fd = fileno(fp);
19881     if (fd < 0)
19882       exit(3);
19883     b = ($selecttype)s;
19884     for (i = 0; i < NBITS; i++)
19885         FD_SET(i, b);
19886     t.tv_sec  = 0;
19887     t.tv_usec = 0;
19888     select(fd + 1, b, 0, 0, &t);
19889     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19890     free(s);
19891     printf("%d\n", i + 1);
19892     return 0;
19893 }
19894 EOCP
19895                 set try
19896                 if eval $compile_ok; then
19897                         selectminbits=`$run ./try`
19898                         case "$selectminbits" in
19899                         '')     cat >&4 <<EOM
19900 Cannot figure out on how many bits at a time your select() operates.
19901 I'll play safe and guess it is $safebits bits.
19902 EOM
19903                                 selectminbits=$safebits
19904                                 bits="$safebits bits"
19905                                 ;;
19906                         1)      bits="1 bit" ;;
19907                         *)      bits="$selectminbits bits" ;;
19908                         esac
19909                         echo "Your select() operates on $bits at a time." >&4
19910                 else
19911                         rp='What is the minimum number of bits your select() operates on?'
19912                         case "$byteorder" in
19913                         12345678)       dflt=64 ;;
19914                         1234)           dflt=32 ;;
19915                         *)              dflt=1  ;;
19916                         esac
19917                         . ./myread
19918                         val=$ans
19919                         selectminbits="$val"
19920                 fi
19921                 $rm_try
19922                 ;;
19923         *)      : no select, so pick a harmless default
19924                 selectminbits=$safebits
19925                 ;;
19926         esac
19927         ;;
19928 esac
19929
19930 : Trace out the files included by signal.h, then look for SIGxxx names.
19931 : Remove SIGARRAYSIZE used by HPUX.
19932 : Remove SIGSTKSIZE used by Linux.
19933 : Remove SIGSTKSZ used by Posix.
19934 : Remove SIGTYP void lines used by OS2.
19935 : Some cpps, like os390, dont give the file name anywhere
19936 if [ "X$fieldn" = X ]; then
19937         : Just make some guesses.  We check them later.
19938         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19939 else
19940         xxx=`echo '#include <signal.h>' |
19941         $cppstdin $cppminus $cppflags 2>/dev/null |
19942         $grep '^[       ]*#.*include' | 
19943         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19944 fi
19945 : Check this list of files to be sure we have parsed the cpp output ok.
19946 : This will also avoid potentially non-existent files, such 
19947 : as ../foo/bar.h
19948 xxxfiles=''
19949 for xx in $xxx /dev/null ; do
19950         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19951 done
19952 : If we have found no files, at least try signal.h
19953 case "$xxxfiles" in
19954 '')     xxxfiles=`./findhdr signal.h` ;;
19955 esac
19956 xxx=`awk '
19957 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19958         print substr($2, 4, 20)
19959 }
19960 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19961         print substr($3, 4, 20)
19962 }' $xxxfiles`
19963 : Append some common names just in case the awk scan failed.
19964 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19965 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19966 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19967 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19968 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19969
19970 : generate a few handy files for later
19971 $cat > signal.c <<EOCP
19972 #include <sys/types.h>
19973 #include <signal.h>
19974 #$i_stdlib I_STDLIB
19975 #ifdef I_STDLIB
19976 #include <stdlib.h>
19977 #endif
19978 #include <stdio.h>
19979 int main() {
19980
19981 /* Strange style to avoid deeply-nested #if/#else/#endif */
19982 #ifndef NSIG
19983 #  ifdef _NSIG
19984 #    define NSIG (_NSIG)
19985 #  endif
19986 #endif
19987
19988 #ifndef NSIG
19989 #  ifdef SIGMAX
19990 #    define NSIG (SIGMAX+1)
19991 #  endif
19992 #endif
19993
19994 #ifndef NSIG
19995 #  ifdef SIG_MAX
19996 #    define NSIG (SIG_MAX+1)
19997 #  endif
19998 #endif
19999
20000 #ifndef NSIG
20001 #  ifdef _SIG_MAX
20002 #    define NSIG (_SIG_MAX+1)
20003 #  endif
20004 #endif
20005
20006 #ifndef NSIG
20007 #  ifdef MAXSIG
20008 #    define NSIG (MAXSIG+1)
20009 #  endif
20010 #endif
20011
20012 #ifndef NSIG
20013 #  ifdef MAX_SIG
20014 #    define NSIG (MAX_SIG+1)
20015 #  endif
20016 #endif
20017
20018 #ifndef NSIG
20019 #  ifdef SIGARRAYSIZE
20020 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20021 #  endif
20022 #endif
20023
20024 #ifndef NSIG
20025 #  ifdef _sys_nsig
20026 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20027 #  endif
20028 #endif
20029
20030 /* Default to some arbitrary number that's big enough to get most
20031    of the common signals.
20032 */
20033 #ifndef NSIG
20034 #    define NSIG 50
20035 #endif
20036
20037 printf("NSIG %d\n", NSIG);
20038
20039 #ifndef JUST_NSIG
20040
20041 EOCP
20042
20043 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20044 {
20045         printf "#ifdef SIG"; printf $1; printf "\n"
20046         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20047         printf $1; printf ");\n"
20048         printf "#endif\n"
20049 }
20050 END {
20051         printf "#endif /* JUST_NSIG */\n";
20052         printf "exit(0);\n}\n";
20053 }
20054 ' >>signal.c
20055 $cat >signal.awk <<'EOP'
20056 BEGIN { ndups = 0 }
20057 $1 ~ /^NSIG$/ { nsig = $2 }
20058 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20059     if ($2 > maxsig) { maxsig = $2 }
20060     if (sig_name[$2]) {
20061         dup_name[ndups] = $1
20062         dup_num[ndups] = $2
20063         ndups++ 
20064     }
20065     else {
20066         sig_name[$2] = $1
20067         sig_num[$2] = $2
20068     }
20069 }
20070 END { 
20071     if (nsig == 0) {
20072         nsig = maxsig + 1
20073     }
20074     printf("NSIG %d\n", nsig);
20075     for (n = 1; n < nsig; n++) {
20076         if (sig_name[n]) {
20077             printf("%s %d\n", sig_name[n], sig_num[n])
20078         }
20079         else {
20080             printf("NUM%d %d\n", n, n) 
20081         }
20082     }
20083     for (n = 0; n < ndups; n++) {
20084         printf("%s %d\n", dup_name[n], dup_num[n])
20085     }
20086 }
20087 EOP
20088 $cat >signal_cmd <<EOS
20089 $startsh
20090 if $test -s signal.lst; then
20091     echo "Using your existing signal.lst file"
20092         exit 0
20093 fi
20094 xxx="$xxx"
20095 EOS
20096 $cat >>signal_cmd <<'EOS'
20097
20098 set signal
20099 if eval $compile_ok; then
20100         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
20101 else
20102         echo "(I can't seem be able to compile the whole test program)" >&4
20103         echo "(I'll try it in little pieces.)" >&4
20104         set signal -DJUST_NSIG
20105         if eval $compile_ok; then
20106                 $run ./signal$_exe > signal.nsg
20107                 $cat signal.nsg
20108         else
20109                 echo "I can't seem to figure out how many signals you have." >&4
20110                 echo "Guessing 50." >&4
20111                 echo 'NSIG 50' > signal.nsg
20112         fi
20113         : Now look at all the signal names, one at a time.
20114         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20115                 $cat > signal.c <<EOCP
20116 #include <sys/types.h>
20117 #include <signal.h>
20118 #include <stdio.h>
20119 int main() {
20120 printf("$xx %d\n", SIG${xx});
20121 return 0;
20122 }
20123 EOCP
20124                 set signal
20125                 if eval $compile; then
20126                         echo "SIG${xx} found."
20127                         $run ./signal$_exe  >> signal.ls1
20128                 else
20129                         echo "SIG${xx} NOT found."
20130                 fi
20131         done
20132         if $test -s signal.ls1; then
20133                 $cat signal.nsg signal.ls1 |
20134                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20135         fi
20136
20137 fi
20138 if $test -s signal.lst; then
20139         :
20140 else
20141         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20142         echo 'kill -l' >signal
20143         set X `csh -f <signal`
20144         $rm -f signal
20145         shift
20146         case $# in
20147         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20148         esac
20149         echo $@ | $tr ' ' $trnl | \
20150             $awk '{ printf "%s %d\n", $1, ++s; }
20151                   END { printf "NSIG %d\n", ++s }' >signal.lst
20152 fi
20153 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20154 EOS
20155 chmod a+x signal_cmd
20156 $eunicefix signal_cmd
20157
20158 : generate list of signal names
20159 echo " "
20160 case "$sig_name_init" in
20161 '') doinit=yes ;;
20162 *)  case "$sig_num_init" in
20163     ''|*,*) doinit=yes ;;
20164     esac ;;
20165 esac
20166 case "$doinit" in
20167 yes)
20168         echo "Generating a list of signal names and numbers..." >&4
20169         . ./signal_cmd
20170         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20171         sig_name=`$awk 'BEGIN { printf "ZERO " }
20172                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20173         sig_num=`$awk  'BEGIN { printf "0 " }
20174                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20175         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20176                              !/^NSIG/   { printf "\"%s\", ", $1 }
20177                              END        { printf "0\n" }' signal.lst`
20178         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20179                              !/^NSIG/   { printf "%d, ", $2}
20180                              END        { printf "0\n"}' signal.lst`
20181         ;;
20182 esac
20183 echo "The following $sig_count signals are available:"
20184 echo " "
20185 echo $sig_name | $awk \
20186 'BEGIN { linelen = 0 }
20187 {
20188         for (i = 1; i <= NF; i++) {
20189                 name = "SIG" $i " "
20190                 linelen = linelen + length(name)
20191                 if (linelen > 70) {
20192                         printf "\n"
20193                         linelen = length(name)
20194                 }
20195                 printf "%s", name
20196         }
20197         printf "\n"
20198 }'
20199 sig_size=`echo $sig_name | awk '{print NF}'`
20200 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
20201
20202 echo " "
20203 case "$sizetype" in
20204 *_t) zzz="$sizetype"    ;;
20205 *)   zzz="filesize"     ;;
20206 esac
20207 echo "Checking the size of $zzz..." >&4 
20208 cat > try.c <<EOCP
20209 #include <sys/types.h>
20210 #include <stdio.h>
20211 #$i_stdlib I_STDLIB
20212 #ifdef I_STDLIB
20213 #include <stdlib.h>
20214 #endif
20215 int main() {
20216     printf("%d\n", (int)sizeof($sizetype));
20217     exit(0);
20218 }
20219 EOCP
20220 set try
20221 if eval $compile_ok; then
20222         yyy=`$run ./try`
20223         case "$yyy" in
20224         '')     sizesize=4
20225                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20226                 ;;
20227         *)      sizesize=$yyy
20228                 echo "Your $zzz size is $sizesize bytes."
20229                 ;;
20230         esac
20231 else
20232         sizesize=4
20233         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20234 fi
20235
20236
20237 : check for socklen_t
20238 echo " "
20239 echo "Checking to see if you have socklen_t..." >&4
20240 $cat >try.c <<EOCP
20241 #include <sys/types.h>
20242 #$d_socket HAS_SOCKET
20243 #ifdef HAS_SOCKET
20244 #include <sys/socket.h>
20245 #endif
20246 int main() { socklen_t x = 16; }
20247 EOCP
20248 set try
20249 if eval $compile; then
20250         val="$define"
20251         echo "You have socklen_t."
20252 else
20253         val="$undef"
20254         echo "You do not have socklen_t."
20255         case "$sizetype" in
20256         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20257         esac
20258 fi
20259 $rm_try
20260 set d_socklen_t
20261 eval $setvar
20262
20263 : see if this is a socks.h system
20264 set socks.h i_socks
20265 eval $inhdr
20266
20267 : check for type of the size argument to socket calls
20268 case "$d_socket" in
20269 "$define")
20270         $cat <<EOM
20271
20272 Checking to see what type is the last argument of accept().
20273 EOM
20274         yyy=''
20275         case "$d_socklen_t" in
20276         "$define") yyy="$yyy socklen_t"
20277         esac
20278         yyy="$yyy $sizetype int long unsigned"
20279         for xxx in $yyy; do
20280                 case "$socksizetype" in
20281                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20282                         case "$usesocks" in
20283                         "$define")
20284                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20285                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20286                                         socksizetype="$xxx"
20287                                 fi
20288                                 ;;
20289                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20290                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20291                                         socksizetype="$xxx"
20292                                 fi
20293                                 ;;
20294                         esac
20295                         ;;
20296                 esac
20297         done
20298 : In case none of those worked, prompt the user.
20299         case "$socksizetype" in
20300         '')     rp='What is the type for socket address structure sizes?'
20301                 dflt='int'
20302                 . ./myread
20303                 socksizetype=$ans
20304                 ;;
20305         esac
20306         ;;
20307 *)      : no sockets, so pick relatively harmless default
20308         socksizetype='int'
20309         ;;
20310 esac
20311
20312 : see what type is used for signed size_t
20313 set ssize_t ssizetype int stdio.h sys/types.h
20314 eval $typedef
20315 dflt="$ssizetype"
20316 $cat > try.c <<EOM
20317 #include <stdio.h>
20318 #$i_stdlib I_STDLIB
20319 #ifdef I_STDLIB
20320 #include <stdlib.h>
20321 #endif
20322 #include <sys/types.h>
20323 #define Size_t $sizetype
20324 #define SSize_t $dflt
20325 int main()
20326 {
20327         if (sizeof(Size_t) == sizeof(SSize_t))
20328                 printf("$dflt\n");
20329         else if (sizeof(Size_t) == sizeof(int))
20330                 printf("int\n");
20331         else
20332                 printf("long\n");
20333         exit(0);
20334 }
20335 EOM
20336 echo " "
20337 set try
20338 if eval $compile_ok && $run ./try > /dev/null; then
20339         ssizetype=`$run ./try`
20340         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20341 else
20342         $cat >&4 <<EOM
20343 Help! I can't compile and run the ssize_t test program: please enlighten me!
20344 (This is probably a misconfiguration in your system or libraries, and
20345 you really ought to fix it.  Still, I'll try anyway.)
20346
20347 I need a type that is the same size as $sizetype, but is guaranteed to
20348 be signed.  Common values are ssize_t, int and long.
20349
20350 EOM
20351         rp="What signed type is the same size as $sizetype?"
20352         . ./myread
20353         ssizetype="$ans"
20354 fi
20355 $rm_try
20356
20357 : see what type of char stdio uses.
20358 echo " "
20359 echo '#include <stdio.h>' > stdio.c
20360 $cppstdin $cppminus < stdio.c > stdioh
20361 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20362         echo "Your stdio uses unsigned chars." >&4
20363         stdchar="unsigned char"
20364 else
20365         echo "Your stdio uses signed chars." >&4
20366         stdchar="char"
20367 fi
20368 $rm -f stdio.* stdioh
20369
20370 : see what type uids are declared as in the kernel
20371 echo " "
20372 echo "Looking for the type for user ids returned by getuid()."
20373 set uid_t uidtype xxx stdio.h sys/types.h
20374 eval $typedef
20375 case "$uidtype" in
20376 xxx)
20377         xxx=`./findhdr sys/user.h`
20378         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20379         case $1 in
20380         unsigned) dflt="$1 $2" ;;
20381         *) dflt="$1" ;;
20382         esac
20383         ;;
20384 *) dflt="$uidtype";;
20385 esac
20386 case "$uidtype" in
20387 uid_t)  echo "uid_t found." ;;
20388 *)      rp="What is the type for user ids returned by getuid()?"
20389         . ./myread
20390         uidtype="$ans"
20391         ;;
20392 esac
20393
20394 echo " "
20395 case "$uidtype" in
20396 *_t) zzz="$uidtype"     ;;
20397 *)   zzz="uid"          ;;
20398 esac
20399 echo "Checking the size of $zzz..." >&4 
20400 cat > try.c <<EOCP
20401 #include <sys/types.h>
20402 #include <stdio.h>
20403 #$i_stdlib I_STDLIB
20404 #ifdef I_STDLIB
20405 #include <stdlib.h>
20406 #endif
20407 int main() {
20408     printf("%d\n", (int)sizeof($uidtype));
20409     exit(0);
20410 }
20411 EOCP
20412 set try
20413 if eval $compile_ok; then
20414         yyy=`$run ./try`
20415         case "$yyy" in
20416         '')     uidsize=4
20417                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20418                 ;;
20419         *)      uidsize=$yyy
20420                 echo "Your $zzz is $uidsize bytes long."
20421                 ;;
20422         esac
20423 else
20424         uidsize=4
20425         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20426 fi
20427
20428 echo " "
20429 case "$uidtype" in
20430 *_t) zzz="$uidtype"     ;;
20431 *)   zzz="uid"          ;;
20432 esac
20433 echo "Checking the sign of $zzz..." >&4
20434 cat > try.c <<EOCP
20435 #include <sys/types.h>
20436 #include <stdio.h>
20437 int main() {
20438         $uidtype foo = -1;
20439         if (foo < 0)
20440                 printf("-1\n");
20441         else
20442                 printf("1\n");
20443 }
20444 EOCP
20445 set try
20446 if eval $compile; then
20447         yyy=`$run ./try`
20448         case "$yyy" in
20449         '')     uidsign=1
20450                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20451                 ;;
20452         *)      uidsign=$yyy
20453                 case "$uidsign" in
20454                  1) echo "Your $zzz is unsigned." ;;
20455                 -1) echo "Your $zzz is signed."   ;;
20456                 esac
20457                 ;;
20458         esac
20459 else
20460         uidsign=1
20461         echo "(I can't compile the test program--guessing unsigned.)" >&4
20462 fi
20463
20464
20465
20466 echo " "
20467 $echo "Checking the format string to be used for uids..." >&4
20468
20469 case "$uidsign" in
20470 -1)     if $test X"$uidsize" = X"$ivsize"; then
20471                 uidformat="$ivdformat"
20472         else
20473                 if $test X"$uidsize" = X"$longsize"; then
20474                         uidformat='"ld"'
20475                 else
20476                         if $test X"$uidsize" = X"$intsize"; then
20477                                 uidformat='"d"'
20478                         else
20479                                 if $test X"$uidsize" = X"$shortsize"; then
20480                                         uidformat='"hd"'
20481                                 fi
20482                         fi
20483                 fi
20484         fi
20485         ;;
20486 *)      if $test X"$uidsize" = X"$uvsize"; then
20487                 uidformat="$uvuformat"
20488         else
20489                 if $test X"$uidsize" = X"$longsize"; then
20490                         uidformat='"lu"'
20491                 else
20492                         if $test X"$uidsize" = X"$intsize"; then
20493                                 uidformat='"u"'
20494                         else
20495                                 if $test X"$uidsize" = X"$shortsize"; then
20496                                         uidformat='"hu"'
20497                                 fi
20498                         fi
20499                 fi
20500         fi
20501         ;;
20502 esac
20503
20504
20505 case "$usesitecustomize" in
20506     $define|true|[Yy]*)
20507         usesitecustomize="$define"
20508         ;;
20509     *)
20510         usesitecustomize="$undef"
20511         ;;
20512     esac
20513
20514 : determine compiler compiler
20515 case "$yacc" in
20516 '')
20517         dflt=yacc;;
20518 *)
20519         dflt="$yacc";;
20520 esac
20521 echo " "
20522 comp='yacc'
20523 if $test -f "$byacc$_exe"; then
20524         dflt="$byacc"
20525         comp="byacc or $comp"
20526 fi
20527 if $test -f "$bison$_exe"; then
20528         comp="$comp or bison -y"
20529 fi
20530 rp="Which compiler compiler ($comp) shall I use?"
20531 . ./myread
20532 yacc="$ans"
20533 case "$yacc" in
20534 *bis*)
20535         case "$yacc" in
20536         *-y*) ;;
20537         *)
20538                 yacc="$yacc -y"
20539                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20540                 ;;
20541         esac
20542         ;;
20543 esac
20544
20545 : see if this is a fp.h system
20546 set fp.h i_fp
20547 eval $inhdr
20548
20549 : see if this is a fp_class.h system
20550 set fp_class.h i_fp_class
20551 eval $inhdr
20552
20553 : see if gdbm.h is available
20554 set gdbm.h t_gdbm
20555 eval $inhdr
20556 case "$t_gdbm" in
20557 $define)
20558         : see if gdbm_open exists
20559         set gdbm_open d_gdbm_open
20560         eval $inlibc
20561         case "$d_gdbm_open" in
20562         $undef)
20563                 t_gdbm="$undef"
20564                 echo "We won't be including <gdbm.h>"
20565                 ;;
20566         esac
20567         ;;
20568 esac
20569 val="$t_gdbm"
20570 set i_gdbm
20571 eval $setvar
20572
20573 : see if this is a ieeefp.h system
20574 case "$i_ieeefp" in
20575 '' ) set ieeefp.h i_ieeefp
20576      eval $inhdr
20577      ;;
20578 esac
20579
20580 : see if this is a libutil.h system
20581 set libutil.h i_libutil
20582 eval $inhdr
20583
20584 : see if mach cthreads are available
20585 if test "X$usethreads" = "X$define"; then
20586         set mach/cthreads.h i_machcthr
20587         eval $inhdr
20588 else
20589         i_machcthr="$undef"
20590 fi
20591
20592
20593
20594 : see if this is a mntent.h system
20595 set mntent.h i_mntent
20596 eval $inhdr
20597
20598 : see if ndbm.h is available
20599 set ndbm.h t_ndbm
20600 eval $inhdr
20601
20602 case "$t_ndbm" in
20603 $undef)
20604     # Some Linux distributions such as RedHat 7.1 put the
20605     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20606     if $test -f /usr/include/gdbm/ndbm.h; then
20607         echo '<gdbm/ndbm.h> found.'
20608         ccflags="$ccflags -I/usr/include/gdbm"
20609         cppflags="$cppflags -I/usr/include/gdbm"
20610         t_ndbm=$define
20611     fi
20612     ;;
20613 esac
20614
20615 case "$t_ndbm" in
20616 $define)
20617         : see if dbm_open exists
20618         set dbm_open d_dbm_open
20619         eval $inlibc
20620         case "$d_dbm_open" in
20621         $undef)
20622                 t_ndbm="$undef"
20623                 echo "We won't be including <ndbm.h>"
20624                 ;;
20625         esac
20626         ;;
20627 esac
20628 val="$t_ndbm"
20629 set i_ndbm
20630 eval $setvar
20631
20632 : see if net/errno.h is available
20633 val=''
20634 set net/errno.h val
20635 eval $inhdr
20636
20637 : Unfortunately, it causes problems on some systems.  Arrgh.
20638 case "$val" in
20639 $define)
20640         cat > try.c <<'EOM'
20641 #include <stdio.h>
20642 #include <errno.h>
20643 #include <net/errno.h>
20644 int func()
20645 {
20646         return ENOTSOCK;
20647 }
20648 EOM
20649         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20650                 echo "We'll be including <net/errno.h>." >&4
20651         else
20652                 echo "We won't be including <net/errno.h>." >&4
20653                 val="$undef"
20654         fi
20655         $rm_try
20656         ;;
20657 esac
20658 set i_neterrno
20659 eval $setvar
20660
20661 : see if netinet/tcp.h is available
20662 set netinet/tcp.h i_netinettcp
20663 eval $inhdr
20664
20665 : see if this is a poll.h system
20666 set poll.h i_poll
20667 eval $inhdr
20668
20669 : see if this is a prot.h system
20670 set prot.h i_prot
20671 eval $inhdr
20672
20673 echo " "
20674 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20675 $cat <<'EOSH' > Cppsym.know
20676 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20677 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20678 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20679 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20680 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20681 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20682 bull c cadmus clipper CMU COFF COMPILER_VERSION
20683 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20684 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20685 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20686 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20687 GLIBC GLIBC_MINOR
20688 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20689 H3050R H3050RX hbullx20 hcx host_mips
20690 hp200 hp300 hp700 HP700 hp800 hp9000
20691 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20692 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20693 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20694 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20695 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20696 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20697 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20698 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20699 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20700 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20701 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20702 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20703 MATH_HAS_NO_SIDE_EFFECTS
20704 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20705 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20706 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20707 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20708 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20709 NetBSD news1500 news1700 news1800 news1900 news3700
20710 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20711 ns32016 ns32332 ns32k nsc32000
20712 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20713 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20714 pc532 pdp11 PGC PIC plexus PORTAR posix
20715 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20716 POSIX_C_SOURCE POSIX_SOURCE POWER
20717 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20718 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20719 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20720 sony sony_news sonyrisc sparc sparclite spectrum
20721 stardent stdc STDC_EXT stratos sun sun3 sun386
20722 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20723 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20724 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20725 sysV68 sysV88 Tek4132 Tek4300 titan
20726 TM3200 TM5400 TM5600
20727 tower tower32 tower32_200 tower32_600 tower32_700
20728 tower32_800 tower32_850 tss
20729 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20730 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20731 unix UNIX95 UNIX99 unixpc unos
20732 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20733 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20734 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20735 USGr4 USGr4_2
20736 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20737 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20738 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20739 z8000
20740 EOSH
20741 # Maybe put other stuff here too.
20742 cat <<EOSH >>Cppsym.know
20743 $osname
20744 EOSH
20745 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20746 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20747 $cat Cppsym.know > Cppsym.c
20748 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20749 $rm -f Cppsym.a Cppsym.b Cppsym.c
20750 cat <<EOSH > Cppsym
20751 $startsh
20752 if $test \$# -gt 0; then
20753     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20754     if $test -s Cppsym.got; then
20755         $rm -f Cppsym.got
20756         exit 0
20757     fi
20758     $rm -f Cppsym.got
20759     exit 1
20760 else
20761     $tr " " "$trnl" | ./Cppsym.try
20762     exit 0
20763 fi
20764 EOSH
20765 chmod +x Cppsym
20766 $eunicefix Cppsym
20767 cat <<EOSH > Cppsym.try
20768 $startsh
20769 cat <<'EOCP' > try.c
20770 #include <stdio.h>
20771 #if cpp_stuff == 1
20772 #define STRINGIFY(a)    "a"
20773 #endif
20774 #if cpp_stuff == 42
20775 #define StGiFy(a)  #a
20776 #define STRINGIFY(a)    StGiFy(a)
20777 #endif
20778 #if $cpp_stuff != 1 && $cpp_stuff != 42
20779 #   include "Bletch: How does this C preprocessor stringify macros?"
20780 #endif
20781 int main() {
20782 EOCP
20783 $awk \\
20784 EOSH
20785 cat <<'EOSH' >> Cppsym.try
20786 'length($1) > 0 {
20787     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20788     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20789     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20790     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20791 }'       >> try.c
20792 echo 'return 0;}' >> try.c
20793 EOSH
20794 cat <<EOSH >> Cppsym.try
20795 ccflags="$ccflags"
20796 case "$osname-$gccversion" in
20797 irix-) ccflags="\$ccflags -woff 1178" ;;
20798 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20799 esac
20800 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20801 EOSH
20802 chmod +x Cppsym.try
20803 $eunicefix Cppsym.try
20804 ./Cppsym < Cppsym.know > Cppsym.true
20805 : Add in any linux cpp "predefined macros":
20806 case "$osname::$gccversion" in
20807   *linux*::*.*)
20808     tHdrH=_tmpHdr
20809     rm -f $tHdrH'.h' $tHdrH
20810     touch $tHdrH'.h'
20811     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20812        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20813        if [ -s $tHdrH'_cppsym.real' ]; then
20814           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20815        fi
20816     fi
20817     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20818   ;;
20819 esac
20820 : now check the C compiler for additional symbols
20821 postprocess_cc_v=''
20822 case "$osname" in
20823 aix) postprocess_cc_v="|$tr , ' '" ;;
20824 esac
20825 $cat >ccsym <<EOS
20826 $startsh
20827 $cat >tmp.c <<EOF
20828 extern int foo;
20829 EOF
20830 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20831 do
20832         case "\$i" in
20833         -D*) echo "\$i" | $sed 's/^-D//';;
20834         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20835         esac
20836 done
20837 $rm_try
20838 EOS
20839 postprocess_cc_v=''
20840 chmod +x ccsym
20841 $eunicefix ccsym
20842 ./ccsym > ccsym1.raw
20843 if $test -s ccsym1.raw; then
20844        $sort ccsym1.raw | $uniq >ccsym.raw
20845 else
20846        mv ccsym1.raw ccsym.raw
20847 fi
20848
20849 $awk '/\=/ { print $0; next }
20850         { print $0"=1" }' ccsym.raw >ccsym.list
20851 $comm -13 Cppsym.true ccsym.list >ccsym.own
20852 $comm -12 Cppsym.true ccsym.list >ccsym.com
20853 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20854 also=''
20855 if $test -z ccsym.raw; then
20856         echo "Your C compiler doesn't seem to define any symbols!" >&4
20857         echo " "
20858         echo "However, your C preprocessor defines the following symbols:"
20859         $cat Cppsym.true
20860         ccsymbols=''
20861         cppsymbols=`$cat Cppsym.true`
20862         cppsymbols=`echo $cppsymbols`
20863         cppccsymbols="$cppsymbols"
20864 else
20865         if $test -s ccsym.com; then
20866                 echo "Your C compiler and pre-processor define these symbols:"
20867                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20868                 also='also '
20869                 symbols='ones'
20870                 cppccsymbols=`$cat ccsym.com`
20871                 cppccsymbols=`echo $cppccsymbols`
20872                 $test "$silent" || sleep 1
20873         fi
20874         if $test -s ccsym.cpp; then
20875                 $test "$also" && echo " "
20876                 echo "Your C pre-processor ${also}defines the following symbols:"
20877                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20878                 also='further '
20879                 cppsymbols=`$cat ccsym.cpp`
20880                 cppsymbols=`echo $cppsymbols`
20881                 $test "$silent" || sleep 1
20882         fi
20883         if $test -s ccsym.own; then
20884                 $test "$also" && echo " "
20885                 echo "Your C compiler ${also}defines the following cpp symbols:"
20886                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20887                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20888                 ccsymbols=`$cat ccsym.own`
20889                 ccsymbols=`echo $ccsymbols`
20890                 $test "$silent" || sleep 1
20891         fi
20892 fi
20893
20894 : see if this is a termio system
20895 val="$undef"
20896 val2="$undef"
20897 val3="$undef"
20898 if $test `./findhdr termios.h`; then
20899         set tcsetattr i_termios
20900         eval $inlibc
20901         val3="$i_termios"
20902 fi
20903 echo " "
20904 case "$val3" in
20905 "$define") echo "You have POSIX termios.h... good!" >&4;;
20906 *) if ./Cppsym pyr; then
20907                 case "`/bin/universe`" in
20908                 ucb) if $test `./findhdr sgtty.h`; then
20909                                 val2="$define"
20910                                 echo "<sgtty.h> found." >&4
20911                         else
20912                                 echo "System is pyramid with BSD universe."
20913                                 echo "<sgtty.h> not found--you could have problems." >&4
20914                         fi;;
20915                 *) if $test `./findhdr termio.h`; then
20916                                 val="$define"
20917                                 echo "<termio.h> found." >&4
20918                         else
20919                                 echo "System is pyramid with USG universe."
20920                                 echo "<termio.h> not found--you could have problems." >&4
20921                         fi;;
20922                 esac
20923         elif ./usg; then
20924                 if $test `./findhdr termio.h`; then
20925                         echo "<termio.h> found." >&4
20926                         val="$define"
20927                 elif $test `./findhdr sgtty.h`; then
20928                         echo "<sgtty.h> found." >&4
20929                         val2="$define"
20930                 else
20931 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20932                 fi
20933         else
20934                 if $test `./findhdr sgtty.h`; then
20935                         echo "<sgtty.h> found." >&4
20936                         val2="$define"
20937                 elif $test `./findhdr termio.h`; then
20938                         echo "<termio.h> found." >&4
20939                         val="$define"
20940                 else
20941 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20942                 fi
20943         fi;;
20944 esac
20945 set i_termio; eval $setvar
20946 val=$val2; set i_sgtty; eval $setvar
20947 val=$val3; set i_termios; eval $setvar
20948
20949 : see if stddef is available
20950 set stddef.h i_stddef
20951 eval $inhdr
20952
20953 : see if sys/access.h is available
20954 set sys/access.h i_sysaccess
20955 eval $inhdr
20956
20957 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20958 set sys/filio.h i_sysfilio
20959 eval $inhdr
20960 echo " "
20961 if $test `./findhdr sys/ioctl.h`; then
20962         val="$define"
20963         echo '<sys/ioctl.h> found.' >&4
20964 else
20965         val="$undef"
20966         if $test $i_sysfilio = "$define"; then
20967             echo '<sys/ioctl.h> NOT found.' >&4
20968         else
20969                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20970                 $test $i_termio = "$define" && xxx="termio.h"
20971                 $test $i_termios = "$define" && xxx="termios.h"
20972 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20973         fi
20974 fi
20975 set i_sysioctl
20976 eval $setvar
20977
20978 : see if socket ioctl defs are in sys/sockio.h
20979 echo " "
20980 xxx=`./findhdr sys/sockio.h`
20981 if $test "$xxx"; then
20982         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20983                 val="$define"
20984                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20985         else
20986                 val="$undef"
20987                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20988         fi
20989 else
20990         val="$undef"
20991         $cat <<EOM
20992 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20993 EOM
20994 fi
20995 set i_syssockio
20996 eval $setvar
20997
20998
20999 : see if this is a syslog.h system
21000 set syslog.h i_syslog
21001 eval $inhdr
21002
21003
21004 : see if this is a sys/mode.h system
21005 set sys/mode.h i_sysmode
21006 eval $inhdr
21007
21008 : see if sys/resource.h has to be included
21009 set sys/resource.h i_sysresrc
21010 eval $inhdr
21011
21012 : see if sys/security.h is available
21013 set sys/security.h i_syssecrt
21014 eval $inhdr
21015
21016 : see if this is a sys/statvfs.h system
21017 set sys/statvfs.h i_sysstatvfs
21018 eval $inhdr
21019
21020 : see if this is a sys/un.h system
21021 set sys/un.h i_sysun
21022 eval $inhdr
21023
21024
21025 : see if this is a sys/utsname.h system
21026 set sys/utsname.h i_sysutsname
21027 eval $inhdr
21028
21029 : see if this is a syswait system
21030 set sys/wait.h i_syswait
21031 eval $inhdr
21032
21033 : see if this is a ustat.h system
21034 set ustat.h i_ustat
21035 eval $inhdr
21036
21037 : see if this is an utime system
21038 set utime.h i_utime
21039 eval $inhdr
21040
21041 : see if this is a values.h system
21042 set values.h i_values
21043 eval $inhdr
21044
21045 : see if this is a vfork system
21046 case "$d_vfork" in
21047 "$define")
21048         set vfork.h i_vfork
21049         eval $inhdr
21050         ;;
21051 *)
21052         i_vfork="$undef"
21053         ;;
21054 esac
21055
21056 echo " "
21057 echo "Looking for extensions..." >&4
21058 : If we are using the old config.sh, known_extensions may contain
21059 : old or inaccurate or duplicate values.
21060 known_extensions=''
21061 nonxs_extensions=''
21062 : We do not use find because it might not be available.
21063 : We do not just use MANIFEST because the user may have dropped
21064 : some additional extensions into the source tree and expect them
21065 : to be built.
21066
21067 : Function to recursively find available extensions, ignoring DynaLoader
21068 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21069 find_extensions='
21070     for xxx in *; do
21071         case "$xxx" in
21072             DynaLoader|dynaload) ;;
21073             *)
21074             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21075                 known_extensions="$known_extensions $1$xxx";
21076             elif $test -f $xxx/Makefile.PL; then
21077                 nonxs_extensions="$nonxs_extensions $1$xxx";
21078             else
21079                 if $test -d $xxx -a $# -lt 10; then
21080                     set $1$xxx/ $*;
21081                     cd "$xxx";
21082                     eval $find_extensions;
21083                     cd ..;
21084                     shift;
21085                 fi;
21086             fi
21087             ;;
21088         esac;
21089     done'
21090 tdir=`pwd`
21091 cd "$rsrc/ext"
21092 set X
21093 shift
21094 eval $find_extensions
21095 # Special case:  Add in threads/shared since it is not picked up by the
21096 # recursive find above (and adding in general recursive finding breaks
21097 # SDBM_File/sdbm).  A.D.  10/25/2001.
21098 known_extensions="$known_extensions threads/shared"
21099 set X $known_extensions
21100 shift
21101 known_extensions="$*"
21102 set X $nonxs_extensions
21103 shift
21104 nonxs_extensions="$*"
21105 cd "$tdir"
21106
21107 : Now see which are supported on this system.
21108 avail_ext=''
21109 for xxx in $known_extensions ; do
21110         case "$xxx" in
21111         DB_File|db_file)
21112                 case "$i_db" in
21113                 $define) avail_ext="$avail_ext $xxx" ;;
21114                 esac
21115                 ;;
21116         GDBM_File|gdbm_fil)
21117                 case "$i_gdbm" in
21118                 $define) avail_ext="$avail_ext $xxx" ;;
21119                 esac
21120                 ;;
21121         I18N/Langinfo|i18n_lan)
21122                 case "$i_langinfo$d_nl_langinfo" in
21123                 $define$define) avail_ext="$avail_ext $xxx" ;;
21124                 esac
21125                 ;;
21126         IPC/SysV|ipc/sysv)
21127                 : XXX Do we need a useipcsysv variable here
21128                 case "${d_msg}${d_sem}${d_shm}" in
21129                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21130                 esac
21131                 ;;
21132         NDBM_File|ndbm_fil)
21133                 case "$i_ndbm" in
21134                 $define)
21135                     case "$osname-$use64bitint" in
21136                     hpux-define)
21137                         case "$libs" in
21138                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21139                         esac
21140                         ;;
21141                     *) avail_ext="$avail_ext $xxx" ;;
21142                     esac
21143                     ;;
21144                 esac
21145                 ;;
21146         ODBM_File|odbm_fil)
21147                 case "${i_dbm}${i_rpcsvcdbm}" in
21148                 *"${define}"*)
21149                     case "$d_cplusplus" in
21150                     define) ;; # delete as a function name will not work
21151                     *)  case "$osname-$use64bitint" in
21152                         hpux-define)
21153                             case "$libs" in
21154                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21155                             esac
21156                             ;;
21157                         *) avail_ext="$avail_ext $xxx" ;;
21158                         esac
21159                         ;;
21160                     esac
21161                     ;;
21162                 esac
21163                 ;;
21164         Opcode|opcode)
21165                 case "$useopcode" in
21166                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21167                 esac
21168                 ;;
21169         POSIX|posix)
21170                 case "$useposix" in
21171                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21172                 esac
21173                 ;;
21174         Socket|socket)
21175                 case "$d_socket" in
21176                 true|$define|y)
21177                     case "$osname" in
21178                     beos) ;; # not unless BONE
21179                     *) avail_ext="$avail_ext $xxx" ;;
21180                     esac
21181                     ;;
21182                 esac
21183                 ;;
21184         Sys/Syslog|sys/syslog)
21185                 : XXX syslog requires socket
21186                 case "$d_socket" in
21187                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21188                 esac
21189                 ;;
21190         Thread|thread)
21191                 case "$usethreads" in
21192                 true|$define|y)
21193                         case "$use5005threads" in
21194                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21195                         esac
21196                 esac
21197                 ;;
21198         threads|threads/shared)
21199                 # threads and threads::shared are special cases.
21200                 # To stop people from asking "Perl 5.8.0 was supposed
21201                 # to have this new fancy threads implementation but my
21202                 # perl doesn't have it" and from people trying to
21203                 # (re)install the threads module using CPAN.pm and
21204                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21205                 # the threads.pm and threads/shared.pm will always be
21206                 # there, croaking informatively ("you need to rebuild
21207                 # all of Perl with threads, sorry") when threads haven't
21208                 # been compiled in.
21209                 # --jhi
21210                 avail_ext="$avail_ext $xxx"
21211                 ;;
21212         Win32*)
21213                 case "$osname" in
21214                 cygwin) avail_ext="$avail_ext $xxx" ;;
21215                 esac
21216                 ;;
21217         XS/APItest|xs/apitest)
21218                 # This is just for testing.  Skip it unless we have dynamic loading.
21219
21220                 case "$usedl" in
21221                 $define) avail_ext="$avail_ext $xxx" ;;
21222                 esac
21223                 ;;
21224         XS/Typemap|xs/typemap)
21225                 # This is just for testing.  Skip it unless we have dynamic loading.
21226                 case "$usedl" in
21227                 $define) avail_ext="$avail_ext $xxx" ;;
21228                 esac
21229                 ;;
21230         *)      avail_ext="$avail_ext $xxx"
21231                 ;;
21232         esac
21233 done
21234
21235 set X $avail_ext
21236 shift
21237 avail_ext="$*"
21238
21239 case "$onlyextensions" in
21240 '') ;;
21241 *)  keepextensions=''
21242     echo "You have requested that only certains extensions be included..." >&4
21243     for i in $onlyextensions; do
21244         case " $avail_ext " in
21245         *" $i "*)
21246             echo "Keeping extension $i."
21247             keepextensions="$keepextensions $i"
21248             ;;
21249         *) echo "Ignoring extension $i." ;;
21250         esac
21251     done
21252     avail_ext="$keepextensions"
21253     ;;
21254 esac
21255
21256 case "$noextensions" in
21257 '') ;;
21258 *)  keepextensions=''
21259     echo "You have requested that certain extensions be ignored..." >&4
21260     for i in $avail_ext; do
21261         case " $noextensions " in
21262         *" $i "*) echo "Ignoring extension $i." ;;
21263         *) echo "Keeping extension $i.";
21264            keepextensions="$keepextensions $i"
21265            ;;
21266         esac
21267     done
21268     avail_ext="$keepextensions"
21269     ;;
21270 esac
21271
21272 : Now see which nonxs extensions are supported on this system.
21273 : For now assume all are.
21274 nonxs_ext=''
21275 for xxx in $nonxs_extensions ; do
21276         case "$xxx" in
21277         *)      nonxs_ext="$nonxs_ext $xxx"
21278                 ;;
21279         esac
21280 done
21281
21282 set X $nonxs_ext
21283 shift
21284 nonxs_ext="$*"
21285
21286 case $usedl in
21287 $define)
21288         $cat <<EOM
21289 A number of extensions are supplied with $package.  You may choose to
21290 compile these extensions for dynamic loading (the default), compile
21291 them into the $package executable (static loading), or not include
21292 them at all.  Answer "none" to include no extensions.
21293 Note that DynaLoader is always built and need not be mentioned here.
21294
21295 EOM
21296         case "$dynamic_ext" in
21297         '')
21298                 : Exclude those listed in static_ext
21299                 dflt=''
21300                 for xxx in $avail_ext; do
21301                         case " $static_ext " in
21302                         *" $xxx "*) ;;
21303                         *) dflt="$dflt $xxx" ;;
21304                         esac
21305                 done
21306                 set X $dflt
21307                 shift
21308                 dflt="$*"
21309                 ;;
21310         *)      dflt="$dynamic_ext"
21311                 # Perhaps we are reusing an old out-of-date config.sh.
21312                 case "$hint" in
21313                 previous)
21314                         if test X"$dynamic_ext" != X"$avail_ext"; then
21315                                 $cat <<EOM
21316 NOTICE:  Your previous config.sh list may be incorrect.
21317 The extensions now available to you are
21318         ${avail_ext}
21319 but the default list from your previous config.sh is
21320         ${dynamic_ext}
21321
21322 EOM
21323                         fi
21324                         ;;
21325                 esac
21326                 ;;
21327         esac
21328         case "$dflt" in
21329         '')     dflt=none;;
21330         esac
21331         rp="What extensions do you wish to load dynamically?"
21332         . ./myread
21333         case "$ans" in
21334         none) dynamic_ext=' ' ;;
21335         *) dynamic_ext="$ans" ;;
21336         esac
21337
21338         case "$static_ext" in
21339         '')
21340                 : Exclude those already listed in dynamic linking
21341                 dflt=''
21342                 for xxx in $avail_ext; do
21343                         case " $dynamic_ext " in
21344                         *" $xxx "*) ;;
21345                         *) dflt="$dflt $xxx" ;;
21346                         esac
21347                 done
21348                 set X $dflt
21349                 shift
21350                 dflt="$*"
21351                 ;;
21352         *)  dflt="$static_ext"
21353                 ;;
21354         esac
21355
21356         case "$dflt" in
21357         '')     dflt=none;;
21358         esac
21359         rp="What extensions do you wish to load statically?"
21360         . ./myread
21361         case "$ans" in
21362         none) static_ext=' ' ;;
21363         *) static_ext="$ans" ;;
21364         esac
21365         ;;
21366 *)
21367         $cat <<EOM
21368 A number of extensions are supplied with $package.  Answer "none"
21369 to include no extensions.
21370 Note that DynaLoader is always built and need not be mentioned here.
21371
21372 EOM
21373         case "$static_ext" in
21374         '') dflt="$avail_ext" ;;
21375         *)      dflt="$static_ext"
21376                 # Perhaps we are reusing an old out-of-date config.sh.
21377                 case "$hint" in
21378                 previous)
21379                         if test X"$static_ext" != X"$avail_ext"; then
21380                                 $cat <<EOM
21381 NOTICE:  Your previous config.sh list may be incorrect.
21382 The extensions now available to you are
21383         ${avail_ext}
21384 but the default list from your previous config.sh is
21385         ${static_ext}
21386
21387 EOM
21388                         fi
21389                         ;;
21390                 esac
21391                 ;;
21392         esac
21393         : Exclude those that are not xs extensions
21394         case "$dflt" in
21395         '')     dflt=none;;
21396         esac
21397         rp="What extensions do you wish to include?"
21398         . ./myread
21399         case "$ans" in
21400         none) static_ext=' ' ;;
21401         *) static_ext="$ans" ;;
21402         esac
21403         ;;
21404 esac
21405 #
21406 # Encode is a special case.  If we are building Encode as a static
21407 # extension, we need to explicitly list its subextensions as well.
21408 # For other nested extensions, this is handled automatically by
21409 # the appropriate Makefile.PL.
21410 case " $static_ext " in
21411         *" Encode "*) # Add the subextensions of Encode
21412         cd "$rsrc/ext"
21413         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21414                 static_ext="$static_ext Encode/$xxx"
21415         done
21416         cd "$tdir"
21417         ;;
21418 esac
21419
21420 set X $dynamic_ext $static_ext $nonxs_ext
21421 shift
21422 extensions="$*"
21423
21424 # Sanity check:  We require an extension suitable for use with
21425 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21426 # should show up as failures in the test suite, but it's helpful to
21427 # catch them now.) The 'extensions' list is normally sorted
21428 # alphabetically, so we need to accept either
21429 #    DB_File ... Fcntl ... IO  ....
21430 # or something like
21431 #    Fcntl ... NDBM_File ... IO  ....
21432 case " $extensions"  in
21433 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21434 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21435 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21436 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21437    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21438    ;;
21439 esac
21440
21441 : Remove libraries needed only for extensions
21442 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21443 : The exception is SunOS 4.x, which needs them.
21444 case "${osname}X${osvers}" in
21445 sunos*X4*)
21446     perllibs="$libs"
21447     ;;
21448 *) case "$usedl" in
21449     $define|true|[yY]*)
21450             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21451             shift
21452             perllibs="$*"
21453             ;;
21454     *)  perllibs="$libs"
21455             ;;
21456     esac
21457     ;;
21458 esac
21459
21460 : Remove build directory name from cppstdin so it can be used from
21461 : either the present location or the final installed location.
21462 echo " "
21463 : Get out of the UU directory to get correct path name.
21464 cd ..
21465 case "$cppstdin" in
21466 `pwd`/cppstdin)
21467         echo "Stripping down cppstdin path name"
21468         cppstdin=cppstdin
21469         ;;
21470 esac
21471 cd UU
21472
21473 : end of configuration questions
21474 echo " "
21475 echo "End of configuration questions."
21476 echo " "
21477
21478 : back to where it started
21479 if test -d ../UU; then
21480         cd ..
21481 fi
21482
21483 : configuration may be patched via a 'config.arch' file
21484 if $test -f config.arch; then
21485         echo "I see a config.arch file, loading it."
21486         . ./config.arch
21487 fi
21488
21489 : configuration may be patched via a 'config.over' file
21490 if $test -f config.over; then
21491         echo " "
21492         dflt=y
21493         rp='I see a config.over file.  Do you wish to load it?'
21494         . UU/myread
21495         case "$ans" in
21496         n*) echo "OK, I'll ignore it.";;
21497         *)      . ./config.over
21498                 echo "Configuration override changes have been loaded."
21499                 ;;
21500         esac
21501 fi
21502
21503 : in case they want portability, strip down executable paths
21504 case "$d_portable" in
21505 "$define")
21506         echo " "
21507         echo "Stripping down executable paths..." >&4
21508         for file in $loclist $trylist; do
21509                 eval temp=\$$file
21510                 eval $file=`basename $temp`
21511         done
21512         ;;
21513 esac
21514
21515 : create config.sh file
21516 echo " "
21517 echo "Creating config.sh..." >&4
21518 $spitshell <<EOT >config.sh
21519 $startsh
21520 #
21521 # This file was produced by running the Configure script. It holds all the
21522 # definitions figured out by Configure. Should you modify one of these values,
21523 # do not forget to propagate your changes by running "Configure -der". You may
21524 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21525 #
21526
21527 # Package name      : $package
21528 # Source directory  : $src
21529 # Configuration time: $cf_time
21530 # Configured by     : $cf_by
21531 # Target system     : $myuname
21532
21533 Author='$Author'
21534 Date='$Date'
21535 Header='$Header'
21536 Id='$Id'
21537 Locker='$Locker'
21538 Log='$Log'
21539 Mcc='$Mcc'
21540 RCSfile='$RCSfile'
21541 Revision='$Revision'
21542 Source='$Source'
21543 State='$State'
21544 _a='$_a'
21545 _exe='$_exe'
21546 _o='$_o'
21547 afs='$afs'
21548 afsroot='$afsroot'
21549 alignbytes='$alignbytes'
21550 ansi2knr='$ansi2knr'
21551 aphostname='$aphostname'
21552 api_revision='$api_revision'
21553 api_subversion='$api_subversion'
21554 api_version='$api_version'
21555 api_versionstring='$api_versionstring'
21556 ar='$ar'
21557 archlib='$archlib'
21558 archlibexp='$archlibexp'
21559 archname64='$archname64'
21560 archname='$archname'
21561 archobjs='$archobjs'
21562 asctime_r_proto='$asctime_r_proto'
21563 awk='$awk'
21564 baserev='$baserev'
21565 bash='$bash'
21566 bin='$bin'
21567 binexp='$binexp'
21568 bison='$bison'
21569 byacc='$byacc'
21570 byteorder='$byteorder'
21571 c='$c'
21572 castflags='$castflags'
21573 cat='$cat'
21574 cc='$cc'
21575 cccdlflags='$cccdlflags'
21576 ccdlflags='$ccdlflags'
21577 ccflags='$ccflags'
21578 ccflags_uselargefiles='$ccflags_uselargefiles'
21579 ccname='$ccname'
21580 ccsymbols='$ccsymbols'
21581 ccversion='$ccversion'
21582 cf_by='$cf_by'
21583 cf_email='$cf_email'
21584 cf_time='$cf_time'
21585 charsize='$charsize'
21586 chgrp='$chgrp'
21587 chmod='$chmod'
21588 chown='$chown'
21589 clocktype='$clocktype'
21590 comm='$comm'
21591 compress='$compress'
21592 contains='$contains'
21593 cp='$cp'
21594 cpio='$cpio'
21595 cpp='$cpp'
21596 cpp_stuff='$cpp_stuff'
21597 cppccsymbols='$cppccsymbols'
21598 cppflags='$cppflags'
21599 cpplast='$cpplast'
21600 cppminus='$cppminus'
21601 cpprun='$cpprun'
21602 cppstdin='$cppstdin'
21603 cppsymbols='$cppsymbols'
21604 crypt_r_proto='$crypt_r_proto'
21605 cryptlib='$cryptlib'
21606 csh='$csh'
21607 ctermid_r_proto='$ctermid_r_proto'
21608 ctime_r_proto='$ctime_r_proto'
21609 d_Gconvert='$d_Gconvert'
21610 d_PRIEUldbl='$d_PRIEUldbl'
21611 d_PRIFUldbl='$d_PRIFUldbl'
21612 d_PRIGUldbl='$d_PRIGUldbl'
21613 d_PRIXU64='$d_PRIXU64'
21614 d_PRId64='$d_PRId64'
21615 d_PRIeldbl='$d_PRIeldbl'
21616 d_PRIfldbl='$d_PRIfldbl'
21617 d_PRIgldbl='$d_PRIgldbl'
21618 d_PRIi64='$d_PRIi64'
21619 d_PRIo64='$d_PRIo64'
21620 d_PRIu64='$d_PRIu64'
21621 d_PRIx64='$d_PRIx64'
21622 d_SCNfldbl='$d_SCNfldbl'
21623 d__fwalk='$d__fwalk'
21624 d_access='$d_access'
21625 d_accessx='$d_accessx'
21626 d_aintl='$d_aintl'
21627 d_alarm='$d_alarm'
21628 d_archlib='$d_archlib'
21629 d_asctime_r='$d_asctime_r'
21630 d_atolf='$d_atolf'
21631 d_atoll='$d_atoll'
21632 d_attribute_format='$d_attribute_format'
21633 d_attribute_malloc='$d_attribute_malloc'
21634 d_attribute_nonnull='$d_attribute_nonnull'
21635 d_attribute_noreturn='$d_attribute_noreturn'
21636 d_attribute_pure='$d_attribute_pure'
21637 d_attribute_unused='$d_attribute_unused'
21638 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21639 d_bcmp='$d_bcmp'
21640 d_bcopy='$d_bcopy'
21641 d_bsd='$d_bsd'
21642 d_bsdgetpgrp='$d_bsdgetpgrp'
21643 d_bsdsetpgrp='$d_bsdsetpgrp'
21644 d_builtin_choose_expr='$d_builtin_choose_expr'
21645 d_builtin_expect='$d_builtin_expect'
21646 d_bzero='$d_bzero'
21647 d_c99_variadic_macros='$d_c99_variadic_macros'
21648 d_casti32='$d_casti32'
21649 d_castneg='$d_castneg'
21650 d_charvspr='$d_charvspr'
21651 d_chown='$d_chown'
21652 d_chroot='$d_chroot'
21653 d_chsize='$d_chsize'
21654 d_class='$d_class'
21655 d_clearenv='$d_clearenv'
21656 d_closedir='$d_closedir'
21657 d_cmsghdr_s='$d_cmsghdr_s'
21658 d_const='$d_const'
21659 d_copysignl='$d_copysignl'
21660 d_cplusplus='$d_cplusplus'
21661 d_crypt='$d_crypt'
21662 d_crypt_r='$d_crypt_r'
21663 d_csh='$d_csh'
21664 d_ctermid='$d_ctermid'
21665 d_ctermid_r='$d_ctermid_r'
21666 d_ctime_r='$d_ctime_r'
21667 d_cuserid='$d_cuserid'
21668 d_dbl_dig='$d_dbl_dig'
21669 d_dbminitproto='$d_dbminitproto'
21670 d_difftime='$d_difftime'
21671 d_dir_dd_fd='$d_dir_dd_fd'
21672 d_dirfd='$d_dirfd'
21673 d_dirnamlen='$d_dirnamlen'
21674 d_dlerror='$d_dlerror'
21675 d_dlopen='$d_dlopen'
21676 d_dlsymun='$d_dlsymun'
21677 d_dosuid='$d_dosuid'
21678 d_drand48_r='$d_drand48_r'
21679 d_drand48proto='$d_drand48proto'
21680 d_dup2='$d_dup2'
21681 d_eaccess='$d_eaccess'
21682 d_endgrent='$d_endgrent'
21683 d_endgrent_r='$d_endgrent_r'
21684 d_endhent='$d_endhent'
21685 d_endhostent_r='$d_endhostent_r'
21686 d_endnent='$d_endnent'
21687 d_endnetent_r='$d_endnetent_r'
21688 d_endpent='$d_endpent'
21689 d_endprotoent_r='$d_endprotoent_r'
21690 d_endpwent='$d_endpwent'
21691 d_endpwent_r='$d_endpwent_r'
21692 d_endsent='$d_endsent'
21693 d_endservent_r='$d_endservent_r'
21694 d_eofnblk='$d_eofnblk'
21695 d_eunice='$d_eunice'
21696 d_faststdio='$d_faststdio'
21697 d_fchdir='$d_fchdir'
21698 d_fchmod='$d_fchmod'
21699 d_fchown='$d_fchown'
21700 d_fcntl='$d_fcntl'
21701 d_fcntl_can_lock='$d_fcntl_can_lock'
21702 d_fd_macros='$d_fd_macros'
21703 d_fd_set='$d_fd_set'
21704 d_fds_bits='$d_fds_bits'
21705 d_fgetpos='$d_fgetpos'
21706 d_finite='$d_finite'
21707 d_finitel='$d_finitel'
21708 d_flexfnam='$d_flexfnam'
21709 d_flock='$d_flock'
21710 d_flockproto='$d_flockproto'
21711 d_fork='$d_fork'
21712 d_fp_class='$d_fp_class'
21713 d_fpathconf='$d_fpathconf'
21714 d_fpclass='$d_fpclass'
21715 d_fpclassify='$d_fpclassify'
21716 d_fpclassl='$d_fpclassl'
21717 d_fpos64_t='$d_fpos64_t'
21718 d_frexpl='$d_frexpl'
21719 d_fs_data_s='$d_fs_data_s'
21720 d_fseeko='$d_fseeko'
21721 d_fsetpos='$d_fsetpos'
21722 d_fstatfs='$d_fstatfs'
21723 d_fstatvfs='$d_fstatvfs'
21724 d_fsync='$d_fsync'
21725 d_ftello='$d_ftello'
21726 d_ftime='$d_ftime'
21727 d_futimes='$d_futimes'
21728 d_getcwd='$d_getcwd'
21729 d_getespwnam='$d_getespwnam'
21730 d_getfsstat='$d_getfsstat'
21731 d_getgrent='$d_getgrent'
21732 d_getgrent_r='$d_getgrent_r'
21733 d_getgrgid_r='$d_getgrgid_r'
21734 d_getgrnam_r='$d_getgrnam_r'
21735 d_getgrps='$d_getgrps'
21736 d_gethbyaddr='$d_gethbyaddr'
21737 d_gethbyname='$d_gethbyname'
21738 d_gethent='$d_gethent'
21739 d_gethname='$d_gethname'
21740 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21741 d_gethostbyname_r='$d_gethostbyname_r'
21742 d_gethostent_r='$d_gethostent_r'
21743 d_gethostprotos='$d_gethostprotos'
21744 d_getitimer='$d_getitimer'
21745 d_getlogin='$d_getlogin'
21746 d_getlogin_r='$d_getlogin_r'
21747 d_getmnt='$d_getmnt'
21748 d_getmntent='$d_getmntent'
21749 d_getnbyaddr='$d_getnbyaddr'
21750 d_getnbyname='$d_getnbyname'
21751 d_getnent='$d_getnent'
21752 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21753 d_getnetbyname_r='$d_getnetbyname_r'
21754 d_getnetent_r='$d_getnetent_r'
21755 d_getnetprotos='$d_getnetprotos'
21756 d_getpagsz='$d_getpagsz'
21757 d_getpbyname='$d_getpbyname'
21758 d_getpbynumber='$d_getpbynumber'
21759 d_getpent='$d_getpent'
21760 d_getpgid='$d_getpgid'
21761 d_getpgrp2='$d_getpgrp2'
21762 d_getpgrp='$d_getpgrp'
21763 d_getppid='$d_getppid'
21764 d_getprior='$d_getprior'
21765 d_getprotobyname_r='$d_getprotobyname_r'
21766 d_getprotobynumber_r='$d_getprotobynumber_r'
21767 d_getprotoent_r='$d_getprotoent_r'
21768 d_getprotoprotos='$d_getprotoprotos'
21769 d_getprpwnam='$d_getprpwnam'
21770 d_getpwent='$d_getpwent'
21771 d_getpwent_r='$d_getpwent_r'
21772 d_getpwnam_r='$d_getpwnam_r'
21773 d_getpwuid_r='$d_getpwuid_r'
21774 d_getsbyname='$d_getsbyname'
21775 d_getsbyport='$d_getsbyport'
21776 d_getsent='$d_getsent'
21777 d_getservbyname_r='$d_getservbyname_r'
21778 d_getservbyport_r='$d_getservbyport_r'
21779 d_getservent_r='$d_getservent_r'
21780 d_getservprotos='$d_getservprotos'
21781 d_getspnam='$d_getspnam'
21782 d_getspnam_r='$d_getspnam_r'
21783 d_gettimeod='$d_gettimeod'
21784 d_gmtime_r='$d_gmtime_r'
21785 d_gnulibc='$d_gnulibc'
21786 d_grpasswd='$d_grpasswd'
21787 d_hasmntopt='$d_hasmntopt'
21788 d_htonl='$d_htonl'
21789 d_ilogbl='$d_ilogbl'
21790 d_inc_version_list='$d_inc_version_list'
21791 d_index='$d_index'
21792 d_inetaton='$d_inetaton'
21793 d_int64_t='$d_int64_t'
21794 d_isascii='$d_isascii'
21795 d_isfinite='$d_isfinite'
21796 d_isinf='$d_isinf'
21797 d_isnan='$d_isnan'
21798 d_isnanl='$d_isnanl'
21799 d_killpg='$d_killpg'
21800 d_lchown='$d_lchown'
21801 d_ldbl_dig='$d_ldbl_dig'
21802 d_libm_lib_version='$d_libm_lib_version'
21803 d_link='$d_link'
21804 d_localtime_r='$d_localtime_r'
21805 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21806 d_locconv='$d_locconv'
21807 d_lockf='$d_lockf'
21808 d_longdbl='$d_longdbl'
21809 d_longlong='$d_longlong'
21810 d_lseekproto='$d_lseekproto'
21811 d_lstat='$d_lstat'
21812 d_madvise='$d_madvise'
21813 d_malloc_good_size='$d_malloc_good_size'
21814 d_malloc_size='$d_malloc_size'
21815 d_mblen='$d_mblen'
21816 d_mbstowcs='$d_mbstowcs'
21817 d_mbtowc='$d_mbtowc'
21818 d_memchr='$d_memchr'
21819 d_memcmp='$d_memcmp'
21820 d_memcpy='$d_memcpy'
21821 d_memmove='$d_memmove'
21822 d_memset='$d_memset'
21823 d_mkdir='$d_mkdir'
21824 d_mkdtemp='$d_mkdtemp'
21825 d_mkfifo='$d_mkfifo'
21826 d_mkstemp='$d_mkstemp'
21827 d_mkstemps='$d_mkstemps'
21828 d_mktime='$d_mktime'
21829 d_mmap='$d_mmap'
21830 d_modfl='$d_modfl'
21831 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21832 d_modflproto='$d_modflproto'
21833 d_mprotect='$d_mprotect'
21834 d_msg='$d_msg'
21835 d_msg_ctrunc='$d_msg_ctrunc'
21836 d_msg_dontroute='$d_msg_dontroute'
21837 d_msg_oob='$d_msg_oob'
21838 d_msg_peek='$d_msg_peek'
21839 d_msg_proxy='$d_msg_proxy'
21840 d_msgctl='$d_msgctl'
21841 d_msgget='$d_msgget'
21842 d_msghdr_s='$d_msghdr_s'
21843 d_msgrcv='$d_msgrcv'
21844 d_msgsnd='$d_msgsnd'
21845 d_msync='$d_msync'
21846 d_munmap='$d_munmap'
21847 d_mymalloc='$d_mymalloc'
21848 d_nice='$d_nice'
21849 d_nl_langinfo='$d_nl_langinfo'
21850 d_nv_preserves_uv='$d_nv_preserves_uv'
21851 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21852 d_off64_t='$d_off64_t'
21853 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21854 d_oldpthreads='$d_oldpthreads'
21855 d_oldsock='$d_oldsock'
21856 d_open3='$d_open3'
21857 d_pathconf='$d_pathconf'
21858 d_pause='$d_pause'
21859 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21860 d_phostname='$d_phostname'
21861 d_pipe='$d_pipe'
21862 d_poll='$d_poll'
21863 d_portable='$d_portable'
21864 d_printf_format_null='$d_printf_format_null'
21865 d_procselfexe='$d_procselfexe'
21866 d_pseudofork='$d_pseudofork'
21867 d_pthread_atfork='$d_pthread_atfork'
21868 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21869 d_pthread_yield='$d_pthread_yield'
21870 d_pwage='$d_pwage'
21871 d_pwchange='$d_pwchange'
21872 d_pwclass='$d_pwclass'
21873 d_pwcomment='$d_pwcomment'
21874 d_pwexpire='$d_pwexpire'
21875 d_pwgecos='$d_pwgecos'
21876 d_pwpasswd='$d_pwpasswd'
21877 d_pwquota='$d_pwquota'
21878 d_qgcvt='$d_qgcvt'
21879 d_quad='$d_quad'
21880 d_random_r='$d_random_r'
21881 d_readdir64_r='$d_readdir64_r'
21882 d_readdir='$d_readdir'
21883 d_readdir_r='$d_readdir_r'
21884 d_readlink='$d_readlink'
21885 d_readv='$d_readv'
21886 d_recvmsg='$d_recvmsg'
21887 d_rename='$d_rename'
21888 d_rewinddir='$d_rewinddir'
21889 d_rmdir='$d_rmdir'
21890 d_safebcpy='$d_safebcpy'
21891 d_safemcpy='$d_safemcpy'
21892 d_sanemcmp='$d_sanemcmp'
21893 d_sbrkproto='$d_sbrkproto'
21894 d_scalbnl='$d_scalbnl'
21895 d_sched_yield='$d_sched_yield'
21896 d_scm_rights='$d_scm_rights'
21897 d_seekdir='$d_seekdir'
21898 d_select='$d_select'
21899 d_sem='$d_sem'
21900 d_semctl='$d_semctl'
21901 d_semctl_semid_ds='$d_semctl_semid_ds'
21902 d_semctl_semun='$d_semctl_semun'
21903 d_semget='$d_semget'
21904 d_semop='$d_semop'
21905 d_sendmsg='$d_sendmsg'
21906 d_setegid='$d_setegid'
21907 d_seteuid='$d_seteuid'
21908 d_setgrent='$d_setgrent'
21909 d_setgrent_r='$d_setgrent_r'
21910 d_setgrps='$d_setgrps'
21911 d_sethent='$d_sethent'
21912 d_sethostent_r='$d_sethostent_r'
21913 d_setitimer='$d_setitimer'
21914 d_setlinebuf='$d_setlinebuf'
21915 d_setlocale='$d_setlocale'
21916 d_setlocale_r='$d_setlocale_r'
21917 d_setnent='$d_setnent'
21918 d_setnetent_r='$d_setnetent_r'
21919 d_setpent='$d_setpent'
21920 d_setpgid='$d_setpgid'
21921 d_setpgrp2='$d_setpgrp2'
21922 d_setpgrp='$d_setpgrp'
21923 d_setprior='$d_setprior'
21924 d_setproctitle='$d_setproctitle'
21925 d_setprotoent_r='$d_setprotoent_r'
21926 d_setpwent='$d_setpwent'
21927 d_setpwent_r='$d_setpwent_r'
21928 d_setregid='$d_setregid'
21929 d_setresgid='$d_setresgid'
21930 d_setresuid='$d_setresuid'
21931 d_setreuid='$d_setreuid'
21932 d_setrgid='$d_setrgid'
21933 d_setruid='$d_setruid'
21934 d_setsent='$d_setsent'
21935 d_setservent_r='$d_setservent_r'
21936 d_setsid='$d_setsid'
21937 d_setvbuf='$d_setvbuf'
21938 d_sfio='$d_sfio'
21939 d_shm='$d_shm'
21940 d_shmat='$d_shmat'
21941 d_shmatprototype='$d_shmatprototype'
21942 d_shmctl='$d_shmctl'
21943 d_shmdt='$d_shmdt'
21944 d_shmget='$d_shmget'
21945 d_sigaction='$d_sigaction'
21946 d_signbit='$d_signbit'
21947 d_sigprocmask='$d_sigprocmask'
21948 d_sigsetjmp='$d_sigsetjmp'
21949 d_sitearch='$d_sitearch'
21950 d_snprintf='$d_snprintf'
21951 d_sockatmark='$d_sockatmark'
21952 d_sockatmarkproto='$d_sockatmarkproto'
21953 d_socket='$d_socket'
21954 d_socklen_t='$d_socklen_t'
21955 d_sockpair='$d_sockpair'
21956 d_socks5_init='$d_socks5_init'
21957 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21958 d_sqrtl='$d_sqrtl'
21959 d_srand48_r='$d_srand48_r'
21960 d_srandom_r='$d_srandom_r'
21961 d_sresgproto='$d_sresgproto'
21962 d_sresuproto='$d_sresuproto'
21963 d_statblks='$d_statblks'
21964 d_statfs_f_flags='$d_statfs_f_flags'
21965 d_statfs_s='$d_statfs_s'
21966 d_statvfs='$d_statvfs'
21967 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21968 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21969 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21970 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21971 d_stdio_stream_array='$d_stdio_stream_array'
21972 d_stdiobase='$d_stdiobase'
21973 d_stdstdio='$d_stdstdio'
21974 d_strchr='$d_strchr'
21975 d_strcoll='$d_strcoll'
21976 d_strctcpy='$d_strctcpy'
21977 d_strerrm='$d_strerrm'
21978 d_strerror='$d_strerror'
21979 d_strerror_r='$d_strerror_r'
21980 d_strftime='$d_strftime'
21981 d_strlcat='$d_strlcat'
21982 d_strlcpy='$d_strlcpy'
21983 d_strtod='$d_strtod'
21984 d_strtol='$d_strtol'
21985 d_strtold='$d_strtold'
21986 d_strtoll='$d_strtoll'
21987 d_strtoq='$d_strtoq'
21988 d_strtoul='$d_strtoul'
21989 d_strtoull='$d_strtoull'
21990 d_strtouq='$d_strtouq'
21991 d_strxfrm='$d_strxfrm'
21992 d_suidsafe='$d_suidsafe'
21993 d_symlink='$d_symlink'
21994 d_syscall='$d_syscall'
21995 d_syscallproto='$d_syscallproto'
21996 d_sysconf='$d_sysconf'
21997 d_sysernlst='$d_sysernlst'
21998 d_syserrlst='$d_syserrlst'
21999 d_system='$d_system'
22000 d_tcgetpgrp='$d_tcgetpgrp'
22001 d_tcsetpgrp='$d_tcsetpgrp'
22002 d_telldir='$d_telldir'
22003 d_telldirproto='$d_telldirproto'
22004 d_time='$d_time'
22005 d_times='$d_times'
22006 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22007 d_tm_tm_zone='$d_tm_tm_zone'
22008 d_tmpnam_r='$d_tmpnam_r'
22009 d_truncate='$d_truncate'
22010 d_ttyname_r='$d_ttyname_r'
22011 d_tzname='$d_tzname'
22012 d_u32align='$d_u32align'
22013 d_ualarm='$d_ualarm'
22014 d_umask='$d_umask'
22015 d_uname='$d_uname'
22016 d_union_semun='$d_union_semun'
22017 d_unordered='$d_unordered'
22018 d_unsetenv='$d_unsetenv'
22019 d_usleep='$d_usleep'
22020 d_usleepproto='$d_usleepproto'
22021 d_ustat='$d_ustat'
22022 d_vendorarch='$d_vendorarch'
22023 d_vendorbin='$d_vendorbin'
22024 d_vendorlib='$d_vendorlib'
22025 d_vendorscript='$d_vendorscript'
22026 d_vfork='$d_vfork'
22027 d_void_closedir='$d_void_closedir'
22028 d_voidsig='$d_voidsig'
22029 d_voidtty='$d_voidtty'
22030 d_volatile='$d_volatile'
22031 d_vprintf='$d_vprintf'
22032 d_vsnprintf='$d_vsnprintf'
22033 d_wait4='$d_wait4'
22034 d_waitpid='$d_waitpid'
22035 d_wcstombs='$d_wcstombs'
22036 d_wctomb='$d_wctomb'
22037 d_writev='$d_writev'
22038 d_xenix='$d_xenix'
22039 date='$date'
22040 db_hashtype='$db_hashtype'
22041 db_prefixtype='$db_prefixtype'
22042 db_version_major='$db_version_major'
22043 db_version_minor='$db_version_minor'
22044 db_version_patch='$db_version_patch'
22045 defvoidused='$defvoidused'
22046 direntrytype='$direntrytype'
22047 dlext='$dlext'
22048 dlsrc='$dlsrc'
22049 doublesize='$doublesize'
22050 drand01='$drand01'
22051 drand48_r_proto='$drand48_r_proto'
22052 dynamic_ext='$dynamic_ext'
22053 eagain='$eagain'
22054 ebcdic='$ebcdic'
22055 echo='$echo'
22056 egrep='$egrep'
22057 emacs='$emacs'
22058 endgrent_r_proto='$endgrent_r_proto'
22059 endhostent_r_proto='$endhostent_r_proto'
22060 endnetent_r_proto='$endnetent_r_proto'
22061 endprotoent_r_proto='$endprotoent_r_proto'
22062 endpwent_r_proto='$endpwent_r_proto'
22063 endservent_r_proto='$endservent_r_proto'
22064 eunicefix='$eunicefix'
22065 exe_ext='$exe_ext'
22066 expr='$expr'
22067 extensions='$extensions'
22068 extras='$extras'
22069 fflushNULL='$fflushNULL'
22070 fflushall='$fflushall'
22071 find='$find'
22072 firstmakefile='$firstmakefile'
22073 flex='$flex'
22074 fpossize='$fpossize'
22075 fpostype='$fpostype'
22076 freetype='$freetype'
22077 from='$from'
22078 full_ar='$full_ar'
22079 full_csh='$full_csh'
22080 full_sed='$full_sed'
22081 gccansipedantic='$gccansipedantic'
22082 gccosandvers='$gccosandvers'
22083 gccversion='$gccversion'
22084 getgrent_r_proto='$getgrent_r_proto'
22085 getgrgid_r_proto='$getgrgid_r_proto'
22086 getgrnam_r_proto='$getgrnam_r_proto'
22087 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22088 gethostbyname_r_proto='$gethostbyname_r_proto'
22089 gethostent_r_proto='$gethostent_r_proto'
22090 getlogin_r_proto='$getlogin_r_proto'
22091 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22092 getnetbyname_r_proto='$getnetbyname_r_proto'
22093 getnetent_r_proto='$getnetent_r_proto'
22094 getprotobyname_r_proto='$getprotobyname_r_proto'
22095 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22096 getprotoent_r_proto='$getprotoent_r_proto'
22097 getpwent_r_proto='$getpwent_r_proto'
22098 getpwnam_r_proto='$getpwnam_r_proto'
22099 getpwuid_r_proto='$getpwuid_r_proto'
22100 getservbyname_r_proto='$getservbyname_r_proto'
22101 getservbyport_r_proto='$getservbyport_r_proto'
22102 getservent_r_proto='$getservent_r_proto'
22103 getspnam_r_proto='$getspnam_r_proto'
22104 gidformat='$gidformat'
22105 gidsign='$gidsign'
22106 gidsize='$gidsize'
22107 gidtype='$gidtype'
22108 glibpth='$glibpth'
22109 gmake='$gmake'
22110 gmtime_r_proto='$gmtime_r_proto'
22111 gnulibc_version='$gnulibc_version'
22112 grep='$grep'
22113 groupcat='$groupcat'
22114 groupstype='$groupstype'
22115 gzip='$gzip'
22116 h_fcntl='$h_fcntl'
22117 h_sysfile='$h_sysfile'
22118 hint='$hint'
22119 hostcat='$hostcat'
22120 html1dir='$html1dir'
22121 html1direxp='$html1direxp'
22122 html3dir='$html3dir'
22123 html3direxp='$html3direxp'
22124 i16size='$i16size'
22125 i16type='$i16type'
22126 i32size='$i32size'
22127 i32type='$i32type'
22128 i64size='$i64size'
22129 i64type='$i64type'
22130 i8size='$i8size'
22131 i8type='$i8type'
22132 i_arpainet='$i_arpainet'
22133 i_bsdioctl='$i_bsdioctl'
22134 i_crypt='$i_crypt'
22135 i_db='$i_db'
22136 i_dbm='$i_dbm'
22137 i_dirent='$i_dirent'
22138 i_dld='$i_dld'
22139 i_dlfcn='$i_dlfcn'
22140 i_fcntl='$i_fcntl'
22141 i_float='$i_float'
22142 i_fp='$i_fp'
22143 i_fp_class='$i_fp_class'
22144 i_gdbm='$i_gdbm'
22145 i_grp='$i_grp'
22146 i_ieeefp='$i_ieeefp'
22147 i_inttypes='$i_inttypes'
22148 i_langinfo='$i_langinfo'
22149 i_libutil='$i_libutil'
22150 i_limits='$i_limits'
22151 i_locale='$i_locale'
22152 i_machcthr='$i_machcthr'
22153 i_malloc='$i_malloc'
22154 i_math='$i_math'
22155 i_memory='$i_memory'
22156 i_mntent='$i_mntent'
22157 i_ndbm='$i_ndbm'
22158 i_netdb='$i_netdb'
22159 i_neterrno='$i_neterrno'
22160 i_netinettcp='$i_netinettcp'
22161 i_niin='$i_niin'
22162 i_poll='$i_poll'
22163 i_prot='$i_prot'
22164 i_pthread='$i_pthread'
22165 i_pwd='$i_pwd'
22166 i_rpcsvcdbm='$i_rpcsvcdbm'
22167 i_sfio='$i_sfio'
22168 i_sgtty='$i_sgtty'
22169 i_shadow='$i_shadow'
22170 i_socks='$i_socks'
22171 i_stdarg='$i_stdarg'
22172 i_stddef='$i_stddef'
22173 i_stdlib='$i_stdlib'
22174 i_string='$i_string'
22175 i_sunmath='$i_sunmath'
22176 i_sysaccess='$i_sysaccess'
22177 i_sysdir='$i_sysdir'
22178 i_sysfile='$i_sysfile'
22179 i_sysfilio='$i_sysfilio'
22180 i_sysin='$i_sysin'
22181 i_sysioctl='$i_sysioctl'
22182 i_syslog='$i_syslog'
22183 i_sysmman='$i_sysmman'
22184 i_sysmode='$i_sysmode'
22185 i_sysmount='$i_sysmount'
22186 i_sysndir='$i_sysndir'
22187 i_sysparam='$i_sysparam'
22188 i_sysresrc='$i_sysresrc'
22189 i_syssecrt='$i_syssecrt'
22190 i_sysselct='$i_sysselct'
22191 i_syssockio='$i_syssockio'
22192 i_sysstat='$i_sysstat'
22193 i_sysstatfs='$i_sysstatfs'
22194 i_sysstatvfs='$i_sysstatvfs'
22195 i_systime='$i_systime'
22196 i_systimek='$i_systimek'
22197 i_systimes='$i_systimes'
22198 i_systypes='$i_systypes'
22199 i_sysuio='$i_sysuio'
22200 i_sysun='$i_sysun'
22201 i_sysutsname='$i_sysutsname'
22202 i_sysvfs='$i_sysvfs'
22203 i_syswait='$i_syswait'
22204 i_termio='$i_termio'
22205 i_termios='$i_termios'
22206 i_time='$i_time'
22207 i_unistd='$i_unistd'
22208 i_ustat='$i_ustat'
22209 i_utime='$i_utime'
22210 i_values='$i_values'
22211 i_varargs='$i_varargs'
22212 i_varhdr='$i_varhdr'
22213 i_vfork='$i_vfork'
22214 ignore_versioned_solibs='$ignore_versioned_solibs'
22215 inc_version_list='$inc_version_list'
22216 inc_version_list_init='$inc_version_list_init'
22217 incpath='$incpath'
22218 inews='$inews'
22219 initialinstalllocation='$initialinstalllocation'
22220 installarchlib='$installarchlib'
22221 installbin='$installbin'
22222 installhtml1dir='$installhtml1dir'
22223 installhtml3dir='$installhtml3dir'
22224 installman1dir='$installman1dir'
22225 installman3dir='$installman3dir'
22226 installprefix='$installprefix'
22227 installprefixexp='$installprefixexp'
22228 installprivlib='$installprivlib'
22229 installscript='$installscript'
22230 installsitearch='$installsitearch'
22231 installsitebin='$installsitebin'
22232 installsitehtml1dir='$installsitehtml1dir'
22233 installsitehtml3dir='$installsitehtml3dir'
22234 installsitelib='$installsitelib'
22235 installsiteman1dir='$installsiteman1dir'
22236 installsiteman3dir='$installsiteman3dir'
22237 installsitescript='$installsitescript'
22238 installstyle='$installstyle'
22239 installusrbinperl='$installusrbinperl'
22240 installvendorarch='$installvendorarch'
22241 installvendorbin='$installvendorbin'
22242 installvendorhtml1dir='$installvendorhtml1dir'
22243 installvendorhtml3dir='$installvendorhtml3dir'
22244 installvendorlib='$installvendorlib'
22245 installvendorman1dir='$installvendorman1dir'
22246 installvendorman3dir='$installvendorman3dir'
22247 installvendorscript='$installvendorscript'
22248 intsize='$intsize'
22249 issymlink='$issymlink'
22250 ivdformat='$ivdformat'
22251 ivsize='$ivsize'
22252 ivtype='$ivtype'
22253 known_extensions='$known_extensions'
22254 ksh='$ksh'
22255 ld='$ld'
22256 lddlflags='$lddlflags'
22257 ldflags='$ldflags'
22258 ldflags_uselargefiles='$ldflags_uselargefiles'
22259 ldlibpthname='$ldlibpthname'
22260 less='$less'
22261 lib_ext='$lib_ext'
22262 libc='$libc'
22263 libperl='$libperl'
22264 libpth='$libpth'
22265 libs='$libs'
22266 libsdirs='$libsdirs'
22267 libsfiles='$libsfiles'
22268 libsfound='$libsfound'
22269 libspath='$libspath'
22270 libswanted='$libswanted'
22271 libswanted_uselargefiles='$libswanted_uselargefiles'
22272 line='$line'
22273 lint='$lint'
22274 lkflags='$lkflags'
22275 ln='$ln'
22276 lns='$lns'
22277 localtime_r_proto='$localtime_r_proto'
22278 locincpth='$locincpth'
22279 loclibpth='$loclibpth'
22280 longdblsize='$longdblsize'
22281 longlongsize='$longlongsize'
22282 longsize='$longsize'
22283 lp='$lp'
22284 lpr='$lpr'
22285 ls='$ls'
22286 lseeksize='$lseeksize'
22287 lseektype='$lseektype'
22288 mad='$mad'
22289 madlyh='$madlyh'
22290 madlyobj='$madlyobj'
22291 madlysrc='$madlysrc'
22292 mail='$mail'
22293 mailx='$mailx'
22294 make='$make'
22295 make_set_make='$make_set_make'
22296 mallocobj='$mallocobj'
22297 mallocsrc='$mallocsrc'
22298 malloctype='$malloctype'
22299 man1dir='$man1dir'
22300 man1direxp='$man1direxp'
22301 man1ext='$man1ext'
22302 man3dir='$man3dir'
22303 man3direxp='$man3direxp'
22304 man3ext='$man3ext'
22305 mips_type='$mips_type'
22306 mistrustnm='$mistrustnm'
22307 mkdir='$mkdir'
22308 mmaptype='$mmaptype'
22309 modetype='$modetype'
22310 more='$more'
22311 multiarch='$multiarch'
22312 mv='$mv'
22313 myarchname='$myarchname'
22314 mydomain='$mydomain'
22315 myhostname='$myhostname'
22316 myuname='$myuname'
22317 n='$n'
22318 need_va_copy='$need_va_copy'
22319 netdb_hlen_type='$netdb_hlen_type'
22320 netdb_host_type='$netdb_host_type'
22321 netdb_name_type='$netdb_name_type'
22322 netdb_net_type='$netdb_net_type'
22323 nm='$nm'
22324 nm_opt='$nm_opt'
22325 nm_so_opt='$nm_so_opt'
22326 nonxs_ext='$nonxs_ext'
22327 nroff='$nroff'
22328 nvEUformat='$nvEUformat'
22329 nvFUformat='$nvFUformat'
22330 nvGUformat='$nvGUformat'
22331 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22332 nveformat='$nveformat'
22333 nvfformat='$nvfformat'
22334 nvgformat='$nvgformat'
22335 nvsize='$nvsize'
22336 nvtype='$nvtype'
22337 o_nonblock='$o_nonblock'
22338 obj_ext='$obj_ext'
22339 old_pthread_create_joinable='$old_pthread_create_joinable'
22340 optimize='$optimize'
22341 orderlib='$orderlib'
22342 osname='$osname'
22343 osvers='$osvers'
22344 otherlibdirs='$otherlibdirs'
22345 package='$package'
22346 pager='$pager'
22347 passcat='$passcat'
22348 patchlevel='$patchlevel'
22349 path_sep='$path_sep'
22350 perl5='$perl5'
22351 perl='$perl'
22352 perl_patchlevel='$perl_patchlevel'
22353 perladmin='$perladmin'
22354 perllibs='$perllibs'
22355 perlpath='$perlpath'
22356 pg='$pg'
22357 phostname='$phostname'
22358 pidtype='$pidtype'
22359 plibpth='$plibpth'
22360 pmake='$pmake'
22361 pr='$pr'
22362 prefix='$prefix'
22363 prefixexp='$prefixexp'
22364 privlib='$privlib'
22365 privlibexp='$privlibexp'
22366 procselfexe='$procselfexe'
22367 prototype='$prototype'
22368 ptrsize='$ptrsize'
22369 quadkind='$quadkind'
22370 quadtype='$quadtype'
22371 randbits='$randbits'
22372 randfunc='$randfunc'
22373 random_r_proto='$random_r_proto'
22374 randseedtype='$randseedtype'
22375 ranlib='$ranlib'
22376 rd_nodata='$rd_nodata'
22377 readdir64_r_proto='$readdir64_r_proto'
22378 readdir_r_proto='$readdir_r_proto'
22379 revision='$revision'
22380 rm='$rm'
22381 rm_try='$rm_try'
22382 rmail='$rmail'
22383 run='$run'
22384 runnm='$runnm'
22385 sPRIEUldbl='$sPRIEUldbl'
22386 sPRIFUldbl='$sPRIFUldbl'
22387 sPRIGUldbl='$sPRIGUldbl'
22388 sPRIXU64='$sPRIXU64'
22389 sPRId64='$sPRId64'
22390 sPRIeldbl='$sPRIeldbl'
22391 sPRIfldbl='$sPRIfldbl'
22392 sPRIgldbl='$sPRIgldbl'
22393 sPRIi64='$sPRIi64'
22394 sPRIo64='$sPRIo64'
22395 sPRIu64='$sPRIu64'
22396 sPRIx64='$sPRIx64'
22397 sSCNfldbl='$sSCNfldbl'
22398 sched_yield='$sched_yield'
22399 scriptdir='$scriptdir'
22400 scriptdirexp='$scriptdirexp'
22401 sed='$sed'
22402 seedfunc='$seedfunc'
22403 selectminbits='$selectminbits'
22404 selecttype='$selecttype'
22405 sendmail='$sendmail'
22406 setgrent_r_proto='$setgrent_r_proto'
22407 sethostent_r_proto='$sethostent_r_proto'
22408 setlocale_r_proto='$setlocale_r_proto'
22409 setnetent_r_proto='$setnetent_r_proto'
22410 setprotoent_r_proto='$setprotoent_r_proto'
22411 setpwent_r_proto='$setpwent_r_proto'
22412 setservent_r_proto='$setservent_r_proto'
22413 sh='$sh'
22414 shar='$shar'
22415 sharpbang='$sharpbang'
22416 shmattype='$shmattype'
22417 shortsize='$shortsize'
22418 shrpenv='$shrpenv'
22419 shsharp='$shsharp'
22420 sig_count='$sig_count'
22421 sig_name='$sig_name'
22422 sig_name_init='$sig_name_init'
22423 sig_num='$sig_num'
22424 sig_num_init='$sig_num_init'
22425 sig_size='$sig_size'
22426 signal_t='$signal_t'
22427 sitearch='$sitearch'
22428 sitearchexp='$sitearchexp'
22429 sitebin='$sitebin'
22430 sitebinexp='$sitebinexp'
22431 sitehtml1dir='$sitehtml1dir'
22432 sitehtml1direxp='$sitehtml1direxp'
22433 sitehtml3dir='$sitehtml3dir'
22434 sitehtml3direxp='$sitehtml3direxp'
22435 sitelib='$sitelib'
22436 sitelib_stem='$sitelib_stem'
22437 sitelibexp='$sitelibexp'
22438 siteman1dir='$siteman1dir'
22439 siteman1direxp='$siteman1direxp'
22440 siteman3dir='$siteman3dir'
22441 siteman3direxp='$siteman3direxp'
22442 siteprefix='$siteprefix'
22443 siteprefixexp='$siteprefixexp'
22444 sitescript='$sitescript'
22445 sitescriptexp='$sitescriptexp'
22446 sizesize='$sizesize'
22447 sizetype='$sizetype'
22448 sleep='$sleep'
22449 smail='$smail'
22450 so='$so'
22451 sockethdr='$sockethdr'
22452 socketlib='$socketlib'
22453 socksizetype='$socksizetype'
22454 sort='$sort'
22455 spackage='$spackage'
22456 spitshell='$spitshell'
22457 srand48_r_proto='$srand48_r_proto'
22458 srandom_r_proto='$srandom_r_proto'
22459 src='$src'
22460 ssizetype='$ssizetype'
22461 startperl='$startperl'
22462 startsh='$startsh'
22463 static_ext='$static_ext'
22464 stdchar='$stdchar'
22465 stdio_base='$stdio_base'
22466 stdio_bufsiz='$stdio_bufsiz'
22467 stdio_cnt='$stdio_cnt'
22468 stdio_filbuf='$stdio_filbuf'
22469 stdio_ptr='$stdio_ptr'
22470 stdio_stream_array='$stdio_stream_array'
22471 strerror_r_proto='$strerror_r_proto'
22472 strings='$strings'
22473 submit='$submit'
22474 subversion='$subversion'
22475 sysman='$sysman'
22476 tail='$tail'
22477 tar='$tar'
22478 targetarch='$targetarch'
22479 tbl='$tbl'
22480 tee='$tee'
22481 test='$test'
22482 timeincl='$timeincl'
22483 timetype='$timetype'
22484 tmpnam_r_proto='$tmpnam_r_proto'
22485 to='$to'
22486 touch='$touch'
22487 tr='$tr'
22488 trnl='$trnl'
22489 troff='$troff'
22490 ttyname_r_proto='$ttyname_r_proto'
22491 u16size='$u16size'
22492 u16type='$u16type'
22493 u32size='$u32size'
22494 u32type='$u32type'
22495 u64size='$u64size'
22496 u64type='$u64type'
22497 u8size='$u8size'
22498 u8type='$u8type'
22499 uidformat='$uidformat'
22500 uidsign='$uidsign'
22501 uidsize='$uidsize'
22502 uidtype='$uidtype'
22503 uname='$uname'
22504 uniq='$uniq'
22505 uquadtype='$uquadtype'
22506 use5005threads='$use5005threads'
22507 use64bitall='$use64bitall'
22508 use64bitint='$use64bitint'
22509 usecrosscompile='$usecrosscompile'
22510 usedl='$usedl'
22511 usefaststdio='$usefaststdio'
22512 useithreads='$useithreads'
22513 uselargefiles='$uselargefiles'
22514 uselongdouble='$uselongdouble'
22515 usemallocwrap='$usemallocwrap'
22516 usemorebits='$usemorebits'
22517 usemultiplicity='$usemultiplicity'
22518 usemymalloc='$usemymalloc'
22519 usenm='$usenm'
22520 useopcode='$useopcode'
22521 useperlio='$useperlio'
22522 useposix='$useposix'
22523 usereentrant='$usereentrant'
22524 userelocatableinc='$userelocatableinc'
22525 usesfio='$usesfio'
22526 useshrplib='$useshrplib'
22527 usesitecustomize='$usesitecustomize'
22528 usesocks='$usesocks'
22529 usethreads='$usethreads'
22530 usevendorprefix='$usevendorprefix'
22531 usevfork='$usevfork'
22532 usrinc='$usrinc'
22533 uuname='$uuname'
22534 uvXUformat='$uvXUformat'
22535 uvoformat='$uvoformat'
22536 uvsize='$uvsize'
22537 uvtype='$uvtype'
22538 uvuformat='$uvuformat'
22539 uvxformat='$uvxformat'
22540 vendorarch='$vendorarch'
22541 vendorarchexp='$vendorarchexp'
22542 vendorbin='$vendorbin'
22543 vendorbinexp='$vendorbinexp'
22544 vendorhtml1dir='$vendorhtml1dir'
22545 vendorhtml1direxp='$vendorhtml1direxp'
22546 vendorhtml3dir='$vendorhtml3dir'
22547 vendorhtml3direxp='$vendorhtml3direxp'
22548 vendorlib='$vendorlib'
22549 vendorlib_stem='$vendorlib_stem'
22550 vendorlibexp='$vendorlibexp'
22551 vendorman1dir='$vendorman1dir'
22552 vendorman1direxp='$vendorman1direxp'
22553 vendorman3dir='$vendorman3dir'
22554 vendorman3direxp='$vendorman3direxp'
22555 vendorprefix='$vendorprefix'
22556 vendorprefixexp='$vendorprefixexp'
22557 vendorscript='$vendorscript'
22558 vendorscriptexp='$vendorscriptexp'
22559 version='$version'
22560 version_patchlevel_string='$version_patchlevel_string'
22561 versiononly='$versiononly'
22562 vi='$vi'
22563 voidflags='$voidflags'
22564 xlibpth='$xlibpth'
22565 yacc='$yacc'
22566 yaccflags='$yaccflags'
22567 zcat='$zcat'
22568 zip='$zip'
22569 EOT
22570
22571 : Add in command line options if available
22572 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22573
22574 : add special variables
22575 $test -f $src/patchlevel.h && \
22576 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22577 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22578 echo "PERL_CONFIG_SH=true" >>config.sh
22579
22580 : propagate old symbols
22581 if $test -f UU/config.sh; then
22582         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22583         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22584         $sort | $uniq -u >UU/oldsyms
22585         set X `cat UU/oldsyms`
22586         shift
22587         case $# in
22588         0) ;;
22589         *)
22590                 cat <<EOM
22591 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22592 EOM
22593                 echo "# Variables propagated from previous config.sh file." >>config.sh
22594                 for sym in `cat UU/oldsyms`; do
22595                         echo "    Propagating $hint variable "'$'"$sym..."
22596                         eval 'tmp="$'"${sym}"'"'
22597                         echo "$tmp" | \
22598                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22599                 done
22600                 ;;
22601         esac
22602 fi
22603
22604 : Finish up by extracting the .SH files
22605 case "$alldone" in
22606 exit)
22607         $rm -rf UU
22608         echo "Extraction done."
22609         exit 0
22610         ;;
22611 cont)
22612         ;;
22613 '')
22614         dflt=''
22615         nostick=true
22616         $cat <<EOM
22617
22618 If you'd like to make any changes to the config.sh file before I begin
22619 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22620
22621 EOM
22622         rp="Press return or use a shell escape to edit config.sh:"
22623         . UU/myread
22624         nostick=''
22625         case "$ans" in
22626         '') ;;
22627         *) : in case they cannot read
22628                 sh 1>&4 -c "$ans";;
22629         esac
22630         ;;
22631 esac
22632
22633 : if this fails, just run all the .SH files by hand
22634 . ./config.sh
22635
22636 echo " "
22637 exec 1>&4
22638 pwd=`pwd`
22639 . ./UU/extract
22640 cd "$pwd"
22641
22642 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22643         dflt=y
22644         case "$silent" in
22645         true) ;;
22646         *)
22647                 $cat <<EOM
22648
22649 Now you need to generate make dependencies by running "$make depend".
22650 You might prefer to run it in background: "$make depend > makedepend.out &"
22651 It can take a while, so you might not want to run it right now.
22652
22653 EOM
22654                 ;;
22655         esac
22656         rp="Run $make depend now?"
22657         . UU/myread
22658         case "$ans" in
22659         y*)
22660                 $make depend && echo "Now you must run '$make'."
22661                 ;;
22662         *)
22663                 echo "You must run '$make depend' then '$make'."
22664                 ;;
22665         esac
22666 elif test -f [Mm]akefile; then
22667         echo " "
22668         echo "Now you must run a $make."
22669 else
22670         echo "Configure done."
22671 fi
22672
22673 if $test -f Policy.sh; then
22674     $cat <<EOM
22675
22676 If you compile $package on a different machine or from a different object
22677 directory, copy the Policy.sh file from this object directory to the
22678 new one before you run Configure -- this will help you with most of
22679 the policy defaults.
22680
22681 EOM
22682 fi
22683 if $test -f config.msg; then
22684     echo "Hmm.  I also noted the following information while running:"
22685     echo " "
22686     $cat config.msg >&4
22687     $rm -f config.msg
22688 fi
22689 $rm -f kit*isdone ark*isdone
22690 $rm -rf UU
22691
22692 : End of Configure
22693