A couple of File::Path tests require unix syntax on VMS.
[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 Fri Jun  1 08:37:13 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     printf("define\n");
7585 #else
7586     printf("undef\n");
7587 #endif
7588     return 0;
7589 }
7590 EOCP
7591 set try
7592 if eval $compile_ok && $run ./try >cplusplus$$; then
7593         val=`$cat cplusplus$$`
7594         echo "You are using a C++ compiler."
7595 else
7596         val="$undef"
7597         echo "You are not using a C++ compiler."
7598 fi
7599 $rm_try cplusplus$$
7600 set d_cplusplus
7601 eval $setvar
7602
7603 : is a C symbol defined?
7604 csym='tlook=$1;
7605 case "$3" in
7606 -v) tf=libc.tmp; tdc="";;
7607 -a) tf=libc.tmp; tdc="[]";;
7608 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7609 esac;
7610 tx=yes;
7611 case "$reuseval-$4" in
7612 true-) ;;
7613 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7614 esac;
7615 case "$tx" in
7616 yes)
7617         tval=false;
7618         case "$d_cplusplus" in
7619                 $define) extern_C=\"C\";;
7620         esac;
7621         if $test "$runnm" = true; then
7622                 if $contains $tlook $tf >/dev/null 2>&1; then
7623                         tval=true;
7624                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7625                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7626                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7627                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7628                         $rm_try;
7629                 fi;
7630         else
7631                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7632                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7633                 $rm_try;
7634         fi;
7635         ;;
7636 *)
7637         case "$tval" in
7638         $define) tval=true;;
7639         *) tval=false;;
7640         esac;
7641         ;;
7642 esac;
7643 eval "$2=$tval"'
7644
7645 : define an is-in-libc? function
7646 inlibc='echo " "; td=$define; tu=$undef;
7647 sym=$1; var=$2; eval "was=\$$2";
7648 tx=yes;
7649 case "$reuseval$was" in
7650 true) ;;
7651 true*) tx=no;;
7652 esac;
7653 case "$tx" in
7654 yes)
7655         set $sym tres -f;
7656         eval $csym;
7657         case "$tres" in
7658         true)
7659                 echo "$sym() found." >&4;
7660                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7661         *)
7662                 echo "$sym() NOT found." >&4;
7663                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7664         esac;;
7665 *)
7666         case "$was" in
7667         $define) echo "$sym() found." >&4;;
7668         *) echo "$sym() NOT found." >&4;;
7669         esac;;
7670 esac'
7671
7672 : see if dlopen exists
7673 xxx_runnm="$runnm"
7674 xxx_ccflags="$ccflags"
7675 runnm=false
7676 : with g++ one needs -shared to get is-in-libc to work for dlopen
7677 case "$gccversion" in
7678 '')     ;;
7679 *)      case "$d_cplusplus" in
7680         "$define") ccflags="$ccflags -shared" ;;
7681         esac
7682         ;;
7683 esac
7684 set dlopen d_dlopen
7685 eval $inlibc
7686 runnm="$xxx_runnm"
7687 ccflags="$xxx_ccflags"
7688
7689 : see if this is a unistd.h system
7690 set unistd.h i_unistd
7691 eval $inhdr
7692
7693 : determine which dynamic loading, if any, to compile in
7694 echo " "
7695 dldir="ext/DynaLoader"
7696 case "$usedl" in
7697 $define|y|true)
7698         dflt='y'
7699         usedl="$define"
7700         ;;
7701 $undef|n|false)
7702         dflt='n'
7703         usedl="$undef"
7704         ;;
7705 *)
7706         dflt='n'
7707         case "$d_dlopen" in
7708             $define) dflt='y' ;;
7709         esac
7710         case "$i_dld" in
7711             $define) dflt='y' ;;
7712         esac
7713         : Does a dl_xxx.xs file exist for this operating system
7714         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7715         ;;
7716 esac
7717 rp="Do you wish to use dynamic loading?"
7718 . ./myread
7719 usedl="$ans"
7720 case "$ans" in
7721 y*) usedl="$define"
7722         case "$dlsrc" in
7723         '')
7724                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7725                         dflt="$dldir/dl_${osname}.xs"
7726                 elif $test "$d_dlopen" = "$define" ; then
7727                         dflt="$dldir/dl_dlopen.xs"
7728                 elif $test "$i_dld" = "$define" ; then
7729                         dflt="$dldir/dl_dld.xs"
7730                 else
7731                         dflt=''
7732                 fi
7733                 ;;
7734         *)      dflt="$dldir/$dlsrc"
7735                 ;;
7736         esac
7737     echo "The following dynamic loading files are available:"
7738         : Can not go over to $dldir because getfile has path hard-coded in.
7739         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7740         rp="Source file to use for dynamic loading"
7741         fn="fne"
7742         gfpth="$src"
7743         . ./getfile
7744         usedl="$define"
7745         : emulate basename
7746         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7747
7748         $cat << EOM
7749
7750 Some systems may require passing special flags to $cc -c to
7751 compile modules that will be used to create a shared library.
7752 To use no flags, say "none".
7753
7754 EOM
7755     case "$cccdlflags" in
7756     '') case "$gccversion" in
7757                 '') case "$osname" in
7758                         hpux)   dflt='+z' ;;
7759                         next)   dflt='none' ;;
7760                         irix*)  dflt='-KPIC' ;;
7761                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7762                         sunos)  dflt='-pic' ;;
7763                         *)      dflt='none' ;;
7764                     esac
7765                         ;;
7766                 *)  case "$osname" in
7767                         darwin) dflt='none' ;;
7768                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7769                         *)      dflt='-fpic' ;;
7770                     esac ;;
7771             esac ;;
7772         ' ') dflt='none' ;;
7773     *)  dflt="$cccdlflags" ;;
7774     esac
7775     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7776     . ./myread
7777     case "$ans" in
7778     none) cccdlflags=' ' ;;
7779     *) cccdlflags="$ans" ;;
7780     esac
7781
7782     cat << EOM
7783
7784 Some systems use ld to create libraries that can be dynamically loaded,
7785 while other systems (such as those using ELF) use $cc.
7786
7787 EOM
7788         case "$ld" in
7789         '')     $cat >try.c <<EOM
7790 /* Test for whether ELF binaries are produced */
7791 #include <fcntl.h>
7792 #$i_stdlib I_STDLIB
7793 #ifdef I_STDLIB
7794 #include <stdlib.h>
7795 #endif
7796 #$i_unistd I_UNISTD
7797 #ifdef I_UNISTD
7798 #include <unistd.h>
7799 #endif
7800 int main() {
7801         char b[4];
7802         int i = open("a.out",O_RDONLY);
7803         if(i == -1)
7804                 exit(1); /* fail */
7805         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7806                 exit(0); /* succeed (yes, it's ELF) */
7807         else
7808                 exit(1); /* fail */
7809 }
7810 EOM
7811                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7812                         cat <<EOM
7813 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7814 EOM
7815                         dflt="$cc"
7816                 else
7817                         echo "I'll use ld to build dynamic libraries."
7818                         dflt='ld'
7819                 fi
7820                 $rm_try
7821                 ;;
7822         *)      dflt="$ld"
7823                 ;;
7824         esac
7825
7826     rp="What command should be used to create dynamic libraries?"
7827     . ./myread
7828         ld="$ans"
7829
7830     cat << EOM
7831
7832 Some systems may require passing special flags to $ld to create a
7833 library that can be dynamically loaded.  If your ld flags include
7834 -L/other/path options to locate libraries outside your loader's normal
7835 search path, you may need to specify those -L options here as well.  To
7836 use no flags, say "none".
7837
7838 EOM
7839     case "$lddlflags" in
7840     '') case "$osname" in
7841                         beos) dflt='-nostart' ;;
7842                         hpux) dflt='-b';
7843                               case "$gccversion" in
7844                               '') dflt="$dflt +vnocompatwarnings" ;;
7845                               esac
7846                               ;;
7847                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7848                         next)  dflt='none' ;;
7849                         solaris) dflt='-G' ;;
7850                         sunos) dflt='-assert nodefinitions' ;;
7851                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7852                 *)     dflt='none' ;;
7853                         esac
7854                         ;;
7855     *) dflt="$lddlflags" ;;
7856     esac
7857
7858         : Try to guess additional flags to pick up local libraries.
7859         : Be careful not to append to a plain 'none'
7860         case "$dflt" in
7861         none) dflt='' ;;
7862         esac
7863         for thisflag in $ldflags; do
7864                 case "$thisflag" in
7865                 -L*|-R*|-Wl,-R*)
7866                         case " $dflt " in
7867                         *" $thisflag "*) ;;
7868                         *) dflt="$dflt $thisflag" ;;
7869                         esac
7870                         ;;
7871                 esac
7872         done
7873
7874         case "$dflt" in
7875         ''|' ') dflt='none' ;;
7876         esac
7877
7878     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7879     . ./myread
7880     case "$ans" in
7881     none) lddlflags=' ' ;;
7882     *) lddlflags="$ans" ;;
7883     esac
7884
7885         cat <<EOM
7886
7887 Some systems may require passing special flags to $cc to indicate that
7888 the resulting executable will use dynamic linking.  To use no flags,
7889 say "none".
7890
7891 EOM
7892     case "$ccdlflags" in
7893     '') case "$osname" in
7894             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7895             next|sunos) dflt='none' ;;
7896             *)          dflt='none' ;;
7897             esac ;;
7898     ' ')  dflt='none' ;;
7899     *)  dflt="$ccdlflags" ;;
7900     esac
7901     rp="Any special flags to pass to $cc to use dynamic linking?"
7902     . ./myread
7903     case "$ans" in
7904     none) ccdlflags=' ' ;;
7905     *) ccdlflags="$ans" ;;
7906     esac
7907     ;;
7908 *)  usedl="$undef"
7909         ld='ld'
7910     dlsrc='dl_none.xs'
7911     lddlflags=''
7912     ccdlflags=''
7913     ;;
7914 esac
7915
7916 also=''
7917 case "$usedl" in
7918 $undef)
7919         # No dynamic loading being used, so don't bother even to prompt.
7920         useshrplib='false'
7921         ;;
7922 *)      case "$useshrplib" in
7923         '')     case "$osname" in
7924                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7925                         dflt=y
7926                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7927                         ;;
7928                 next*)
7929                         case "$osvers" in
7930                         4*)     dflt=y
7931                                 also='Building a shared libperl is needed for MAB support.'
7932                                 ;;
7933                         *)      dflt=n
7934                                 ;;
7935                         esac
7936                         ;;
7937                 *)      dflt=n
7938                         ;;
7939                 esac
7940                 ;;
7941         $define|true|[Yy]*)
7942                 dflt=y
7943                 ;;
7944         *)      dflt=n
7945                 ;;
7946         esac
7947         $cat << EOM
7948
7949 The perl executable is normally obtained by linking perlmain.c with
7950 libperl${_a}, any static extensions (usually just DynaLoader), and
7951 any other libraries needed on this system (such as -lm, etc.).  Since
7952 your system supports dynamic loading, it is probably possible to build
7953 a shared libperl.$so.  If you will have more than one executable linked
7954 to libperl.$so, this will significantly reduce the size of each
7955 executable, but it may have a noticeable effect on performance.  The
7956 default is probably sensible for your system.
7957 $also
7958
7959 EOM
7960         rp="Build a shared libperl.$so (y/n)"
7961         . ./myread
7962         case "$ans" in
7963         true|$define|[Yy]*)
7964                 useshrplib='true'  ;;
7965         *)      useshrplib='false' ;;
7966         esac
7967         ;;
7968 esac
7969
7970 case "$useshrplib" in
7971 true)
7972         case "$libperl" in
7973         '')
7974                 # Figure out a good name for libperl.so.  Since it gets stored in
7975                 # a version-specific architecture-dependent library, the version
7976                 # number isn't really that important, except for making cc/ld happy.
7977                 #
7978                 # A name such as libperl.so.3.1
7979                 majmin="libperl.$so.$patchlevel.$subversion"
7980                 # A name such as libperl.so.301
7981                 majonly=`echo $patchlevel $subversion |
7982                         $awk '{printf "%d%02d", $1, $2}'`
7983                 majonly=libperl.$so.$majonly
7984                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7985                 # rely on figuring it out from the naming of libc.
7986                 case "${osname}${osvers}" in
7987                 next4*)
7988                         dflt=libperl.5.$so
7989                         # XXX How handle the --version stuff for MAB?
7990                         ;;
7991                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7992                         dflt=libperl.$so
7993                         ;;
7994                 cygwin*) # ld links against an importlib
7995                         dflt=libperl$lib_ext
7996                         ;;
7997                 *)      # Try to guess based on whether libc has major.minor.
7998                         case "$libc" in
7999                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8000                         *libc.$so.[0-9]*) dflt=$majonly ;;
8001                         *)      dflt=libperl.$so ;;
8002                         esac
8003                         ;;
8004                 esac
8005                 ;;
8006         *)      dflt=$libperl
8007                 ;;
8008         esac
8009         cat << EOM
8010
8011 I need to select a good name for the shared libperl.  If your system uses
8012 library names with major and minor numbers, then you might want something
8013 like $majmin.  Alternatively, if your system uses a single version
8014 number for shared libraries, then you might want to use $majonly.
8015 Or, your system might be quite happy with a simple libperl.$so.
8016
8017 Since the shared libperl will get installed into a version-specific
8018 architecture-dependent directory, the version number of the shared perl
8019 library probably isn't important, so the default should be o.k.
8020
8021 EOM
8022         rp='What name do you want to give to the shared libperl?'
8023         . ./myread
8024         libperl=$ans
8025         echo "Ok, I'll use $libperl"
8026         ;;
8027 *)
8028         libperl="libperl${_a}"
8029         ;;
8030 esac
8031
8032 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8033 case "$shrpdir" in
8034 '') ;;
8035 *)      $cat >&4 <<EOM
8036 WARNING:  Use of the shrpdir variable for the installation location of
8037 the shared $libperl is not supported.  It was never documented and
8038 will not work in this version.  Let me (perlbug@perl.org)
8039 know of any problems this may cause.
8040
8041 EOM
8042         case "$shrpdir" in
8043         "$archlibexp/CORE")
8044                 $cat >&4 <<EOM
8045 But your current setting of $shrpdir is
8046 the default anyway, so it's harmless.
8047 EOM
8048                 ;;
8049         *)
8050                 $cat >&4 <<EOM
8051 Further, your current attempted setting of $shrpdir
8052 conflicts with the value of $archlibexp/CORE
8053 that installperl will use.
8054 EOM
8055                 ;;
8056         esac
8057         ;;
8058 esac
8059
8060 # How will the perl executable find the installed shared $libperl?
8061 # Add $xxx to ccdlflags.
8062 # If we can't figure out a command-line option, use $shrpenv to
8063 # set env LD_RUN_PATH.  The main perl makefile uses this.
8064 shrpdir=$archlibexp/CORE
8065 xxx=''
8066 tmp_shrpenv=''
8067 if "$useshrplib"; then
8068     case "$osname" in 
8069         aix)
8070                 # We'll set it in Makefile.SH...
8071                 ;;
8072         solaris)
8073                 xxx="-R $shrpdir"
8074                 ;;
8075         freebsd|netbsd|openbsd|interix|dragonfly)
8076                 xxx="-Wl,-R$shrpdir"
8077                 ;;
8078         bsdos|linux|irix*|dec_osf|gnu*)
8079                 xxx="-Wl,-rpath,$shrpdir"
8080                 ;;
8081         next)
8082                 # next doesn't like the default...
8083                 ;;
8084         beos)
8085                 # beos doesn't like the default, either.
8086                 ;;
8087         hpux*)
8088                 # hpux doesn't like the default, either.
8089                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8090                 ;;
8091         *)
8092                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8093                 ;;
8094         esac
8095         case "$xxx" in
8096         '') ;;
8097         *)      
8098                 # Only add $xxx if it isn't already in ccdlflags.
8099                 case " $ccdlflags " in
8100                 *" $xxx "*)     ;;
8101                 *)      ccdlflags="$ccdlflags $xxx"
8102                         cat <<EOM >&4
8103
8104 Adding $xxx to the flags
8105 passed to $ld so that the perl executable will find the 
8106 installed shared $libperl.
8107
8108 EOM
8109                         ;;
8110                 esac
8111                 ;;
8112         esac
8113 fi
8114 # Fix ccdlflags in AIX for building external extensions.
8115 # (For building Perl itself bare -bE:perl.exp is needed,
8116 #  Makefile.SH takes care of this.)
8117 case "$osname" in
8118 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8119 esac
8120 # Respect a hint or command-line value.
8121 case "$shrpenv" in
8122 '') shrpenv="$tmp_shrpenv" ;;
8123 esac
8124 case "$ldlibpthname" in
8125 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8126 none)   ldlibpthname='' ;;
8127 esac
8128
8129 : determine where manual pages are on this system
8130 echo " "
8131 case "$sysman" in
8132 '') 
8133         syspath='/usr/share/man/man1 /usr/man/man1'
8134         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8135         syspath="$syspath /usr/man/u_man/man1"
8136         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8137         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8138         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8139         sysman=`./loc . /usr/man/man1 $syspath`
8140         ;;
8141 esac
8142 if $test -d "$sysman"; then
8143         echo "System manual is in $sysman." >&4
8144 else
8145         echo "Could not find manual pages in source form." >&4
8146 fi
8147
8148 : determine where manual pages go
8149 set man1dir man1dir none
8150 eval $prefixit
8151 $cat <<EOM
8152
8153 $spackage has manual pages available in source form.
8154 EOM
8155 case "$nroff" in
8156 nroff)
8157         echo "However, you don't have nroff, so they're probably useless to you."
8158         case "$man1dir" in
8159         '') man1dir="none";;
8160         esac;;
8161 esac
8162 echo "If you don't want the manual sources installed, answer 'none'."
8163 case "$man1dir" in
8164 ' ') dflt=none
8165         ;;
8166 '')
8167         lookpath="$prefixexp/share/man/man1"
8168         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8169         lookpath="$lookpath $prefixexp/man/p_man/man1"
8170         lookpath="$lookpath $prefixexp/man/u_man/man1"
8171         lookpath="$lookpath $prefixexp/man/man.1"
8172         case "$sysman" in
8173         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8174         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8175         esac
8176         set dflt
8177         eval $prefixup
8178         ;;
8179 *)  dflt="$man1dir"
8180         ;;
8181 esac
8182 echo " "
8183 fn=dn+~
8184 rp="Where do the main $spackage manual pages (source) go?"
8185 . ./getfile
8186 if $test "X$man1direxp" != "X$ansexp"; then
8187         installman1dir=''
8188 fi
8189 prefixvar=man1dir
8190 . ./setprefixvar
8191
8192 case "$man1dir" in
8193 '')     man1dir=' '
8194         installman1dir='';;
8195 esac
8196
8197 : What suffix to use on installed man pages
8198
8199 case "$man1dir" in
8200 ' ')
8201         man1ext='0'
8202         ;;
8203 *)
8204         rp="What suffix should be used for the main $spackage man pages?"
8205         case "$man1ext" in
8206         '')     case "$man1dir" in
8207                 *1)  dflt=1 ;;
8208                 *1p) dflt=1p ;;
8209                 *1pm) dflt=1pm ;;
8210                 *l) dflt=l;;
8211                 *n) dflt=n;;
8212                 *o) dflt=o;;
8213                 *p) dflt=p;;
8214                 *C) dflt=C;;
8215                 *L) dflt=L;;
8216                 *L1) dflt=L1;;
8217                 *) dflt=1;;
8218                 esac
8219                 ;;
8220         *)      dflt="$man1ext";;
8221         esac
8222         . ./myread
8223         man1ext="$ans"
8224         ;;
8225 esac
8226
8227 : see if we can have long filenames
8228 echo " "
8229 first=123456789abcdef
8230 $rm -f $first
8231 if (echo hi >$first) 2>/dev/null; then
8232         if $test -f 123456789abcde; then
8233                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8234                 val="$undef"
8235         else
8236                 echo 'You can have filenames longer than 14 characters.'>&4
8237                 val="$define"
8238         fi
8239 else
8240         $cat <<'EOM'
8241 You can't have filenames longer than 14 chars.
8242 You can't even think about them!
8243 EOM
8244         val="$undef"
8245 fi 
8246 set d_flexfnam
8247 eval $setvar
8248 $rm -rf 123456789abcde*
8249
8250 : determine where library module manual pages go
8251 set man3dir man3dir none
8252 eval $prefixit
8253 $cat <<EOM
8254
8255 $spackage has manual pages for many of the library modules.
8256 EOM
8257
8258 case "$nroff" in
8259 nroff)
8260         $cat <<'EOM'
8261 However, you don't have nroff, so they're probably useless to you.
8262 EOM
8263         case "$man3dir" in
8264         '') man3dir="none";;
8265         esac;;
8266 esac
8267
8268 case "$d_flexfnam" in
8269 undef)
8270         $cat <<'EOM'
8271 However, your system can't handle the long file names like File::Basename.3.
8272 EOM
8273         case "$man3dir" in
8274         '') man3dir="none";;
8275         esac;;
8276 esac
8277
8278 echo "If you don't want the manual sources installed, answer 'none'."
8279 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8280 case "$man3dir" in
8281 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8282         if $test -d "$privlib/man/man3"; then
8283                 cat <<EOM >&4
8284
8285 WARNING:  Previous versions of perl installed man3 pages into
8286 $privlib/man/man3.  This version will suggest a
8287 new default of $dflt.
8288 EOM
8289                 tdflt=$dflt
8290                 dflt='n'
8291                 rp='Do you wish to preserve the old behavior?(y/n)'
8292                 . ./myread
8293                 case "$ans" in
8294                 y*) dflt="$privlib/man/man3" ;;
8295                 *)  dflt=$tdflt ;;
8296                 esac
8297     fi
8298         ;;
8299 *)      dflt="$man3dir" ;;
8300 esac
8301 case "$dflt" in
8302 ' ') dflt=none ;;
8303 esac
8304 echo " "
8305 fn=dn+~
8306 rp="Where do the $package library man pages (source) go?"
8307 . ./getfile
8308 prefixvar=man3dir
8309 . ./setprefixvar
8310
8311 case "$man3dir" in
8312 '')     man3dir=' '
8313         installman3dir='';;
8314 esac
8315
8316 : What suffix to use on installed man pages
8317 case "$man3dir" in
8318 ' ')
8319         man3ext='0'
8320         ;;
8321 *)
8322         rp="What suffix should be used for the $package library man pages?"
8323         case "$man3ext" in
8324         '')     case "$man3dir" in
8325                 *3)  dflt=3 ;;
8326                 *3p) dflt=3p ;;
8327                 *3pm) dflt=3pm ;;
8328                 *l) dflt=l;;
8329                 *n) dflt=n;;
8330                 *o) dflt=o;;
8331                 *p) dflt=p;;
8332                 *C) dflt=C;;
8333                 *L) dflt=L;;
8334                 *L3) dflt=L3;;
8335                 *) dflt=3;;
8336                 esac
8337                 ;;
8338         *)      dflt="$man3ext";;
8339         esac
8340         . ./myread
8341         man3ext="$ans"
8342         ;;
8343 esac
8344
8345 : see if we have to deal with yellow pages, now NIS.
8346 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8347         if $test -f /usr/etc/nibindd; then
8348                 echo " "
8349                 echo "I'm fairly confident you're on a NeXT."
8350                 echo " "
8351                 rp='Do you get the hosts file via NetInfo?'
8352                 dflt=y
8353                 case "$hostcat" in
8354                 nidump*) ;;
8355                 '') ;;
8356                 *) dflt=n;;
8357                 esac
8358                 . ./myread
8359                 case "$ans" in
8360                 y*) hostcat='nidump hosts .';;
8361                 *)      case "$hostcat" in
8362                         nidump*) hostcat='';;
8363                         esac
8364                         ;;
8365                 esac
8366         fi
8367         case "$hostcat" in
8368         nidump*) ;;
8369         *)
8370                 case "$hostcat" in
8371                 *ypcat*) dflt=y;;
8372                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8373                                 dflt=y
8374                         else
8375                                 dflt=n
8376                         fi;;
8377                 *) dflt=n;;
8378                 esac
8379                 echo " "
8380                 rp='Are you getting the hosts file via yellow pages?'
8381                 . ./myread
8382                 case "$ans" in
8383                 y*) hostcat='ypcat hosts';;
8384                 *) hostcat='cat /etc/hosts';;
8385                 esac
8386                 ;;
8387         esac
8388 fi
8389 case "$hostcat" in
8390 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8391 esac
8392 case "$groupcat" in
8393 '') test -f /etc/group && groupcat='cat /etc/group';;
8394 esac
8395 case "$passcat" in
8396 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8397 esac
8398
8399 : now get the host name
8400 echo " "
8401 echo "Figuring out host name..." >&4
8402 case "$myhostname" in
8403 '') cont=true
8404         echo 'Maybe "hostname" will work...'
8405         if tans=`sh -c hostname 2>&1` ; then
8406                 myhostname=$tans
8407                 phostname=hostname
8408                 cont=''
8409         fi
8410         ;;
8411 *) cont='';;
8412 esac
8413 if $test "$cont"; then
8414         if ./xenix; then
8415                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8416                 if tans=`cat /etc/systemid 2>&1` ; then
8417                         myhostname=$tans
8418                         phostname='cat /etc/systemid'
8419                         echo "Whadyaknow.  Xenix always was a bit strange..."
8420                         cont=''
8421                 fi
8422         elif $test -r /etc/systemid; then
8423                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8424         fi
8425 fi
8426 if $test "$cont"; then
8427         echo 'No, maybe "uuname -l" will work...'
8428         if tans=`sh -c 'uuname -l' 2>&1` ; then
8429                 myhostname=$tans
8430                 phostname='uuname -l'
8431         else
8432                 echo 'Strange.  Maybe "uname -n" will work...'
8433                 if tans=`sh -c 'uname -n' 2>&1` ; then
8434                         myhostname=$tans
8435                         phostname='uname -n'
8436                 else
8437                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8438                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8439                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8440                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8441                         else
8442                                 case "$myhostname" in
8443                                 '') echo "Does this machine have an identity crisis or something?"
8444                                         phostname='';;
8445                                 *)
8446                                         echo "Well, you said $myhostname before..."
8447                                         phostname='echo $myhostname';;
8448                                 esac
8449                         fi
8450                 fi
8451         fi
8452 fi
8453 case "$myhostname" in
8454 '') myhostname=noname ;;
8455 esac
8456 : you do not want to know about this
8457 set $myhostname
8458 myhostname=$1
8459
8460 : verify guess
8461 if $test "$myhostname" ; then
8462         dflt=y
8463         rp='Your host name appears to be "'$myhostname'".'" Right?"
8464         . ./myread
8465         case "$ans" in
8466         y*) ;;
8467         *) myhostname='';;
8468         esac
8469 fi
8470
8471 : bad guess or no guess
8472 while $test "X$myhostname" = X ; do
8473         dflt=''
8474         rp="Please type the (one word) name of your host:"
8475         . ./myread
8476         myhostname="$ans"
8477 done
8478
8479 : translate upper to lower if necessary
8480 case "$myhostname" in
8481 *[A-Z]*)
8482         echo "(Normalizing case in your host name)"
8483         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8484         ;;
8485 esac
8486
8487 case "$myhostname" in
8488 *.*)
8489         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8490         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8491         echo "(Trimming domain name from host name--host name is now $myhostname)"
8492         ;;
8493 *) case "$mydomain" in
8494         '')
8495                 {
8496                         test "X$hostcat" = "Xypcat hosts" &&
8497                         ypmatch "$myhostname" hosts 2>/dev/null |\
8498                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8499                         $test -s hosts
8500                 } || {
8501                         test "X$hostcat" != "X" &&
8502                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8503                                         /[       ]$myhostname[  . ]/p" > hosts
8504                 }
8505                 tmp_re="[       . ]"
8506                 if $test -f hosts; then
8507                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8508                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8509                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8510                                 hosts | $sort | $uniq | \
8511                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8512                         case `$echo X$dflt` in
8513                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8514                                 dflt=.
8515                                 ;;
8516                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8517                                 ;;
8518                         esac
8519                 else
8520                         echo "(I cannot locate a hosts database anywhere)"
8521                         dflt=.
8522                 fi
8523                 case "$dflt" in
8524                 .)
8525                         tans=`./loc resolv.conf X /etc /usr/etc`
8526                         if $test -f "$tans"; then
8527                                 echo "(Attempting domain name extraction from $tans)"
8528                                 dflt=.`$sed -n -e 's/   / /g' \
8529                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8530                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8531                                 case "$dflt" in
8532                                 .) dflt=.`$sed -n -e 's/        / /g' \
8533                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8534                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8535                                         ;;
8536                                 esac
8537                         fi
8538                         ;;
8539                 esac
8540                 case "$dflt" in
8541                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8542                         dflt=.`sh -c domainname 2>/dev/null`
8543                         case "$dflt" in
8544                         '') dflt='.';;
8545                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8546                         esac
8547                         ;;
8548                 esac
8549                 case "$dflt$osname" in
8550                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8551                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8552                         ;;
8553                 esac
8554                 case "$dflt" in
8555                 .) echo "(Lost all hope -- silly guess then)"
8556                         dflt='.nonet'
8557                         ;;
8558                 esac
8559                 $rm -f hosts
8560                 ;;
8561         *) dflt="$mydomain";;
8562         esac;;
8563 esac
8564 echo " "
8565 rp="What is your domain name?"
8566 . ./myread
8567 tans="$ans"
8568 case "$ans" in
8569 '') ;;
8570 .*) ;;
8571 *) tans=".$tans";;
8572 esac
8573 mydomain="$tans"
8574
8575 : translate upper to lower if necessary
8576 case "$mydomain" in
8577 *[A-Z]*)
8578         echo "(Normalizing case in your domain name)"
8579         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8580         ;;
8581 esac
8582
8583 : a little sanity check here
8584 case "$phostname" in
8585 '') ;;
8586 *)
8587         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8588         $myhostname$mydomain|$myhostname) ;;
8589         *)
8590                 case "$phostname" in
8591                 sed*)
8592                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8593                         ;;
8594                 *)
8595                         echo "(That doesn't agree with your $phostname command, by the way.)"
8596                         ;;
8597                 esac
8598         ;;
8599         esac
8600         ;;
8601 esac
8602
8603 $cat <<EOM
8604
8605 I need to get your e-mail address in Internet format if possible, i.e.
8606 something like user@host.domain. Please answer accurately since I have
8607 no easy means to double check it. The default value provided below
8608 is most probably close to reality but may not be valid from outside
8609 your organization...
8610
8611 EOM
8612 cont=x
8613 while test "$cont"; do
8614         case "$cf_email" in
8615         '') dflt="$cf_by@$myhostname$mydomain";;
8616         *) dflt="$cf_email";;
8617         esac
8618         rp='What is your e-mail address?'
8619         . ./myread
8620         cf_email="$ans"
8621         case "$cf_email" in
8622         *@*.*) cont='' ;;
8623         *)
8624                 rp='Address does not look like an Internet one.  Use it anyway?'
8625                 case "$fastread" in
8626                 yes) dflt=y ;;
8627                 *) dflt=n ;;
8628                 esac
8629                 . ./myread
8630                 case "$ans" in
8631                 y*) cont='' ;;
8632                 *) echo " " ;;
8633                 esac
8634                 ;;
8635         esac
8636 done
8637
8638 $cat <<EOM
8639
8640 If you or somebody else will be maintaining perl at your site, please
8641 fill in the correct e-mail address here so that they may be contacted
8642 if necessary. Currently, the "perlbug" program included with perl
8643 will send mail to this address in addition to perlbug@perl.org. You may
8644 enter "none" for no administrator.
8645
8646 EOM
8647 case "$perladmin" in
8648 '') dflt="$cf_email";;
8649 *) dflt="$perladmin";;
8650 esac
8651 rp='Perl administrator e-mail address'
8652 . ./myread
8653 perladmin="$ans"
8654
8655 : determine whether to only install version-specific parts.
8656 echo " "
8657 $cat <<EOM
8658 Do you want to install only the version-specific parts of the perl
8659 distribution?  Usually you do *not* want to do this.
8660 EOM
8661 case "$versiononly" in
8662 "$define"|[Yy]*|true) dflt='y' ;;
8663 *) dflt='n';
8664 esac
8665 rp="Do you want to install only the version-specific parts of perl?"
8666 . ./myread
8667 case "$ans" in
8668 [yY]*)  val="$define";;
8669 *)      val="$undef" ;;
8670 esac
8671 set versiononly
8672 eval $setvar
8673
8674 case "$versiononly" in
8675 "$define") inc_version_list=''
8676            inc_version_list_init=0
8677            ;;
8678 esac
8679
8680 : figure out how to guarantee perl startup
8681 : XXX Note that this currently takes advantage of the bug that binexp ignores
8682 :     the Configure -Dinstallprefix setting, which in turn means that under
8683 :     relocatable @INC, initialinstalllocation is what binexp started as.
8684 case "$startperl" in
8685 '')
8686         case "$sharpbang" in
8687         *!)
8688                 $cat <<EOH
8689
8690 I can use the #! construct to start perl on your system. This will
8691 make startup of perl scripts faster, but may cause problems if you
8692 want to share those scripts and perl is not in a standard place
8693 ($initialinstalllocation/perl) on all your platforms. The alternative
8694 is to force a shell by starting the script with a single ':' character.
8695
8696 EOH
8697                 case "$versiononly" in
8698                 "$define")      dflt="$initialinstalllocation/perl$version";;
8699                 *)              dflt="$initialinstalllocation/perl";;
8700                 esac
8701                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8702                 . ./myread
8703                 case "$ans" in
8704                 none)   startperl=": # use perl";;
8705                 *)      startperl="#!$ans"
8706                         if $test 30 -lt `echo "$ans" | wc -c`; then
8707                                 $cat >&4 <<EOM
8708
8709 WARNING:  Some systems limit the #! command to 32 characters.
8710 If you experience difficulty running Perl scripts with #!, try
8711 installing Perl in a directory with a shorter pathname.
8712
8713 EOM
8714                         fi ;;
8715                 esac
8716                 ;;
8717         *) startperl=": # use perl"
8718                 ;;
8719         esac
8720         ;;
8721 esac
8722 echo "I'll use $startperl to start perl scripts."
8723
8724 : figure best path for perl in scripts
8725 case "$perlpath" in
8726 '')
8727         case "$versiononly" in
8728         "$define")      perlpath="$initialinstalllocation/perl$version";;
8729         *)              perlpath="$initialinstalllocation/perl";;
8730         esac
8731         case "$startperl" in
8732         *!*) ;;
8733         *)
8734                 $cat <<EOH
8735
8736 I will use the "eval 'exec'" idiom to start Perl on your system.
8737 I can use the full path of your Perl binary for this purpose, but
8738 doing so may cause problems if you want to share those scripts and
8739 Perl is not always in a standard place ($initialinstalllocation/perl).
8740
8741 EOH
8742                 dflt="$initialinstalllocation/perl"
8743                 rp="What path shall I use in \"eval 'exec'\"?"
8744                 . ./myread
8745                 perlpath="$ans"
8746                 ;;
8747         esac
8748         ;;
8749 esac
8750 case "$startperl" in
8751 *!*)    ;;
8752 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8753 esac
8754
8755 : determine where public executable scripts go
8756 set scriptdir scriptdir
8757 eval $prefixit
8758 case "$scriptdir" in
8759 '')
8760         dflt="$bin"
8761         : guess some guesses
8762         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8763         $test -d /usr/share/bin     && dflt=/usr/share/bin
8764         $test -d /usr/local/script  && dflt=/usr/local/script
8765         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8766         $test -d $prefixexp/script  && dflt=$prefixexp/script
8767         set dflt
8768         eval $prefixup
8769         ;;
8770 *)  dflt="$scriptdir"
8771         ;;
8772 esac
8773 $cat <<EOM
8774
8775 Some installations have a separate directory just for executable scripts so
8776 that they can mount it across multiple architectures but keep the scripts in
8777 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8778 Or you might just lump your scripts in with all your other executables.
8779
8780 EOM
8781 fn=d~
8782 rp='Where do you keep publicly executable scripts?'
8783 . ./getfile
8784 if $test "X$ansexp" != "X$scriptdirexp"; then
8785         installscript=''
8786 fi
8787 installscriptdir=''
8788 prefixvar=scriptdir
8789 . ./setprefixvar
8790 : A little fix up for an irregularly named variable.
8791 installscript="$installscriptdir"
8792
8793 : determine where add-on public executables go
8794 case "$sitebin" in
8795 '')     dflt=$siteprefix/bin ;;
8796 *)      dflt=$sitebin ;;
8797 esac
8798 fn=d~
8799 rp='Pathname where the add-on public executables should be installed?'
8800 . ./getfile
8801 prefixvar=sitebin
8802 . ./setprefixvar
8803
8804 : determine where add-on html pages go
8805 : There is no standard location, so try to copy the previously-selected
8806 : directory structure for the core html pages.
8807 case "$sitehtml1dir" in
8808 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8809 *)     dflt=$sitehtml1dir ;;
8810 esac
8811 case "$dflt" in
8812 ''|' ') dflt=none ;;
8813 esac
8814 fn=dn+~
8815 rp='Pathname where the site-specific html pages should be installed?'
8816 . ./getfile
8817 prefixvar=sitehtml1dir
8818 . ./setprefixvar
8819
8820 : determine where add-on library html pages go
8821 : There is no standard location, so try to copy the previously-selected
8822 : directory structure for the core html pages.
8823 case "$sitehtml3dir" in
8824 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8825 *)     dflt=$sitehtml3dir ;;
8826 esac
8827 case "$dflt" in
8828 ''|' ') dflt=none ;;
8829 esac
8830 fn=dn+~
8831 rp='Pathname where the site-specific library html pages should be installed?'
8832 . ./getfile
8833 prefixvar=sitehtml3dir
8834 . ./setprefixvar
8835
8836 : determine where add-on manual pages go
8837 case "$siteman1dir" in
8838 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8839 *)      dflt=$siteman1dir ;;
8840 esac
8841 case "$dflt" in
8842 ''|' ') dflt=none ;;
8843 esac
8844 fn=dn+~
8845 rp='Pathname where the site-specific manual pages should be installed?'
8846 . ./getfile
8847 prefixvar=siteman1dir
8848 . ./setprefixvar
8849
8850 : determine where add-on library man pages go
8851 case "$siteman3dir" in
8852 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8853 *)      dflt=$siteman3dir ;;
8854 esac
8855 case "$dflt" in
8856 ''|' ') dflt=none ;;
8857 esac
8858 fn=dn+~
8859 rp='Pathname where the site-specific library manual pages should be installed?'
8860 . ./getfile
8861 prefixvar=siteman3dir
8862 . ./setprefixvar
8863
8864 : determine where add-on public executable scripts go
8865 case "$sitescript" in
8866 '')     dflt=$siteprefix/script
8867         $test -d $dflt || dflt=$sitebin ;;
8868 *)  dflt="$sitescript" ;;
8869 esac
8870 fn=d~+
8871 rp='Pathname where add-on public executable scripts should be installed?'
8872 . ./getfile
8873 prefixvar=sitescript
8874 . ./setprefixvar
8875
8876 case "$usefaststdio" in
8877 $define|true|[yY]*|'')
8878         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8879         case "$xversion" in
8880         [68])   dflt='y' ;;
8881         *)      dflt='n' ;;
8882         esac
8883         ;;
8884 *) dflt='n';;
8885 esac
8886 cat <<EOM
8887
8888 Perl can be built to use 'fast stdio', which means using the stdio
8889 library but also directly manipulating the stdio buffers to enable
8890 faster I/O.  Using stdio is better for backward compatibility (especially
8891 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8892 interface has been preferred instead of stdio.
8893
8894 If this doesn't make any sense to you, just accept the default '$dflt'.
8895 EOM
8896 rp='Use the "fast stdio" if available?'
8897 . ./myread
8898 case "$ans" in
8899 y|Y)    val="$define" ;;     
8900 *)      val="$undef" ;;
8901 esac
8902 set usefaststdio
8903 eval $setvar
8904
8905
8906 : define an is-a-typedef? function
8907 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8908 case "$inclist" in
8909 "") inclist="sys/types.h";;
8910 esac;
8911 eval "varval=\$$var";
8912 case "$varval" in
8913 "")
8914         $rm -f temp.c;
8915         for inc in $inclist; do
8916                 echo "#include <$inc>" >>temp.c;
8917         done;
8918         echo "#ifdef $type" >> temp.c;
8919         echo "printf(\"We have $type\");" >> temp.c;
8920         echo "#endif" >> temp.c;
8921         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8922         if $contains $type temp.E >/dev/null 2>&1; then
8923                 eval "$var=\$type";
8924         else
8925                 eval "$var=\$def";
8926         fi;
8927         $rm -f temp.?;;
8928 *) eval "$var=\$varval";;
8929 esac'
8930
8931 : define an is-a-typedef? function that prompts if the type is not available.
8932 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8933 case "$inclist" in
8934 "") inclist="sys/types.h";;
8935 esac;
8936 eval "varval=\$$var";
8937 case "$varval" in
8938 "")
8939         $rm -f temp.c;
8940         for inc in $inclist; do
8941                 echo "#include <$inc>" >>temp.c;
8942         done;
8943         echo "#ifdef $type" >> temp.c;
8944         echo "printf(\"We have $type\");" >> temp.c;
8945         echo "#endif" >> temp.c;
8946         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8947         echo " " ;
8948         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8949         if $contains $type temp.E >/dev/null 2>&1; then
8950                 echo "$type found." >&4;
8951                 eval "$var=\$type";
8952         else
8953                 echo "$type NOT found." >&4;
8954                 dflt="$def";
8955                 . ./myread ;
8956                 eval "$var=\$ans";
8957         fi;
8958         $rm -f temp.?;;
8959 *) eval "$var=\$varval";;
8960 esac'
8961
8962 : see what type lseek is declared as in the kernel
8963 rp="What is the type used for lseek's offset on this system?"
8964 set off_t lseektype long stdio.h sys/types.h
8965 eval $typedef_ask
8966
8967 echo " "
8968 echo "Checking to see how big your file offsets are..." >&4
8969 $cat >try.c <<EOCP
8970 #include <sys/types.h>
8971 #include <stdio.h>
8972 int main()
8973 {
8974     printf("%d\n", (int)sizeof($lseektype));
8975     return(0);
8976 }
8977 EOCP
8978 set try
8979 if eval $compile_ok; then
8980         lseeksize=`$run ./try`
8981         echo "Your file offsets are $lseeksize bytes long."
8982 else
8983         dflt=$longsize
8984         echo " "
8985         echo "(I can't seem to compile the test program.  Guessing...)"
8986         rp="What is the size of your file offsets (in bytes)?"
8987         . ./myread
8988         lseeksize="$ans"
8989 fi
8990 $rm_try
8991
8992 : see what type file positions are declared as in the library
8993 rp="What is the type for file position used by fsetpos()?"
8994 set fpos_t fpostype long stdio.h sys/types.h
8995 eval $typedef_ask
8996
8997 echo " "
8998 case "$fpostype" in
8999 *_t) zzz="$fpostype"    ;;
9000 *)   zzz="fpos_t"       ;;
9001 esac
9002 echo "Checking the size of $zzz..." >&4 
9003 cat > try.c <<EOCP
9004 #include <sys/types.h>
9005 #include <stdio.h>
9006 #$i_stdlib I_STDLIB
9007 #ifdef I_STDLIB
9008 #include <stdlib.h>
9009 #endif
9010 int main() {
9011     printf("%d\n", (int)sizeof($fpostype));
9012     exit(0);
9013 }
9014 EOCP
9015 set try
9016 if eval $compile_ok; then
9017         yyy=`$run ./try`
9018         case "$yyy" in
9019         '')     fpossize=4
9020                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9021                 ;;
9022         *)      fpossize=$yyy
9023                 echo "Your $zzz is $fpossize bytes long."
9024                 ;;
9025         esac
9026 else
9027         dflt="$longsize"
9028         echo " " >&4
9029         echo "(I can't compile the test program.  Guessing...)" >&4
9030         rp="What is the size of your file positions (in bytes)?"
9031         . ./myread
9032         fpossize="$ans"
9033 fi
9034
9035 # Backward compatibility (uselfs is deprecated).
9036 case "$uselfs" in
9037 "$define"|true|[yY]*)
9038         cat <<EOM >&4
9039
9040 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9041 EOM
9042         uselargefiles="$define"
9043         ;;
9044 esac
9045
9046 case "$lseeksize:$fpossize" in
9047 8:8) cat <<EOM
9048
9049 You can have files larger than 2 gigabytes.
9050 EOM
9051    val="$define" ;;
9052 *)    case "$uselargefiles" in
9053    "$undef"|false|[nN]*) dflt='n' ;;
9054    *)   dflt='y' ;;
9055    esac
9056    cat <<EOM
9057
9058 Perl can be built to understand large files (files larger than 2 gigabytes)
9059 on some systems.  To do so, Configure can be run with -Duselargefiles.
9060
9061 If this doesn't make any sense to you, just accept the default '$dflt'.
9062 EOM
9063    rp='Try to understand large files, if available?'
9064    . ./myread
9065    case "$ans" in
9066    y|Y)         val="$define" ;;
9067    *)           val="$undef"  ;;
9068    esac
9069    ;;
9070 esac
9071 set uselargefiles
9072 eval $setvar
9073 : Look for a hint-file generated 'call-back-unit'.  If the
9074 : user has specified that a large files perl is to be built,
9075 : we may need to set or change some other defaults.
9076 if $test -f uselargefiles.cbu; then
9077         echo "Your platform has some specific hints regarding large file builds, using them..."
9078         . ./uselargefiles.cbu
9079 fi
9080 case "$uselargefiles" in
9081 "$define")
9082         if $test -f uselargefiles.cbu; then
9083                 echo " "
9084                 echo "Rechecking to see how big your file offsets are..." >&4
9085                 $cat >try.c <<EOCP
9086 #include <sys/types.h>
9087 #include <stdio.h>
9088 int main()
9089 {
9090     printf("%d\n", (int)sizeof($lseektype));
9091     return(0);
9092 }
9093 EOCP
9094                 set try
9095                 if eval $compile_ok; then
9096                         lseeksize=`$run ./try`
9097                         $echo "Your file offsets are now $lseeksize bytes long."
9098                 else
9099                         dflt="$lseeksize"
9100                         echo " "
9101                         echo "(I can't seem to compile the test program.  Guessing...)"
9102                         rp="What is the size of your file offsets (in bytes)?"
9103                         . ./myread
9104                         lseeksize="$ans"
9105                 fi
9106                 case "$fpostype" in
9107                 *_t) zzz="$fpostype"    ;;
9108                 *)   zzz="fpos_t"       ;;
9109                 esac
9110                 $echo $n "Rechecking the size of $zzz...$c" >&4
9111                 $cat > try.c <<EOCP
9112 #include <sys/types.h>
9113 #include <stdio.h>
9114 #$i_stdlib I_STDLIB
9115 #ifdef I_STDLIB
9116 #include <stdlib.h>
9117 #endif
9118 int main() {
9119     printf("%d\n", (int)sizeof($fpostype));
9120     return(0);
9121 }
9122 EOCP
9123                 set try
9124                 if eval $compile_ok; then
9125                         yyy=`$run ./try`
9126                         dflt="$lseeksize"
9127                         case "$yyy" in
9128                         '')     echo " "
9129                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9130                                 ;;
9131                         *)      fpossize=$yyy
9132                                 echo " $fpossize bytes." >&4
9133                                 ;;
9134                         esac
9135                 else
9136                         dflt="$fpossize"
9137                         echo " "
9138                         echo "(I can't compile the test program.  Guessing...)" >&4
9139                         rp="What is the size of your file positions (in bytes)?"
9140                         . ./myread
9141                         fpossize="$ans"
9142                 fi
9143                 $rm_try
9144         fi
9145         ;;
9146 esac
9147
9148 case "$vendorprefix" in
9149 '')     d_vendorbin="$undef"
9150         vendorbin=''
9151         vendorbinexp=''
9152         ;;
9153 *)      d_vendorbin="$define"
9154         : determine where vendor-supplied executables go.
9155         case "$vendorbin" in
9156         '') dflt=$vendorprefix/bin ;;
9157         *)      dflt="$vendorbin" ;;
9158         esac
9159         fn=d~+
9160         rp='Pathname for the vendor-supplied executables directory?'
9161         . ./getfile
9162         vendorbin="$ans"
9163         vendorbinexp="$ansexp"
9164         ;;
9165 esac
9166 prefixvar=vendorbin
9167 . ./installprefix
9168
9169 case "$vendorprefix" in
9170 '')     vendorhtml1dir=''
9171         vendorhtml1direxp=''
9172         ;;
9173 *)      : determine where vendor-supplied html pages go.
9174         : There is no standard location, so try to copy the previously-selected
9175         : directory structure for the core html pages.
9176         : XXX Better default suggestions would be welcome.
9177         case "$vendorhtml1dir" in
9178         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9179         *)      dflt=$vendorhtml1dir ;;
9180         esac
9181         case "$dflt" in
9182         ''|' ') dflt=none ;;
9183         esac
9184         fn=dn+~
9185         rp='Pathname for the vendor-supplied html pages?'
9186         . ./getfile
9187         vendorhtml1dir="$ans"
9188         vendorhtml1direxp="$ansexp"
9189         ;;
9190 esac
9191 : Use ' ' for none so value is preserved next time through Configure
9192 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9193 prefixvar=vendorhtml1dir
9194 . ./installprefix
9195
9196 case "$vendorprefix" in
9197 '')     vendorhtml3dir=''
9198         vendorhtml3direxp=''
9199         ;;
9200 *)      : determine where vendor-supplied module html pages go.
9201         : There is no standard location, so try to copy the previously-selected
9202         : directory structure for the core html pages.
9203         : XXX Better default suggestions would be welcome.
9204         case "$vendorhtml3dir" in
9205         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9206         *)      dflt=$vendorhtml3dir ;;
9207         esac
9208         case "$dflt" in
9209         ''|' ') dflt=none ;;
9210         esac
9211         fn=dn+~
9212         rp='Pathname for the vendor-supplied html pages?'
9213         . ./getfile
9214         vendorhtml3dir="$ans"
9215         vendorhtml3direxp="$ansexp"
9216         ;;
9217 esac
9218 : Use ' ' for none so value is preserved next time through Configure
9219 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9220 prefixvar=vendorhtml3dir
9221 . ./installprefix
9222
9223 case "$vendorprefix" in
9224 '')     vendorman1dir=''
9225         vendorman1direxp=''
9226         ;;
9227 *)      : determine where vendor-supplied manual pages go.
9228         case "$vendorman1dir" in
9229         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9230         *)      dflt=$vendorman1dir ;;
9231         esac
9232         case "$dflt" in
9233         ''|' ') dflt=none ;;
9234         esac
9235         fn=nd~+
9236         rp='Pathname for the vendor-supplied manual section 1 pages?'
9237         . ./getfile
9238         vendorman1dir="$ans"
9239         vendorman1direxp="$ansexp"
9240         ;;
9241 esac
9242 : Use ' ' for none so value is preserved next time through Configure
9243 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9244 prefixvar=vendorman1dir
9245 . ./installprefix
9246
9247 case "$vendorprefix" in
9248 '')     vendorman3dir=''
9249         vendorman3direxp=''
9250         ;;
9251 *)      : determine where vendor-supplied module manual pages go.
9252         case "$vendorman3dir" in
9253         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9254         *)      dflt=$vendorman3dir ;;
9255         esac
9256         case "$dflt" in
9257         ''|' ') dflt=none ;;
9258         esac
9259         fn=nd~+
9260         rp='Pathname for the vendor-supplied manual section 3 pages?'
9261         . ./getfile
9262         vendorman3dir="$ans"
9263         vendorman3direxp="$ansexp"
9264         ;;
9265 esac
9266 : Use ' ' for none so value is preserved next time through Configure
9267 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9268 prefixvar=vendorman3dir
9269 . ./installprefix
9270
9271 case "$vendorprefix" in
9272 '')     d_vendorscript="$undef"
9273         vendorscript=''
9274         vendorscriptexp=''
9275         ;;
9276 *)      d_vendorscript="$define"
9277         : determine where vendor-supplied scripts go.
9278         case "$vendorscript" in
9279         '')     dflt=$vendorprefix/script
9280                 $test -d $dflt || dflt=$vendorbin ;;
9281         *)  dflt="$vendorscript" ;;
9282         esac
9283         $cat <<EOM
9284
9285 The installation process will create a directory for
9286 vendor-supplied scripts.
9287
9288 EOM
9289         fn=d~+
9290         rp='Pathname for the vendor-supplied scripts directory?'
9291         . ./getfile
9292         vendorscript="$ans"
9293         vendorscriptexp="$ansexp"
9294         ;;
9295 esac
9296 prefixvar=vendorscript
9297 . ./installprefix
9298
9299 : see if qgcvt exists
9300 set qgcvt d_qgcvt
9301 eval $inlibc
9302
9303 echo " "
9304
9305 if $test X"$d_longdbl" = X"$define"; then
9306
9307 echo "Checking how to print long doubles..." >&4
9308
9309 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9310         $cat >try.c <<'EOCP'
9311 #include <sys/types.h>
9312 #include <stdio.h>
9313 int main() {
9314   double d = 123.456;
9315   printf("%.3f\n", d);
9316 }
9317 EOCP
9318         set try
9319         if eval $compile; then
9320                 yyy=`$run ./try`
9321                 case "$yyy" in
9322                 123.456)
9323                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9324                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9325                         echo "We will use %f."
9326                         ;;
9327                 esac
9328         fi
9329 fi
9330
9331 if $test X"$sPRIfldbl" = X; then
9332         $cat >try.c <<'EOCP'
9333 #include <sys/types.h>
9334 #include <stdio.h>
9335 int main() {
9336   long double d = 123.456;
9337   printf("%.3Lf\n", d);
9338 }
9339 EOCP
9340         set try
9341         if eval $compile; then
9342                 yyy=`$run ./try`
9343                 case "$yyy" in
9344                 123.456)
9345                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9346                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9347                         echo "We will use %Lf."
9348                         ;;
9349                 esac
9350         fi
9351 fi
9352
9353 if $test X"$sPRIfldbl" = X; then
9354         $cat >try.c <<'EOCP'
9355 #include <sys/types.h>
9356 #include <stdio.h>
9357 int main() {
9358   long double d = 123.456;
9359   printf("%.3llf\n", d);
9360 }
9361 EOCP
9362         set try
9363         if eval $compile; then
9364                 yyy=`$run ./try`
9365                 case "$yyy" in
9366                 123.456)
9367                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9368                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9369                         echo "We will use %llf."
9370                         ;;
9371                 esac
9372         fi
9373 fi
9374
9375 if $test X"$sPRIfldbl" = X; then
9376         $cat >try.c <<'EOCP'
9377 #include <sys/types.h>
9378 #include <stdio.h>
9379 int main() {
9380   long double d = 123.456;
9381   printf("%.3lf\n", d);
9382 }
9383 EOCP
9384         set try
9385         if eval $compile; then
9386                 yyy=`$run ./try`
9387                 case "$yyy" in
9388                 123.456)
9389                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9390                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9391                         echo "We will use %lf."
9392                         ;;
9393                 esac
9394         fi
9395 fi
9396
9397 if $test X"$sPRIfldbl" = X; then
9398         echo "Cannot figure out how to print long doubles." >&4
9399 else
9400         sSCNfldbl=$sPRIfldbl    # expect consistency
9401 fi
9402
9403 $rm_try
9404
9405 fi # d_longdbl
9406
9407 case "$sPRIfldbl" in
9408 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9409         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9410         d_SCNfldbl="$undef";
9411         ;;
9412 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9413         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9414         d_SCNfldbl="$define";
9415         ;;
9416 esac
9417
9418 : Check how to convert floats to strings.
9419
9420 if test "X$d_Gconvert" = X; then
9421
9422 echo " "
9423 echo "Checking for an efficient way to convert floats to strings."
9424 echo " " > try.c
9425 case "$uselongdouble" in
9426 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9427 esac
9428 case "$d_longdbl" in
9429 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9430 esac
9431 case "$d_PRIgldbl" in
9432 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9433 esac
9434 $cat >>try.c <<EOP
9435 #ifdef TRY_gconvert
9436 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9437 char *myname = "gconvert";
9438 #endif
9439 #ifdef TRY_gcvt
9440 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9441 char *myname = "gcvt";
9442 #endif
9443 #ifdef TRY_qgcvt
9444 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9445 char *myname = "qgcvt";
9446 #define DOUBLETYPE long double
9447 #endif
9448 #ifdef TRY_sprintf
9449 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9450 #ifdef HAS_PRIgldbl
9451 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9452 #else
9453 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9454 #endif
9455 #else
9456 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9457 #endif
9458 char *myname = "sprintf";
9459 #endif
9460
9461 #ifndef DOUBLETYPE
9462 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9463 #define DOUBLETYPE long double
9464 #else
9465 #define DOUBLETYPE double
9466 #endif
9467 #endif
9468
9469 #include <stdio.h>
9470
9471 #define I_STDLIB $i_stdlib
9472 #ifdef I_STDLIB
9473 #include <stdlib.h>
9474 #endif
9475
9476 int
9477 checkit(expect, got)
9478 char *expect;
9479 char *got;
9480 {
9481     if (strcmp(expect, got)) {
9482                 printf("%s oddity:  Expected %s, got %s\n",
9483                         myname, expect, got);
9484                 exit(1);
9485         }
9486 }
9487
9488 int main()
9489 {
9490         char buf[64];
9491         buf[63] = '\0';
9492
9493         /* This must be 1st test on (which?) platform */
9494         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9495         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9496         checkit("0.1", buf);
9497
9498         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9499         checkit("0.01", buf);
9500
9501         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9502         checkit("0.001", buf);
9503
9504         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9505         checkit("0.0001", buf);
9506
9507         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9508         if (strlen(buf) > 5)
9509             checkit("9e-005", buf); /* for Microsoft ?? */
9510         else
9511             checkit("9e-05", buf);
9512
9513         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9514         checkit("1", buf);
9515
9516         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9517         checkit("1.1", buf);
9518
9519         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9520         checkit("1.01", buf);
9521
9522         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9523         checkit("1.001", buf);
9524
9525         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9526         checkit("1.0001", buf);
9527
9528         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9529         checkit("1.00001", buf);
9530
9531         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9532         checkit("1.000001", buf);
9533
9534         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9535         checkit("0", buf);
9536
9537         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9538         checkit("-1", buf);
9539
9540         /* Some Linux gcvt's give 1.e+5 here. */
9541         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9542         checkit("100000", buf);
9543
9544         /* Some Linux gcvt's give -1.e+5 here. */
9545         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9546         checkit("-100000", buf);
9547
9548         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9549         checkit("123.456", buf);
9550
9551         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9552         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9553         /* 34 should be enough to scare even long double
9554          * places into using the e notation. */
9555         if (strlen(buf) > 5)
9556             checkit("1e+034", buf); /* for Microsoft */
9557         else
9558             checkit("1e+34", buf);
9559
9560         /* For Perl, if you add additional tests here, also add them to
9561          * t/base/num.t for benefit of platforms not using Configure or
9562          * overriding d_Gconvert */
9563
9564         exit(0);
9565 }
9566 EOP
9567 : first add preferred functions to our list
9568 xxx_list=""
9569 for xxx_convert in $gconvert_preference; do
9570     case $xxx_convert in
9571     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9572     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9573     esac
9574 done
9575 : then add any others
9576 for xxx_convert in gconvert gcvt sprintf; do
9577     case "$xxx_list" in
9578     *$xxx_convert*) ;;
9579     *) xxx_list="$xxx_list $xxx_convert" ;;
9580     esac
9581 done
9582
9583 case "$d_longdbl$uselongdouble" in
9584 "$define$define")
9585     : again, add prefered functions to our list first
9586     xxx_ld_list=""
9587     for xxx_convert in $gconvert_ld_preference; do
9588         case $xxx_convert in
9589         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9590         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9591         esac
9592     done
9593     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9594     for xxx_convert in qgcvt sprintf $xxx_list; do
9595         case "$xxx_ld_list" in
9596         $xxx_convert*|*" $xxx_convert"*) ;;
9597         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9598         esac
9599     done
9600     : if sprintf cannot do long doubles, move it to the end
9601     if test "$d_PRIgldbl" != "$define"; then
9602         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9603     fi
9604     : if no qgcvt, remove it
9605     if test "$d_qgcvt" != "$define"; then
9606         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9607     fi
9608     : use the ld_list
9609     xxx_list="$xxx_ld_list"
9610     ;;
9611 esac
9612
9613 for xxx_convert in $xxx_list; do
9614         echo "Trying $xxx_convert..."
9615         $rm -f try try$_o core
9616         set try -DTRY_$xxx_convert
9617         if eval $compile; then
9618                 echo "$xxx_convert() found." >&4
9619                 if $run ./try; then
9620                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9621                         break;
9622                 else
9623                         echo "...But $xxx_convert didn't work as I expected."
9624                         xxx_convert=''
9625                 fi
9626         else
9627                 echo "$xxx_convert NOT found." >&4
9628         fi
9629 done
9630
9631 if test X$xxx_convert = X; then
9632     echo "*** WHOA THERE!!! ***" >&4
9633     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9634     xxx_convert=sprintf
9635 fi
9636
9637 case "$xxx_convert" in
9638 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9639 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9640 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9641 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9642    "$define$define$define")
9643       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9644    "$define$define$undef")
9645       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9646    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9647    esac
9648    ;;
9649 esac
9650
9651 fi
9652 $rm_try
9653
9654 : see if _fwalk exists
9655 set fwalk d__fwalk
9656 eval $inlibc
9657
9658 : Initialize h_fcntl
9659 h_fcntl=false
9660
9661 : Initialize h_sysfile
9662 h_sysfile=false
9663
9664 : access call always available on UNIX
9665 set access d_access
9666 eval $inlibc
9667
9668 : locate the flags for 'access()'
9669 case "$d_access" in
9670 "$define")
9671         echo " "
9672         $cat >access.c <<EOCP
9673 #include <sys/types.h>
9674 #ifdef I_FCNTL
9675 #include <fcntl.h>
9676 #endif
9677 #ifdef I_SYS_FILE
9678 #include <sys/file.h>
9679 #endif
9680 #ifdef I_UNISTD
9681 #include <unistd.h>
9682 #endif
9683 #$i_stdlib I_STDLIB
9684 #ifdef I_STDLIB
9685 #include <stdlib.h>
9686 #endif
9687 int main() {
9688         exit(R_OK);
9689 }
9690 EOCP
9691         : check sys/file.h first, no particular reason here
9692         if $test `./findhdr sys/file.h` && \
9693                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9694                 h_sysfile=true;
9695                 echo "<sys/file.h> defines the *_OK access constants." >&4
9696         elif $test `./findhdr fcntl.h` && \
9697                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9698                 h_fcntl=true;
9699                 echo "<fcntl.h> defines the *_OK access constants." >&4
9700         elif $test `./findhdr unistd.h` && \
9701                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9702                 echo "<unistd.h> defines the *_OK access constants." >&4
9703         else
9704                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9705         fi
9706         ;;
9707 esac
9708 $rm -f access*
9709
9710 : see if accessx exists
9711 set accessx d_accessx
9712 eval $inlibc
9713
9714 : see if aintl exists
9715 set aintl d_aintl
9716 eval $inlibc
9717
9718 : see if alarm exists
9719 set alarm d_alarm
9720 eval $inlibc
9721
9722 : see if POSIX threads are available
9723 set pthread.h i_pthread
9724 eval $inhdr
9725
9726 : define a fucntion to check prototypes
9727 $cat > protochk <<EOSH
9728 $startsh
9729 cc="$cc"
9730 optimize="$optimize"
9731 ccflags="$ccflags"
9732 prototype="$prototype"
9733 define="$define"
9734 rm_try="$rm_try"
9735 usethreads=$usethreads
9736 i_pthread=$i_pthread
9737 pthread_h_first=$pthread_h_first
9738 EOSH
9739
9740 $cat >> protochk <<'EOSH'
9741
9742 $rm_try
9743 foo="$1"
9744 shift
9745 while test $# -ge 2; do
9746         case "$1" in
9747                 $define) echo "#include <$2>" >> try.c ;;
9748                 literal) echo "$2" >> try.c ;;
9749         esac
9750     # Extra magic for the benefit of systems that need pthread.h
9751     # to be included early to correctly detect threadsafe functions.
9752     # Such functions must guarantee themselves, though, that the usethreads
9753     # and i_pthread have been defined, before calling protochk.
9754     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9755         echo "#include <pthread.h>" >> try.c
9756         pthread_h_done=yes
9757     fi
9758     shift 2
9759 done
9760 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9761 cat >> try.c <<'EOCP'
9762 #ifdef CAN_PROTOTYPE
9763 #define _(args) args
9764 #else
9765 #define _(args) ()
9766 #endif
9767 EOCP
9768 echo "$foo" >> try.c
9769 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9770 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9771 status=$?
9772 $rm_try
9773 exit $status
9774 EOSH
9775 chmod +x protochk
9776 $eunicefix protochk
9777
9778 hasproto='varname=$1; func=$2; shift; shift;
9779 while $test $# -ge 2; do
9780         case "$1" in
9781         $define) echo "#include <$2>";;
9782         esac ;
9783     shift 2;
9784 done > try.c;
9785 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9786 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9787         echo "$func() prototype found.";
9788         val="$define";
9789 else
9790         echo "$func() prototype NOT found.";
9791         val="$undef";
9792 fi;
9793 set $varname;
9794 eval $setvar;
9795 $rm_try tryout.c'
9796
9797 : see if sys/types.h has to be included
9798 set sys/types.h i_systypes
9799 eval $inhdr
9800
9801 : see if sys/select.h has to be included
9802 set sys/select.h i_sysselct
9803 eval $inhdr
9804
9805 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9806 while $test $# -ge 2; do
9807         case "$1" in
9808         $define) echo "#include <$2>";;
9809         esac ;
9810     shift 2;
9811 done > try.c;
9812 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9813 set try;
9814 if eval $compile; then
9815         val="$define";
9816 else
9817         val="$undef";
9818 fi;
9819 set $varname;
9820 eval $setvar;
9821 $rm_try'
9822
9823 : see if we should include time.h, sys/time.h, or both
9824 echo " "
9825 if test "X$timeincl" = X; then
9826         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9827         $echo $n "I'm now running the test program...$c"
9828         $cat >try.c <<EOCP
9829 #include <sys/types.h>
9830 #ifdef I_TIME
9831 #include <time.h>
9832 #endif
9833 #ifdef I_SYSTIME
9834 #ifdef SYSTIMEKERNEL
9835 #define KERNEL
9836 #endif
9837 #include <sys/time.h>
9838 #endif
9839 #ifdef I_SYSSELECT
9840 #include <sys/select.h>
9841 #endif
9842 #$i_stdlib I_STDLIB
9843 #ifdef I_STDLIB
9844 #include <stdlib.h>
9845 #endif
9846 int main()
9847 {
9848         struct tm foo;
9849 #ifdef S_TIMEVAL
9850         struct timeval bar;
9851 #endif
9852 #ifdef S_TIMEZONE
9853         struct timezone tzp;
9854 #endif
9855         if (foo.tm_sec == foo.tm_sec)
9856                 exit(0);
9857 #ifdef S_TIMEVAL
9858         if (bar.tv_sec == bar.tv_sec)
9859                 exit(0);
9860 #endif
9861         exit(1);
9862 }
9863 EOCP
9864         flags=''
9865         for s_timezone in '-DS_TIMEZONE' ''; do
9866         sysselect=''
9867         for s_timeval in '-DS_TIMEVAL' ''; do
9868         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9869         for i_time in '' '-DI_TIME'; do
9870         for i_systime in '-DI_SYSTIME' ''; do
9871                 case "$flags" in
9872                 '') $echo $n ".$c"
9873                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9874                         if eval $compile; then
9875                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9876                                 shift
9877                                 flags="$*"
9878                                 echo " "
9879                                 $echo $n "Succeeded with $flags$c"
9880                         fi
9881                         ;;
9882                 esac
9883         done
9884         done
9885         done
9886         done
9887         done
9888         timeincl=''
9889         echo " "
9890         case "$flags" in
9891         *SYSTIMEKERNEL*) i_systimek="$define"
9892                 timeincl=`./findhdr sys/time.h`
9893                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9894         *) i_systimek="$undef";;
9895         esac
9896         case "$flags" in
9897         *I_TIME*) i_time="$define"
9898                 timeincl=`./findhdr time.h`" $timeincl"
9899                 echo "We'll include <time.h>." >&4;;
9900         *) i_time="$undef";;
9901         esac
9902         case "$flags" in
9903         *I_SYSTIME*) i_systime="$define"
9904                 timeincl=`./findhdr sys/time.h`" $timeincl"
9905                 echo "We'll include <sys/time.h>." >&4;;
9906         *) i_systime="$undef";;
9907         esac
9908         $rm_try
9909 fi
9910 : see if struct tm knows about tm_zone
9911 case "$i_systime$i_time" in
9912 *$define*)
9913         echo " "
9914         echo "Checking to see if your struct tm has tm_zone field..." >&4
9915         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9916         eval $hasfield
9917         ;;
9918 *)      val="$undef"
9919         set d_tm_tm_zone
9920         eval $setvar
9921         ;;
9922 esac
9923 case "$d_tm_tm_zone" in
9924 "$define")      echo "Yes, it does."   ;;
9925 *)              echo "No, it doesn't." ;;
9926 esac
9927 : see if struct tm knows about tm_gmtoff
9928 case "$i_systime$i_time" in
9929 *$define*)
9930         echo " "
9931         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9932         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9933         eval $hasfield
9934         ;;
9935 *)      val="$undef"
9936         set d_tm_tm_gmtoff
9937         eval $setvar
9938         ;;
9939 esac
9940 case "$d_tm_tm_gmtoff" in
9941 "$define")      echo "Yes, it does."   ;;
9942 *)              echo "No, it doesn't." ;;
9943 esac
9944
9945 : see if asctime_r exists
9946 set asctime_r d_asctime_r
9947 eval $inlibc
9948 case "$d_asctime_r" in
9949 "$define")
9950         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9951         case "$d_asctime_r_proto:$usethreads" in
9952         ":define")      d_asctime_r_proto=define
9953                 set d_asctime_r_proto asctime_r $hdrs
9954                 eval $hasproto ;;
9955         *)      ;;
9956         esac
9957         case "$d_asctime_r_proto" in
9958         define)
9959         case "$asctime_r_proto" in
9960         ''|0) try='char* asctime_r(const struct tm*, char*);'
9961         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9962         esac
9963         case "$asctime_r_proto" in
9964         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9965         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9966         esac
9967         case "$asctime_r_proto" in
9968         ''|0) try='int asctime_r(const struct tm*, char*);'
9969         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9970         esac
9971         case "$asctime_r_proto" in
9972         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9973         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9974         esac
9975         case "$asctime_r_proto" in
9976         ''|0)   d_asctime_r=undef
9977                 asctime_r_proto=0
9978                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9979         * )     case "$asctime_r_proto" in
9980                 REENTRANT_PROTO*) ;;
9981                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9982                 esac
9983                 echo "Prototype: $try" ;;
9984         esac
9985         ;;
9986         *)      case "$usethreads" in
9987                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9988                 esac
9989                 d_asctime_r=undef
9990                 asctime_r_proto=0
9991                 ;;
9992         esac
9993         ;;
9994 *)      asctime_r_proto=0
9995         ;;
9996 esac
9997
9998 : see if atolf exists
9999 set atolf d_atolf
10000 eval $inlibc
10001
10002 : see if atoll exists
10003 set atoll d_atoll
10004 eval $inlibc
10005
10006 : Look for GCC-style attribute format
10007 case "$d_attribute_format" in
10008 '')
10009 echo " "
10010 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10011 $cat >attrib.c <<'EOCP'
10012 #include <stdio.h>
10013 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10014 EOCP
10015 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10016         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10017                 echo "Your C compiler doesn't support __attribute__((format))."
10018                 val="$undef"
10019         else
10020                 echo "Your C compiler supports __attribute__((format))."
10021                 val="$define"
10022         fi
10023 else
10024         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10025         val="$undef"
10026 fi
10027 ;;
10028 *) val="$d_attribute_format" ;;
10029 esac
10030 set d_attribute_format
10031 eval $setvar
10032 $rm -f attrib*
10033
10034 : Look for GCC-style attribute format with null format allowed
10035 case "$d_printf_format_null" in
10036 '') case "$d_attribute_format" in
10037     $define)
10038         echo " "
10039         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10040 $cat >attrib.c <<EOCP
10041 #include <stdio.h>
10042 #$i_stdlib I_STDLIB
10043 #ifdef I_STDLIB
10044 #include <stdlib.h>
10045 #endif
10046 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10047 int null_printf (char* pat,...) { return (int)pat; }
10048 int main () { exit(null_printf(NULL)); }
10049 EOCP
10050         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10051             : run the executable in case it produces a run-time warning
10052             if $run ./attrib >>attrib.out 2>&1; then
10053                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10054                     echo "Your C compiler doesn't allow __printf__ format to be null."
10055                     val="$undef"
10056                 else
10057                     echo "Your C compiler allows __printf__ format to be null."
10058                     val="$define"
10059                 fi
10060             else
10061             echo "Your C compiler executable failed with __printf__ format null."
10062             val="$undef"
10063         fi
10064     else
10065         echo "Your C compiler fails with __printf__ format null."
10066         val="$undef"
10067     fi
10068     ;;
10069     *)  val="$undef" ;;
10070     esac
10071 ;;
10072 *)  val="$d_printf_format_null" ;;
10073 esac
10074 set d_printf_format_null
10075 eval $setvar
10076 $rm -f attrib*
10077
10078 : Look for GCC-style attribute malloc
10079 case "$d_attribute_malloc" in
10080 '')
10081 echo " "
10082 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10083 $cat >attrib.c <<'EOCP'
10084 #include <stdio.h>
10085 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10086 EOCP
10087 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10088         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10089                 echo "Your C compiler doesn't support __attribute__((malloc))."
10090                 val="$undef"
10091         else
10092                 echo "Your C compiler supports __attribute__((malloc))."
10093                 val="$define"
10094         fi
10095 else
10096         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10097         val="$undef"
10098 fi
10099 ;;
10100 *) val="$d_attribute_malloc" ;;
10101 esac
10102 set d_attribute_malloc
10103 eval $setvar
10104 $rm -f attrib*
10105
10106 : Look for GCC-style attribute nonnull
10107 case "$d_attribute_nonnull" in
10108 '')
10109 echo " "
10110 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10111 $cat >attrib.c <<'EOCP'
10112 #include <stdio.h>
10113 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10114 EOCP
10115 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10116         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10117                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10118                 val="$undef"
10119         else
10120                 echo "Your C compiler supports __attribute__((nonnull))."
10121                 val="$define"
10122         fi
10123 else
10124         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10125         val="$undef"
10126 fi
10127 ;;
10128 *) val="$d_attribute_nonnull" ;;
10129 esac
10130 set d_attribute_nonnull
10131 eval $setvar
10132 $rm -f attrib*
10133
10134 : Look for GCC-style attribute noreturn
10135 case "$d_attribute_noreturn" in
10136 '')
10137 echo " "
10138 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10139 $cat >attrib.c <<'EOCP'
10140 #include <stdio.h>
10141 void fall_over_dead( void ) __attribute__((noreturn));
10142 EOCP
10143 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10144         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10145                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10146                 val="$undef"
10147         else
10148                 echo "Your C compiler supports __attribute__((noreturn))."
10149                 val="$define"
10150         fi
10151 else
10152         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10153         val="$undef"
10154 fi
10155 ;;
10156 *) val="$d_attribute_noreturn" ;;
10157 esac
10158 set d_attribute_noreturn
10159 eval $setvar
10160 $rm -f attrib*
10161
10162 : Look for GCC-style attribute pure
10163 case "$d_attribute_pure" in
10164 '')
10165 echo " "
10166 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10167 $cat >attrib.c <<'EOCP'
10168 #include <stdio.h>
10169 int square( int n ) __attribute__((pure));
10170 EOCP
10171 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10172         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10173                 echo "Your C compiler doesn't support __attribute__((pure))."
10174                 val="$undef"
10175         else
10176                 echo "Your C compiler supports __attribute__((pure))."
10177                 val="$define"
10178         fi
10179 else
10180         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10181         val="$undef"
10182 fi
10183 ;;
10184 *) val="$d_attribute_pure" ;;
10185 esac
10186 set d_attribute_pure
10187 eval $setvar
10188 $rm -f attrib*
10189
10190 : Look for GCC-style attribute unused
10191 case "$d_attribute_unused" in
10192 '')
10193 echo " "
10194 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10195 $cat >attrib.c <<'EOCP'
10196 #include <stdio.h>
10197 int do_something( int dummy __attribute__((unused)), int n );
10198 EOCP
10199 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10200         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10201                 echo "Your C compiler doesn't support __attribute__((unused))."
10202                 val="$undef"
10203         else
10204                 echo "Your C compiler supports __attribute__((unused))."
10205                 val="$define"
10206         fi
10207 else
10208         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10209         val="$undef"
10210 fi
10211 ;;
10212 *) val="$d_attribute_unused" ;;
10213 esac
10214 set d_attribute_unused
10215 eval $setvar
10216 $rm -f attrib*
10217
10218 : Look for GCC-style attribute warn_unused_result
10219 case "$d_attribute_warn_unused_result" in
10220 '')
10221 echo " "
10222 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10223 $cat >attrib.c <<'EOCP'
10224 #include <stdio.h>
10225 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10226 EOCP
10227 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10228         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10229                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10230                 val="$undef"
10231         else
10232                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10233                 val="$define"
10234         fi
10235 else
10236         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10237         val="$undef"
10238 fi
10239 ;;
10240 *) val="$d_attribute_warn_unused_result" ;;
10241 esac
10242 set d_attribute_warn_unused_result
10243 eval $setvar
10244 $rm -f attrib*
10245
10246 : see if bcmp exists
10247 set bcmp d_bcmp
10248 eval $inlibc
10249
10250 : see if bcopy exists
10251 set bcopy d_bcopy
10252 eval $inlibc
10253
10254 : see if getpgrp exists
10255 set getpgrp d_getpgrp
10256 eval $inlibc
10257
10258 case "$d_getpgrp" in
10259 "$define")
10260         echo " "
10261         echo "Checking to see which flavor of getpgrp is in use..."
10262         $cat >try.c <<EOP
10263 #$i_unistd I_UNISTD
10264 #include <sys/types.h>
10265 #ifdef I_UNISTD
10266 #  include <unistd.h>
10267 #endif
10268 #$i_stdlib I_STDLIB
10269 #ifdef I_STDLIB
10270 #include <stdlib.h>
10271 #endif
10272 int main()
10273 {
10274         if (getuid() == 0) {
10275                 printf("(I see you are running Configure as super-user...)\n");
10276                 setuid(1);
10277         }
10278 #ifdef TRY_BSD_PGRP
10279         if (getpgrp(1) == 0)
10280                 exit(0);
10281 #else
10282         if (getpgrp() > 0)
10283                 exit(0);
10284 #endif
10285         exit(1);
10286 }
10287 EOP
10288         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10289                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10290                 val="$define"
10291         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10292                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10293                 val="$undef"
10294         else
10295                 echo "I can't seem to compile and run the test program."
10296                 if ./usg; then
10297                         xxx="a USG one, i.e. you use getpgrp()."
10298                 else
10299                         # SVR4 systems can appear rather BSD-ish.
10300                         case "$i_unistd" in
10301                         $undef)
10302                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10303                                 val="$define"
10304                                 ;;
10305                         $define)
10306                                 xxx="probably a USG one, i.e. you use getpgrp()."
10307                                 val="$undef"
10308                                 ;;
10309                         esac
10310                 fi
10311                 echo "Assuming your getpgrp is $xxx" >&4
10312         fi
10313         ;;
10314 *) val="$undef";;
10315 esac
10316 set d_bsdgetpgrp
10317 eval $setvar
10318 $rm_try
10319
10320 : see if setpgrp exists
10321 set setpgrp d_setpgrp
10322 eval $inlibc
10323
10324 case "$d_setpgrp" in
10325 "$define")
10326         echo " "
10327         echo "Checking to see which flavor of setpgrp is in use..."
10328         $cat >try.c <<EOP
10329 #$i_unistd I_UNISTD
10330 #include <sys/types.h>
10331 #ifdef I_UNISTD
10332 #  include <unistd.h>
10333 #endif
10334 #$i_stdlib I_STDLIB
10335 #ifdef I_STDLIB
10336 #include <stdlib.h>
10337 #endif
10338 int main()
10339 {
10340         if (getuid() == 0) {
10341                 printf("(I see you are running Configure as super-user...)\n");
10342                 setuid(1);
10343         }
10344 #ifdef TRY_BSD_PGRP
10345         if (-1 == setpgrp(1, 1))
10346                 exit(0);
10347 #else
10348         if (setpgrp() != -1)
10349                 exit(0);
10350 #endif
10351         exit(1);
10352 }
10353 EOP
10354         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10355                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10356                 val="$define"
10357         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10358                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10359                 val="$undef"
10360         else
10361                 echo "(I can't seem to compile and run the test program.)"
10362                 if ./usg; then
10363                         xxx="a USG one, i.e. you use setpgrp()."
10364                 else
10365                         # SVR4 systems can appear rather BSD-ish.
10366                         case "$i_unistd" in
10367                         $undef)
10368                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10369                                 val="$define"
10370                                 ;;
10371                         $define)
10372                                 xxx="probably a USG one, i.e. you use setpgrp()."
10373                                 val="$undef"
10374                                 ;;
10375                         esac
10376                 fi
10377                 echo "Assuming your setpgrp is $xxx" >&4
10378         fi
10379         ;;
10380 *) val="$undef";;
10381 esac
10382 set d_bsdsetpgrp
10383 eval $setvar
10384 $rm_try
10385
10386 : Look for GCC-style __builtin_choose_expr
10387 case "$d_builtin_choose_expr" in
10388 '')
10389     echo " "
10390     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10391     $cat >try.c <<'EOCP'
10392 #include <assert.h>
10393 #include <stdlib.h>
10394 #include <stdio.h>
10395
10396 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10397
10398 int main(void) {
10399     assert( SYRINX(1) == 2112 );
10400     assert( SYRINX(1) != 5150 );
10401     assert( SYRINX(0) == 5150 );
10402     assert( SYRINX(0) != 2112 );
10403     puts( "All good!" );
10404     exit(0);
10405 }
10406
10407 EOCP
10408     set try
10409     if eval $compile; then
10410         echo "Your C compiler supports __builtin_choose_expr."
10411         val="$define"
10412     else
10413         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10414         val="$undef"
10415     fi
10416 ;;
10417 *) val="$d_builtin_choose_expr" ;;
10418 esac
10419
10420 set d_builtin_choose_expr
10421 eval $setvar
10422 $rm_try
10423
10424 : Look for GCC-style __builtin_expect
10425 case "$d_builtin_expect" in
10426 '')
10427     echo " "
10428     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10429     $cat >builtin.c <<'EOCP'
10430 int main(void) {
10431     int n = 50;
10432     if ( __builtin_expect(n, 0) ) n = 1;
10433 }
10434 EOCP
10435     set try
10436     if eval $compile; then
10437         echo "Your C compiler supports __builtin_choose_expr."
10438         val="$define"
10439     else
10440         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10441         val="$undef"
10442     fi
10443     ;;
10444 *) val="$d_builtin_expect" ;;
10445 esac
10446
10447 set d_builtin_expect
10448 eval $setvar
10449 $rm_try
10450
10451 : see if bzero exists
10452 set bzero d_bzero
10453 eval $inlibc
10454
10455 : see if stdarg is available
10456 echo " "
10457 if $test `./findhdr stdarg.h`; then
10458         echo "<stdarg.h> found." >&4
10459         valstd="$define"
10460 else
10461         echo "<stdarg.h> NOT found." >&4
10462         valstd="$undef"
10463 fi
10464
10465 : see if varags is available
10466 echo " "
10467 if $test `./findhdr varargs.h`; then
10468         echo "<varargs.h> found." >&4
10469 else
10470         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10471 fi
10472
10473 : set up the varargs testing programs
10474 $cat > varargs.c <<EOP
10475 #ifdef I_STDARG
10476 #include <stdarg.h>
10477 #endif
10478 #ifdef I_VARARGS
10479 #include <varargs.h>
10480 #endif
10481
10482 #ifdef I_STDARG
10483 int f(char *p, ...)
10484 #else
10485 int f(va_alist)
10486 va_dcl
10487 #endif
10488 {
10489         va_list ap;
10490 #ifndef I_STDARG
10491         char *p;
10492 #endif
10493 #ifdef I_STDARG
10494         va_start(ap,p);
10495 #else
10496         va_start(ap);
10497         p = va_arg(ap, char *);
10498 #endif
10499         va_end(ap);
10500         return 0;
10501 }
10502 EOP
10503 $cat > varargs <<EOP
10504 $startsh
10505 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10506         echo "true"
10507 else
10508         echo "false"
10509 fi
10510 $rm -f varargs$_o
10511 EOP
10512 chmod +x varargs
10513
10514 : now check which varargs header should be included
10515 echo " "
10516 i_varhdr=''
10517 case "$valstd" in
10518 "$define")
10519         if `./varargs I_STDARG`; then
10520                 val='stdarg.h'
10521         elif `./varargs I_VARARGS`; then
10522                 val='varargs.h'
10523         fi
10524         ;;
10525 *)
10526         if `./varargs I_VARARGS`; then
10527                 val='varargs.h'
10528         fi
10529         ;;
10530 esac
10531 case "$val" in
10532 '')
10533 echo "I could not find the definition for va_dcl... You have problems..." >&4
10534         val="$undef"; set i_stdarg; eval $setvar
10535         val="$undef"; set i_varargs; eval $setvar
10536         ;;
10537 *) 
10538         set i_varhdr
10539         eval $setvar
10540         case "$i_varhdr" in
10541         stdarg.h)
10542                 val="$define"; set i_stdarg; eval $setvar
10543                 val="$undef"; set i_varargs; eval $setvar
10544                 ;;
10545         varargs.h)
10546                 val="$undef"; set i_stdarg; eval $setvar
10547                 val="$define"; set i_varargs; eval $setvar
10548                 ;;
10549         esac
10550         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10551 esac
10552 $rm -f varargs*
10553
10554 : see if the Compiler supports C99 variadic macros
10555 case "$i_stdarg$i_stdlib" in
10556     "$define$define")
10557     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10558     $cat >try.c <<EOCP
10559 #include <stdio.h>
10560 #include <stdarg.h>
10561
10562 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10563
10564 int main() {
10565   char buf[20];
10566   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10567   puts(buf);
10568   return 0;
10569 }
10570 EOCP
10571     set try
10572     if eval $compile && $run ./try 2>&1 >/dev/null; then
10573         case "`$run ./try`" in
10574             "123 456 789")
10575             echo "You have C99 variadic macros." >&4
10576             d_c99_variadic_macros="$define"
10577             ;;
10578             *)
10579             echo "You don't have functional C99 variadic macros." >&4
10580             d_c99_variadic_macros="$undef"
10581             ;;
10582         esac
10583     else
10584         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10585         d_c99_variadic_macros="$undef"
10586     fi
10587     $rm_try
10588     ;;
10589     *)
10590     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10591     d_c99_variadic_macros="$undef"
10592     ;;
10593 esac
10594
10595 : see if signal is declared as pointer to function returning int or void
10596 echo " "
10597 xxx=`./findhdr signal.h`
10598 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10599 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10600         echo "You have int (*signal())() instead of void." >&4
10601         val="$undef"
10602 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10603         echo "You have void (*signal())()." >&4
10604         val="$define"
10605 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10606         echo "You have int (*signal())() instead of void." >&4
10607         val="$undef"
10608 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10609         echo "You have void (*signal())()." >&4
10610         val="$define"
10611 else
10612         case "$d_voidsig" in
10613         '')
10614         echo "I can't determine whether signal handler returns void or int..." >&4
10615                 dflt=void
10616                 rp="What type does your signal handler return?"
10617                 . ./myread
10618                 case "$ans" in
10619                 v*) val="$define";;
10620                 *) val="$undef";;
10621                 esac;;
10622         "$define")
10623                 echo "As you already told me, signal handler returns void." >&4
10624                 val="$define"
10625                 ;;
10626         *)      echo "As you already told me, signal handler returns int." >&4
10627                 val="$undef"
10628                 ;;
10629         esac
10630 fi
10631 set d_voidsig
10632 eval $setvar
10633 case "$d_voidsig" in
10634 "$define") signal_t="void";;
10635 *) signal_t="int";;
10636 esac
10637 $rm -f $$.tmp
10638
10639 : check for ability to cast large floats to 32-bit ints.
10640 echo " "
10641 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10642 if $test "$intsize" -ge 4; then
10643         xxx=int
10644 else
10645         xxx=long
10646 fi
10647 $cat >try.c <<EOCP
10648 #include <stdio.h>
10649 #$i_stdlib I_STDLIB
10650 #ifdef I_STDLIB
10651 #include <stdlib.h>
10652 #endif
10653 #include <sys/types.h>
10654 #include <signal.h>
10655 $signal_t blech(int s) { exit(3); }
10656 int main()
10657 {
10658         $xxx i32;
10659         double f, g;
10660         int result = 0;
10661         char str[16];
10662         signal(SIGFPE, blech);
10663
10664         /* Don't let compiler optimize the test away.  Store the number
10665            in a writable string for gcc to pass to sscanf under HP/UX.
10666         */
10667         sprintf(str, "2147483647");
10668         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10669         g = 10 * f;
10670         i32  = ($xxx) g;
10671
10672         /* x86 processors will probably give 0x8000 0000, which is a
10673            sign change.  We don't want that.  We want to mimic SPARC
10674            behavior here, which is to preserve the sign and give
10675            back 0x7fff ffff.
10676         */
10677         if (i32 != ($xxx) f)
10678                 result |= 1;
10679         exit(result);
10680 }
10681 EOCP
10682 set try
10683 if eval $compile_ok; then
10684         $run ./try
10685         yyy=$?
10686 else
10687         echo "(I can't seem to compile the test program--assuming it can't)"
10688         yyy=1
10689 fi
10690 case "$yyy" in
10691 0)      val="$define"
10692         echo "Yup, it can."
10693         ;;
10694 *)      val="$undef"
10695         echo "Nope, it can't."
10696         ;;
10697 esac
10698 set d_casti32
10699 eval $setvar
10700 $rm_try
10701
10702 : check for ability to cast negative floats to unsigned
10703 echo " "
10704 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10705 $cat >try.c <<EOCP
10706 #include <stdio.h>
10707 #$i_stdlib I_STDLIB
10708 #ifdef I_STDLIB
10709 #include <stdlib.h>
10710 #endif
10711 #include <sys/types.h>
10712 #include <signal.h>
10713 $signal_t blech(int s) { exit(7); }
10714 $signal_t blech_in_list(int s) { exit(4); }
10715 unsigned long dummy_long(unsigned long p) { return p; }
10716 unsigned int dummy_int(unsigned int p) { return p; }
10717 unsigned short dummy_short(unsigned short p) { return p; }
10718 int main()
10719 {
10720         double f;
10721         unsigned long along;
10722         unsigned int aint;
10723         unsigned short ashort;
10724         int result = 0;
10725         char str[16];
10726
10727         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10728            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10729            optimized the whole file away
10730         */
10731         /* Store the number in a writable string for gcc to pass to
10732            sscanf under HP/UX.
10733         */
10734         sprintf(str, "-123");
10735         sscanf(str, "%lf", &f);  /* f = -123.; */
10736
10737         signal(SIGFPE, blech);
10738         along = (unsigned long)f;
10739         aint = (unsigned int)f;
10740         ashort = (unsigned short)f;
10741         if (along != (unsigned long)-123)
10742                 result |= 1;
10743         if (aint != (unsigned int)-123)
10744                 result |= 1;
10745         if (ashort != (unsigned short)-123)
10746                 result |= 1;
10747         sprintf(str, "1073741824.");
10748         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10749         f = f + f;
10750         along = 0;
10751         along = (unsigned long)f;
10752         if (along != 0x80000000)
10753                 result |= 2;
10754         f -= 1.;
10755         along = 0;
10756         along = (unsigned long)f;
10757         if (along != 0x7fffffff)
10758                 result |= 1;
10759         f += 2.;
10760         along = 0;
10761         along = (unsigned long)f;
10762         if (along != 0x80000001)
10763                 result |= 2;
10764         if (result)
10765                 exit(result);
10766         signal(SIGFPE, blech_in_list);
10767         sprintf(str, "123.");
10768         sscanf(str, "%lf", &f);  /* f = 123.; */
10769         along = dummy_long((unsigned long)f);
10770         aint = dummy_int((unsigned int)f);
10771         ashort = dummy_short((unsigned short)f);
10772         if (along != (unsigned long)123)
10773                 result |= 4;
10774         if (aint != (unsigned int)123)
10775                 result |= 4;
10776         if (ashort != (unsigned short)123)
10777                 result |= 4;
10778         exit(result);
10779
10780 }
10781 EOCP
10782 set try
10783 if eval $compile_ok; then
10784         $run ./try
10785         castflags=$?
10786 else
10787         echo "(I can't seem to compile the test program--assuming it can't)"
10788         castflags=7
10789 fi
10790 case "$castflags" in
10791 0)      val="$define"
10792         echo "Yup, it can."
10793         ;;
10794 *)      val="$undef"
10795         echo "Nope, it can't."
10796         ;;
10797 esac
10798 set d_castneg
10799 eval $setvar
10800 $rm_try
10801
10802 : see if vprintf exists
10803 echo " "
10804 if set vprintf val -f d_vprintf; eval $csym; $val; then
10805         echo 'vprintf() found.' >&4
10806         val="$define"
10807         $cat >try.c <<EOF
10808 #include <varargs.h>
10809 #$i_stdlib I_STDLIB
10810 #ifdef I_STDLIB
10811 #include <stdlib.h>
10812 #endif
10813
10814 int main() { xxx("foo"); }
10815
10816 xxx(va_alist)
10817 va_dcl
10818 {
10819         va_list args;
10820         char buf[10];
10821
10822         va_start(args);
10823         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10824 }
10825 EOF
10826         set try
10827         if eval $compile && $run ./try; then
10828                 echo "Your vsprintf() returns (int)." >&4
10829                 val2="$undef"
10830         else
10831                 echo "Your vsprintf() returns (char*)." >&4
10832                 val2="$define"
10833         fi
10834 else
10835         echo 'vprintf() NOT found.' >&4
10836                 val="$undef"
10837                 val2="$undef"
10838 fi
10839 $rm_try
10840 set d_vprintf
10841 eval $setvar
10842 val=$val2
10843 set d_charvspr
10844 eval $setvar
10845
10846 : see if chown exists
10847 set chown d_chown
10848 eval $inlibc
10849
10850 : see if chroot exists
10851 set chroot d_chroot
10852 eval $inlibc
10853
10854 : see if chsize exists
10855 set chsize d_chsize
10856 eval $inlibc
10857
10858 : see if class exists
10859 set class d_class
10860 eval $inlibc
10861
10862 : see if clearenv exists
10863 set clearenv d_clearenv
10864 eval $inlibc
10865
10866 hasstruct='varname=$1; struct=$2; shift; shift;
10867 while $test $# -ge 2; do
10868         case "$1" in
10869         $define) echo "#include <$2>";;
10870         esac ;
10871     shift 2;
10872 done > try.c;
10873 echo "int main () { struct $struct foo; }" >> try.c;
10874 set try;
10875 if eval $compile; then
10876         val="$define";
10877 else
10878         val="$undef";
10879 fi;
10880 set $varname;
10881 eval $setvar;
10882 $rm_try'
10883
10884 socketlib=''
10885 sockethdr=''
10886 : see whether socket exists
10887 echo " "
10888 $echo $n "Hmm... $c" >&4
10889 if set socket val -f d_socket; eval $csym; $val; then
10890         echo "Looks like you have Berkeley networking support." >&4
10891         d_socket="$define"
10892         if set setsockopt val -f; eval $csym; $val; then
10893                 d_oldsock="$undef"
10894         else
10895                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10896                 d_oldsock="$define"
10897         fi
10898 else
10899         if $contains socklib libc.list >/dev/null 2>&1; then
10900                 echo "Looks like you have Berkeley networking support." >&4
10901                 d_socket="$define"
10902                 : we will have to assume that it supports the 4.2 BSD interface
10903                 d_oldsock="$undef"
10904         else
10905                 echo "You don't have Berkeley networking in libc$_a..." >&4
10906                 if test "X$d_socket" = "X$define"; then
10907                    echo "...but you seem to believe that you have sockets." >&4
10908                 else
10909                         for net in net socket
10910                         do
10911                                 if test -f /usr/lib/lib$net$_a; then
10912                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10913                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10914                                         if $contains socket libc.list >/dev/null 2>&1; then
10915                                                 d_socket="$define"
10916                                                 socketlib="-l$net"
10917                                                 case "$net" in
10918                                                 net)
10919                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10920                                                         sockethdr="-I/usr/netinclude"
10921                                                         ;;
10922                                                 esac
10923                                                 echo "Found Berkeley sockets interface in lib$net." >&4
10924                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10925                                                         d_oldsock="$undef"
10926                                                 else
10927                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10928                                                         d_oldsock="$define"
10929                                                 fi
10930                                                 break
10931                                         fi
10932                                 fi
10933                         done
10934                         if test "X$d_socket" != "X$define"; then
10935                            echo "or anywhere else I see." >&4
10936                            d_socket="$undef"
10937                            d_oldsock="$undef"
10938                         fi
10939                 fi
10940         fi
10941 fi
10942
10943 : see if socketpair exists
10944 set socketpair d_sockpair
10945 eval $inlibc
10946
10947
10948 echo " "
10949 echo "Checking the availability of certain socket constants..." >&4
10950 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10951         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10952         $cat >try.c <<EOF
10953 #include <sys/types.h>
10954 #include <sys/socket.h>
10955 int main() {
10956     int i = $ENUM;
10957 }
10958 EOF
10959         val="$undef"
10960         set try; if eval $compile; then
10961                 val="$define"
10962         fi
10963         set d_${enum}; eval $setvar
10964         $rm_try
10965 done
10966
10967 : see if this is a sys/uio.h system
10968 set sys/uio.h i_sysuio
10969 eval $inhdr
10970
10971
10972 echo " "
10973 echo "Checking to see if your system supports struct cmsghdr..." >&4
10974 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10975 eval $hasstruct
10976 case "$d_cmsghdr_s" in
10977 "$define")      echo "Yes, it does."   ;;
10978 *)              echo "No, it doesn't." ;;
10979 esac
10980
10981
10982 : check for const keyword
10983 echo " "
10984 echo 'Checking to see if your C compiler knows about "const"...' >&4
10985 $cat >const.c <<'EOCP'
10986 typedef struct spug { int drokk; } spug;
10987 int main()
10988 {
10989         const char *foo;
10990         const spug y = { 0 };
10991 }
10992 EOCP
10993 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10994         val="$define"
10995         echo "Yup, it does."
10996 else
10997         val="$undef"
10998         echo "Nope, it doesn't."
10999 fi
11000 set d_const
11001 eval $setvar
11002
11003 : see if copysignl exists
11004 set copysignl d_copysignl
11005 eval $inlibc
11006
11007 : see if crypt exists
11008 echo " "
11009 set crypt d_crypt
11010 eval $inlibc
11011 case "$d_crypt" in
11012 $define) cryptlib='' ;;
11013 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11014                 echo 'crypt() found.' >&4
11015                 val="$define"
11016                 cryptlib=''
11017         else
11018                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11019                 if $test -z "$cryptlib"; then
11020                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11021                 else
11022                         cryptlib=-lcrypt
11023                 fi
11024                 if $test -z "$cryptlib"; then
11025                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11026                 else
11027                         cryptlib=-lcrypt
11028                 fi
11029                 if $test -z "$cryptlib"; then
11030                         cryptlib=`./loc libcrypt$_a "" $libpth`
11031                 else
11032                         cryptlib=-lcrypt
11033                 fi
11034                 if $test -z "$cryptlib"; then
11035                         echo 'crypt() NOT found.' >&4
11036                         val="$undef"
11037                 else
11038                         val="$define"
11039                 fi
11040         fi
11041         set d_crypt
11042         eval $setvar
11043         ;;
11044 esac
11045
11046 : see if this is a crypt.h system
11047 set crypt.h i_crypt
11048 eval $inhdr
11049
11050 : see if crypt_r exists
11051 set crypt_r d_crypt_r
11052 eval $inlibc
11053 case "$d_crypt_r" in
11054 "$define")
11055         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11056         case "$d_crypt_r_proto:$usethreads" in
11057         ":define")      d_crypt_r_proto=define
11058                 set d_crypt_r_proto crypt_r $hdrs
11059                 eval $hasproto ;;
11060         *)      ;;
11061         esac
11062         case "$d_crypt_r_proto" in
11063         define)
11064         case "$crypt_r_proto" in
11065         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11066         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11067         esac
11068         case "$crypt_r_proto" in
11069         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11070         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11071         esac
11072         case "$crypt_r_proto" in
11073         ''|0)   d_crypt_r=undef
11074                 crypt_r_proto=0
11075                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11076         * )     case "$crypt_r_proto" in
11077                 REENTRANT_PROTO*) ;;
11078                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11079                 esac
11080                 echo "Prototype: $try" ;;
11081         esac
11082         ;;
11083         *)      case "$usethreads" in
11084                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11085                 esac
11086                 d_crypt_r=undef
11087                 crypt_r_proto=0
11088                 ;;
11089         esac
11090         ;;
11091 *)      crypt_r_proto=0
11092         ;;
11093 esac
11094
11095 : get csh whereabouts
11096 case "$csh" in
11097 'csh') val="$undef" ;;
11098 *) val="$define" ;;
11099 esac
11100 set d_csh
11101 eval $setvar
11102 : Respect a hint or command line value for full_csh.
11103 case "$full_csh" in
11104 '') full_csh=$csh ;;
11105 esac
11106
11107 : see if ctermid exists
11108 set ctermid d_ctermid
11109 eval $inlibc
11110
11111 : see if ctermid_r exists
11112 set ctermid_r d_ctermid_r
11113 eval $inlibc
11114 case "$d_ctermid_r" in
11115 "$define")
11116         hdrs="$i_systypes sys/types.h define stdio.h "
11117         case "$d_ctermid_r_proto:$usethreads" in
11118         ":define")      d_ctermid_r_proto=define
11119                 set d_ctermid_r_proto ctermid_r $hdrs
11120                 eval $hasproto ;;
11121         *)      ;;
11122         esac
11123         case "$d_ctermid_r_proto" in
11124         define)
11125         case "$ctermid_r_proto" in
11126         ''|0) try='char* ctermid_r(char*);'
11127         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11128         esac
11129         case "$ctermid_r_proto" in
11130         ''|0)   d_ctermid_r=undef
11131                 ctermid_r_proto=0
11132                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11133         * )     case "$ctermid_r_proto" in
11134                 REENTRANT_PROTO*) ;;
11135                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11136                 esac
11137                 echo "Prototype: $try" ;;
11138         esac
11139         ;;
11140         *)      case "$usethreads" in
11141                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11142                 esac
11143                 d_ctermid_r=undef
11144                 ctermid_r_proto=0
11145                 ;;
11146         esac
11147         ;;
11148 *)      ctermid_r_proto=0
11149         ;;
11150 esac
11151
11152 : see if ctime_r exists
11153 set ctime_r d_ctime_r
11154 eval $inlibc
11155 case "$d_ctime_r" in
11156 "$define")
11157         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11158         case "$d_ctime_r_proto:$usethreads" in
11159         ":define")      d_ctime_r_proto=define
11160                 set d_ctime_r_proto ctime_r $hdrs
11161                 eval $hasproto ;;
11162         *)      ;;
11163         esac
11164         case "$d_ctime_r_proto" in
11165         define)
11166         case "$ctime_r_proto" in
11167         ''|0) try='char* ctime_r(const time_t*, char*);'
11168         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11169         esac
11170         case "$ctime_r_proto" in
11171         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11172         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11173         esac
11174         case "$ctime_r_proto" in
11175         ''|0) try='int ctime_r(const time_t*, char*);'
11176         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11177         esac
11178         case "$ctime_r_proto" in
11179         ''|0) try='int ctime_r(const time_t*, char*, int);'
11180         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11181         esac
11182         case "$ctime_r_proto" in
11183         ''|0)   d_ctime_r=undef
11184                 ctime_r_proto=0
11185                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11186         * )     case "$ctime_r_proto" in
11187                 REENTRANT_PROTO*) ;;
11188                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11189                 esac
11190                 echo "Prototype: $try" ;;
11191         esac
11192         ;;
11193         *)      case "$usethreads" in
11194                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11195                 esac
11196                 d_ctime_r=undef
11197                 ctime_r_proto=0
11198                 ;;
11199         esac
11200         ;;
11201 *)      ctime_r_proto=0
11202         ;;
11203 esac
11204
11205 : see if cuserid exists
11206 set cuserid d_cuserid
11207 eval $inlibc
11208
11209 : see if this is a limits.h system
11210 set limits.h i_limits
11211 eval $inhdr
11212
11213 : see if this is a float.h system
11214 set float.h i_float
11215 eval $inhdr
11216
11217 : See if number of significant digits in a double precision number is known
11218 echo " "
11219 $cat >dbl_dig.c <<EOM
11220 #$i_limits I_LIMITS
11221 #$i_float I_FLOAT
11222 #ifdef I_LIMITS
11223 #include <limits.h>
11224 #endif
11225 #ifdef I_FLOAT
11226 #include <float.h>
11227 #endif
11228 #ifdef DBL_DIG
11229 printf("Contains DBL_DIG");
11230 #endif
11231 EOM
11232 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11233 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11234         echo "DBL_DIG found." >&4
11235         val="$define"
11236 else
11237         echo "DBL_DIG NOT found." >&4
11238         val="$undef"
11239 fi
11240 $rm -f dbl_dig.?
11241 set d_dbl_dig
11242 eval $setvar
11243
11244 : see if dbm.h is available
11245 : see if dbmclose exists
11246 set dbmclose d_dbmclose
11247 eval $inlibc
11248
11249 case "$d_dbmclose" in
11250 $define)
11251         set dbm.h i_dbm
11252         eval $inhdr
11253         case "$i_dbm" in
11254         $define)
11255                 val="$undef"
11256                 set i_rpcsvcdbm
11257                 eval $setvar
11258                 ;;
11259         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11260                 eval $inhdr
11261                 ;;
11262         esac
11263         ;;
11264 *)      echo "We won't be including <dbm.h>"
11265         val="$undef"
11266         set i_dbm
11267         eval $setvar
11268         val="$undef"
11269         set i_rpcsvcdbm
11270         eval $setvar
11271         ;;
11272 esac
11273
11274 : see if prototype for dbminit is available
11275 echo " "
11276 set d_dbminitproto dbminit $i_dbm dbm.h
11277 eval $hasproto
11278
11279 : see if difftime exists
11280 set difftime d_difftime
11281 eval $inlibc
11282
11283 : see if this is a dirent system
11284 echo " "
11285 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11286         val="$define"
11287         echo "<dirent.h> found." >&4
11288 else
11289         val="$undef"
11290         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11291                 echo "<sys/dir.h> found." >&4
11292                 echo " "
11293         else
11294                 xinc=`./findhdr sys/ndir.h`
11295         fi
11296         echo "<dirent.h> NOT found." >&4
11297 fi
11298 set i_dirent
11299 eval $setvar
11300
11301 : Look for type of directory structure.
11302 echo " "
11303 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11304
11305 case "$direntrytype" in
11306 ''|' ')
11307         case "$i_dirent" in
11308         $define) guess1='struct dirent' ;;
11309         *) guess1='struct direct'  ;;
11310         esac
11311         ;;
11312 *)      guess1="$direntrytype"
11313         ;;
11314 esac
11315
11316 case "$guess1" in
11317 'struct dirent') guess2='struct direct' ;;
11318 *) guess2='struct dirent' ;;
11319 esac
11320
11321 if $contains "$guess1" try.c >/dev/null 2>&1; then
11322         direntrytype="$guess1"
11323         echo "Your directory entries are $direntrytype." >&4
11324 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11325         direntrytype="$guess2"
11326         echo "Your directory entries seem to be $direntrytype." >&4
11327 else
11328         echo "I don't recognize your system's directory entries." >&4
11329         rp="What type is used for directory entries on this system?"
11330         dflt="$guess1"
11331         . ./myread
11332         direntrytype="$ans"
11333 fi
11334 $rm_try
11335
11336 : see if the directory entry stores field length
11337 echo " "
11338 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11339 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11340         echo "Good, your directory entry keeps length information in d_namlen." >&4
11341         val="$define"
11342 else
11343         echo "Your directory entry does not know about the d_namlen field." >&4
11344         val="$undef"
11345 fi
11346 set d_dirnamlen
11347 eval $setvar
11348 $rm_try
11349
11350 : Look for DIR.dd_fd
11351 case "$i_dirent" in
11352 "$define")
11353     echo "Checking to see if DIR has a dd_fd member variable" >&4
11354     $cat >try.c <<EOCP
11355 #$i_stdlib I_STDLIB
11356 #ifdef I_STDLIB
11357 #include <stdlib.h>
11358 #endif
11359 #include <dirent.h>
11360
11361 int main() {
11362     DIR dir;
11363     dir.dd_fd = 1;
11364     return 0;
11365 }
11366 EOCP
11367     val=$undef
11368     set try
11369     if eval $compile; then
11370         echo "Yes, it does."
11371         val="$define"
11372     else
11373         echo "No, it does not."
11374         val="$undef"
11375     fi
11376     ;;
11377 *)
11378     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11379     val="$undef"
11380     ;;
11381 esac
11382 set d_dir_dd_fd
11383 eval $setvar
11384 $rm_try
11385
11386 : see if this is an sysdir system
11387 set sys/dir.h i_sysdir
11388 eval $inhdr
11389
11390 : see if this is an sysndir system
11391 set sys/ndir.h i_sysndir
11392 eval $inhdr
11393
11394 : Look for dirfd
11395 echo " "
11396 $cat >dirfd.c <<EOM
11397 #include <stdio.h>
11398 #$i_stdlib I_STDLIB
11399 #ifdef I_STDLIB
11400 #include <stdlib.h>
11401 #endif
11402 #$i_dirent I_DIRENT             /**/
11403 #$i_sysdir I_SYS_DIR            /**/
11404 #$i_sysndir I_SYS_NDIR          /**/
11405 #$i_systypes I_SYS_TYPES        /**/
11406 #if defined(I_SYS_TYPES)
11407 #include <sys/types.h>
11408 #endif
11409 #if defined(I_DIRENT)
11410 #include <dirent.h>
11411 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11412 #include <sys/dir.h>
11413 #endif
11414 #else
11415 #ifdef I_SYS_NDIR
11416 #include <sys/ndir.h>
11417 #else
11418 #ifdef I_SYS_DIR
11419 #ifdef hp9000s500
11420 #include <ndir.h>       /* may be wrong in the future */
11421 #else
11422 #include <sys/dir.h>
11423 #endif
11424 #endif
11425 #endif
11426 #endif 
11427 int main() {
11428         DIR *dirp = opendir(".");
11429         if (dirfd(dirp) >= 0)
11430                 exit(0);
11431         else
11432                 exit(1);
11433 }
11434 EOM
11435 val=$undef
11436 set dirfd
11437 if eval $compile; then
11438         val="$define"
11439 fi
11440 case "$val" in
11441 $define)        echo "dirfd() found." >&4       ;;
11442 *)              echo "dirfd() NOT found." >&4   ;;
11443 esac
11444 set d_dirfd
11445 eval $setvar
11446 $rm -f dirfd*
11447
11448 : see if dlerror exists
11449 xxx_runnm="$runnm"
11450 runnm=false
11451 set dlerror d_dlerror
11452 eval $inlibc
11453 runnm="$xxx_runnm"
11454
11455 : see if dlfcn is available
11456 set dlfcn.h i_dlfcn
11457 eval $inhdr
11458
11459 case "$usedl" in
11460 $define|y|true)
11461         $cat << EOM
11462
11463 On a few systems, the dynamically loaded modules that perl generates and uses
11464 will need a different extension than shared libs. The default will probably
11465 be appropriate.
11466
11467 EOM
11468         case "$dlext" in
11469         '')     dflt="$so" ;;
11470         *)      dflt="$dlext" ;;
11471         esac
11472         rp='What is the extension of dynamically loaded modules'
11473         . ./myread
11474         dlext="$ans"
11475         ;;
11476 *)
11477         dlext="none"
11478         ;;
11479 esac
11480
11481 : Check if dlsym need a leading underscore
11482 echo " "
11483 val="$undef"
11484
11485 case "$dlsrc" in
11486 dl_dlopen.xs)
11487         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11488         $cat >dyna.c <<'EOM'
11489 fred () { }
11490 EOM
11491
11492 $cat >fred.c<<EOM
11493
11494 #include <stdio.h>
11495 #$i_stdlib I_STDLIB
11496 #ifdef I_STDLIB
11497 #include <stdlib.h>
11498 #endif
11499 #$i_dlfcn I_DLFCN
11500 #ifdef I_DLFCN
11501 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11502 #else
11503 #include <sys/types.h>
11504 #include <nlist.h>
11505 #include <link.h>
11506 #endif
11507
11508 extern int fred() ;
11509
11510 int main()
11511 {
11512     void * handle ;
11513     void * symbol ;
11514 #ifndef RTLD_LAZY
11515     int mode = 1 ;
11516 #else
11517     int mode = RTLD_LAZY ;
11518 #endif
11519     handle = dlopen("./dyna.$dlext", mode) ;
11520     if (handle == NULL) {
11521         printf ("1\n") ;
11522         fflush (stdout) ;
11523         exit(0);
11524     }
11525     symbol = dlsym(handle, "fred") ;
11526     if (symbol == NULL) {
11527         /* try putting a leading underscore */
11528         symbol = dlsym(handle, "_fred") ;
11529         if (symbol == NULL) {
11530             printf ("2\n") ;
11531             fflush (stdout) ;
11532             exit(0);
11533         }
11534         printf ("3\n") ;
11535     }
11536     else
11537         printf ("4\n") ;
11538     fflush (stdout) ;
11539     exit(0);
11540 }
11541 EOM
11542         : Call the object file tmp-dyna.o in case dlext=o.
11543         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11544                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11545                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11546                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11547                 xxx=`$run ./fred`
11548                 case $xxx in
11549                 1)      echo "Test program failed using dlopen." >&4
11550                         echo "Perhaps you should not use dynamic loading." >&4;;
11551                 2)      echo "Test program failed using dlsym." >&4
11552                         echo "Perhaps you should not use dynamic loading." >&4;;
11553                 3)      echo "dlsym needs a leading underscore" >&4
11554                         val="$define" ;;
11555                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11556                 esac
11557         else
11558                 echo "I can't compile and run the test program." >&4
11559                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11560         fi
11561         ;;
11562 esac
11563                 
11564 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11565
11566 set d_dlsymun
11567 eval $setvar
11568
11569 : see if drand48_r exists
11570 set drand48_r d_drand48_r
11571 eval $inlibc
11572 case "$d_drand48_r" in
11573 "$define")
11574         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11575         case "$d_drand48_r_proto:$usethreads" in
11576         ":define")      d_drand48_r_proto=define
11577                 set d_drand48_r_proto drand48_r $hdrs
11578                 eval $hasproto ;;
11579         *)      ;;
11580         esac
11581         case "$d_drand48_r_proto" in
11582         define)
11583         case "$drand48_r_proto" in
11584         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11585         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11586         esac
11587         case "$drand48_r_proto" in
11588         ''|0)   d_drand48_r=undef
11589                 drand48_r_proto=0
11590                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11591         * )     case "$drand48_r_proto" in
11592                 REENTRANT_PROTO*) ;;
11593                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11594                 esac
11595                 echo "Prototype: $try" ;;
11596         esac
11597         ;;
11598         *)      case "$usethreads" in
11599                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11600                 esac
11601                 d_drand48_r=undef
11602                 drand48_r_proto=0
11603                 ;;
11604         esac
11605         ;;
11606 *)      drand48_r_proto=0
11607         ;;
11608 esac
11609
11610 : see if prototype for drand48 is available
11611 echo " "
11612 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11613 eval $hasproto
11614
11615 : see if dup2 exists
11616 set dup2 d_dup2
11617 eval $inlibc
11618
11619 : see if eaccess exists
11620 set eaccess d_eaccess
11621 eval $inlibc
11622
11623 : see if endgrent exists
11624 set endgrent d_endgrent
11625 eval $inlibc
11626
11627 : see if this is an grp system
11628 set grp.h i_grp
11629 eval $inhdr
11630
11631 case "$i_grp" in
11632 $define)
11633         xxx=`./findhdr grp.h`
11634         $cppstdin $cppflags $cppminus < $xxx >$$.h
11635
11636         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11637                 val="$define"
11638         else
11639                 val="$undef"
11640         fi
11641         set d_grpasswd
11642         eval $setvar
11643
11644         $rm -f $$.h
11645         ;;
11646 *)
11647         val="$undef";
11648         set d_grpasswd; eval $setvar
11649         ;;
11650 esac
11651
11652 : see if endgrent_r exists
11653 set endgrent_r d_endgrent_r
11654 eval $inlibc
11655 case "$d_endgrent_r" in
11656 "$define")
11657         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11658         case "$d_endgrent_r_proto:$usethreads" in
11659         ":define")      d_endgrent_r_proto=define
11660                 set d_endgrent_r_proto endgrent_r $hdrs
11661                 eval $hasproto ;;
11662         *)      ;;
11663         esac
11664         case "$d_endgrent_r_proto" in
11665         define)
11666         case "$endgrent_r_proto" in
11667         ''|0) try='int endgrent_r(FILE**);'
11668         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11669         esac
11670         case "$endgrent_r_proto" in
11671         ''|0) try='void endgrent_r(FILE**);'
11672         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11673         esac
11674         case "$endgrent_r_proto" in
11675         ''|0)   d_endgrent_r=undef
11676                 endgrent_r_proto=0
11677                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11678         * )     case "$endgrent_r_proto" in
11679                 REENTRANT_PROTO*) ;;
11680                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11681                 esac
11682                 echo "Prototype: $try" ;;
11683         esac
11684         ;;
11685         *)      case "$usethreads" in
11686                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11687                 esac
11688                 d_endgrent_r=undef
11689                 endgrent_r_proto=0
11690                 ;;
11691         esac
11692         ;;
11693 *)      endgrent_r_proto=0
11694         ;;
11695 esac
11696
11697 : see if endhostent exists
11698 set endhostent d_endhent
11699 eval $inlibc
11700
11701 : see if this is a netdb.h system
11702 set netdb.h i_netdb
11703 eval $inhdr
11704
11705 : see if endhostent_r exists
11706 set endhostent_r d_endhostent_r
11707 eval $inlibc
11708 case "$d_endhostent_r" in
11709 "$define")
11710         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11711         case "$d_endhostent_r_proto:$usethreads" in
11712         ":define")      d_endhostent_r_proto=define
11713                 set d_endhostent_r_proto endhostent_r $hdrs
11714                 eval $hasproto ;;
11715         *)      ;;
11716         esac
11717         case "$d_endhostent_r_proto" in
11718         define)
11719         case "$endhostent_r_proto" in
11720         ''|0) try='int endhostent_r(struct hostent_data*);'
11721         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11722         esac
11723         case "$endhostent_r_proto" in
11724         ''|0) try='void endhostent_r(struct hostent_data*);'
11725         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11726         esac
11727         case "$endhostent_r_proto" in
11728         ''|0)   d_endhostent_r=undef
11729                 endhostent_r_proto=0
11730                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11731         * )     case "$endhostent_r_proto" in
11732                 REENTRANT_PROTO*) ;;
11733                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11734                 esac
11735                 echo "Prototype: $try" ;;
11736         esac
11737         ;;
11738         *)      case "$usethreads" in
11739                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11740                 esac
11741                 d_endhostent_r=undef
11742                 endhostent_r_proto=0
11743                 ;;
11744         esac
11745         ;;
11746 *)      endhostent_r_proto=0
11747         ;;
11748 esac
11749
11750 : see if endnetent exists
11751 set endnetent d_endnent
11752 eval $inlibc
11753
11754 : see if endnetent_r exists
11755 set endnetent_r d_endnetent_r
11756 eval $inlibc
11757 case "$d_endnetent_r" in
11758 "$define")
11759         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11760         case "$d_endnetent_r_proto:$usethreads" in
11761         ":define")      d_endnetent_r_proto=define
11762                 set d_endnetent_r_proto endnetent_r $hdrs
11763                 eval $hasproto ;;
11764         *)      ;;
11765         esac
11766         case "$d_endnetent_r_proto" in
11767         define)
11768         case "$endnetent_r_proto" in
11769         ''|0) try='int endnetent_r(struct netent_data*);'
11770         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11771         esac
11772         case "$endnetent_r_proto" in
11773         ''|0) try='void endnetent_r(struct netent_data*);'
11774         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11775         esac
11776         case "$endnetent_r_proto" in
11777         ''|0)   d_endnetent_r=undef
11778                 endnetent_r_proto=0
11779                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11780         * )     case "$endnetent_r_proto" in
11781                 REENTRANT_PROTO*) ;;
11782                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11783                 esac
11784                 echo "Prototype: $try" ;;
11785         esac
11786         ;;
11787         *)      case "$usethreads" in
11788                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11789                 esac
11790                 d_endnetent_r=undef
11791                 endnetent_r_proto=0
11792                 ;;
11793         esac
11794         ;;
11795 *)      endnetent_r_proto=0
11796         ;;
11797 esac
11798
11799 : see if endprotoent exists
11800 set endprotoent d_endpent
11801 eval $inlibc
11802
11803 : see if endprotoent_r exists
11804 set endprotoent_r d_endprotoent_r
11805 eval $inlibc
11806 case "$d_endprotoent_r" in
11807 "$define")
11808         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11809         case "$d_endprotoent_r_proto:$usethreads" in
11810         ":define")      d_endprotoent_r_proto=define
11811                 set d_endprotoent_r_proto endprotoent_r $hdrs
11812                 eval $hasproto ;;
11813         *)      ;;
11814         esac
11815         case "$d_endprotoent_r_proto" in
11816         define)
11817         case "$endprotoent_r_proto" in
11818         ''|0) try='int endprotoent_r(struct protoent_data*);'
11819         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11820         esac
11821         case "$endprotoent_r_proto" in
11822         ''|0) try='void endprotoent_r(struct protoent_data*);'
11823         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11824         esac
11825         case "$endprotoent_r_proto" in
11826         ''|0)   d_endprotoent_r=undef
11827                 endprotoent_r_proto=0
11828                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11829         * )     case "$endprotoent_r_proto" in
11830                 REENTRANT_PROTO*) ;;
11831                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11832                 esac
11833                 echo "Prototype: $try" ;;
11834         esac
11835         ;;
11836         *)      case "$usethreads" in
11837                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11838                 esac
11839                 d_endprotoent_r=undef
11840                 endprotoent_r_proto=0
11841                 ;;
11842         esac
11843         ;;
11844 *)      endprotoent_r_proto=0
11845         ;;
11846 esac
11847
11848 : see if endpwent exists
11849 set endpwent d_endpwent
11850 eval $inlibc
11851
11852 : see if this is a pwd.h system
11853 set pwd.h i_pwd
11854 eval $inhdr
11855
11856 case "$i_pwd" in
11857 $define)
11858         xxx=`./findhdr pwd.h`
11859         $cppstdin $cppflags $cppminus < $xxx >$$.h
11860
11861         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11862                 val="$define"
11863         else
11864                 val="$undef"
11865         fi
11866         set d_pwquota
11867         eval $setvar
11868
11869         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11870                 val="$define"
11871         else
11872                 val="$undef"
11873         fi
11874         set d_pwage
11875         eval $setvar
11876
11877         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11878                 val="$define"
11879         else
11880                 val="$undef"
11881         fi
11882         set d_pwchange
11883         eval $setvar
11884
11885         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11886                 val="$define"
11887         else
11888                 val="$undef"
11889         fi
11890         set d_pwclass
11891         eval $setvar
11892
11893         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11894                 val="$define"
11895         else
11896                 val="$undef"
11897         fi
11898         set d_pwexpire
11899         eval $setvar
11900
11901         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11902                 val="$define"
11903         else
11904                 val="$undef"
11905         fi
11906         set d_pwcomment
11907         eval $setvar
11908
11909         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11910                 val="$define"
11911         else
11912                 val="$undef"
11913         fi
11914         set d_pwgecos
11915         eval $setvar
11916
11917         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11918                 val="$define"
11919         else
11920                 val="$undef"
11921         fi
11922         set d_pwpasswd
11923         eval $setvar
11924
11925         $rm -f $$.h
11926         ;;
11927 *)
11928         val="$undef"; 
11929         set d_pwquota; eval $setvar
11930         set d_pwage; eval $setvar
11931         set d_pwchange; eval $setvar
11932         set d_pwclass; eval $setvar
11933         set d_pwexpire; eval $setvar
11934         set d_pwcomment; eval $setvar
11935         set d_pwgecos; eval $setvar
11936         set d_pwpasswd; eval $setvar
11937         ;;
11938 esac
11939
11940 : see if endpwent_r exists
11941 set endpwent_r d_endpwent_r
11942 eval $inlibc
11943 case "$d_endpwent_r" in
11944 "$define")
11945         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11946         case "$d_endpwent_r_proto:$usethreads" in
11947         ":define")      d_endpwent_r_proto=define
11948                 set d_endpwent_r_proto endpwent_r $hdrs
11949                 eval $hasproto ;;
11950         *)      ;;
11951         esac
11952         case "$d_endpwent_r_proto" in
11953         define)
11954         case "$endpwent_r_proto" in
11955         ''|0) try='int endpwent_r(FILE**);'
11956         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11957         esac
11958         case "$endpwent_r_proto" in
11959         ''|0) try='void endpwent_r(FILE**);'
11960         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11961         esac
11962         case "$endpwent_r_proto" in
11963         ''|0)   d_endpwent_r=undef
11964                 endpwent_r_proto=0
11965                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11966         * )     case "$endpwent_r_proto" in
11967                 REENTRANT_PROTO*) ;;
11968                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11969                 esac
11970                 echo "Prototype: $try" ;;
11971         esac
11972         ;;
11973         *)      case "$usethreads" in
11974                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11975                 esac
11976                 d_endpwent_r=undef
11977                 endpwent_r_proto=0
11978                 ;;
11979         esac
11980         ;;
11981 *)      endpwent_r_proto=0
11982         ;;
11983 esac
11984
11985 : see if endservent exists
11986 set endservent d_endsent
11987 eval $inlibc
11988
11989 : see if endservent_r exists
11990 set endservent_r d_endservent_r
11991 eval $inlibc
11992 case "$d_endservent_r" in
11993 "$define")
11994         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11995         case "$d_endservent_r_proto:$usethreads" in
11996         ":define")      d_endservent_r_proto=define
11997                 set d_endservent_r_proto endservent_r $hdrs
11998                 eval $hasproto ;;
11999         *)      ;;
12000         esac
12001         case "$d_endservent_r_proto" in
12002         define)
12003         case "$endservent_r_proto" in
12004         ''|0) try='int endservent_r(struct servent_data*);'
12005         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12006         esac
12007         case "$endservent_r_proto" in
12008         ''|0) try='void endservent_r(struct servent_data*);'
12009         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12010         esac
12011         case "$endservent_r_proto" in
12012         ''|0)   d_endservent_r=undef
12013                 endservent_r_proto=0
12014                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12015         * )     case "$endservent_r_proto" in
12016                 REENTRANT_PROTO*) ;;
12017                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12018                 esac
12019                 echo "Prototype: $try" ;;
12020         esac
12021         ;;
12022         *)      case "$usethreads" in
12023                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12024                 esac
12025                 d_endservent_r=undef
12026                 endservent_r_proto=0
12027                 ;;
12028         esac
12029         ;;
12030 *)      endservent_r_proto=0
12031         ;;
12032 esac
12033
12034 : Locate the flags for 'open()'
12035 echo " "
12036 $cat >try.c <<EOCP
12037 #include <sys/types.h>
12038 #ifdef I_FCNTL
12039 #include <fcntl.h>
12040 #endif
12041 #ifdef I_SYS_FILE
12042 #include <sys/file.h>
12043 #endif
12044 #$i_stdlib I_STDLIB
12045 #ifdef I_STDLIB
12046 #include <stdlib.h>
12047 #endif
12048 int main() {
12049         if(O_RDONLY);
12050 #ifdef O_TRUNC
12051         exit(0);
12052 #else
12053         exit(1);
12054 #endif
12055 }
12056 EOCP
12057 : check sys/file.h first to get FREAD on Sun
12058 if $test `./findhdr sys/file.h` && \
12059                 set try -DI_SYS_FILE && eval $compile; then
12060         h_sysfile=true;
12061         echo "<sys/file.h> defines the O_* constants..." >&4
12062         if $run ./try; then
12063                 echo "and you have the 3 argument form of open()." >&4
12064                 val="$define"
12065         else
12066                 echo "but not the 3 argument form of open().  Oh, well." >&4
12067                 val="$undef"
12068         fi
12069 elif $test `./findhdr fcntl.h` && \
12070                 set try -DI_FCNTL && eval $compile; then
12071         h_fcntl=true;
12072         echo "<fcntl.h> defines the O_* constants..." >&4
12073         if $run ./try; then
12074                 echo "and you have the 3 argument form of open()." >&4
12075                 val="$define"
12076         else
12077                 echo "but not the 3 argument form of open().  Oh, well." >&4
12078                 val="$undef"
12079         fi
12080 else
12081         val="$undef"
12082         echo "I can't find the O_* constant definitions!  You got problems." >&4
12083 fi
12084 set d_open3
12085 eval $setvar
12086 $rm_try
12087
12088 : see which of string.h or strings.h is needed
12089 echo " "
12090 strings=`./findhdr string.h`
12091 if $test "$strings" && $test -r "$strings"; then
12092         echo "Using <string.h> instead of <strings.h>." >&4
12093         val="$define"
12094 else
12095         val="$undef"
12096         strings=`./findhdr strings.h`
12097         if $test "$strings" && $test -r "$strings"; then
12098                 echo "Using <strings.h> instead of <string.h>." >&4
12099         else
12100                 echo "No string header found -- You'll surely have problems." >&4
12101         fi
12102 fi
12103 set i_string
12104 eval $setvar
12105 case "$i_string" in
12106 "$undef") strings=`./findhdr strings.h`;;
12107 *)        strings=`./findhdr string.h`;;
12108 esac
12109
12110 : see if this is a sys/file.h system
12111 val=''
12112 set sys/file.h val
12113 eval $inhdr
12114
12115 : do we need to include sys/file.h ?
12116 case "$val" in
12117 "$define")
12118         echo " "
12119         if $h_sysfile; then
12120                 val="$define"
12121                 echo "We'll be including <sys/file.h>." >&4
12122         else
12123                 val="$undef"
12124                 echo "We won't be including <sys/file.h>." >&4
12125         fi
12126         ;;
12127 *)
12128         h_sysfile=false
12129         ;;
12130 esac
12131 set i_sysfile
12132 eval $setvar
12133
12134 : see if fcntl.h is there
12135 val=''
12136 set fcntl.h val
12137 eval $inhdr
12138
12139 : see if we can include fcntl.h
12140 case "$val" in
12141 "$define")
12142         echo " "
12143         if $h_fcntl; then
12144                 val="$define"
12145                 echo "We'll be including <fcntl.h>." >&4
12146         else
12147                 val="$undef"
12148                 if $h_sysfile; then
12149         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12150                 else
12151                         echo "We won't be including <fcntl.h>." >&4
12152                 fi
12153         fi
12154         ;;
12155 *)
12156         h_fcntl=false
12157         val="$undef"
12158         ;;
12159 esac
12160 set i_fcntl
12161 eval $setvar
12162
12163 : see if fork exists
12164 set fork d_fork
12165 eval $inlibc
12166
12167 : see if pipe exists
12168 set pipe d_pipe
12169 eval $inlibc
12170
12171 : check for non-blocking I/O stuff
12172 case "$h_sysfile" in
12173 true) echo "#include <sys/file.h>" > head.c;;
12174 *)
12175        case "$h_fcntl" in
12176        true) echo "#include <fcntl.h>" > head.c;;
12177        *) echo "#include <sys/fcntl.h>" > head.c;;
12178        esac
12179        ;;
12180 esac
12181 echo " "
12182 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12183 case "$o_nonblock" in
12184 '')
12185         $cat head.c > try.c
12186         $cat >>try.c <<EOCP
12187 #include <stdio.h>
12188 #$i_stdlib I_STDLIB
12189 #ifdef I_STDLIB
12190 #include <stdlib.h>
12191 #endif
12192 #$i_fcntl I_FCNTL
12193 #ifdef I_FCNTL
12194 #include <fcntl.h>
12195 #endif
12196 int main() {
12197 #ifdef O_NONBLOCK
12198         printf("O_NONBLOCK\n");
12199         exit(0);
12200 #endif
12201 #ifdef O_NDELAY
12202         printf("O_NDELAY\n");
12203         exit(0);
12204 #endif
12205 #ifdef FNDELAY
12206         printf("FNDELAY\n");
12207         exit(0);
12208 #endif
12209         exit(0);
12210 }
12211 EOCP
12212         set try
12213         if eval $compile_ok; then
12214                 o_nonblock=`$run ./try`
12215                 case "$o_nonblock" in
12216                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12217                 *) echo "Seems like we can use $o_nonblock.";;
12218                 esac
12219         else
12220                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12221         fi
12222         ;;
12223 *) echo "Using $hint value $o_nonblock.";;
12224 esac
12225 $rm_try
12226
12227 echo " "
12228 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12229 case "$eagain" in
12230 '')
12231         case "$d_fork:$d_pipe" in
12232         define:define)
12233         $cat head.c > try.c
12234         $cat >>try.c <<EOCP
12235 #include <errno.h>
12236 #include <sys/types.h>
12237 #include <signal.h>
12238 #include <stdio.h>
12239 #$i_stdlib I_STDLIB
12240 #ifdef I_STDLIB
12241 #include <stdlib.h>
12242 #endif
12243 #$i_fcntl I_FCNTL
12244 #ifdef I_FCNTL
12245 #include <fcntl.h>
12246 #endif
12247 #define MY_O_NONBLOCK $o_nonblock
12248 #ifndef errno  /* XXX need better Configure test */
12249 extern int errno;
12250 #endif
12251 #$i_unistd I_UNISTD
12252 #ifdef I_UNISTD
12253 #include <unistd.h>
12254 #endif
12255 #$i_string I_STRING
12256 #ifdef I_STRING
12257 #include <string.h>
12258 #else
12259 #include <strings.h>
12260 #endif
12261 $signal_t blech(int x) { exit(3); }
12262 EOCP
12263         $cat >> try.c <<'EOCP'
12264 int main()
12265 {
12266         int pd[2];
12267         int pu[2];
12268         char buf[1];
12269         char string[100];
12270
12271         pipe(pd);       /* Down: child -> parent */
12272         pipe(pu);       /* Up: parent -> child */
12273         if (0 != fork()) {
12274                 int ret;
12275                 close(pd[1]);   /* Parent reads from pd[0] */
12276                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12277 #ifdef F_SETFL
12278                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12279                         exit(1);
12280 #else
12281                 exit(4);
12282 #endif
12283                 signal(SIGALRM, blech);
12284                 alarm(5);
12285                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12286                         exit(2);
12287                 sprintf(string, "%d\n", ret);
12288                 write(2, string, strlen(string));
12289                 alarm(0);
12290 #ifdef EAGAIN
12291                 if (errno == EAGAIN) {
12292                         printf("EAGAIN\n");
12293                         goto ok;
12294                 }
12295 #endif
12296 #ifdef EWOULDBLOCK
12297                 if (errno == EWOULDBLOCK)
12298                         printf("EWOULDBLOCK\n");
12299 #endif
12300         ok:
12301                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12302                 sleep(2);                               /* Give it time to close our pipe */
12303                 alarm(5);
12304                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12305                 alarm(0);
12306                 sprintf(string, "%d\n", ret);
12307                 write(4, string, strlen(string));
12308                 exit(0);
12309         }
12310
12311         close(pd[0]);                   /* We write to pd[1] */
12312         close(pu[1]);                   /* We read from pu[0] */
12313         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12314         close(pd[1]);                   /* Pipe pd is now fully closed! */
12315         exit(0);                                /* Bye bye, thank you for playing! */
12316 }
12317 EOCP
12318         set try
12319         if eval $compile_ok; then
12320                 echo "$startsh" >mtry
12321                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12322                 chmod +x mtry
12323                 ./mtry >/dev/null 2>&1
12324                 case $? in
12325                 0) eagain=`$cat try.out`;;
12326                 1) echo "Could not perform non-blocking setting!";;
12327                 2) echo "I did a successful read() for something that was not there!";;
12328                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12329                 4) echo "Could not find F_SETFL!";;
12330                 *) echo "Something terribly wrong happened during testing.";;
12331                 esac
12332                 rd_nodata=`$cat try.ret`
12333                 echo "A read() system call with no data present returns $rd_nodata."
12334                 case "$rd_nodata" in
12335                 0|-1) ;;
12336                 *)
12337                         echo "(That's peculiar, fixing that to be -1.)"
12338                         rd_nodata=-1
12339                         ;;
12340                 esac
12341                 case "$eagain" in
12342                 '')
12343                         echo "Forcing errno EAGAIN on read() with no data available."
12344                         eagain=EAGAIN
12345                         ;;
12346                 *)
12347                         echo "Your read() sets errno to $eagain when no data is available."
12348                         ;;
12349                 esac
12350                 status=`$cat try.err`
12351                 case "$status" in
12352                 0) echo "And it correctly returns 0 to signal EOF.";;
12353                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12354                 *) echo "However, your read() returns '$status' on EOF??";;
12355                 esac
12356                 val="$define"
12357                 if test "$status" = "$rd_nodata"; then
12358                         echo "WARNING: you can't distinguish between EOF and no data!"
12359                         val="$undef"
12360                 fi
12361         else
12362                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12363                 eagain=EAGAIN
12364         fi
12365         ;;
12366         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12367                 eagain=EAGAIN
12368                 val="$define"
12369                 ;;
12370         esac
12371         set d_eofnblk
12372         eval $setvar
12373         ;;
12374 *)
12375         echo "Using $hint value $eagain."
12376         echo "Your read() returns $rd_nodata when no data is present."
12377         case "$d_eofnblk" in
12378         "$define") echo "And you can see EOF because read() returns 0.";;
12379         "$undef") echo "But you can't see EOF status from read() returned value.";;
12380         *)
12381                 echo "(Assuming you can't see EOF status from read anyway.)"
12382                 d_eofnblk=$undef
12383                 ;;
12384         esac
12385         ;;
12386 esac
12387 $rm_try head.c mtry
12388
12389 : see if _ptr and _cnt from stdio act std
12390 echo " "
12391
12392 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12393         echo "(Looks like you have stdio.h from BSD.)"
12394         case "$stdio_ptr" in
12395         '') stdio_ptr='((fp)->_p)'
12396                 ptr_lval=$define
12397                 ;;
12398         *)      ptr_lval=$d_stdio_ptr_lval;;
12399         esac
12400         case "$stdio_cnt" in
12401         '') stdio_cnt='((fp)->_r)'
12402                 cnt_lval=$define
12403                 ;;
12404         *)      cnt_lval=$d_stdio_cnt_lval;;
12405         esac
12406         case "$stdio_base" in
12407         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12408         esac
12409         case "$stdio_bufsiz" in
12410         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12411         esac
12412 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12413         echo "(Looks like you have stdio.h from Linux.)"
12414         case "$stdio_ptr" in
12415         '') stdio_ptr='((fp)->_IO_read_ptr)'
12416                 ptr_lval=$define
12417                 ;;
12418         *)      ptr_lval=$d_stdio_ptr_lval;;
12419         esac
12420         case "$stdio_cnt" in
12421         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12422                 cnt_lval=$undef
12423                 ;;
12424         *)      cnt_lval=$d_stdio_cnt_lval;;
12425         esac
12426         case "$stdio_base" in
12427         '') stdio_base='((fp)->_IO_read_base)';;
12428         esac
12429         case "$stdio_bufsiz" in
12430         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12431         esac
12432 else
12433         case "$stdio_ptr" in
12434         '') stdio_ptr='((fp)->_ptr)'
12435                 ptr_lval=$define
12436                 ;;
12437         *)      ptr_lval=$d_stdio_ptr_lval;;
12438         esac
12439         case "$stdio_cnt" in
12440         '') stdio_cnt='((fp)->_cnt)'
12441                 cnt_lval=$define
12442                 ;;
12443         *)      cnt_lval=$d_stdio_cnt_lval;;
12444         esac
12445         case "$stdio_base" in
12446         '') stdio_base='((fp)->_base)';;
12447         esac
12448         case "$stdio_bufsiz" in
12449         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12450         esac
12451 fi
12452
12453 : test whether _ptr and _cnt really work
12454 echo "Checking how std your stdio is..." >&4
12455 $cat >try.c <<EOP
12456 #include <stdio.h>
12457 #$i_stdlib I_STDLIB
12458 #ifdef I_STDLIB
12459 #include <stdlib.h>
12460 #endif
12461 #define FILE_ptr(fp)    $stdio_ptr
12462 #define FILE_cnt(fp)    $stdio_cnt
12463 int main() {
12464         FILE *fp = fopen("try.c", "r");
12465         char c = getc(fp);
12466         if (
12467                 18 <= FILE_cnt(fp) &&
12468                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12469         )
12470                 exit(0);
12471         exit(1);
12472 }
12473 EOP
12474 val="$undef"
12475 set try
12476 if eval $compile && $to try.c; then
12477         if $run ./try; then
12478                 echo "Your stdio acts pretty std."
12479                 val="$define"
12480         else
12481                 echo "Your stdio isn't very std."
12482         fi
12483 else
12484         echo "Your stdio doesn't appear very std."
12485 fi
12486 $rm_try
12487
12488 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12489 # direct buffer manipulation no longer works.  The Configure tests
12490 # should be changed to correctly detect this, but until then,
12491 # the following check should at least let perl compile and run.
12492 # (This quick fix should be updated before 5.8.1.)
12493 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12494 # A. Dougherty, June 3, 2002.
12495 case "$d_gnulibc" in
12496 $define)
12497         case "$gnulibc_version" in
12498         2.[01]*)  ;;
12499         2.2) ;;
12500         2.2.[0-9]) ;;
12501         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12502                 val="$undef"
12503                 ;;
12504         esac
12505         ;;
12506 esac
12507 set d_stdstdio
12508 eval $setvar
12509
12510 : Can _ptr be used as an lvalue?
12511 case "$d_stdstdio$ptr_lval" in
12512 $define$define) val=$define ;;
12513 *) val=$undef ;;
12514 esac
12515 set d_stdio_ptr_lval
12516 eval $setvar
12517
12518 : Can _cnt be used as an lvalue?
12519 case "$d_stdstdio$cnt_lval" in
12520 $define$define) val=$define ;;
12521 *) val=$undef ;;
12522 esac
12523 set d_stdio_cnt_lval
12524 eval $setvar
12525
12526
12527 : test whether setting _ptr sets _cnt as a side effect
12528 d_stdio_ptr_lval_sets_cnt="$undef"
12529 d_stdio_ptr_lval_nochange_cnt="$undef"
12530 case "$d_stdio_ptr_lval$d_stdstdio" in
12531 $define$define)
12532         echo "Checking to see what happens if we set the stdio ptr..." >&4
12533 $cat >try.c <<EOP
12534 #include <stdio.h>
12535 /* Can we scream? */
12536 /* Eat dust sed :-) */
12537 /* In the buffer space, no one can hear you scream. */
12538 #$i_stdlib I_STDLIB
12539 #ifdef I_STDLIB
12540 #include <stdlib.h>
12541 #endif
12542 #define FILE_ptr(fp)    $stdio_ptr
12543 #define FILE_cnt(fp)    $stdio_cnt
12544 #include <sys/types.h>
12545 int main() {
12546         FILE *fp = fopen("try.c", "r");
12547         int c;
12548         char *ptr;
12549         size_t cnt;
12550         if (!fp) {
12551             puts("Fail even to read");
12552             exit(1);
12553         }
12554         c = getc(fp); /* Read away the first # */
12555         if (c == EOF) {
12556             puts("Fail even to read");
12557             exit(1);
12558         }
12559         if (!(
12560                 18 <= FILE_cnt(fp) &&
12561                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12562         )) {
12563                 puts("Fail even to read");
12564                 exit (1);
12565         }
12566         ptr = (char*) FILE_ptr(fp);
12567         cnt = (size_t)FILE_cnt(fp);
12568
12569         FILE_ptr(fp) += 42;
12570
12571         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12572                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12573                 exit (1);
12574         }
12575         if (FILE_cnt(fp) <= 20) {
12576                 printf ("Fail (<20 chars to test)");
12577                 exit (1);
12578         }
12579         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12580                 puts("Fail compare");
12581                 exit (1);
12582         }
12583         if (cnt == FILE_cnt(fp)) {
12584                 puts("Pass_unchanged");
12585                 exit (0);
12586         }
12587         if (FILE_cnt(fp) == (cnt - 42)) {
12588                 puts("Pass_changed");
12589                 exit (0);
12590         }
12591         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12592         return 1;
12593
12594 }
12595 EOP
12596         set try
12597         if eval $compile && $to try.c; then
12598                 case `$run ./try` in
12599                 Pass_changed)
12600                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12601                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12602                 Pass_unchanged)
12603                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12604                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12605                 Fail*)
12606                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12607                 *)
12608                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12609         esac
12610         else
12611                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12612         fi
12613         $rm_try
12614         ;;
12615 esac
12616
12617 : see if _base is also standard
12618 val="$undef"
12619 case "$d_stdstdio" in
12620 $define)
12621         $cat >try.c <<EOP
12622 #include <stdio.h>
12623 #$i_stdlib I_STDLIB
12624 #ifdef I_STDLIB
12625 #include <stdlib.h>
12626 #endif
12627 #define FILE_base(fp)   $stdio_base
12628 #define FILE_bufsiz(fp) $stdio_bufsiz
12629 int main() {
12630         FILE *fp = fopen("try.c", "r");
12631         char c = getc(fp);
12632         if (
12633                 19 <= FILE_bufsiz(fp) &&
12634                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12635         )
12636                 exit(0);
12637         exit(1);
12638 }
12639 EOP
12640         set try
12641         if eval $compile && $to try.c; then
12642                 if $run ./try; then
12643                         echo "And its _base field acts std."
12644                         val="$define"
12645                 else
12646                         echo "But its _base field isn't std."
12647                 fi
12648         else
12649                 echo "However, it seems to be lacking the _base field."
12650         fi
12651         $rm_try
12652         ;;
12653 esac
12654 set d_stdiobase
12655 eval $setvar
12656
12657 : see if fast_stdio exists
12658 val="$undef"
12659 case "$d_stdstdio:$d_stdio_ptr_lval" in
12660 "$define:$define")
12661         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12662         *$define*)
12663                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12664                 val="$define"
12665                 ;;
12666         esac
12667         ;;
12668 esac
12669 set d_faststdio
12670 eval $setvar
12671
12672
12673
12674 : see if fchdir exists
12675 set fchdir d_fchdir
12676 eval $inlibc
12677
12678 : see if fchmod exists
12679 set fchmod d_fchmod
12680 eval $inlibc
12681
12682 : see if fchown exists
12683 set fchown d_fchown
12684 eval $inlibc
12685
12686 : see if this is an fcntl system
12687 set fcntl d_fcntl
12688 eval $inlibc
12689
12690 echo " "
12691 : See if fcntl-based locking works.
12692 $cat >try.c <<EOCP
12693 #$i_stdlib I_STDLIB
12694 #ifdef I_STDLIB
12695 #include <stdlib.h>
12696 #endif
12697 #include <unistd.h>
12698 #include <fcntl.h>
12699 #include <signal.h>
12700 $signal_t blech(int x) { exit(3); }
12701 int main() {
12702 #if defined(F_SETLK) && defined(F_SETLKW)
12703      struct flock flock;
12704      int retval, fd;
12705      fd = open("try.c", O_RDONLY);
12706      flock.l_type = F_RDLCK;
12707      flock.l_whence = SEEK_SET;
12708      flock.l_start = flock.l_len = 0;
12709      signal(SIGALRM, blech);
12710      alarm(10);
12711      retval = fcntl(fd, F_SETLK, &flock);
12712      close(fd);
12713      (retval < 0 ? exit(2) : exit(0));
12714 #else
12715      exit(2);
12716 #endif
12717 }
12718 EOCP
12719 echo "Checking if fcntl-based file locking works... "
12720 case "$d_fcntl" in
12721 "$define")
12722         set try
12723         if eval $compile_ok; then
12724                 if $run ./try; then
12725                         echo "Yes, it seems to work."
12726                         val="$define"
12727                 else
12728                         echo "Nope, it didn't work."
12729                         val="$undef"
12730                         case "$?" in
12731                         3) $cat >&4 <<EOM
12732 ***
12733 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12734 *** This is (almost) impossible.
12735 *** If your NFS lock daemons are not feeling well, something like
12736 *** this may happen, please investigate.  Cannot continue, aborting.
12737 ***
12738 EOM
12739                                 exit 1
12740                                 ;;
12741                         esac
12742                 fi
12743         else
12744                 echo "I'm unable to compile the test program, so I'll assume not."
12745                 val="$undef"
12746         fi
12747         ;;
12748 *) val="$undef";
12749         echo "Nope, since you don't even have fcntl()."
12750         ;;
12751 esac
12752 set d_fcntl_can_lock
12753 eval $setvar
12754 $rm_try
12755
12756 : check for fd_set items
12757 $cat <<EOM
12758
12759 Checking to see how well your C compiler handles fd_set and friends ...
12760 EOM
12761 $cat >try.c <<EOCP
12762 #$i_stdlib I_STDLIB
12763 #ifdef I_STDLIB
12764 #include <stdlib.h>
12765 #endif
12766 #$i_systime I_SYS_TIME
12767 #$i_sysselct I_SYS_SELECT
12768 #$d_socket HAS_SOCKET
12769 #include <sys/types.h>
12770 #ifdef HAS_SOCKET
12771 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12772 #endif
12773 #ifdef I_SYS_TIME
12774 #include <sys/time.h>
12775 #endif
12776 #ifdef I_SYS_SELECT
12777 #include <sys/select.h>
12778 #endif
12779 int main() {
12780         fd_set fds;
12781
12782 #ifdef TRYBITS
12783         if(fds.fds_bits);
12784 #endif
12785
12786 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12787         exit(0);
12788 #else
12789         exit(1);
12790 #endif
12791 }
12792 EOCP
12793 set try -DTRYBITS
12794 if eval $compile; then
12795         d_fds_bits="$define"
12796         d_fd_set="$define"
12797         echo "Well, your system knows about the normal fd_set typedef..." >&4
12798         if $run ./try; then
12799                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12800                 d_fd_macros="$define"
12801         else
12802                 $cat >&4 <<'EOM'
12803 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12804 EOM
12805                 d_fd_macros="$undef"
12806         fi
12807 else
12808         $cat <<'EOM'
12809 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12810 EOM
12811         set try
12812         if eval $compile; then
12813                 d_fds_bits="$undef"
12814                 d_fd_set="$define"
12815                 echo "Well, your system has some sort of fd_set available..." >&4
12816                 if $run ./try; then
12817                         echo "and you have the normal fd_set macros." >&4
12818                         d_fd_macros="$define"
12819                 else
12820                         $cat <<'EOM'
12821 but not the normal fd_set macros!  Gross!  More work for me...
12822 EOM
12823                         d_fd_macros="$undef"
12824                 fi
12825         else
12826         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12827                 d_fd_set="$undef"
12828                 d_fds_bits="$undef"
12829                 d_fd_macros="$undef"
12830         fi
12831 fi
12832 $rm_try
12833
12834 : see if fgetpos exists
12835 set fgetpos d_fgetpos
12836 eval $inlibc
12837
12838 : see if finite exists
12839 set finite d_finite
12840 eval $inlibc
12841
12842 : see if finitel exists
12843 set finitel d_finitel
12844 eval $inlibc
12845
12846 : see if flock exists
12847 set flock d_flock
12848 eval $inlibc
12849
12850 : see if prototype for flock is available
12851 echo " "
12852 set d_flockproto flock $i_sysfile sys/file.h
12853 eval $hasproto
12854
12855 : see if fp_class exists
12856 set fp_class d_fp_class
12857 eval $inlibc
12858
12859 : see if pathconf exists
12860 set pathconf d_pathconf
12861 eval $inlibc
12862
12863 : see if fpathconf exists
12864 set fpathconf d_fpathconf
12865 eval $inlibc
12866
12867 : see if fpclass exists
12868 set fpclass d_fpclass
12869 eval $inlibc
12870
12871 : see if fpclassify exists
12872 set fpclassify d_fpclassify
12873 eval $inlibc
12874
12875 : see if fpclassl exists
12876 set fpclassl d_fpclassl
12877 eval $inlibc
12878
12879
12880 : check for fpos64_t
12881 echo " "
12882 echo "Checking to see if you have fpos64_t..." >&4
12883 $cat >try.c <<EOCP
12884 #include <stdio.h>
12885 int main() { fpos64_t x = 7; }
12886 EOCP
12887 set try
12888 if eval $compile; then
12889         val="$define"
12890         echo "You have fpos64_t."
12891 else
12892         val="$undef"
12893         echo "You do not have fpos64_t."
12894         case "$fpossize" in
12895         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12896         esac
12897 fi
12898 $rm_try
12899 set d_fpos64_t
12900 eval $setvar
12901
12902 : see if frexpl exists
12903 set frexpl d_frexpl
12904 eval $inlibc
12905
12906 : see if this is a sys/param system
12907 set sys/param.h i_sysparam
12908 eval $inhdr
12909
12910 : see if this is a sys/mount.h system
12911 set sys/mount.h i_sysmount
12912 eval $inhdr
12913
12914
12915 echo " "
12916 echo "Checking to see if your system supports struct fs_data..." >&4
12917 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12918 eval $hasstruct
12919 case "$d_fs_data_s" in
12920 "$define")      echo "Yes, it does."   ;;
12921 *)              echo "No, it doesn't." ;;
12922 esac
12923
12924 : see if fseeko exists
12925 set fseeko d_fseeko
12926 eval $inlibc
12927 case "$longsize" in
12928 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12929 esac
12930
12931 : see if fsetpos exists
12932 set fsetpos d_fsetpos
12933 eval $inlibc
12934
12935
12936 : see if fstatfs exists
12937 set fstatfs d_fstatfs
12938 eval $inlibc
12939
12940
12941 : see if statvfs exists
12942 set statvfs d_statvfs
12943 eval $inlibc
12944
12945 : see if fstatvfs exists
12946 set fstatvfs d_fstatvfs
12947 eval $inlibc
12948
12949
12950 : see if fsync exists
12951 set fsync d_fsync
12952 eval $inlibc
12953
12954 : see if ftello exists
12955 set ftello d_ftello
12956 eval $inlibc
12957 case "$longsize" in
12958 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12959 esac
12960
12961 d_futimes="$undef"
12962 : check for a working futimes
12963 echo " "
12964 echo "Checking if you have a working futimes()" >&4
12965 $cat >try.c <<EOCP
12966 #include <stdio.h>
12967 #include <sys/time.h>
12968 #include <errno.h>
12969 #include <fcntl.h>
12970
12971 int main ()
12972 {
12973     int fd, rv;
12974     fd = open ("try.c", O_RDWR);
12975     if (-1 == fd) exit (1);
12976     rv = futimes (fd, NULL);
12977     exit (rv == -1 ? errno : 0);
12978 }
12979 EOCP
12980 set try
12981 if eval $compile; then
12982     `$run ./try`
12983     rc=$?
12984     case "$rc" in
12985         0)  echo "Yes, you have" >&4
12986             d_futimes="$define"
12987             ;;
12988         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
12989             ;;
12990     esac
12991 else
12992     echo "No, it does not (probably harmless)" >&4
12993 fi
12994 $rm_try
12995
12996 : see if getcwd exists
12997 set getcwd d_getcwd
12998 eval $inlibc
12999
13000 : see if getespwnam exists
13001 set getespwnam d_getespwnam
13002 eval $inlibc
13003
13004
13005 : see if getfsstat exists
13006 set getfsstat d_getfsstat
13007 eval $inlibc
13008
13009 : see if getgrent exists
13010 set getgrent d_getgrent
13011 eval $inlibc
13012
13013 : see if getgrent_r exists
13014 set getgrent_r d_getgrent_r
13015 eval $inlibc
13016 case "$d_getgrent_r" in
13017 "$define")
13018         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13019         case "$d_getgrent_r_proto:$usethreads" in
13020         ":define")      d_getgrent_r_proto=define
13021                 set d_getgrent_r_proto getgrent_r $hdrs
13022                 eval $hasproto ;;
13023         *)      ;;
13024         esac
13025         case "$d_getgrent_r_proto" in
13026         define)
13027         case "$getgrent_r_proto" in
13028         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13029         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13030         esac
13031         case "$getgrent_r_proto" in
13032         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13033         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13034         esac
13035         case "$getgrent_r_proto" in
13036         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13037         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13038         esac
13039         case "$getgrent_r_proto" in
13040         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13041         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13042         esac
13043         case "$getgrent_r_proto" in
13044         ''|0) try='int getgrent_r(struct group*, char*, int);'
13045         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13046         esac
13047         case "$getgrent_r_proto" in
13048         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13049         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13050         esac
13051         case "$getgrent_r_proto" in
13052         ''|0)   d_getgrent_r=undef
13053                 getgrent_r_proto=0
13054                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13055         * )     case "$getgrent_r_proto" in
13056                 REENTRANT_PROTO*) ;;
13057                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13058                 esac
13059                 echo "Prototype: $try" ;;
13060         esac
13061         ;;
13062         *)      case "$usethreads" in
13063                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13064                 esac
13065                 d_getgrent_r=undef
13066                 getgrent_r_proto=0
13067                 ;;
13068         esac
13069         ;;
13070 *)      getgrent_r_proto=0
13071         ;;
13072 esac
13073
13074 : see if getgrgid_r exists
13075 set getgrgid_r d_getgrgid_r
13076 eval $inlibc
13077 case "$d_getgrgid_r" in
13078 "$define")
13079         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13080         case "$d_getgrgid_r_proto:$usethreads" in
13081         ":define")      d_getgrgid_r_proto=define
13082                 set d_getgrgid_r_proto getgrgid_r $hdrs
13083                 eval $hasproto ;;
13084         *)      ;;
13085         esac
13086         case "$d_getgrgid_r_proto" in
13087         define)
13088         case "$getgrgid_r_proto" in
13089         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13090         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13091         esac
13092         case "$getgrgid_r_proto" in
13093         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13094         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13095         esac
13096         case "$getgrgid_r_proto" in
13097         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13098         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13099         esac
13100         case "$getgrgid_r_proto" in
13101         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13102         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13103         esac
13104         case "$getgrgid_r_proto" in
13105         ''|0)   d_getgrgid_r=undef
13106                 getgrgid_r_proto=0
13107                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13108         * )     case "$getgrgid_r_proto" in
13109                 REENTRANT_PROTO*) ;;
13110                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13111                 esac
13112                 echo "Prototype: $try" ;;
13113         esac
13114         ;;
13115         *)      case "$usethreads" in
13116                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13117                 esac
13118                 d_getgrgid_r=undef
13119                 getgrgid_r_proto=0
13120                 ;;
13121         esac
13122         ;;
13123 *)      getgrgid_r_proto=0
13124         ;;
13125 esac
13126
13127 : see if getgrnam_r exists
13128 set getgrnam_r d_getgrnam_r
13129 eval $inlibc
13130 case "$d_getgrnam_r" in
13131 "$define")
13132         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13133         case "$d_getgrnam_r_proto:$usethreads" in
13134         ":define")      d_getgrnam_r_proto=define
13135                 set d_getgrnam_r_proto getgrnam_r $hdrs
13136                 eval $hasproto ;;
13137         *)      ;;
13138         esac
13139         case "$d_getgrnam_r_proto" in
13140         define)
13141         case "$getgrnam_r_proto" in
13142         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13143         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13144         esac
13145         case "$getgrnam_r_proto" in
13146         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13147         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13148         esac
13149         case "$getgrnam_r_proto" in
13150         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13151         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13152         esac
13153         case "$getgrnam_r_proto" in
13154         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13155         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13156         esac
13157         case "$getgrnam_r_proto" in
13158         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13159         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13160         esac
13161         case "$getgrnam_r_proto" in
13162         ''|0)   d_getgrnam_r=undef
13163                 getgrnam_r_proto=0
13164                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13165         * )     case "$getgrnam_r_proto" in
13166                 REENTRANT_PROTO*) ;;
13167                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13168                 esac
13169                 echo "Prototype: $try" ;;
13170         esac
13171         ;;
13172         *)      case "$usethreads" in
13173                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13174                 esac
13175                 d_getgrnam_r=undef
13176                 getgrnam_r_proto=0
13177                 ;;
13178         esac
13179         ;;
13180 *)      getgrnam_r_proto=0
13181         ;;
13182 esac
13183
13184 : see if gethostbyaddr exists
13185 set gethostbyaddr d_gethbyaddr
13186 eval $inlibc
13187
13188 : see if gethostbyname exists
13189 set gethostbyname d_gethbyname
13190 eval $inlibc
13191
13192 : see if gethostent exists
13193 set gethostent d_gethent
13194 eval $inlibc
13195
13196 : see how we will look up host name
13197 echo " "
13198 call=''
13199 if set gethostname val -f d_gethname; eval $csym; $val; then
13200         echo 'gethostname() found.' >&4
13201         d_gethname="$define"
13202         call=gethostname
13203 fi
13204 if set uname val -f d_uname; eval $csym; $val; then
13205         if ./xenix; then
13206                 $cat <<'EOM'
13207 uname() was found, but you're running xenix, and older versions of xenix
13208 have a broken uname(). If you don't really know whether your xenix is old
13209 enough to have a broken system call, use the default answer.
13210
13211 EOM
13212                 dflt=y
13213                 case "$d_uname" in
13214                 "$define") dflt=n;;
13215                 esac
13216                 rp='Is your uname() broken?'
13217                 . ./myread
13218                 case "$ans" in
13219                 n*) d_uname="$define"; call=uname;;
13220                 esac
13221         else
13222                 echo 'uname() found.' >&4
13223                 d_uname="$define"
13224                 case "$call" in
13225                 '') call=uname ;;
13226                 esac
13227         fi
13228 fi
13229 case "$d_gethname" in
13230 '') d_gethname="$undef";;
13231 esac
13232 case "$d_uname" in
13233 '') d_uname="$undef";;
13234 esac
13235 case "$d_uname$d_gethname" in
13236 *define*)
13237         dflt=n
13238         cat <<EOM
13239  
13240 Every now and then someone has a $call() that lies about the hostname
13241 but can't be fixed for political or economic reasons.  If you wish, I can
13242 pretend $call() isn't there and maybe compute hostname at run-time
13243 thanks to the '$phostname' command.
13244
13245 EOM
13246         rp="Shall I ignore $call() from now on?"
13247         . ./myread
13248         case "$ans" in
13249         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13250         esac;;
13251 esac
13252 case "$phostname" in
13253 '') aphostname='';;
13254 *) case "$aphostname" in
13255         /*) ;;
13256         *) set X $phostname
13257                 shift
13258                 file=$1
13259                 shift
13260                 file=`./loc $file $file $pth`
13261                 aphostname=`echo $file $*`
13262                 ;;
13263         esac
13264         ;;
13265 esac
13266 case "$d_uname$d_gethname" in
13267 *define*) ;;
13268 *)
13269         case "$phostname" in
13270         '')
13271                 echo "There will be no way for $package to get your hostname." >&4;;
13272         *)
13273         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13274                 ;;
13275         esac;;
13276 esac
13277 case "$d_phostname" in
13278 '') d_phostname="$undef";;
13279 esac
13280
13281 : see if gethostbyaddr_r exists
13282 set gethostbyaddr_r d_gethostbyaddr_r
13283 eval $inlibc
13284 case "$d_gethostbyaddr_r" in
13285 "$define")
13286         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13287         case "$d_gethostbyaddr_r_proto:$usethreads" in
13288         ":define")      d_gethostbyaddr_r_proto=define
13289                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13290                 eval $hasproto ;;
13291         *)      ;;
13292         esac
13293         case "$d_gethostbyaddr_r_proto" in
13294         define)
13295         case "$gethostbyaddr_r_proto" in
13296         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13297         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13298         esac
13299         case "$gethostbyaddr_r_proto" in
13300         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13301         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13302         esac
13303         case "$gethostbyaddr_r_proto" in
13304         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13305         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13306         esac
13307         case "$gethostbyaddr_r_proto" in
13308         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13309         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13310         esac
13311         case "$gethostbyaddr_r_proto" in
13312         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13313         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13314         esac
13315         case "$gethostbyaddr_r_proto" in
13316         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13317         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13318         esac
13319         case "$gethostbyaddr_r_proto" in
13320         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13321         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13322         esac
13323         case "$gethostbyaddr_r_proto" in
13324         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13325         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13326         esac
13327         case "$gethostbyaddr_r_proto" in
13328         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13329         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13330         esac
13331         case "$gethostbyaddr_r_proto" in
13332         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13333         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13334         esac
13335         case "$gethostbyaddr_r_proto" in
13336         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13337         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13338         esac
13339         case "$gethostbyaddr_r_proto" in
13340         ''|0)   d_gethostbyaddr_r=undef
13341                 gethostbyaddr_r_proto=0
13342                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13343         * )     case "$gethostbyaddr_r_proto" in
13344                 REENTRANT_PROTO*) ;;
13345                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13346                 esac
13347                 echo "Prototype: $try" ;;
13348         esac
13349         ;;
13350         *)      case "$usethreads" in
13351                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13352                 esac
13353                 d_gethostbyaddr_r=undef
13354                 gethostbyaddr_r_proto=0
13355                 ;;
13356         esac
13357         ;;
13358 *)      gethostbyaddr_r_proto=0
13359         ;;
13360 esac
13361
13362 : see if gethostbyname_r exists
13363 set gethostbyname_r d_gethostbyname_r
13364 eval $inlibc
13365 case "$d_gethostbyname_r" in
13366 "$define")
13367         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13368         case "$d_gethostbyname_r_proto:$usethreads" in
13369         ":define")      d_gethostbyname_r_proto=define
13370                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13371                 eval $hasproto ;;
13372         *)      ;;
13373         esac
13374         case "$d_gethostbyname_r_proto" in
13375         define)
13376         case "$gethostbyname_r_proto" in
13377         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13378         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13379         esac
13380         case "$gethostbyname_r_proto" in
13381         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13382         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13383         esac
13384         case "$gethostbyname_r_proto" in
13385         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13386         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13387         esac
13388         case "$gethostbyname_r_proto" in
13389         ''|0)   d_gethostbyname_r=undef
13390                 gethostbyname_r_proto=0
13391                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13392         * )     case "$gethostbyname_r_proto" in
13393                 REENTRANT_PROTO*) ;;
13394                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13395                 esac
13396                 echo "Prototype: $try" ;;
13397         esac
13398         ;;
13399         *)      case "$usethreads" in
13400                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13401                 esac
13402                 d_gethostbyname_r=undef
13403                 gethostbyname_r_proto=0
13404                 ;;
13405         esac
13406         ;;
13407 *)      gethostbyname_r_proto=0
13408         ;;
13409 esac
13410
13411 : see if gethostent_r exists
13412 set gethostent_r d_gethostent_r
13413 eval $inlibc
13414 case "$d_gethostent_r" in
13415 "$define")
13416         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13417         case "$d_gethostent_r_proto:$usethreads" in
13418         ":define")      d_gethostent_r_proto=define
13419                 set d_gethostent_r_proto gethostent_r $hdrs
13420                 eval $hasproto ;;
13421         *)      ;;
13422         esac
13423         case "$d_gethostent_r_proto" in
13424         define)
13425         case "$gethostent_r_proto" in
13426         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13427         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13428         esac
13429         case "$gethostent_r_proto" in
13430         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13431         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13432         esac
13433         case "$gethostent_r_proto" in
13434         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13435         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13436         esac
13437         case "$gethostent_r_proto" in
13438         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13439         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13440         esac
13441         case "$gethostent_r_proto" in
13442         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13443         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13444         esac
13445         case "$gethostent_r_proto" in
13446         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13447         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13448         esac
13449         case "$gethostent_r_proto" in
13450         ''|0)   d_gethostent_r=undef
13451                 gethostent_r_proto=0
13452                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13453         * )     case "$gethostent_r_proto" in
13454                 REENTRANT_PROTO*) ;;
13455                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13456                 esac
13457                 echo "Prototype: $try" ;;
13458         esac
13459         ;;
13460         *)      case "$usethreads" in
13461                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13462                 esac
13463                 d_gethostent_r=undef
13464                 gethostent_r_proto=0
13465                 ;;
13466         esac
13467         ;;
13468 *)      gethostent_r_proto=0
13469         ;;
13470 esac
13471
13472 : see if prototypes for various gethostxxx netdb.h functions are available
13473 echo " "
13474 set d_gethostprotos gethostent $i_netdb netdb.h
13475 eval $hasproto
13476
13477 : see if getitimer exists
13478 set getitimer d_getitimer
13479 eval $inlibc
13480
13481 : see if getlogin exists
13482 set getlogin d_getlogin
13483 eval $inlibc
13484
13485 : see if getlogin_r exists
13486 set getlogin_r d_getlogin_r
13487 eval $inlibc
13488 case "$d_getlogin_r" in
13489 "$define")
13490         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13491         case "$d_getlogin_r_proto:$usethreads" in
13492         ":define")      d_getlogin_r_proto=define
13493                 set d_getlogin_r_proto getlogin_r $hdrs
13494                 eval $hasproto ;;
13495         *)      ;;
13496         esac
13497         case "$d_getlogin_r_proto" in
13498         define)
13499         case "$getlogin_r_proto" in
13500         ''|0) try='int getlogin_r(char*, size_t);'
13501         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13502         esac
13503         case "$getlogin_r_proto" in
13504         ''|0) try='int getlogin_r(char*, int);'
13505         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13506         esac
13507         case "$getlogin_r_proto" in
13508         ''|0) try='char* getlogin_r(char*, size_t);'
13509         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13510         esac
13511         case "$getlogin_r_proto" in
13512         ''|0) try='char* getlogin_r(char*, int);'
13513         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13514         esac
13515         case "$getlogin_r_proto" in
13516         ''|0)   d_getlogin_r=undef
13517                 getlogin_r_proto=0
13518                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13519         * )     case "$getlogin_r_proto" in
13520                 REENTRANT_PROTO*) ;;
13521                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13522                 esac
13523                 echo "Prototype: $try" ;;
13524         esac
13525         ;;
13526         *)      case "$usethreads" in
13527                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13528                 esac
13529                 d_getlogin_r=undef
13530                 getlogin_r_proto=0
13531                 ;;
13532         esac
13533         ;;
13534 *)      getlogin_r_proto=0
13535         ;;
13536 esac
13537
13538 : see if getmnt exists
13539 set getmnt d_getmnt
13540 eval $inlibc
13541
13542 : see if getmntent exists
13543 set getmntent d_getmntent
13544 eval $inlibc
13545
13546 : see if getnetbyaddr exists
13547 set getnetbyaddr d_getnbyaddr
13548 eval $inlibc
13549
13550 : see if getnetbyname exists
13551 set getnetbyname d_getnbyname
13552 eval $inlibc
13553
13554 : see if getnetent exists
13555 set getnetent d_getnent
13556 eval $inlibc
13557
13558 : see if getnetbyaddr_r exists
13559 set getnetbyaddr_r d_getnetbyaddr_r
13560 eval $inlibc
13561 case "$d_getnetbyaddr_r" in
13562 "$define")
13563         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13564         case "$d_getnetbyaddr_r_proto:$usethreads" in
13565         ":define")      d_getnetbyaddr_r_proto=define
13566                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13567                 eval $hasproto ;;
13568         *)      ;;
13569         esac
13570         case "$d_getnetbyaddr_r_proto" in
13571         define)
13572         case "$getnetbyaddr_r_proto" in
13573         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13574         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13575         esac
13576         case "$getnetbyaddr_r_proto" in
13577         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13578         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13579         esac
13580         case "$getnetbyaddr_r_proto" in
13581         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13582         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13583         esac
13584         case "$getnetbyaddr_r_proto" in
13585         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13586         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13587         esac
13588         case "$getnetbyaddr_r_proto" in
13589         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13590         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13591         esac
13592         case "$getnetbyaddr_r_proto" in
13593         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13594         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13595         esac
13596         case "$getnetbyaddr_r_proto" in
13597         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13598         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13599         esac
13600         case "$getnetbyaddr_r_proto" in
13601         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13602         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13603         esac
13604         case "$getnetbyaddr_r_proto" in
13605         ''|0)   d_getnetbyaddr_r=undef
13606                 getnetbyaddr_r_proto=0
13607                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13608         * )     case "$getnetbyaddr_r_proto" in
13609                 REENTRANT_PROTO*) ;;
13610                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13611                 esac
13612                 echo "Prototype: $try" ;;
13613         esac
13614         ;;
13615         *)      case "$usethreads" in
13616                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13617                 esac
13618                 d_getnetbyaddr_r=undef
13619                 getnetbyaddr_r_proto=0
13620                 ;;
13621         esac
13622         ;;
13623 *)      getnetbyaddr_r_proto=0
13624         ;;
13625 esac
13626
13627 : see if getnetbyname_r exists
13628 set getnetbyname_r d_getnetbyname_r
13629 eval $inlibc
13630 case "$d_getnetbyname_r" in
13631 "$define")
13632         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13633         case "$d_getnetbyname_r_proto:$usethreads" in
13634         ":define")      d_getnetbyname_r_proto=define
13635                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13636                 eval $hasproto ;;
13637         *)      ;;
13638         esac
13639         case "$d_getnetbyname_r_proto" in
13640         define)
13641         case "$getnetbyname_r_proto" in
13642         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13643         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13644         esac
13645         case "$getnetbyname_r_proto" in
13646         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13647         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13648         esac
13649         case "$getnetbyname_r_proto" in
13650         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13651         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13652         esac
13653         case "$getnetbyname_r_proto" in
13654         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13655         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13656         esac
13657         case "$getnetbyname_r_proto" in
13658         ''|0)   d_getnetbyname_r=undef
13659                 getnetbyname_r_proto=0
13660                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13661         * )     case "$getnetbyname_r_proto" in
13662                 REENTRANT_PROTO*) ;;
13663                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13664                 esac
13665                 echo "Prototype: $try" ;;
13666         esac
13667         ;;
13668         *)      case "$usethreads" in
13669                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13670                 esac
13671                 d_getnetbyname_r=undef
13672                 getnetbyname_r_proto=0
13673                 ;;
13674         esac
13675         ;;
13676 *)      getnetbyname_r_proto=0
13677         ;;
13678 esac
13679
13680 : see if getnetent_r exists
13681 set getnetent_r d_getnetent_r
13682 eval $inlibc
13683 case "$d_getnetent_r" in
13684 "$define")
13685         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13686         case "$d_getnetent_r_proto:$usethreads" in
13687         ":define")      d_getnetent_r_proto=define
13688                 set d_getnetent_r_proto getnetent_r $hdrs
13689                 eval $hasproto ;;
13690         *)      ;;
13691         esac
13692         case "$d_getnetent_r_proto" in
13693         define)
13694         case "$getnetent_r_proto" in
13695         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13696         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13697         esac
13698         case "$getnetent_r_proto" in
13699         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13700         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13701         esac
13702         case "$getnetent_r_proto" in
13703         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13704         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13705         esac
13706         case "$getnetent_r_proto" in
13707         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13708         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13709         esac
13710         case "$getnetent_r_proto" in
13711         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13712         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13713         esac
13714         case "$getnetent_r_proto" in
13715         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13716         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13717         esac
13718         case "$getnetent_r_proto" in
13719         ''|0)   d_getnetent_r=undef
13720                 getnetent_r_proto=0
13721                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13722         * )     case "$getnetent_r_proto" in
13723                 REENTRANT_PROTO*) ;;
13724                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13725                 esac
13726                 echo "Prototype: $try" ;;
13727         esac
13728         ;;
13729         *)      case "$usethreads" in
13730                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13731                 esac
13732                 d_getnetent_r=undef
13733                 getnetent_r_proto=0
13734                 ;;
13735         esac
13736         ;;
13737 *)      getnetent_r_proto=0
13738         ;;
13739 esac
13740
13741 : see if prototypes for various getnetxxx netdb.h functions are available
13742 echo " "
13743 set d_getnetprotos getnetent $i_netdb netdb.h
13744 eval $hasproto
13745
13746 : see if getpagesize exists
13747 set getpagesize d_getpagsz
13748 eval $inlibc
13749
13750
13751 : see if getprotobyname exists
13752 set getprotobyname d_getpbyname
13753 eval $inlibc
13754
13755 : see if getprotobynumber exists
13756 set getprotobynumber d_getpbynumber
13757 eval $inlibc
13758
13759 : see if getprotoent exists
13760 set getprotoent d_getpent
13761 eval $inlibc
13762
13763 : see if getpgid exists
13764 set getpgid d_getpgid
13765 eval $inlibc
13766
13767 : see if getpgrp2 exists
13768 set getpgrp2 d_getpgrp2
13769 eval $inlibc
13770
13771 : see if getppid exists
13772 set getppid d_getppid
13773 eval $inlibc
13774
13775 : see if getpriority exists
13776 set getpriority d_getprior
13777 eval $inlibc
13778
13779 : see if getprotobyname_r exists
13780 set getprotobyname_r d_getprotobyname_r
13781 eval $inlibc
13782 case "$d_getprotobyname_r" in
13783 "$define")
13784         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13785         case "$d_getprotobyname_r_proto:$usethreads" in
13786         ":define")      d_getprotobyname_r_proto=define
13787                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13788                 eval $hasproto ;;
13789         *)      ;;
13790         esac
13791         case "$d_getprotobyname_r_proto" in
13792         define)
13793         case "$getprotobyname_r_proto" in
13794         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13795         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13796         esac
13797         case "$getprotobyname_r_proto" in
13798         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13799         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13800         esac
13801         case "$getprotobyname_r_proto" in
13802         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13803         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13804         esac
13805         case "$getprotobyname_r_proto" in
13806         ''|0)   d_getprotobyname_r=undef
13807                 getprotobyname_r_proto=0
13808                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13809         * )     case "$getprotobyname_r_proto" in
13810                 REENTRANT_PROTO*) ;;
13811                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13812                 esac
13813                 echo "Prototype: $try" ;;
13814         esac
13815         ;;
13816         *)      case "$usethreads" in
13817                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13818                 esac
13819                 d_getprotobyname_r=undef
13820                 getprotobyname_r_proto=0
13821                 ;;
13822         esac
13823         ;;
13824 *)      getprotobyname_r_proto=0
13825         ;;
13826 esac
13827
13828 : see if getprotobynumber_r exists
13829 set getprotobynumber_r d_getprotobynumber_r
13830 eval $inlibc
13831 case "$d_getprotobynumber_r" in
13832 "$define")
13833         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13834         case "$d_getprotobynumber_r_proto:$usethreads" in
13835         ":define")      d_getprotobynumber_r_proto=define
13836                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13837                 eval $hasproto ;;
13838         *)      ;;
13839         esac
13840         case "$d_getprotobynumber_r_proto" in
13841         define)
13842         case "$getprotobynumber_r_proto" in
13843         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13844         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13845         esac
13846         case "$getprotobynumber_r_proto" in
13847         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13848         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13849         esac
13850         case "$getprotobynumber_r_proto" in
13851         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13852         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13853         esac
13854         case "$getprotobynumber_r_proto" in
13855         ''|0)   d_getprotobynumber_r=undef
13856                 getprotobynumber_r_proto=0
13857                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13858         * )     case "$getprotobynumber_r_proto" in
13859                 REENTRANT_PROTO*) ;;
13860                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13861                 esac
13862                 echo "Prototype: $try" ;;
13863         esac
13864         ;;
13865         *)      case "$usethreads" in
13866                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13867                 esac
13868                 d_getprotobynumber_r=undef
13869                 getprotobynumber_r_proto=0
13870                 ;;
13871         esac
13872         ;;
13873 *)      getprotobynumber_r_proto=0
13874         ;;
13875 esac
13876
13877 : see if getprotoent_r exists
13878 set getprotoent_r d_getprotoent_r
13879 eval $inlibc
13880 case "$d_getprotoent_r" in
13881 "$define")
13882         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13883         case "$d_getprotoent_r_proto:$usethreads" in
13884         ":define")      d_getprotoent_r_proto=define
13885                 set d_getprotoent_r_proto getprotoent_r $hdrs
13886                 eval $hasproto ;;
13887         *)      ;;
13888         esac
13889         case "$d_getprotoent_r_proto" in
13890         define)
13891         case "$getprotoent_r_proto" in
13892         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13893         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13894         esac
13895         case "$getprotoent_r_proto" in
13896         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13897         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13898         esac
13899         case "$getprotoent_r_proto" in
13900         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13901         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13902         esac
13903         case "$getprotoent_r_proto" in
13904         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13905         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13906         esac
13907         case "$getprotoent_r_proto" in
13908         ''|0)   d_getprotoent_r=undef
13909                 getprotoent_r_proto=0
13910                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13911         * )     case "$getprotoent_r_proto" in
13912                 REENTRANT_PROTO*) ;;
13913                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13914                 esac
13915                 echo "Prototype: $try" ;;
13916         esac
13917         ;;
13918         *)      case "$usethreads" in
13919                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13920                 esac
13921                 d_getprotoent_r=undef
13922                 getprotoent_r_proto=0
13923                 ;;
13924         esac
13925         ;;
13926 *)      getprotoent_r_proto=0
13927         ;;
13928 esac
13929
13930 : see if prototypes for various getprotoxxx netdb.h functions are available
13931 echo " "
13932 set d_getprotoprotos getprotoent $i_netdb netdb.h
13933 eval $hasproto
13934
13935 : see if getprpwnam exists
13936 set getprpwnam d_getprpwnam
13937 eval $inlibc
13938
13939 : see if getpwent exists
13940 set getpwent d_getpwent
13941 eval $inlibc
13942
13943 : see if getpwent_r exists
13944 set getpwent_r d_getpwent_r
13945 eval $inlibc
13946 case "$d_getpwent_r" in
13947 "$define")
13948         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13949         case "$d_getpwent_r_proto:$usethreads" in
13950         ":define")      d_getpwent_r_proto=define
13951                 set d_getpwent_r_proto getpwent_r $hdrs
13952                 eval $hasproto ;;
13953         *)      ;;
13954         esac
13955         case "$d_getpwent_r_proto" in
13956         define)
13957         case "$getpwent_r_proto" in
13958         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13959         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13960         esac
13961         case "$getpwent_r_proto" in
13962         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13963         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13964         esac
13965         case "$getpwent_r_proto" in
13966         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13967         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13968         esac
13969         case "$getpwent_r_proto" in
13970         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13971         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13972         esac
13973         case "$getpwent_r_proto" in
13974         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13975         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13976         esac
13977         case "$getpwent_r_proto" in
13978         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13979         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13980         esac
13981         case "$getpwent_r_proto" in
13982         ''|0)   d_getpwent_r=undef
13983                 getpwent_r_proto=0
13984                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13985         * )     case "$getpwent_r_proto" in
13986                 REENTRANT_PROTO*) ;;
13987                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13988                 esac
13989                 echo "Prototype: $try" ;;
13990         esac
13991         ;;
13992         *)      case "$usethreads" in
13993                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13994                 esac
13995                 d_getpwent_r=undef
13996                 getpwent_r_proto=0
13997                 ;;
13998         esac
13999         ;;
14000 *)      getpwent_r_proto=0
14001         ;;
14002 esac
14003
14004 : see if getpwnam_r exists
14005 set getpwnam_r d_getpwnam_r
14006 eval $inlibc
14007 case "$d_getpwnam_r" in
14008 "$define")
14009         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14010         case "$d_getpwnam_r_proto:$usethreads" in
14011         ":define")      d_getpwnam_r_proto=define
14012                 set d_getpwnam_r_proto getpwnam_r $hdrs
14013                 eval $hasproto ;;
14014         *)      ;;
14015         esac
14016         case "$d_getpwnam_r_proto" in
14017         define)
14018         case "$getpwnam_r_proto" in
14019         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14020         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14021         esac
14022         case "$getpwnam_r_proto" in
14023         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14024         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14025         esac
14026         case "$getpwnam_r_proto" in
14027         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14028         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14029         esac
14030         case "$getpwnam_r_proto" in
14031         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14032         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14033         esac
14034         case "$getpwnam_r_proto" in
14035         ''|0)   d_getpwnam_r=undef
14036                 getpwnam_r_proto=0
14037                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14038         * )     case "$getpwnam_r_proto" in
14039                 REENTRANT_PROTO*) ;;
14040                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14041                 esac
14042                 echo "Prototype: $try" ;;
14043         esac
14044         ;;
14045         *)      case "$usethreads" in
14046                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14047                 esac
14048                 d_getpwnam_r=undef
14049                 getpwnam_r_proto=0
14050                 ;;
14051         esac
14052         ;;
14053 *)      getpwnam_r_proto=0
14054         ;;
14055 esac
14056
14057 : see if getpwuid_r exists
14058 set getpwuid_r d_getpwuid_r
14059 eval $inlibc
14060 case "$d_getpwuid_r" in
14061 "$define")
14062         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14063         case "$d_getpwuid_r_proto:$usethreads" in
14064         ":define")      d_getpwuid_r_proto=define
14065                 set d_getpwuid_r_proto getpwuid_r $hdrs
14066                 eval $hasproto ;;
14067         *)      ;;
14068         esac
14069         case "$d_getpwuid_r_proto" in
14070         define)
14071         case "$getpwuid_r_proto" in
14072         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14073         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14074         esac
14075         case "$getpwuid_r_proto" in
14076         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14077         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14078         esac
14079         case "$getpwuid_r_proto" in
14080         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14081         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14082         esac
14083         case "$getpwuid_r_proto" in
14084         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14085         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14086         esac
14087         case "$getpwuid_r_proto" in
14088         ''|0)   d_getpwuid_r=undef
14089                 getpwuid_r_proto=0
14090                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14091         * )     case "$getpwuid_r_proto" in
14092                 REENTRANT_PROTO*) ;;
14093                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14094                 esac
14095                 echo "Prototype: $try" ;;
14096         esac
14097         ;;
14098         *)      case "$usethreads" in
14099                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14100                 esac
14101                 d_getpwuid_r=undef
14102                 getpwuid_r_proto=0
14103                 ;;
14104         esac
14105         ;;
14106 *)      getpwuid_r_proto=0
14107         ;;
14108 esac
14109
14110
14111 : see if getservbyname exists
14112 set getservbyname d_getsbyname
14113 eval $inlibc
14114
14115 : see if getservbyport exists
14116 set getservbyport d_getsbyport
14117 eval $inlibc
14118
14119 : see if getservent exists
14120 set getservent d_getsent
14121 eval $inlibc
14122
14123 : see if getservbyname_r exists
14124 set getservbyname_r d_getservbyname_r
14125 eval $inlibc
14126 case "$d_getservbyname_r" in
14127 "$define")
14128         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14129         case "$d_getservbyname_r_proto:$usethreads" in
14130         ":define")      d_getservbyname_r_proto=define
14131                 set d_getservbyname_r_proto getservbyname_r $hdrs
14132                 eval $hasproto ;;
14133         *)      ;;
14134         esac
14135         case "$d_getservbyname_r_proto" in
14136         define)
14137         case "$getservbyname_r_proto" in
14138         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14139         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14140         esac
14141         case "$getservbyname_r_proto" in
14142         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14143         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14144         esac
14145         case "$getservbyname_r_proto" in
14146         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14147         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14148         esac
14149         case "$getservbyname_r_proto" in
14150         ''|0)   d_getservbyname_r=undef
14151                 getservbyname_r_proto=0
14152                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14153         * )     case "$getservbyname_r_proto" in
14154                 REENTRANT_PROTO*) ;;
14155                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14156                 esac
14157                 echo "Prototype: $try" ;;
14158         esac
14159         ;;
14160         *)      case "$usethreads" in
14161                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14162                 esac
14163                 d_getservbyname_r=undef
14164                 getservbyname_r_proto=0
14165                 ;;
14166         esac
14167         ;;
14168 *)      getservbyname_r_proto=0
14169         ;;
14170 esac
14171
14172 : see if getservbyport_r exists
14173 set getservbyport_r d_getservbyport_r
14174 eval $inlibc
14175 case "$d_getservbyport_r" in
14176 "$define")
14177         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14178         case "$d_getservbyport_r_proto:$usethreads" in
14179         ":define")      d_getservbyport_r_proto=define
14180                 set d_getservbyport_r_proto getservbyport_r $hdrs
14181                 eval $hasproto ;;
14182         *)      ;;
14183         esac
14184         case "$d_getservbyport_r_proto" in
14185         define)
14186         case "$getservbyport_r_proto" in
14187         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14188         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14189         esac
14190         case "$getservbyport_r_proto" in
14191         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14192         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14193         esac
14194         case "$getservbyport_r_proto" in
14195         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14196         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14197         esac
14198         case "$getservbyport_r_proto" in
14199         ''|0)   d_getservbyport_r=undef
14200                 getservbyport_r_proto=0
14201                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14202         * )     case "$getservbyport_r_proto" in
14203                 REENTRANT_PROTO*) ;;
14204                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14205                 esac
14206                 echo "Prototype: $try" ;;
14207         esac
14208         ;;
14209         *)      case "$usethreads" in
14210                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14211                 esac
14212                 d_getservbyport_r=undef
14213                 getservbyport_r_proto=0
14214                 ;;
14215         esac
14216         ;;
14217 *)      getservbyport_r_proto=0
14218         ;;
14219 esac
14220
14221 : see if getservent_r exists
14222 set getservent_r d_getservent_r
14223 eval $inlibc
14224 case "$d_getservent_r" in
14225 "$define")
14226         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14227         case "$d_getservent_r_proto:$usethreads" in
14228         ":define")      d_getservent_r_proto=define
14229                 set d_getservent_r_proto getservent_r $hdrs
14230                 eval $hasproto ;;
14231         *)      ;;
14232         esac
14233         case "$d_getservent_r_proto" in
14234         define)
14235         case "$getservent_r_proto" in
14236         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14237         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14238         esac
14239         case "$getservent_r_proto" in
14240         ''|0) try='int getservent_r(struct servent*, char*, int);'
14241         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14242         esac
14243         case "$getservent_r_proto" in
14244         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14245         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14246         esac
14247         case "$getservent_r_proto" in
14248         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14249         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14250         esac
14251         case "$getservent_r_proto" in
14252         ''|0)   d_getservent_r=undef
14253                 getservent_r_proto=0
14254                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14255         * )     case "$getservent_r_proto" in
14256                 REENTRANT_PROTO*) ;;
14257                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14258                 esac
14259                 echo "Prototype: $try" ;;
14260         esac
14261         ;;
14262         *)      case "$usethreads" in
14263                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14264                 esac
14265                 d_getservent_r=undef
14266                 getservent_r_proto=0
14267                 ;;
14268         esac
14269         ;;
14270 *)      getservent_r_proto=0
14271         ;;
14272 esac
14273
14274 : see if prototypes for various getservxxx netdb.h functions are available
14275 echo " "
14276 set d_getservprotos getservent $i_netdb netdb.h
14277 eval $hasproto
14278
14279 : see if getspnam exists
14280 set getspnam d_getspnam
14281 eval $inlibc
14282
14283 : see if this is a shadow.h system
14284 set shadow.h i_shadow
14285 eval $inhdr
14286
14287 : see if getspnam_r exists
14288 set getspnam_r d_getspnam_r
14289 eval $inlibc
14290 case "$d_getspnam_r" in
14291 "$define")
14292         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14293         case "$d_getspnam_r_proto:$usethreads" in
14294         ":define")      d_getspnam_r_proto=define
14295                 set d_getspnam_r_proto getspnam_r $hdrs
14296                 eval $hasproto ;;
14297         *)      ;;
14298         esac
14299         case "$d_getspnam_r_proto" in
14300         define)
14301         case "$getspnam_r_proto" in
14302         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14303         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14304         esac
14305         case "$getspnam_r_proto" in
14306         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14307         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14308         esac
14309         case "$getspnam_r_proto" in
14310         ''|0)   d_getspnam_r=undef
14311                 getspnam_r_proto=0
14312                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14313         * )     case "$getspnam_r_proto" in
14314                 REENTRANT_PROTO*) ;;
14315                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14316                 esac
14317                 echo "Prototype: $try" ;;
14318         esac
14319         ;;
14320         *)      case "$usethreads" in
14321                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14322                 esac
14323                 d_getspnam_r=undef
14324                 getspnam_r_proto=0
14325                 ;;
14326         esac
14327         ;;
14328 *)      getspnam_r_proto=0
14329         ;;
14330 esac
14331
14332 : see if gettimeofday or ftime exists
14333 set gettimeofday d_gettimeod
14334 eval $inlibc
14335 case "$d_gettimeod" in
14336 "$undef")
14337         set ftime d_ftime 
14338         eval $inlibc
14339         ;;
14340 *)
14341         val="$undef"; set d_ftime; eval $setvar
14342         ;;
14343 esac
14344 case "$d_gettimeod$d_ftime" in
14345 "$undef$undef")
14346         echo " "
14347         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14348         ;;
14349 esac
14350
14351 : see if gmtime_r exists
14352 set gmtime_r d_gmtime_r
14353 eval $inlibc
14354 case "$d_gmtime_r" in
14355 "$define")
14356         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14357         case "$d_gmtime_r_proto:$usethreads" in
14358         ":define")      d_gmtime_r_proto=define
14359                 set d_gmtime_r_proto gmtime_r $hdrs
14360                 eval $hasproto ;;
14361         *)      ;;
14362         esac
14363         case "$d_gmtime_r_proto" in
14364         define)
14365         case "$gmtime_r_proto" in
14366         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14367         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14368         esac
14369         case "$gmtime_r_proto" in
14370         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14371         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14372         esac
14373         case "$gmtime_r_proto" in
14374         ''|0)   d_gmtime_r=undef
14375                 gmtime_r_proto=0
14376                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14377         * )     case "$gmtime_r_proto" in
14378                 REENTRANT_PROTO*) ;;
14379                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14380                 esac
14381                 echo "Prototype: $try" ;;
14382         esac
14383         ;;
14384         *)      case "$usethreads" in
14385                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14386                 esac
14387                 d_gmtime_r=undef
14388                 gmtime_r_proto=0
14389                 ;;
14390         esac
14391         ;;
14392 *)      gmtime_r_proto=0
14393         ;;
14394 esac
14395
14396 : see if hasmntopt exists
14397 set hasmntopt d_hasmntopt
14398 eval $inlibc
14399
14400 : see if this is a netinet/in.h or sys/in.h system
14401 set netinet/in.h i_niin sys/in.h i_sysin
14402 eval $inhdr
14403
14404 : see if arpa/inet.h has to be included
14405 set arpa/inet.h i_arpainet
14406 eval $inhdr
14407
14408 : see if htonl --and friends-- exists
14409 val=''
14410 set htonl val
14411 eval $inlibc
14412
14413 : Maybe they are macros.
14414 case "$val" in
14415 $undef)
14416         $cat >htonl.c <<EOM
14417 #include <stdio.h>
14418 #include <sys/types.h>
14419 #$i_niin I_NETINET_IN
14420 #$i_sysin I_SYS_IN
14421 #$i_arpainet I_ARPA_INET
14422 #ifdef I_NETINET_IN
14423 #include <netinet/in.h>
14424 #endif
14425 #ifdef I_SYS_IN
14426 #include <sys/in.h>
14427 #endif
14428 #ifdef I_ARPA_INET
14429 #include <arpa/inet.h>
14430 #endif
14431 #ifdef htonl
14432 printf("Defined as a macro.");
14433 #endif
14434 EOM
14435         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14436         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14437                 val="$define"
14438                 echo "But it seems to be defined as a macro." >&4
14439         fi
14440         $rm -f htonl.?
14441         ;;
14442 esac
14443 set d_htonl
14444 eval $setvar
14445
14446 : see if ilogbl exists
14447 set ilogbl d_ilogbl
14448 eval $inlibc
14449
14450 : index or strchr
14451 echo " "
14452 if set index val -f; eval $csym; $val; then
14453         if set strchr val -f d_strchr; eval $csym; $val; then
14454                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14455                         val="$define"
14456                         vali="$undef"
14457                         echo "strchr() found." >&4
14458                 else
14459                         val="$undef"
14460                         vali="$define"
14461                         echo "index() found." >&4
14462                 fi
14463         else
14464                 val="$undef"
14465                 vali="$define"
14466                 echo "index() found." >&4
14467         fi
14468 else
14469         if set strchr val -f d_strchr; eval $csym; $val; then
14470                 val="$define"
14471                 vali="$undef"
14472                 echo "strchr() found." >&4
14473         else
14474                 echo "No index() or strchr() found!" >&4
14475                 val="$undef"
14476                 vali="$undef"
14477         fi
14478 fi
14479 set d_strchr; eval $setvar
14480 val="$vali"
14481 set d_index; eval $setvar
14482
14483 : check whether inet_aton exists
14484 set inet_aton d_inetaton
14485 eval $inlibc
14486
14487 : Look for isascii
14488 echo " "
14489 $cat >isascii.c <<EOCP
14490 #include <stdio.h>
14491 #include <ctype.h>
14492 #$i_stdlib I_STDLIB
14493 #ifdef I_STDLIB
14494 #include <stdlib.h>
14495 #endif
14496 int main() {
14497         int c = 'A';
14498         if (isascii(c))
14499                 exit(0);
14500         else
14501                 exit(1);
14502 }
14503 EOCP
14504 set isascii
14505 if eval $compile; then
14506         echo "isascii() found." >&4
14507         val="$define"
14508 else
14509         echo "isascii() NOT found." >&4
14510         val="$undef"
14511 fi
14512 set d_isascii
14513 eval $setvar
14514 $rm -f isascii*
14515
14516 : see if isfinite exists
14517 set isfinite d_isfinite
14518 eval $inlibc
14519
14520 : see if isinf exists
14521 set isinf d_isinf
14522 eval $inlibc
14523
14524 : see if isnan exists
14525 set isnan d_isnan
14526 eval $inlibc
14527
14528 : see if isnanl exists
14529 set isnanl d_isnanl
14530 eval $inlibc
14531
14532 : see if killpg exists
14533 set killpg d_killpg
14534 eval $inlibc
14535
14536 : see if lchown exists
14537 echo " "
14538 $cat > try.c <<'EOCP'
14539 /* System header to define __stub macros and hopefully few prototypes,
14540     which can conflict with char lchown(); below.  */
14541 #include <assert.h>
14542 /* Override any gcc2 internal prototype to avoid an error.  */
14543 /* We use char because int might match the return type of a gcc2
14544    builtin and then its argument prototype would still apply.  */
14545 char lchown();
14546 int main() {
14547     /*  The GNU C library defines this for functions which it implements
14548         to always fail with ENOSYS.  Some functions are actually named
14549         something starting with __ and the normal name is an alias.  */
14550 #if defined (__stub_lchown) || defined (__stub___lchown)
14551 choke me
14552 #else
14553 lchown();
14554 #endif
14555 ; return 0; }
14556 EOCP
14557 set try
14558 if eval $compile; then
14559     $echo "lchown() found." >&4
14560     val="$define"
14561 else
14562     $echo "lchown() NOT found." >&4
14563     val="$undef"
14564 fi
14565 set d_lchown
14566 eval $setvar
14567
14568 : See if number of significant digits in a double precision number is known
14569 echo " "
14570 $cat >ldbl_dig.c <<EOM
14571 #$i_limits I_LIMITS
14572 #$i_float I_FLOAT
14573 #ifdef I_LIMITS
14574 #include <limits.h>
14575 #endif
14576 #ifdef I_FLOAT
14577 #include <float.h>
14578 #endif
14579 #ifdef LDBL_DIG
14580 printf("Contains LDBL_DIG");
14581 #endif
14582 EOM
14583 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14584 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14585         echo "LDBL_DIG found." >&4
14586         val="$define"
14587 else
14588         echo "LDBL_DIG NOT found." >&4
14589         val="$undef"
14590 fi
14591 $rm -f ldbl_dig.?
14592 set d_ldbl_dig
14593 eval $setvar
14594
14595 : see if this is a math.h system
14596 set math.h i_math
14597 eval $inhdr
14598
14599 d_libm_lib_version="$undef"
14600 case $i_math in
14601     $define)
14602         : check to see if math.h defines _LIB_VERSION
14603         echo " "
14604         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14605         $cat >try.c <<EOCP
14606 #include <unistd.h>
14607 #include <math.h>
14608 int main (int argc, char *argv[])
14609 {
14610     printf ("%d\n", _LIB_VERSION);
14611     return (0);
14612     } /* main */
14613 EOCP
14614         set try
14615         if eval $compile; then
14616             foo=`$run ./try`
14617             echo "Yes, it does ($foo)" >&4
14618             d_libm_lib_version="$define"
14619         else
14620             echo "No, it does not (probably harmless)" >&4
14621             fi
14622         $rm_try
14623         ;;
14624
14625     esac
14626
14627 : see if link exists
14628 set link d_link
14629 eval $inlibc
14630
14631 : see if localtime_r exists
14632 set localtime_r d_localtime_r
14633 eval $inlibc
14634 case "$d_localtime_r" in
14635 "$define")
14636         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14637         case "$d_localtime_r_proto:$usethreads" in
14638         ":define")      d_localtime_r_proto=define
14639                 set d_localtime_r_proto localtime_r $hdrs
14640                 eval $hasproto ;;
14641         *)      ;;
14642         esac
14643         case "$d_localtime_r_proto" in
14644         define)
14645         case "$localtime_r_proto" in
14646         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14647         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14648         esac
14649         case "$localtime_r_proto" in
14650         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14651         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14652         esac
14653         case "$localtime_r_proto" in
14654         ''|0)   d_localtime_r=undef
14655                 localtime_r_proto=0
14656                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14657         * )     case "$localtime_r_proto" in
14658                 REENTRANT_PROTO*) ;;
14659                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14660                 esac
14661                 echo "Prototype: $try" ;;
14662         esac
14663         ;;
14664         *)      case "$usethreads" in
14665                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14666                 esac
14667                 d_localtime_r=undef
14668                 localtime_r_proto=0
14669                 ;;
14670         esac
14671         ;;
14672 *)      localtime_r_proto=0
14673         ;;
14674 esac
14675
14676 : see if localtime_r calls tzset
14677 case "$localtime_r_proto" in
14678 REENTRANT_PROTO*)
14679         $cat >try.c <<EOCP
14680 /*  Does our libc's localtime_r call tzset ?
14681  *  return 0 if so, 1 otherwise.
14682  */
14683 #include <sys/types.h>
14684 #include <unistd.h>
14685 #include <time.h>
14686 #include <string.h>
14687 #include <malloc.h>
14688 int main()
14689 {
14690     time_t t = time(0L);
14691     char w_tz[]="TZ" "=GMT+5",
14692          e_tz[]="TZ" "=GMT-5",
14693         *tz_e = (char*)malloc(16),
14694         *tz_w = (char*)malloc(16);
14695     struct tm tm_e, tm_w;
14696     memset(&tm_e,'\0',sizeof(struct tm));
14697     memset(&tm_w,'\0',sizeof(struct tm));
14698     strcpy(tz_e,e_tz);
14699     strcpy(tz_w,w_tz);
14700
14701     putenv(tz_e);
14702     localtime_r(&t, &tm_e);
14703
14704     putenv(tz_w);
14705     localtime_r(&t, &tm_w);
14706
14707     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14708         return 1;
14709     return 0;
14710 }
14711 EOCP
14712         set try
14713         if eval $compile; then
14714             if $run ./try; then
14715                 d_localtime_r_needs_tzset=undef;
14716             else
14717                 d_localtime_r_needs_tzset=define;
14718             fi;
14719         else
14720             d_localtime_r_needs_tzset=undef;
14721         fi;
14722      ;;
14723   *)
14724      d_localtime_r_needs_tzset=undef;
14725      ;;
14726 esac
14727 $rm_try
14728
14729 : see if localeconv exists
14730 set localeconv d_locconv
14731 eval $inlibc
14732
14733 : see if lockf exists
14734 set lockf d_lockf
14735 eval $inlibc
14736
14737 : see if prototype for lseek is available
14738 echo " "
14739 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14740 eval $hasproto
14741
14742 : see if lstat exists
14743 set lstat d_lstat
14744 eval $inlibc
14745
14746 : see if madvise exists
14747 set madvise d_madvise
14748 eval $inlibc
14749
14750 : see if malloc_size exists
14751 set malloc_size d_malloc_size
14752 eval $inlibc
14753
14754 : see if malloc_size_good exists
14755 set malloc_good_size d_malloc_good_size
14756 eval $inlibc
14757
14758 : see if mblen exists
14759 set mblen d_mblen
14760 eval $inlibc
14761
14762 : see if mbstowcs exists
14763 set mbstowcs d_mbstowcs
14764 eval $inlibc
14765
14766 : see if mbtowc exists
14767 set mbtowc d_mbtowc
14768 eval $inlibc
14769
14770 : see if memchr exists
14771 set memchr d_memchr
14772 eval $inlibc
14773
14774 : see if memcmp exists
14775 set memcmp d_memcmp
14776 eval $inlibc
14777
14778 : see if memcpy exists
14779 set memcpy d_memcpy
14780 eval $inlibc
14781
14782 : see if memmove exists
14783 set memmove d_memmove
14784 eval $inlibc
14785
14786 : see if memset exists
14787 set memset d_memset
14788 eval $inlibc
14789
14790 : see if mkdir exists
14791 set mkdir d_mkdir
14792 eval $inlibc
14793
14794 : see if mkdtemp exists
14795 set mkdtemp d_mkdtemp
14796 eval $inlibc
14797
14798 : see if mkfifo exists
14799 set mkfifo d_mkfifo
14800 eval $inlibc
14801
14802 : see if mkstemp exists
14803 set mkstemp d_mkstemp
14804 eval $inlibc
14805
14806 : see if mkstemps exists
14807 set mkstemps d_mkstemps
14808 eval $inlibc
14809
14810 : see if mktime exists
14811 set mktime d_mktime
14812 eval $inlibc
14813
14814 : see if this is a sys/mman.h system
14815 set sys/mman.h i_sysmman
14816 eval $inhdr
14817
14818 : see if mmap exists
14819 set mmap d_mmap
14820 eval $inlibc
14821 : see what shmat returns
14822 : default to something harmless
14823 mmaptype='void *'
14824 case "$i_sysmman$d_mmap" in
14825 "$define$define")
14826         $cat >mmap.c <<'END'
14827 #include <sys/mman.h>
14828 void *mmap();
14829 END
14830         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14831                 mmaptype='void *'
14832         else
14833                 mmaptype='caddr_t'
14834         fi
14835         echo "and it returns ($mmaptype)." >&4
14836         ;;
14837 esac
14838
14839
14840
14841 : see if sqrtl exists
14842 set sqrtl d_sqrtl
14843 eval $inlibc
14844
14845 : see if scalbnl exists
14846 set scalbnl d_scalbnl
14847 eval $inlibc
14848
14849 : see if modfl exists
14850 set modfl d_modfl
14851 eval $inlibc
14852
14853 : see if prototype for modfl is available
14854 echo " "
14855 set d_modflproto modfl $i_math math.h
14856 eval $hasproto
14857
14858 d_modfl_pow32_bug="$undef"
14859
14860 case "$d_longdbl$d_modfl" in
14861 $define$define)
14862         $cat <<EOM
14863 Checking to see whether your modfl() is okay for large values...
14864 EOM
14865 $cat >try.c <<EOCP
14866 #include <math.h>
14867 #include <stdio.h>
14868 EOCP
14869 if $test "X$d_modflproto" != "X$define"; then
14870         $cat >>try.c <<EOCP
14871 /* Sigh. many current glibcs provide the function, but do not prototype it. */
14872 long double modfl (long double, long double *);
14873 EOCP
14874 fi
14875 $cat >>try.c <<EOCP
14876 int main() {
14877     long double nv = 4294967303.15;
14878     long double v, w;
14879     v = modfl(nv, &w);
14880 #ifdef __GLIBC__
14881     printf("glibc");
14882 #endif
14883     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14884     return 0;
14885 }
14886 EOCP
14887         case "$osname:$gccversion" in
14888         aix:)   saveccflags="$ccflags"
14889                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14890         esac
14891         set try
14892         if eval $compile; then
14893                 foo=`$run ./try`
14894                 case "$foo" in
14895                 *" 4294967303.150000 1.150000 4294967302.000000")
14896                         echo >&4 "Your modfl() is broken for large values."
14897                         d_modfl_pow32_bug="$define"
14898                         case "$foo" in
14899                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14900                         ;;
14901                         esac
14902                         ;;
14903                 *" 4294967303.150000 0.150000 4294967303.000000")
14904                         echo >&4 "Your modfl() seems okay for large values."
14905                         ;;
14906                 *)      echo >&4 "I don't understand your modfl() at all."
14907                         d_modfl="$undef"
14908                         ;;
14909                 esac
14910                 $rm_try
14911         else
14912                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14913                 d_modfl="$undef"
14914         fi
14915         case "$osname:$gccversion" in
14916         aix:)   ccflags="$saveccflags" ;; # restore
14917         esac
14918         ;;
14919 esac
14920
14921 if $test "$uselongdouble" = "$define"; then
14922     message=""
14923     if $test "$d_sqrtl" != "$define"; then
14924         message="$message sqrtl"
14925     fi
14926     if $test "$d_modfl" != "$define"; then
14927         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14928             echo "You have both aintl and copysignl, so I can emulate modfl."
14929         else
14930             message="$message modfl"
14931         fi
14932     fi
14933     if $test "$d_frexpl" != "$define"; then
14934         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14935             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14936         else
14937             message="$message frexpl"
14938         fi
14939     fi
14940
14941     if $test "$message" != ""; then
14942         $cat <<EOM >&4
14943
14944 *** You requested the use of long doubles but you do not seem to have
14945 *** the following mathematical functions needed for long double support:
14946 ***    $message
14947 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14948 *** Cannot continue, aborting.
14949
14950 EOM
14951
14952         exit 1
14953     fi
14954 fi
14955
14956 : see if mprotect exists
14957 set mprotect d_mprotect
14958 eval $inlibc
14959
14960 : see if msgctl exists
14961 set msgctl d_msgctl
14962 eval $inlibc
14963
14964 : see if msgget exists
14965 set msgget d_msgget
14966 eval $inlibc
14967
14968 : see if msgsnd exists
14969 set msgsnd d_msgsnd
14970 eval $inlibc
14971
14972 : see if msgrcv exists
14973 set msgrcv d_msgrcv
14974 eval $inlibc
14975
14976 : see how much of the 'msg*(2)' library is present.
14977 h_msg=true
14978 echo " "
14979 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14980 *"$undef"*) h_msg=false;;
14981 esac
14982 case "$osname" in
14983 freebsd)
14984     case "`ipcs 2>&1`" in
14985     "SVID messages"*"not configured"*)
14986         echo "Your $osname does not have the msg*(2) configured." >&4
14987         h_msg=false
14988         val="$undef"
14989         set msgctl d_msgctl
14990         eval $setvar
14991         set msgget d_msgget
14992         eval $setvar
14993         set msgsnd d_msgsnd
14994         eval $setvar
14995         set msgrcv d_msgrcv
14996         eval $setvar
14997         ;;
14998     esac
14999     ;;
15000 esac
15001 : we could also check for sys/ipc.h ...
15002 if $h_msg && $test `./findhdr sys/msg.h`; then
15003         echo "You have the full msg*(2) library." >&4
15004         val="$define"
15005 else
15006         echo "You don't have the full msg*(2) library." >&4
15007         val="$undef"
15008 fi
15009 set d_msg
15010 eval $setvar
15011
15012
15013 echo " "
15014 echo "Checking to see if your system supports struct msghdr..." >&4
15015 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15016 eval $hasstruct
15017 case "$d_msghdr_s" in
15018 "$define")      echo "Yes, it does."   ;;
15019 *)              echo "No, it doesn't." ;;
15020 esac
15021
15022
15023 : see if msync exists
15024 set msync d_msync
15025 eval $inlibc
15026
15027 : see if munmap exists
15028 set munmap d_munmap
15029 eval $inlibc
15030
15031 : see if nice exists
15032 set nice d_nice
15033 eval $inlibc
15034
15035 : see if this is a langinfo.h system
15036 set langinfo.h i_langinfo
15037 eval $inhdr
15038
15039 : see if nl_langinfo exists
15040 set nl_langinfo d_nl_langinfo
15041 eval $inlibc
15042
15043 : check for length of character
15044 echo " "
15045 case "$charsize" in
15046 '')
15047         echo "Checking to see how big your characters are (hey, you never know)..." >&4
15048         $cat >try.c <<EOCP
15049 #include <stdio.h>
15050 #$i_stdlib I_STDLIB
15051 #ifdef I_STDLIB
15052 #include <stdlib.h>
15053 #endif
15054 int main()
15055 {
15056     printf("%d\n", (int)sizeof(char));
15057     exit(0);
15058 }
15059 EOCP
15060         set try
15061         if eval $compile_ok; then
15062                 dflt=`$run ./try`
15063         else
15064                 dflt='1'
15065                 echo "(I can't seem to compile the test program.  Guessing...)"
15066         fi
15067         ;;
15068 *)
15069         dflt="$charsize"
15070         ;;
15071 esac
15072 rp="What is the size of a character (in bytes)?"
15073 . ./myread
15074 charsize="$ans"
15075 $rm_try
15076
15077 : check for volatile keyword
15078 echo " "
15079 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15080 $cat >try.c <<'EOCP'
15081 int main()
15082 {
15083         typedef struct _goo_struct goo_struct;
15084         goo_struct * volatile goo = ((goo_struct *)0);
15085         struct _goo_struct {
15086                 long long_int;
15087                 int reg_int;
15088                 char char_var;
15089         };
15090         typedef unsigned short foo_t;
15091         char *volatile foo;
15092         volatile int bar;
15093         volatile foo_t blech;
15094         foo = foo;
15095 }
15096 EOCP
15097 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15098         val="$define"
15099         echo "Yup, it does."
15100 else
15101         val="$undef"
15102         echo "Nope, it doesn't."
15103 fi
15104 set d_volatile
15105 eval $setvar
15106 $rm_try
15107
15108
15109 echo " "
15110 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15111
15112 case "$use64bitint:$d_quad:$quadtype" in
15113 define:define:?*)
15114         ivtype="$quadtype"
15115         uvtype="$uquadtype"
15116         ivsize=8
15117         uvsize=8
15118         ;;
15119 *)      ivtype="long"
15120         uvtype="unsigned long"
15121         ivsize=$longsize
15122         uvsize=$longsize
15123         ;;
15124 esac
15125
15126 case "$uselongdouble:$d_longdbl" in
15127 define:define)
15128         nvtype="long double"
15129         nvsize=$longdblsize
15130         ;;
15131 *)      nvtype=double
15132         nvsize=$doublesize
15133         ;;
15134 esac
15135
15136 $echo "(IV will be "$ivtype", $ivsize bytes)"
15137 $echo "(UV will be "$uvtype", $uvsize bytes)"
15138 $echo "(NV will be "$nvtype", $nvsize bytes)"
15139
15140 $cat >try.c <<EOCP
15141 #$i_inttypes I_INTTYPES
15142 #ifdef I_INTTYPES
15143 #include <inttypes.h>
15144 #endif
15145 #include <stdio.h>
15146 int main() {
15147 #ifdef INT8
15148    int8_t i =  INT8_MAX;
15149   uint8_t u = UINT8_MAX;
15150   printf("int8_t\n");
15151 #endif
15152 #ifdef INT16
15153    int16_t i =  INT16_MAX;
15154   uint16_t i = UINT16_MAX;
15155   printf("int16_t\n");
15156 #endif
15157 #ifdef INT32
15158    int32_t i =  INT32_MAX;
15159   uint32_t u = UINT32_MAX;
15160   printf("int32_t\n");
15161 #endif
15162 }
15163 EOCP
15164
15165 case "$i8type" in
15166 '')     case "$charsize" in
15167         1)      i8type=char
15168                 u8type="unsigned char"
15169                 i8size=$charsize
15170                 u8size=$charsize
15171                 ;;
15172         esac
15173         ;;
15174 esac
15175 case "$i8type" in
15176 '')     set try -DINT8
15177         if eval $compile; then
15178                 case "`$run ./try`" in
15179                 int8_t) i8type=int8_t
15180                         u8type=uint8_t
15181                         i8size=1
15182                         u8size=1
15183                         ;;
15184                 esac
15185         fi
15186         ;;
15187 esac
15188 case "$i8type" in
15189 '')     if $test $charsize -ge 1; then
15190                 i8type=char
15191                 u8type="unsigned char"
15192                 i8size=$charsize
15193                 u8size=$charsize
15194         fi
15195         ;;
15196 esac
15197
15198 case "$i16type" in
15199 '')     case "$shortsize" in
15200         2)      i16type=short
15201                 u16type="unsigned short"
15202                 i16size=$shortsize
15203                 u16size=$shortsize
15204                 ;;
15205         esac
15206         ;;
15207 esac
15208 case "$i16type" in
15209 '')     set try -DINT16
15210         if eval $compile; then
15211                 case "`$run ./try`" in
15212                 int16_t)
15213                         i16type=int16_t
15214                         u16type=uint16_t
15215                         i16size=2
15216                         u16size=2
15217                         ;;
15218                 esac
15219         fi
15220         ;;
15221 esac
15222 case "$i16type" in
15223 '')     if $test $shortsize -ge 2; then
15224                 i16type=short
15225                 u16type="unsigned short"
15226                 i16size=$shortsize
15227                 u16size=$shortsize
15228         fi
15229         ;;
15230 esac
15231
15232 case "$i32type" in
15233 '')     case "$longsize" in
15234         4)      i32type=long
15235                 u32type="unsigned long"
15236                 i32size=$longsize
15237                 u32size=$longsize
15238                 ;;
15239         *)      case "$intsize" in
15240                 4)      i32type=int
15241                         u32type="unsigned int"
15242                         i32size=$intsize
15243                         u32size=$intsize
15244                         ;;
15245                 esac
15246                 ;;
15247         esac
15248         ;;
15249 esac
15250 case "$i32type" in
15251 '')     set try -DINT32
15252         if eval $compile; then
15253                 case "`$run ./try`" in
15254                 int32_t)
15255                         i32type=int32_t
15256                         u32type=uint32_t
15257                         i32size=4
15258                         u32size=4
15259                         ;;
15260                 esac
15261         fi
15262         ;;
15263 esac
15264 case "$i32type" in
15265 '')     if $test $intsize -ge 4; then
15266                 i32type=int
15267                 u32type="unsigned int"
15268                 i32size=$intsize
15269                 u32size=$intsize
15270         fi
15271         ;;
15272 esac
15273
15274 case "$i64type" in
15275 '')     case "$d_quad:$quadtype" in
15276         define:?*)
15277                 i64type="$quadtype"
15278                 u64type="$uquadtype"
15279                 i64size=8
15280                 u64size=8
15281                 ;;
15282         esac
15283         ;;
15284 esac
15285
15286 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15287 : volatile so that the compiler has to store it out to memory.
15288 if test X"$d_volatile" = X"$define"; then
15289         volatile=volatile
15290 fi
15291 $cat <<EOP >try.c
15292 #include <stdio.h>
15293 #$i_stdlib I_STDLIB
15294 #ifdef I_STDLIB
15295 #include <stdlib.h>
15296 #endif
15297 #include <sys/types.h>
15298 #include <signal.h>
15299 #ifdef SIGFPE
15300 $volatile int bletched = 0;
15301 $signal_t blech(int s) { bletched = 1; }
15302 #endif
15303 int main() {
15304     $uvtype u = 0;
15305     $nvtype d;
15306     int     n = 8 * $uvsize;
15307     int     i;
15308 #ifdef SIGFPE
15309     signal(SIGFPE, blech);
15310 #endif
15311
15312     for (i = 0; i < n; i++) {
15313       u = u << 1 | ($uvtype)1;
15314       d = ($nvtype)u;
15315       if (($uvtype)d != u)
15316         break;
15317       if (d <= 0)
15318         break;
15319       d = ($nvtype)(u - 1);
15320       if (($uvtype)d != (u - 1))
15321         break;
15322 #ifdef SIGFPE
15323       if (bletched)
15324         break;
15325 #endif
15326     }
15327     printf("%d\n", ((i == n) ? -n : i));
15328     exit(0);
15329 }
15330 EOP
15331 set try
15332
15333 d_nv_preserves_uv="$undef"
15334 if eval $compile; then
15335         nv_preserves_uv_bits="`$run ./try`"
15336 fi
15337 case "$nv_preserves_uv_bits" in
15338 \-[1-9]*)
15339         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15340         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15341         d_nv_preserves_uv="$define"
15342         ;;
15343 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15344         d_nv_preserves_uv="$undef" ;;
15345 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15346         nv_preserves_uv_bits="0" ;;
15347 esac
15348 $rm_try
15349
15350 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15351 : volatile so that the compiler has to store it out to memory.
15352 if test X"$d_volatile" = X"$define"; then
15353         volatile=volatile
15354 fi
15355 $cat <<EOP >try.c
15356 #include <stdio.h>
15357 #$i_stdlib I_STDLIB
15358 #ifdef I_STDLIB
15359 #include <stdlib.h>
15360 #endif
15361 #$i_string I_STRING
15362 #ifdef I_STRING
15363 #  include <string.h>
15364 #else
15365 #  include <strings.h>
15366 #endif
15367 #include <sys/types.h>
15368 #include <signal.h>
15369 #ifdef SIGFPE
15370 $volatile int bletched = 0;
15371 $signal_t blech(int s) { bletched = 1; }
15372 #endif
15373
15374 int checkit($nvtype d, char *where) {
15375     unsigned char *p = (char *)&d;
15376     unsigned char *end = p + sizeof(d);
15377     int fail = 0;
15378
15379     while (p < end)
15380         fail += *p++;
15381
15382     if (!fail)
15383         return 0;
15384
15385     p = (char *)&d;
15386     printf("No - %s: 0x", where);
15387     while (p < end)
15388         printf ("%02X", *p++);
15389     printf("\n");
15390     return 1;
15391 }
15392
15393 int main(int argc, char **argv) {
15394     $nvtype d = 0.0;
15395     int fail = 0;
15396     fail += checkit(d, "0.0");
15397
15398     /* The compiler shouldn't be assuming that bletched is 0  */
15399     d = bletched;
15400
15401     fail += checkit(d, "bleched");
15402
15403 #ifdef SIGFPE
15404     signal(SIGFPE, blech);
15405 #endif
15406
15407     /* Paranoia - the compiler should have no way of knowing that ANSI says
15408        that argv[argc] will always be NULL.  Actually, if it did assume this it
15409        would be buggy, as this is C and main() can be called from elsewhere in
15410        the program.  */
15411     d = argv[argc] ? 1 : 0;
15412
15413     if (d) {
15414         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15415     }
15416
15417     fail += checkit(d, "ternary");
15418
15419     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15420
15421     if (d != 0.0) {
15422         printf("No - memset doesn't give 0.0\n");
15423         /* This might just blow up:  */
15424         printf("(gives %g)\n", d);
15425         return 1;
15426     }
15427
15428 #ifdef SIGFPE
15429     if (bletched) {
15430         printf("No - something bleched\n");
15431         return 1;
15432     }
15433 #endif
15434     if (fail) {
15435       printf("No - %d fail(s)\n", fail);
15436       return 1;
15437     }
15438     printf("Yes\n");
15439     return 0;
15440 }
15441 EOP
15442 set try
15443
15444 d_nv_zero_is_allbits_zero="$undef"
15445 if eval $compile; then
15446     xxx="`$run ./try`"
15447     case "$?" in
15448         0)
15449             case "$xxx" in
15450                 Yes)  cat >&4 <<EOM
15451 0.0 is represented as all bits zero in memory
15452 EOM
15453                     d_nv_zero_is_allbits_zero="$define"
15454                     ;;
15455                 *)  cat >&4 <<EOM
15456 0.0 is not represented as all bits zero in memory
15457 EOM
15458                     d_nv_zero_is_allbits_zero="$undef"
15459                     ;;
15460             esac
15461             ;;
15462         *)  cat >&4 <<EOM
15463 0.0 is not represented as all bits zero in memory
15464 EOM
15465             d_nv_zero_is_allbits_zero="$undef"
15466             ;;
15467     esac
15468 fi
15469 $rm_try
15470
15471 : check for off64_t
15472 echo " "
15473 echo "Checking to see if you have off64_t..." >&4
15474 $cat >try.c <<EOCP
15475 #include <sys/types.h>
15476 #include <unistd.h>
15477 int main() { off64_t x = 7; }
15478 EOCP
15479 set try
15480 if eval $compile; then
15481         val="$define"
15482         echo "You have off64_t."
15483 else
15484         val="$undef"
15485         echo "You do not have off64_t."
15486         case "$lseeksize" in
15487         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15488         esac
15489 fi
15490 $rm_try
15491 set d_off64_t
15492 eval $setvar
15493
15494 : how to create joinable pthreads
15495 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15496         echo " "
15497         echo "Checking what constant to use for creating joinable pthreads..." >&4
15498         $cat >try.c <<'EOCP'
15499 #include <pthread.h>
15500 int main() {
15501     int detachstate = JOINABLE;
15502 }
15503 EOCP
15504         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15505         if eval $compile; then
15506                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15507                 val="$undef" # Yes, undef.
15508                 set d_old_pthread_create_joinable
15509                 eval $setvar
15510                 val=""
15511                 set old_pthread_create_joinable
15512                 eval $setvar
15513         else
15514                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15515                 if eval $compile; then
15516                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15517                         val="$define"
15518                         set d_old_pthread_create_joinable
15519                         eval $setvar
15520                         val=PTHREAD_CREATE_UNDETACHED
15521                         set old_pthread_create_joinable
15522                         eval $setvar
15523                 else
15524                         set try -DJOINABLE=__UNDETACHED
15525                         if eval $compile; then
15526                                 echo "You seem to use __UNDETACHED." >&4
15527                                 val="$define"
15528                                 set d_old_pthread_create_joinable
15529                                 eval $setvar
15530                                 val=__UNDETACHED
15531                                 set old_pthread_create_joinable
15532                                 eval $setvar
15533                         else
15534                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15535                                 val="$define"
15536                                 set d_old_pthread_create_joinable
15537                                 eval $setvar
15538                                 val=0
15539                                 set old_pthread_create_joinable
15540                                 eval $setvar
15541                         fi
15542                 fi
15543         fi
15544         $rm_try
15545 else
15546     d_old_pthread_create_joinable="$undef"
15547     old_pthread_create_joinable=""
15548 fi
15549
15550 : see if pause exists
15551 set pause d_pause
15552 eval $inlibc
15553
15554 : see if poll exists
15555 set poll d_poll
15556 eval $inlibc
15557
15558 : see if readlink exists
15559 set readlink d_readlink
15560 eval $inlibc
15561
15562 echo " "
15563 procselfexe=''
15564 val="$undef"
15565 case "$d_readlink" in
15566 "$define")
15567         if $issymlink /proc/self/exe ; then
15568                 $ls -l /proc/self/exe > reflect
15569                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15570                         echo "You have Linux-like /proc/self/exe."
15571                         procselfexe='"/proc/self/exe"'
15572                         val="$define"
15573                 fi
15574         fi
15575         if $issymlink /proc/curproc/file ; then
15576                 $ls -l /proc/curproc/file > reflect
15577                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15578                         echo "You have BSD-like /proc/curproc/file."
15579                         procselfexe='"/proc/curproc/file"'
15580                         val="$define"
15581                 fi
15582         fi
15583         ;;
15584 esac
15585 $rm -f reflect
15586 set d_procselfexe
15587 eval $setvar
15588
15589 : backward compatibility for d_hvfork
15590 if test X$d_hvfork != X; then
15591         d_vfork="$d_hvfork"
15592         d_hvfork=''
15593 fi
15594 : see if there is a vfork
15595 val=''
15596 set vfork val
15597 eval $inlibc
15598
15599 d_pseudofork=$undef
15600
15601 : Ok, but do we want to use it. vfork is reportedly unreliable in
15602 : perl on Solaris 2.x, and probably elsewhere.
15603 case "$val" in
15604 $define)
15605         echo " "
15606         case "$usevfork" in
15607         false) dflt='n';;
15608         *) dflt='y';;
15609         esac
15610         cat <<'EOM'
15611
15612 Perl can only use a vfork() that doesn't suffer from strict
15613 restrictions on calling functions or modifying global data in
15614 the child.  For example, glibc-2.1 contains such a vfork()
15615 that is unsuitable.  If your system provides a proper fork()
15616 call, chances are that you do NOT want perl to use vfork().
15617
15618 EOM
15619         rp="Do you still want to use vfork()?"
15620         . ./myread
15621         case "$ans" in
15622         y|Y) ;;
15623         *)
15624                 echo "Ok, we won't use vfork()."
15625                 val="$undef"
15626                 ;;
15627         esac
15628         ;;
15629 esac
15630 set d_vfork
15631 eval $setvar
15632 case "$d_vfork" in
15633 $define) usevfork='true';;
15634 *) usevfork='false';;
15635 esac
15636
15637 : see whether the pthread_atfork exists
15638 $cat >try.c <<EOP
15639 #include <pthread.h>
15640 #include <stdio.h>
15641 int main() {
15642 #ifdef  PTHREAD_ATFORK
15643         pthread_atfork(NULL,NULL,NULL);
15644 #endif
15645 }
15646 EOP
15647
15648 : see if pthread_atfork exists
15649 set try -DPTHREAD_ATFORK
15650 if eval $compile; then
15651     val="$define"
15652 else
15653     val="$undef"
15654 fi
15655 case "$usethreads" in
15656 $define)
15657         case "$val" in
15658         $define) echo 'pthread_atfork found.' >&4        ;;
15659         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15660         esac
15661 esac
15662 set d_pthread_atfork
15663 eval $setvar
15664
15665 : see if pthread_attr_setscope exists
15666 set pthread_attr_setscope d_pthread_attr_setscope
15667 eval $inlibc
15668
15669
15670 : see whether the various POSIXish _yields exist
15671 $cat >try.c <<EOP
15672 #include <pthread.h>
15673 #include <stdio.h>
15674 int main() {
15675 #ifdef SCHED_YIELD
15676         sched_yield();
15677 #else
15678 #ifdef PTHREAD_YIELD
15679         pthread_yield();
15680 #else
15681 #ifdef PTHREAD_YIELD_NULL
15682         pthread_yield(NULL);
15683 #endif
15684 #endif
15685 #endif
15686 }
15687 EOP
15688 : see if sched_yield exists
15689 set try -DSCHED_YIELD
15690 if eval $compile; then
15691     val="$define"
15692     sched_yield='sched_yield()'
15693 else
15694     val="$undef"
15695 fi
15696 case "$usethreads" in
15697 $define)
15698         case "$val" in
15699         $define) echo 'sched_yield() found.' >&4        ;;
15700         *)       echo 'sched_yield() NOT found.' >&4    ;;
15701         esac
15702 esac
15703 set d_sched_yield
15704 eval $setvar
15705
15706 : see if pthread_yield exists
15707 set try -DPTHREAD_YIELD
15708 if eval $compile; then
15709     val="$define"
15710     case "$sched_yield" in
15711     '') sched_yield='pthread_yield()' ;;
15712     esac
15713 else
15714     set try -DPTHREAD_YIELD_NULL
15715     if eval $compile; then
15716         val="$define"
15717         case "$sched_yield" in
15718         '') sched_yield='pthread_yield(NULL)' ;;
15719         esac
15720     else
15721         val="$undef"
15722     fi
15723 fi
15724 case "$usethreads" in
15725 $define)
15726         case "$val" in
15727         $define) echo 'pthread_yield() found.' >&4      ;;
15728         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15729         esac
15730         ;;
15731 esac
15732 set d_pthread_yield
15733 eval $setvar
15734 case "$sched_yield" in
15735 '') sched_yield=undef ;;
15736 esac
15737 $rm_try
15738
15739 : see if random_r exists
15740 set random_r d_random_r
15741 eval $inlibc
15742 case "$d_random_r" in
15743 "$define")
15744         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15745         case "$d_random_r_proto:$usethreads" in
15746         ":define")      d_random_r_proto=define
15747                 set d_random_r_proto random_r $hdrs
15748                 eval $hasproto ;;
15749         *)      ;;
15750         esac
15751         case "$d_random_r_proto" in
15752         define)
15753         case "$random_r_proto" in
15754         ''|0) try='int random_r(int*, struct random_data*);'
15755         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15756         esac
15757         case "$random_r_proto" in
15758         ''|0) try='int random_r(long*, struct random_data*);'
15759         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15760         esac
15761         case "$random_r_proto" in
15762         ''|0) try='int random_r(struct random_data*, int32_t*);'
15763         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15764         esac
15765         case "$random_r_proto" in
15766         ''|0)   d_random_r=undef
15767                 random_r_proto=0
15768                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15769         * )     case "$random_r_proto" in
15770                 REENTRANT_PROTO*) ;;
15771                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15772                 esac
15773                 echo "Prototype: $try" ;;
15774         esac
15775         ;;
15776         *)      case "$usethreads" in
15777                 define) echo "random_r has no prototype, not using it." >&4 ;;
15778                 esac
15779                 d_random_r=undef
15780                 random_r_proto=0
15781                 ;;
15782         esac
15783         ;;
15784 *)      random_r_proto=0
15785         ;;
15786 esac
15787
15788 : see if readdir and friends exist
15789 set readdir d_readdir
15790 eval $inlibc
15791 set seekdir d_seekdir
15792 eval $inlibc
15793 set telldir d_telldir
15794 eval $inlibc
15795 set rewinddir d_rewinddir
15796 eval $inlibc
15797
15798 : see if readdir64_r exists
15799 set readdir64_r d_readdir64_r
15800 eval $inlibc
15801 case "$d_readdir64_r" in
15802 "$define")
15803         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15804         case "$d_readdir64_r_proto:$usethreads" in
15805         ":define")      d_readdir64_r_proto=define
15806                 set d_readdir64_r_proto readdir64_r $hdrs
15807                 eval $hasproto ;;
15808         *)      ;;
15809         esac
15810         case "$d_readdir64_r_proto" in
15811         define)
15812         case "$readdir64_r_proto" in
15813         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15814         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15815         esac
15816         case "$readdir64_r_proto" in
15817         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15818         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15819         esac
15820         case "$readdir64_r_proto" in
15821         ''|0)   d_readdir64_r=undef
15822                 readdir64_r_proto=0
15823                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15824         * )     case "$readdir64_r_proto" in
15825                 REENTRANT_PROTO*) ;;
15826                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15827                 esac
15828                 echo "Prototype: $try" ;;
15829         esac
15830         ;;
15831         *)      case "$usethreads" in
15832                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15833                 esac
15834                 d_readdir64_r=undef
15835                 readdir64_r_proto=0
15836                 ;;
15837         esac
15838         ;;
15839 *)      readdir64_r_proto=0
15840         ;;
15841 esac
15842
15843 : see if readdir_r exists
15844 set readdir_r d_readdir_r
15845 eval $inlibc
15846 case "$d_readdir_r" in
15847 "$define")
15848         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15849         case "$d_readdir_r_proto:$usethreads" in
15850         ":define")      d_readdir_r_proto=define
15851                 set d_readdir_r_proto readdir_r $hdrs
15852                 eval $hasproto ;;
15853         *)      ;;
15854         esac
15855         case "$d_readdir_r_proto" in
15856         define)
15857         case "$readdir_r_proto" in
15858         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15859         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15860         esac
15861         case "$readdir_r_proto" in
15862         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15863         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15864         esac
15865         case "$readdir_r_proto" in
15866         ''|0)   d_readdir_r=undef
15867                 readdir_r_proto=0
15868                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15869         * )     case "$readdir_r_proto" in
15870                 REENTRANT_PROTO*) ;;
15871                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15872                 esac
15873                 echo "Prototype: $try" ;;
15874         esac
15875         ;;
15876         *)      case "$usethreads" in
15877                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15878                 esac
15879                 d_readdir_r=undef
15880                 readdir_r_proto=0
15881                 ;;
15882         esac
15883         ;;
15884 *)      readdir_r_proto=0
15885         ;;
15886 esac
15887
15888 : see if readv exists
15889 set readv d_readv
15890 eval $inlibc
15891
15892 : see if recvmsg exists
15893 set recvmsg d_recvmsg
15894 eval $inlibc
15895
15896 : see if rename exists
15897 set rename d_rename
15898 eval $inlibc
15899
15900 : see if rmdir exists
15901 set rmdir d_rmdir
15902 eval $inlibc
15903
15904 : see if memory.h is available.
15905 val=''
15906 set memory.h val
15907 eval $inhdr
15908
15909 : See if it conflicts with string.h
15910 case "$val" in
15911 $define)
15912         case "$strings" in
15913         '') ;;
15914         *)
15915                 $cppstdin $cppflags $cppminus < $strings > mem.h
15916                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15917                         echo " "
15918                         echo "We won't be including <memory.h>."
15919                         val="$undef"
15920                 fi
15921                 $rm -f mem.h
15922                 ;;
15923         esac
15924 esac
15925 set i_memory
15926 eval $setvar
15927
15928 : can bcopy handle overlapping blocks?
15929 echo " "
15930 val="$undef"
15931 case "$d_memmove" in
15932 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15933 *)      case "$d_bcopy" in
15934         "$define")
15935                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15936                 $cat >try.c <<EOCP
15937 #$i_memory I_MEMORY
15938 #$i_stdlib I_STDLIB
15939 #$i_string I_STRING
15940 #$i_unistd I_UNISTD
15941 EOCP
15942         $cat >>try.c <<'EOCP'
15943 #include <stdio.h>
15944 #ifdef I_MEMORY
15945 #  include <memory.h>
15946 #endif
15947 #ifdef I_STDLIB
15948 #  include <stdlib.h>
15949 #endif
15950 #ifdef I_STRING
15951 #  include <string.h>
15952 #else
15953 #  include <strings.h>
15954 #endif
15955 #ifdef I_UNISTD
15956 #  include <unistd.h>  /* Needed for NetBSD */
15957 #endif
15958 int main()
15959 {
15960 char buf[128], abc[128];
15961 char *b;
15962 int len;
15963 int off;
15964 int align;
15965
15966 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15967    try to store the string in read-only memory. */
15968 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15969
15970 for (align = 7; align >= 0; align--) {
15971         for (len = 36; len; len--) {
15972                 b = buf+align;
15973                 bcopy(abc, b, len);
15974                 for (off = 1; off <= len; off++) {
15975                         bcopy(b, b+off, len);
15976                         bcopy(b+off, b, len);
15977                         if (bcmp(b, abc, len))
15978                                 exit(1);
15979                 }
15980         }
15981 }
15982 exit(0);
15983 }
15984 EOCP
15985                 set try
15986                 if eval $compile_ok; then
15987                         if $run ./try 2>/dev/null; then
15988                                 echo "Yes, it can."
15989                                 val="$define"
15990                         else
15991                                 echo "It can't, sorry."
15992                         fi
15993                 else
15994                         echo "(I can't compile the test program, so we'll assume not...)"
15995                 fi
15996                 ;;
15997         esac
15998         $rm_try
15999         ;;
16000 esac
16001 set d_safebcpy
16002 eval $setvar
16003
16004 : can memcpy handle overlapping blocks?
16005 echo " "
16006 val="$undef"
16007 case "$d_memmove" in
16008 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16009 *)      case "$d_memcpy" in
16010         "$define")
16011                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16012                 $cat >try.c <<EOCP
16013 #$i_memory I_MEMORY
16014 #$i_stdlib I_STDLIB
16015 #$i_string I_STRING
16016 #$i_unistd I_UNISTD
16017 EOCP
16018         $cat >>try.c <<'EOCP'
16019 #include <stdio.h>
16020 #ifdef I_MEMORY
16021 #  include <memory.h>
16022 #endif
16023 #ifdef I_STDLIB
16024 #  include <stdlib.h>
16025 #endif
16026 #ifdef I_STRING
16027 #  include <string.h>
16028 #else
16029 #  include <strings.h>
16030 #endif
16031 #ifdef I_UNISTD
16032 #  include <unistd.h>  /* Needed for NetBSD */
16033 #endif
16034 int main()
16035 {
16036 char buf[128], abc[128];
16037 char *b;
16038 int len;
16039 int off;
16040 int align;
16041
16042 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16043    try to store the string in read-only memory. */
16044 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16045
16046 for (align = 7; align >= 0; align--) {
16047         for (len = 36; len; len--) {
16048                 b = buf+align;
16049                 memcpy(b, abc, len);
16050                 for (off = 1; off <= len; off++) {
16051                         memcpy(b+off, b, len);
16052                         memcpy(b, b+off, len);
16053                         if (memcmp(b, abc, len))
16054                                 exit(1);
16055                 }
16056         }
16057 }
16058 exit(0);
16059 }
16060 EOCP
16061                 set try
16062                 if eval $compile_ok; then
16063                         if $run ./try 2>/dev/null; then
16064                                 echo "Yes, it can."
16065                                 val="$define"
16066                         else
16067                                 echo "It can't, sorry."
16068                         fi
16069                 else
16070                         echo "(I can't compile the test program, so we'll assume not...)"
16071                 fi
16072                 ;;
16073         esac
16074         $rm_try
16075         ;;
16076 esac
16077 set d_safemcpy
16078 eval $setvar
16079
16080 : can memcmp be trusted to compare relative magnitude?
16081 val="$undef"
16082 case "$d_memcmp" in
16083 "$define")
16084         echo " "
16085         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16086         $cat >try.c <<EOCP
16087 #$i_memory I_MEMORY
16088 #$i_stdlib I_STDLIB
16089 #$i_string I_STRING
16090 #$i_unistd I_UNISTD
16091 EOCP
16092         $cat >>try.c <<'EOCP'
16093 #include <stdio.h>
16094 #ifdef I_MEMORY
16095 #  include <memory.h>
16096 #endif
16097 #ifdef I_STDLIB
16098 #  include <stdlib.h>
16099 #endif
16100 #ifdef I_STRING
16101 #  include <string.h>
16102 #else
16103 #  include <strings.h>
16104 #endif
16105 #ifdef I_UNISTD
16106 #  include <unistd.h>  /* Needed for NetBSD */
16107 #endif
16108 int main()
16109 {
16110 char a = -1;
16111 char b = 0;
16112 if ((a < b) && memcmp(&a, &b, 1) < 0)
16113         exit(1);
16114 exit(0);
16115 }
16116 EOCP
16117         set try
16118         if eval $compile_ok; then
16119                 if $run ./try 2>/dev/null; then
16120                         echo "Yes, it can."
16121                         val="$define"
16122                 else
16123                         echo "No, it can't (it uses signed chars)."
16124                 fi
16125         else
16126                 echo "(I can't compile the test program, so we'll assume not...)"
16127         fi
16128         ;;
16129 esac
16130 $rm_try
16131 set d_sanemcmp
16132 eval $setvar
16133
16134 : see if prototype for sbrk is available
16135 echo " "
16136 set d_sbrkproto sbrk $i_unistd unistd.h
16137 eval $hasproto
16138
16139 : see if select exists
16140 set select d_select
16141 eval $inlibc
16142
16143 : see if semctl exists
16144 set semctl d_semctl
16145 eval $inlibc
16146
16147 : see if semget exists
16148 set semget d_semget
16149 eval $inlibc
16150
16151 : see if semop exists
16152 set semop d_semop
16153 eval $inlibc
16154
16155 : see how much of the 'sem*(2)' library is present.
16156 h_sem=true
16157 echo " "
16158 case "$d_semctl$d_semget$d_semop" in
16159 *"$undef"*) h_sem=false;;
16160 esac
16161 case "$osname" in
16162 freebsd)
16163     case "`ipcs 2>&1`" in
16164     "SVID messages"*"not configured"*)
16165         echo "Your $osname does not have the sem*(2) configured." >&4
16166         h_sem=false
16167         val="$undef"
16168         set semctl d_semctl
16169         eval $setvar
16170         set semget d_semget
16171         eval $setvar
16172         set semop d_semop
16173         eval $setvar
16174         ;;
16175     esac
16176     ;;
16177 esac
16178 : we could also check for sys/ipc.h ...
16179 if $h_sem && $test `./findhdr sys/sem.h`; then
16180         echo "You have the full sem*(2) library." >&4
16181         val="$define"
16182 else
16183         echo "You don't have the full sem*(2) library." >&4
16184         val="$undef"
16185 fi
16186 set d_sem
16187 eval $setvar
16188
16189 : see whether sys/sem.h defines union semun
16190 echo " "
16191 $cat > try.c <<'END'
16192 #include <sys/types.h>
16193 #include <sys/ipc.h>
16194 #include <sys/sem.h>
16195 int main () { union semun semun; semun.buf = 0; }
16196 END
16197 set try
16198 if eval $compile; then
16199     echo "You have union semun in <sys/sem.h>." >&4
16200     val="$define"
16201 else
16202     echo "You do not have union semun in <sys/sem.h>." >&4
16203     val="$undef"
16204 fi
16205 $rm_try
16206 set d_union_semun
16207 eval $setvar
16208
16209 : see how to do semctl IPC_STAT
16210 case "$d_sem" in
16211 $define)
16212     echo " "
16213     $cat > tryh.h <<END
16214 #ifndef S_IRUSR
16215 #   ifdef S_IREAD
16216 #       define S_IRUSR S_IREAD
16217 #       define S_IWUSR S_IWRITE
16218 #       define S_IXUSR S_IEXEC
16219 #   else
16220 #       define S_IRUSR 0400
16221 #       define S_IWUSR 0200
16222 #       define S_IXUSR 0100
16223 #   endif
16224 #   define S_IRGRP (S_IRUSR>>3)
16225 #   define S_IWGRP (S_IWUSR>>3)
16226 #   define S_IXGRP (S_IXUSR>>3)
16227 #   define S_IROTH (S_IRUSR>>6)
16228 #   define S_IWOTH (S_IWUSR>>6)
16229 #   define S_IXOTH (S_IXUSR>>6)
16230 #endif
16231 #ifndef S_IRWXU
16232 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16233 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16234 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16235 #endif
16236 END
16237     : see whether semctl IPC_STAT can use union semun
16238     case "$d_semctl_semun" in
16239     '')
16240       val="$undef"
16241       $cat > try.c <<END
16242 #include <sys/types.h>
16243 #include <sys/ipc.h>
16244 #include <sys/sem.h>
16245 #include <sys/stat.h>
16246 #include <stdio.h>
16247 #include <errno.h>
16248 #include "tryh.h"
16249 #ifndef errno
16250 extern int errno;
16251 #endif
16252 #$d_union_semun HAS_UNION_SEMUN
16253 int main() {
16254     union semun
16255 #ifndef HAS_UNION_SEMUN
16256     {
16257         int val;
16258         struct semid_ds *buf;
16259         unsigned short *array;
16260     }
16261 #endif
16262     arg;
16263     int sem, st;
16264
16265 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16266     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16267     if (sem > -1) {
16268         struct semid_ds argbuf;
16269         arg.buf = &argbuf;
16270 #       ifdef IPC_STAT
16271         st = semctl(sem, 0, IPC_STAT, arg);
16272         if (st == 0)
16273             printf("semun\n");
16274         else
16275 #       endif /* IPC_STAT */
16276             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16277 #       ifdef IPC_RMID
16278         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16279 #       endif /* IPC_RMID */
16280             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16281     } else
16282 #endif /* IPC_PRIVATE && ... */
16283         printf("semget failed: errno = %d\n", errno);
16284   return 0;
16285 }
16286 END
16287       set try
16288       if eval $compile; then
16289           xxx=`$run ./try`
16290           case "$xxx" in
16291           semun) val="$define" ;;
16292           esac
16293       fi
16294       $rm_try
16295       set d_semctl_semun
16296       eval $setvar
16297       ;;
16298     esac
16299     case "$d_semctl_semun" in
16300     $define)
16301         echo "You can use union semun for semctl IPC_STAT." >&4
16302         also='also'
16303         ;;
16304     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16305         also=''
16306         ;;
16307     esac
16308
16309     : see whether semctl IPC_STAT can use struct semid_ds pointer
16310     case "$d_semctl_semid_ds" in
16311     '')
16312       val="$undef"
16313       $cat > try.c <<'END'
16314 #include <sys/types.h>
16315 #include <sys/ipc.h>
16316 #include <sys/sem.h>
16317 #include <sys/stat.h>
16318 #include "tryh.h"
16319 #include <stdio.h>
16320 #include <errno.h>
16321 #ifndef errno
16322 extern int errno;
16323 #endif
16324 int main() {
16325     struct semid_ds arg;
16326     int sem, st;
16327
16328 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16329     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16330     if (sem > -1) {
16331 #       ifdef IPC_STAT
16332         st = semctl(sem, 0, IPC_STAT, &arg);
16333         if (st == 0)
16334             printf("semid_ds\n");
16335         else
16336 #       endif /* IPC_STAT */
16337             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16338 #       ifdef IPC_RMID
16339         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16340 #       endif /* IPC_RMID */
16341             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16342     } else
16343 #endif /* IPC_PRIVATE && ... */
16344         printf("semget failed: errno = %d\n", errno);
16345
16346     return 0;
16347 }
16348 END
16349       set try
16350       if eval $compile; then
16351           xxx=`$run ./try`
16352           case "$xxx" in
16353           semid_ds) val="$define" ;;
16354           esac
16355       fi
16356       $rm_try
16357       set d_semctl_semid_ds
16358       eval $setvar
16359       ;;
16360     esac
16361     case "$d_semctl_semid_ds" in
16362     $define)
16363         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16364         ;;
16365     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16366         ;;
16367     esac
16368     ;;
16369 *)  val="$undef"
16370
16371     # We do not have the full sem*(2) library, so assume we can not
16372     # use either.
16373
16374     set d_semctl_semun
16375     eval $setvar
16376
16377     set d_semctl_semid_ds
16378     eval $setvar
16379     ;;
16380 esac
16381 $rm_try tryh.h
16382
16383 : see if sendmsg exists
16384 set sendmsg d_sendmsg
16385 eval $inlibc
16386
16387 : see if setegid exists
16388 set setegid d_setegid
16389 eval $inlibc
16390
16391 : see if seteuid exists
16392 set seteuid d_seteuid
16393 eval $inlibc
16394
16395 : see if setgrent exists
16396 set setgrent d_setgrent
16397 eval $inlibc
16398
16399 : see if setgrent_r exists
16400 set setgrent_r d_setgrent_r
16401 eval $inlibc
16402 case "$d_setgrent_r" in
16403 "$define")
16404         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16405         case "$d_setgrent_r_proto:$usethreads" in
16406         ":define")      d_setgrent_r_proto=define
16407                 set d_setgrent_r_proto setgrent_r $hdrs
16408                 eval $hasproto ;;
16409         *)      ;;
16410         esac
16411         case "$d_setgrent_r_proto" in
16412         define)
16413         case "$setgrent_r_proto" in
16414         ''|0) try='int setgrent_r(FILE**);'
16415         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16416         esac
16417         case "$setgrent_r_proto" in
16418         ''|0) try='void setgrent_r(FILE**);'
16419         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16420         esac
16421         case "$setgrent_r_proto" in
16422         ''|0)   d_setgrent_r=undef
16423                 setgrent_r_proto=0
16424                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16425         * )     case "$setgrent_r_proto" in
16426                 REENTRANT_PROTO*) ;;
16427                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16428                 esac
16429                 echo "Prototype: $try" ;;
16430         esac
16431         ;;
16432         *)      case "$usethreads" in
16433                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16434                 esac
16435                 d_setgrent_r=undef
16436                 setgrent_r_proto=0
16437                 ;;
16438         esac
16439         ;;
16440 *)      setgrent_r_proto=0
16441         ;;
16442 esac
16443
16444 : see if sethostent exists
16445 set sethostent d_sethent
16446 eval $inlibc
16447
16448 : see if sethostent_r exists
16449 set sethostent_r d_sethostent_r
16450 eval $inlibc
16451 case "$d_sethostent_r" in
16452 "$define")
16453         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16454         case "$d_sethostent_r_proto:$usethreads" in
16455         ":define")      d_sethostent_r_proto=define
16456                 set d_sethostent_r_proto sethostent_r $hdrs
16457                 eval $hasproto ;;
16458         *)      ;;
16459         esac
16460         case "$d_sethostent_r_proto" in
16461         define)
16462         case "$sethostent_r_proto" in
16463         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16464         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16465         esac
16466         case "$sethostent_r_proto" in
16467         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16468         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16469         esac
16470         case "$sethostent_r_proto" in
16471         ''|0)   d_sethostent_r=undef
16472                 sethostent_r_proto=0
16473                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16474         * )     case "$sethostent_r_proto" in
16475                 REENTRANT_PROTO*) ;;
16476                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16477                 esac
16478                 echo "Prototype: $try" ;;
16479         esac
16480         ;;
16481         *)      case "$usethreads" in
16482                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16483                 esac
16484                 d_sethostent_r=undef
16485                 sethostent_r_proto=0
16486                 ;;
16487         esac
16488         ;;
16489 *)      sethostent_r_proto=0
16490         ;;
16491 esac
16492
16493 : see if setitimer exists
16494 set setitimer d_setitimer
16495 eval $inlibc
16496
16497 : see if setlinebuf exists
16498 set setlinebuf d_setlinebuf
16499 eval $inlibc
16500
16501 : see if setlocale exists
16502 set setlocale d_setlocale
16503 eval $inlibc
16504
16505 : see if locale.h is available
16506 set locale.h i_locale
16507 eval $inhdr
16508
16509 : see if setlocale_r exists
16510 set setlocale_r d_setlocale_r
16511 eval $inlibc
16512 case "$d_setlocale_r" in
16513 "$define")
16514         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16515         case "$d_setlocale_r_proto:$usethreads" in
16516         ":define")      d_setlocale_r_proto=define
16517                 set d_setlocale_r_proto setlocale_r $hdrs
16518                 eval $hasproto ;;
16519         *)      ;;
16520         esac
16521         case "$d_setlocale_r_proto" in
16522         define)
16523         case "$setlocale_r_proto" in
16524         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16525         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16526         esac
16527         case "$setlocale_r_proto" in
16528         ''|0)   d_setlocale_r=undef
16529                 setlocale_r_proto=0
16530                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16531         * )     case "$setlocale_r_proto" in
16532                 REENTRANT_PROTO*) ;;
16533                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16534                 esac
16535                 echo "Prototype: $try" ;;
16536         esac
16537         ;;
16538         *)      case "$usethreads" in
16539                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16540                 esac
16541                 d_setlocale_r=undef
16542                 setlocale_r_proto=0
16543                 ;;
16544         esac
16545         ;;
16546 *)      setlocale_r_proto=0
16547         ;;
16548 esac
16549
16550 : see if setnetent exists
16551 set setnetent d_setnent
16552 eval $inlibc
16553
16554 : see if setnetent_r exists
16555 set setnetent_r d_setnetent_r
16556 eval $inlibc
16557 case "$d_setnetent_r" in
16558 "$define")
16559         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16560         case "$d_setnetent_r_proto:$usethreads" in
16561         ":define")      d_setnetent_r_proto=define
16562                 set d_setnetent_r_proto setnetent_r $hdrs
16563                 eval $hasproto ;;
16564         *)      ;;
16565         esac
16566         case "$d_setnetent_r_proto" in
16567         define)
16568         case "$setnetent_r_proto" in
16569         ''|0) try='int setnetent_r(int, struct netent_data*);'
16570         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16571         esac
16572         case "$setnetent_r_proto" in
16573         ''|0) try='void setnetent_r(int, struct netent_data*);'
16574         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16575         esac
16576         case "$setnetent_r_proto" in
16577         ''|0)   d_setnetent_r=undef
16578                 setnetent_r_proto=0
16579                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16580         * )     case "$setnetent_r_proto" in
16581                 REENTRANT_PROTO*) ;;
16582                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16583                 esac
16584                 echo "Prototype: $try" ;;
16585         esac
16586         ;;
16587         *)      case "$usethreads" in
16588                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16589                 esac
16590                 d_setnetent_r=undef
16591                 setnetent_r_proto=0
16592                 ;;
16593         esac
16594         ;;
16595 *)      setnetent_r_proto=0
16596         ;;
16597 esac
16598
16599 : see if setprotoent exists
16600 set setprotoent d_setpent
16601 eval $inlibc
16602
16603 : see if setpgid exists
16604 set setpgid d_setpgid
16605 eval $inlibc
16606
16607 : see if setpgrp2 exists
16608 set setpgrp2 d_setpgrp2
16609 eval $inlibc
16610
16611 : see if setpriority exists
16612 set setpriority d_setprior
16613 eval $inlibc
16614
16615 : see if setproctitle exists
16616 set setproctitle d_setproctitle
16617 eval $inlibc
16618
16619 : see if setprotoent_r exists
16620 set setprotoent_r d_setprotoent_r
16621 eval $inlibc
16622 case "$d_setprotoent_r" in
16623 "$define")
16624         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16625         case "$d_setprotoent_r_proto:$usethreads" in
16626         ":define")      d_setprotoent_r_proto=define
16627                 set d_setprotoent_r_proto setprotoent_r $hdrs
16628                 eval $hasproto ;;
16629         *)      ;;
16630         esac
16631         case "$d_setprotoent_r_proto" in
16632         define)
16633         case "$setprotoent_r_proto" in
16634         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16635         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16636         esac
16637         case "$setprotoent_r_proto" in
16638         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16639         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16640         esac
16641         case "$setprotoent_r_proto" in
16642         ''|0)   d_setprotoent_r=undef
16643                 setprotoent_r_proto=0
16644                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16645         * )     case "$setprotoent_r_proto" in
16646                 REENTRANT_PROTO*) ;;
16647                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16648                 esac
16649                 echo "Prototype: $try" ;;
16650         esac
16651         ;;
16652         *)      case "$usethreads" in
16653                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16654                 esac
16655                 d_setprotoent_r=undef
16656                 setprotoent_r_proto=0
16657                 ;;
16658         esac
16659         ;;
16660 *)      setprotoent_r_proto=0
16661         ;;
16662 esac
16663
16664 : see if setpwent exists
16665 set setpwent d_setpwent
16666 eval $inlibc
16667
16668 : see if setpwent_r exists
16669 set setpwent_r d_setpwent_r
16670 eval $inlibc
16671 case "$d_setpwent_r" in
16672 "$define")
16673         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16674         case "$d_setpwent_r_proto:$usethreads" in
16675         ":define")      d_setpwent_r_proto=define
16676                 set d_setpwent_r_proto setpwent_r $hdrs
16677                 eval $hasproto ;;
16678         *)      ;;
16679         esac
16680         case "$d_setpwent_r_proto" in
16681         define)
16682         case "$setpwent_r_proto" in
16683         ''|0) try='int setpwent_r(FILE**);'
16684         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16685         esac
16686         case "$setpwent_r_proto" in
16687         ''|0) try='void setpwent_r(FILE**);'
16688         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16689         esac
16690         case "$setpwent_r_proto" in
16691         ''|0)   d_setpwent_r=undef
16692                 setpwent_r_proto=0
16693                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16694         * )     case "$setpwent_r_proto" in
16695                 REENTRANT_PROTO*) ;;
16696                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16697                 esac
16698                 echo "Prototype: $try" ;;
16699         esac
16700         ;;
16701         *)      case "$usethreads" in
16702                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16703                 esac
16704                 d_setpwent_r=undef
16705                 setpwent_r_proto=0
16706                 ;;
16707         esac
16708         ;;
16709 *)      setpwent_r_proto=0
16710         ;;
16711 esac
16712
16713 : see if setregid exists
16714 set setregid d_setregid
16715 eval $inlibc
16716 set setresgid d_setresgid
16717 eval $inlibc
16718
16719 : see if setreuid exists
16720 set setreuid d_setreuid
16721 eval $inlibc
16722 set setresuid d_setresuid
16723 eval $inlibc
16724
16725 : see if setrgid exists
16726 set setrgid d_setrgid
16727 eval $inlibc
16728
16729 : see if setruid exists
16730 set setruid d_setruid
16731 eval $inlibc
16732
16733 : see if setservent exists
16734 set setservent d_setsent
16735 eval $inlibc
16736
16737 : see if setservent_r exists
16738 set setservent_r d_setservent_r
16739 eval $inlibc
16740 case "$d_setservent_r" in
16741 "$define")
16742         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16743         case "$d_setservent_r_proto:$usethreads" in
16744         ":define")      d_setservent_r_proto=define
16745                 set d_setservent_r_proto setservent_r $hdrs
16746                 eval $hasproto ;;
16747         *)      ;;
16748         esac
16749         case "$d_setservent_r_proto" in
16750         define)
16751         case "$setservent_r_proto" in
16752         ''|0) try='int setservent_r(int, struct servent_data*);'
16753         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16754         esac
16755         case "$setservent_r_proto" in
16756         ''|0) try='void setservent_r(int, struct servent_data*);'
16757         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16758         esac
16759         case "$setservent_r_proto" in
16760         ''|0)   d_setservent_r=undef
16761                 setservent_r_proto=0
16762                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16763         * )     case "$setservent_r_proto" in
16764                 REENTRANT_PROTO*) ;;
16765                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16766                 esac
16767                 echo "Prototype: $try" ;;
16768         esac
16769         ;;
16770         *)      case "$usethreads" in
16771                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16772                 esac
16773                 d_setservent_r=undef
16774                 setservent_r_proto=0
16775                 ;;
16776         esac
16777         ;;
16778 *)      setservent_r_proto=0
16779         ;;
16780 esac
16781
16782 : see if setsid exists
16783 set setsid d_setsid
16784 eval $inlibc
16785
16786 : see if setvbuf exists
16787 set setvbuf d_setvbuf
16788 eval $inlibc
16789
16790 : see if sfio.h is available
16791 set sfio.h i_sfio
16792 eval $inhdr
16793
16794
16795 : see if sfio library is available
16796 case "$i_sfio" in
16797 $define)
16798         val=''
16799         set sfreserve val
16800         eval $inlibc
16801         ;;
16802 *)
16803         val="$undef"
16804         ;;
16805 esac
16806 : Ok, but do we want to use it.
16807 case "$val" in
16808 $define)
16809         case "$usesfio" in
16810         true|$define|[yY]*) dflt='y';;
16811         *) dflt='n';;
16812         esac
16813         echo "$package can use the sfio library, but it is experimental."
16814         case "$useperlio" in
16815         "$undef")
16816             echo "For sfio also the PerlIO abstraction layer is needed."
16817             echo "Earlier you said you wouldn't want that."
16818             ;;
16819         esac
16820         rp="You seem to have sfio available, do you want to try using it?"
16821         . ./myread
16822         case "$ans" in
16823         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16824                 useperlio="$define"
16825                 val="$define"
16826                 ;;
16827         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16828                 val="$undef"
16829                 ;;
16830         esac
16831         ;;
16832 *)      case "$usesfio" in
16833         true|$define|[yY]*)
16834                 echo "Sorry, cannot find sfio on this machine." >&4
16835                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16836                 val="$undef"
16837                 ;;
16838         esac
16839         ;;
16840 esac
16841 set d_sfio
16842 eval $setvar
16843 case "$d_sfio" in
16844 $define) usesfio='true';;
16845 *) usesfio='false';;
16846 esac
16847 case "$d_sfio" in
16848 $define) ;;
16849 *)      : Remove sfio from list of libraries to use
16850         case "$libs" in
16851         *-lsfio*)
16852                 echo "Removing unneeded -lsfio from library list" >&4
16853                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16854                 shift
16855                 libs="$*"
16856                 echo "libs = $libs" >&4
16857                 ;;
16858         esac
16859 ;;
16860 esac
16861
16862
16863 : see if shmctl exists
16864 set shmctl d_shmctl
16865 eval $inlibc
16866
16867 : see if shmget exists
16868 set shmget d_shmget
16869 eval $inlibc
16870
16871 : see if shmat exists
16872 set shmat d_shmat
16873 eval $inlibc
16874 : see what shmat returns
16875 case "$d_shmat" in
16876 "$define")
16877         $cat >shmat.c <<'END'
16878 #include <sys/shm.h>
16879 void *shmat();
16880 END
16881         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16882                 shmattype='void *'
16883         else
16884                 shmattype='char *'
16885         fi
16886         echo "and it returns ($shmattype)." >&4
16887         : see if a prototype for shmat is available
16888         xxx=`./findhdr sys/shm.h`
16889         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16890         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16891                 val="$define"
16892         else
16893                 val="$undef"
16894         fi
16895         $rm -f shmat.[co]
16896         ;;
16897 *)
16898         val="$undef"
16899         ;;
16900 esac
16901 set d_shmatprototype
16902 eval $setvar
16903
16904 : see if shmdt exists
16905 set shmdt d_shmdt
16906 eval $inlibc
16907
16908 : see how much of the 'shm*(2)' library is present.
16909 h_shm=true
16910 echo " "
16911 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16912 *"$undef"*) h_shm=false;;
16913 esac
16914 case "$osname" in
16915 freebsd)
16916     case "`ipcs 2>&1`" in
16917     "SVID shared memory"*"not configured"*)
16918         echo "Your $osname does not have the shm*(2) configured." >&4
16919         h_shm=false
16920         val="$undef"
16921         set shmctl d_shmctl
16922         evat $setvar
16923         set shmget d_shmget
16924         evat $setvar
16925         set shmat d_shmat
16926         evat $setvar
16927         set shmdt d_shmdt
16928         evat $setvar
16929         ;;
16930     esac
16931     ;;
16932 esac
16933 : we could also check for sys/ipc.h ...
16934 if $h_shm && $test `./findhdr sys/shm.h`; then
16935         echo "You have the full shm*(2) library." >&4
16936         val="$define"
16937 else
16938         echo "You don't have the full shm*(2) library." >&4
16939         val="$undef"
16940 fi
16941 set d_shm
16942 eval $setvar
16943
16944 echo " "
16945 : see if we have sigaction
16946 if set sigaction val -f d_sigaction; eval $csym; $val; then
16947         echo 'sigaction() found.' >&4
16948         $cat > try.c <<EOP
16949 #include <stdio.h>
16950 #include <sys/types.h>
16951 #include <signal.h>
16952 #$i_stdlib I_STDLIB
16953 #ifdef I_STDLIB
16954 #include <stdlib.h>
16955 #endif
16956 int main()
16957 {
16958     struct sigaction act, oact;
16959     act.sa_flags = 0;
16960     oact.sa_handler = 0;
16961     /* so that act and oact are used */
16962     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16963 }
16964 EOP
16965         set try
16966         if eval $compile_ok; then
16967                 val="$define"
16968         else
16969                 echo "But you don't seem to have a useable struct sigaction." >&4
16970                 val="$undef"
16971         fi
16972 else
16973         echo 'sigaction NOT found.' >&4
16974         val="$undef"
16975 fi
16976 set d_sigaction; eval $setvar
16977 $rm_try
16978
16979 : see if this is a sunmath.h system
16980 set sunmath.h i_sunmath
16981 eval $inhdr
16982
16983 : see if signbit exists
16984 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
16985 $cat >try.c <<EOCP
16986 #$i_math I_MATH
16987 #$i_sunmath I_SUNMATH
16988 #ifdef I_MATH
16989 #  include <math.h>
16990 #endif
16991 #ifdef I_SUNMATH  /* Solaris special math library */
16992 #  include <sunmath.h>
16993 #endif
16994 #define NV $nvtype
16995 int main(int argc, char **argv)
16996 {
16997     NV x = 0.0;
16998     NV y = -0.0;
16999     if ((signbit(x) == 0) && (signbit(y) != 0))
17000         return 0;
17001     else
17002         return 1;
17003 }
17004 EOCP
17005 val="$undef"
17006 set try
17007 if eval $compile; then
17008     if $run ./try; then
17009         $echo "Yes." >&4
17010         val="$define"
17011     else
17012         $echo "Signbit seems to be available, but doesn't work as I expected."
17013         $echo "I won't use it." >&4
17014         val="$undef"
17015     fi
17016 else
17017     $echo "Nope." >&4
17018     dflt="$undef"
17019 fi
17020 set d_signbit
17021 eval $setvar
17022 $rm_try
17023
17024 : see if sigprocmask exists
17025 set sigprocmask d_sigprocmask
17026 eval $inlibc
17027
17028 : see if sigsetjmp exists
17029 echo " "
17030 case "$d_sigsetjmp" in
17031 '')
17032         $cat >try.c <<EOP
17033 #include <setjmp.h>
17034 #$i_stdlib I_STDLIB
17035 #ifdef I_STDLIB
17036 #include <stdlib.h>
17037 #endif
17038 sigjmp_buf env;
17039 int set = 1;
17040 int main()
17041 {
17042         if (sigsetjmp(env,1))
17043                 exit(set);
17044         set = 0;
17045         siglongjmp(env, 1);
17046         exit(1);
17047 }
17048 EOP
17049         set try
17050         if eval $compile; then
17051                 if $run ./try >/dev/null 2>&1; then
17052                         echo "POSIX sigsetjmp found." >&4
17053                         val="$define"
17054                 else
17055                         $cat >&4 <<EOM
17056 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17057 I'll ignore them.
17058 EOM
17059                         val="$undef"
17060                 fi
17061         else
17062                 echo "sigsetjmp not found." >&4
17063                 val="$undef"
17064         fi
17065         ;;
17066 *) val="$d_sigsetjmp"
17067         case "$d_sigsetjmp" in
17068         $define) echo "POSIX sigsetjmp found." >&4;;
17069         $undef) echo "sigsetjmp not found." >&4;;
17070         esac
17071         ;;
17072 esac
17073 set d_sigsetjmp
17074 eval $setvar
17075 $rm_try
17076
17077 : see if snprintf exists
17078 set snprintf d_snprintf
17079 eval $inlibc
17080
17081 : see if vsnprintf exists
17082 set vsnprintf d_vsnprintf
17083 eval $inlibc
17084
17085 case "$d_snprintf-$d_vsnprintf" in
17086 "$define-$define")
17087     $cat <<EOM
17088 Checking whether your snprintf() and vsnprintf() work okay...
17089 EOM
17090     $cat >try.c <<'EOCP'
17091 /* v?snprintf testing logic courtesy of Russ Allbery.
17092  * According to C99:
17093  * - if the buffer is too short it still must be \0-terminated
17094  * - if the buffer is too short the potentially required length
17095  *   must be returned and not -1
17096  * - if the buffer is NULL the potentially required length
17097  *   must be returned and not -1 or core dump
17098  */
17099 #include <stdio.h>
17100 #include <stdarg.h>
17101
17102 char buf[2];
17103
17104 int test (char *format, ...)
17105 {
17106     va_list args;
17107     int count;
17108
17109     va_start (args, format);
17110     count = vsnprintf (buf, sizeof buf, format, args);
17111     va_end (args);
17112     return count;
17113 }
17114
17115 int main ()
17116 {
17117     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17118              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17119 }
17120 EOCP
17121     set try
17122     if eval $compile; then
17123         `$run ./try`
17124         case "$?" in
17125         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17126         *) cat <<EOM >&4
17127 Your snprintf() and snprintf() don't seem to be working okay.
17128 EOM
17129            d_snprintf="$undef"
17130            d_vsnprintf="$undef"
17131            ;;
17132         esac
17133     else
17134         echo "(I can't seem to compile the test program--assuming they don't)"
17135         d_snprintf="$undef"
17136         d_vsnprintf="$undef"
17137     fi
17138     $rm_try
17139     ;;
17140 esac
17141
17142 : see if sockatmark exists
17143 set sockatmark d_sockatmark
17144 eval $inlibc
17145
17146 : see if prototype for sockatmark is available
17147 echo " "
17148 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17149 eval $hasproto
17150
17151 : see if socks5_init exists
17152 set socks5_init d_socks5_init
17153 eval $inlibc
17154
17155 : see if sprintf returns the length of the string in the buffer as per ANSI
17156 $echo "Checking whether sprintf returns the length of the string..." >&4
17157 $cat <<EOP >try.c
17158 #include <stdio.h>
17159 #$i_stdlib I_STDLIB
17160 #ifdef I_STDLIB
17161 #include <stdlib.h>
17162 #endif
17163 #$i_string I_STRING
17164 #ifdef I_STRING
17165 #  include <string.h>
17166 #else
17167 #  include <strings.h>
17168 #endif
17169 #$i_math I_MATH
17170 #ifdef I_MATH
17171 #include <math.h>
17172 #endif
17173
17174 char buffer[256];
17175
17176 int check (size_t expect, int test) {
17177   size_t got = strlen(buffer);
17178   if (expect == got)
17179     return 0;
17180
17181   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17182        test, buffer);
17183   exit (test);
17184 }
17185
17186 int main(int argc, char **argv) {
17187   int test = 0;
17188
17189   check(sprintf(buffer, ""), ++test);
17190   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17191   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17192
17193   return 0;
17194 }
17195 EOP
17196 set try
17197
17198 d_sprintf_returns_strlen="$undef"
17199 if eval $compile; then
17200     xxx="`$run ./try`"
17201     case "$?" in
17202         0) cat >&4 <<EOM
17203 sprintf returns the length of the string (as ANSI says it should)
17204 EOM
17205         d_sprintf_returns_strlen="$define"
17206         ;;
17207         *) cat >&4 <<EOM
17208 sprintf does not return the length of the string (how old is this system?)
17209 EOM
17210         d_sprintf_returns_strlen="$undef"
17211         ;;
17212     esac
17213 fi
17214 $rm_try
17215
17216 : see if srand48_r exists
17217 set srand48_r d_srand48_r
17218 eval $inlibc
17219 case "$d_srand48_r" in
17220 "$define")
17221         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17222         case "$d_srand48_r_proto:$usethreads" in
17223         ":define")      d_srand48_r_proto=define
17224                 set d_srand48_r_proto srand48_r $hdrs
17225                 eval $hasproto ;;
17226         *)      ;;
17227         esac
17228         case "$d_srand48_r_proto" in
17229         define)
17230         case "$srand48_r_proto" in
17231         ''|0) try='int srand48_r(long, struct drand48_data*);'
17232         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17233         esac
17234         case "$srand48_r_proto" in
17235         ''|0)   d_srand48_r=undef
17236                 srand48_r_proto=0
17237                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17238         * )     case "$srand48_r_proto" in
17239                 REENTRANT_PROTO*) ;;
17240                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17241                 esac
17242                 echo "Prototype: $try" ;;
17243         esac
17244         ;;
17245         *)      case "$usethreads" in
17246                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17247                 esac
17248                 d_srand48_r=undef
17249                 srand48_r_proto=0
17250                 ;;
17251         esac
17252         ;;
17253 *)      srand48_r_proto=0
17254         ;;
17255 esac
17256
17257 : see if srandom_r exists
17258 set srandom_r d_srandom_r
17259 eval $inlibc
17260 case "$d_srandom_r" in
17261 "$define")
17262         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17263         case "$d_srandom_r_proto:$usethreads" in
17264         ":define")      d_srandom_r_proto=define
17265                 set d_srandom_r_proto srandom_r $hdrs
17266                 eval $hasproto ;;
17267         *)      ;;
17268         esac
17269         case "$d_srandom_r_proto" in
17270         define)
17271         case "$srandom_r_proto" in
17272         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17273         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17274         esac
17275         case "$srandom_r_proto" in
17276         ''|0)   d_srandom_r=undef
17277                 srandom_r_proto=0
17278                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17279         * )     case "$srandom_r_proto" in
17280                 REENTRANT_PROTO*) ;;
17281                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17282                 esac
17283                 echo "Prototype: $try" ;;
17284         esac
17285         ;;
17286         *)      case "$usethreads" in
17287                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17288                 esac
17289                 d_srandom_r=undef
17290                 srandom_r_proto=0
17291                 ;;
17292         esac
17293         ;;
17294 *)      srandom_r_proto=0
17295         ;;
17296 esac
17297
17298 : see if prototype for setresgid is available
17299 echo " "
17300 set d_sresgproto setresgid $i_unistd unistd.h
17301 eval $hasproto
17302
17303 : see if prototype for setresuid is available
17304 echo " "
17305 set d_sresuproto setresuid $i_unistd unistd.h
17306 eval $hasproto
17307
17308 : see if sys/stat.h is available
17309 set sys/stat.h i_sysstat
17310 eval $inhdr
17311
17312
17313 : see if stat knows about block sizes
17314 echo " "
17315 echo "Checking to see if your struct stat has st_blocks field..." >&4
17316 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17317 eval $hasfield
17318
17319
17320 : see if this is a sys/vfs.h system
17321 set sys/vfs.h i_sysvfs
17322 eval $inhdr
17323
17324
17325 : see if this is a sys/statfs.h system
17326 set sys/statfs.h i_sysstatfs
17327 eval $inhdr
17328
17329
17330 echo " "
17331 echo "Checking to see if your system supports struct statfs..." >&4
17332 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
17333 eval $hasstruct
17334 case "$d_statfs_s" in
17335 "$define")      echo "Yes, it does."   ;;
17336 *)              echo "No, it doesn't." ;;
17337 esac
17338
17339
17340
17341 : see if struct statfs knows about f_flags
17342 case "$d_statfs_s" in
17343 define) 
17344         echo " "
17345         echo "Checking to see if your struct statfs has f_flags field..." >&4
17346         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
17347         eval $hasfield
17348         ;;
17349 *)      val="$undef"
17350         set d_statfs_f_flags
17351         eval $setvar
17352         ;;
17353 esac
17354 case "$d_statfs_f_flags" in
17355 "$define")      echo "Yes, it does."   ;;
17356 *)              echo "No, it doesn't." ;;
17357 esac
17358
17359 $cat >&4 <<EOM
17360 Checking how to access stdio streams by file descriptor number...
17361 EOM
17362 case "$stdio_stream_array" in
17363 '')     $cat >try.c <<EOCP
17364 #include <stdio.h>
17365 int main() {
17366   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17367     printf("yes\n");
17368 }
17369 EOCP
17370         for s in _iob __iob __sF
17371         do
17372                 set try -DSTDIO_STREAM_ARRAY=$s
17373                 if eval $compile; then
17374                         case "`$run ./try`" in
17375                         yes)    stdio_stream_array=$s; break ;;
17376                         esac
17377                 fi
17378         done
17379         $rm_try
17380 esac
17381 case "$stdio_stream_array" in
17382 '')     $cat >&4 <<EOM
17383 I can't figure out how to access stdio streams by file descriptor number.
17384 EOM
17385         d_stdio_stream_array="$undef"
17386         ;;
17387 *)      $cat >&4 <<EOM
17388 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17389 EOM
17390         d_stdio_stream_array="$define"
17391         ;;
17392 esac
17393
17394 : see if strcoll exists
17395 set strcoll d_strcoll
17396 eval $inlibc
17397
17398 : check for structure copying
17399 echo " "
17400 echo "Checking to see if your C compiler can copy structs..." >&4
17401 $cat >try.c <<'EOCP'
17402 int main()
17403 {
17404         struct blurfl {
17405                 int dyick;
17406         } foo, bar;
17407
17408         foo = bar;
17409 }
17410 EOCP
17411 if $cc -c try.c >/dev/null 2>&1 ; then
17412         val="$define"
17413         echo "Yup, it can."
17414 else
17415         val="$undef"
17416         echo "Nope, it can't."
17417 fi
17418 set d_strctcpy
17419 eval $setvar
17420 $rm_try
17421
17422 : see if strerror and/or sys_errlist[] exist
17423 echo " "
17424 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17425     if set strerror val -f d_strerror; eval $csym; $val; then
17426                 echo 'strerror() found.' >&4
17427                 d_strerror="$define"
17428                 d_strerrm='strerror(e)'
17429                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17430                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17431                         d_syserrlst="$define"
17432                 else
17433                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17434                         d_syserrlst="$undef"
17435                 fi
17436     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17437                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17438                 echo 'strerror() found in string header.' >&4
17439                 d_strerror="$define"
17440                 d_strerrm='strerror(e)'
17441                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17442                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17443                                 d_syserrlst="$define"
17444                 else
17445                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17446                         d_syserrlst="$undef"
17447                 fi
17448     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17449                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17450                 d_strerror="$undef"
17451                 d_syserrlst="$define"
17452                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17453     else
17454                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17455                 d_strerror="$undef"
17456                 d_syserrlst="$undef"
17457                 d_strerrm='"unknown"'
17458     fi
17459 fi
17460
17461 : see if strerror_r exists
17462 set strerror_r d_strerror_r
17463 eval $inlibc
17464 case "$d_strerror_r" in
17465 "$define")
17466         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17467         case "$d_strerror_r_proto:$usethreads" in
17468         ":define")      d_strerror_r_proto=define
17469                 set d_strerror_r_proto strerror_r $hdrs
17470                 eval $hasproto ;;
17471         *)      ;;
17472         esac
17473         case "$d_strerror_r_proto" in
17474         define)
17475         case "$strerror_r_proto" in
17476         ''|0) try='int strerror_r(int, char*, size_t);'
17477         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17478         esac
17479         case "$strerror_r_proto" in
17480         ''|0) try='int strerror_r(int, char*, int);'
17481         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17482         esac
17483         case "$strerror_r_proto" in
17484         ''|0) try='char* strerror_r(int, char*, size_t);'
17485         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17486         esac
17487         case "$strerror_r_proto" in
17488         ''|0)   d_strerror_r=undef
17489                 strerror_r_proto=0
17490                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17491         * )     case "$strerror_r_proto" in
17492                 REENTRANT_PROTO*) ;;
17493                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17494                 esac
17495                 echo "Prototype: $try" ;;
17496         esac
17497         ;;
17498         *)      case "$usethreads" in
17499                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17500                 esac
17501                 d_strerror_r=undef
17502                 strerror_r_proto=0
17503                 ;;
17504         esac
17505         ;;
17506 *)      strerror_r_proto=0
17507         ;;
17508 esac
17509
17510 : see if strftime exists
17511 set strftime d_strftime
17512 eval $inlibc
17513
17514 : see if strlcat exists
17515 set strlcat d_strlcat
17516 eval $inlibc
17517
17518 : see if strlcpy exists
17519 set strlcpy d_strlcpy
17520 eval $inlibc
17521
17522 : see if strtod exists
17523 set strtod d_strtod
17524 eval $inlibc
17525
17526 : see if strtol exists
17527 set strtol d_strtol
17528 eval $inlibc
17529
17530 : see if strtold exists
17531 set strtold d_strtold
17532 eval $inlibc
17533
17534 : see if strtoll exists
17535 set strtoll d_strtoll
17536 eval $inlibc
17537
17538 case "$d_longlong-$d_strtoll" in
17539 "$define-$define")
17540         $cat <<EOM
17541 Checking whether your strtoll() works okay...
17542 EOM
17543         $cat >try.c <<'EOCP'
17544 #include <errno.h>
17545 #ifdef __hpux
17546 #define strtoll __strtoll
17547 #endif
17548 #ifdef __EMX__
17549 #define strtoll _strtoll
17550 #endif
17551 #include <stdio.h>
17552 extern long long int strtoll(char *s, char **, int); 
17553 static int bad = 0;
17554 int check(char *s, long long ell, int een) {
17555         long long gll;
17556         errno = 0;
17557         gll = strtoll(s, 0, 10);
17558         if (!((gll == ell) && (errno == een)))
17559                 bad++;
17560 }
17561 int main() {
17562         check(" 1",                                      1LL, 0);
17563         check(" 0",                                      0LL, 0);
17564         check("-1",                                     -1LL, 0);
17565         check("-9223372036854775808", -9223372036854775808LL, 0);
17566         check("-9223372036854775808", -9223372036854775808LL, 0);
17567         check(" 9223372036854775807",  9223372036854775807LL, 0);
17568         check("-9223372036854775808", -9223372036854775808LL, 0);
17569         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17570         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17571         if (!bad)
17572                 printf("ok\n");
17573 }
17574 EOCP
17575         set try
17576         if eval $compile; then
17577                 yyy=`$run ./try`
17578                 case "$yyy" in
17579                 ok) echo "Your strtoll() seems to be working okay." ;;
17580                 *) cat <<EOM >&4
17581 Your strtoll() doesn't seem to be working okay.
17582 EOM
17583                    d_strtoll="$undef"
17584                    ;;
17585                 esac
17586         else
17587                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17588                 d_strtoll="$undef"
17589         fi
17590         ;;
17591 esac
17592
17593 : see if strtoq exists
17594 set strtoq d_strtoq
17595 eval $inlibc
17596
17597 : see if strtoul exists
17598 set strtoul d_strtoul
17599 eval $inlibc
17600
17601 case "$d_strtoul" in
17602 "$define")
17603         $cat <<EOM
17604 Checking whether your strtoul() works okay...
17605 EOM
17606         $cat >try.c <<'EOCP'
17607 #include <errno.h>
17608 #include <stdio.h>
17609 extern unsigned long int strtoul(char *s, char **, int); 
17610 static int bad = 0;
17611 void check(char *s, unsigned long eul, int een) {
17612         unsigned long gul;
17613         errno = 0;
17614         gul = strtoul(s, 0, 10);
17615         if (!((gul == eul) && (errno == een)))
17616                 bad++;
17617 }
17618 int main() {
17619         check(" 1", 1L, 0);
17620         check(" 0", 0L, 0);
17621 EOCP
17622         case "$longsize" in
17623         8)
17624             $cat >>try.c <<'EOCP'
17625         check("18446744073709551615", 18446744073709551615UL, 0);
17626         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17627 #if 0 /* strtoul() for /^-/ strings is undefined. */
17628         check("-1", 18446744073709551615UL, 0);
17629         check("-18446744073709551614", 2, 0);
17630         check("-18446744073709551615", 1, 0);
17631         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17632         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17633 #endif
17634 EOCP
17635                 ;;
17636         4)
17637                     $cat >>try.c <<'EOCP'
17638         check("4294967295", 4294967295UL, 0);
17639         check("4294967296", 4294967295UL, ERANGE);
17640 #if 0 /* strtoul() for /^-/ strings is undefined. */
17641         check("-1", 4294967295UL, 0);
17642         check("-4294967294", 2, 0);
17643         check("-4294967295", 1, 0);
17644         check("-4294967296", 4294967295UL, ERANGE);
17645         check("-4294967297", 4294967295UL, ERANGE);
17646 #endif
17647 EOCP
17648                 ;;
17649         *)
17650 : Should we write these tests to be more portable by sprintf-ing
17651 : ~0 and then manipulating that char string as input for strtol?
17652                 ;;
17653         esac
17654         $cat >>try.c <<'EOCP'
17655         if (!bad)
17656                 printf("ok\n");
17657         return 0;
17658 }
17659 EOCP
17660         set try
17661         if eval $compile; then
17662                 case "`$run ./try`" in
17663                 ok) echo "Your strtoul() seems to be working okay." ;;
17664                 *) cat <<EOM >&4
17665 Your strtoul() doesn't seem to be working okay.
17666 EOM
17667                    d_strtoul="$undef"
17668                    ;;
17669                 esac
17670         else
17671                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17672                 d_strtoul="$undef"
17673         fi
17674         ;;
17675 esac
17676
17677 : see if strtoull exists
17678 set strtoull d_strtoull
17679 eval $inlibc
17680
17681 case "$d_longlong-$d_strtoull" in
17682 "$define-$define")
17683         $cat <<EOM
17684 Checking whether your strtoull() works okay...
17685 EOM
17686         $cat >try.c <<'EOCP'
17687 #include <errno.h>
17688 #ifdef __hpux
17689 #define strtoull __strtoull
17690 #endif
17691 #include <stdio.h>
17692 extern unsigned long long int strtoull(char *s, char **, int); 
17693 static int bad = 0;
17694 int check(char *s, long long eull, int een) {
17695         long long gull;
17696         errno = 0;
17697         gull = strtoull(s, 0, 10);
17698         if (!((gull == eull) && (errno == een)))
17699                 bad++;
17700 }
17701 int main() {
17702         check(" 1",                                        1LL, 0);
17703         check(" 0",                                        0LL, 0);
17704         check("18446744073709551615",  18446744073709551615ULL, 0);
17705         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17706 #if 0 /* strtoull() for /^-/ strings is undefined. */
17707         check("-1",                    18446744073709551615ULL, 0);
17708         check("-18446744073709551614",                     2LL, 0);
17709         check("-18446744073709551615",                     1LL, 0);
17710         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17711         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17712 #endif
17713         if (!bad)
17714                 printf("ok\n");
17715 }
17716 EOCP
17717         set try
17718         if eval $compile; then
17719                 case "`$run ./try`" in
17720                 ok) echo "Your strtoull() seems to be working okay." ;;
17721                 *) cat <<EOM >&4
17722 Your strtoull() doesn't seem to be working okay.
17723 EOM
17724                    d_strtoull="$undef"
17725                    ;;
17726                 esac
17727         else
17728                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17729                 d_strtoull="$undef"
17730         fi
17731         ;;
17732 esac
17733
17734 : see if strtouq exists
17735 set strtouq d_strtouq
17736 eval $inlibc
17737
17738 case "$d_strtouq" in
17739 "$define")
17740         $cat <<EOM
17741 Checking whether your strtouq() works okay...
17742 EOM
17743         $cat >try.c <<'EOCP'
17744 #include <errno.h>
17745 #include <stdio.h>
17746 extern unsigned long long int strtouq(char *s, char **, int); 
17747 static int bad = 0;
17748 void check(char *s, unsigned long long eull, int een) {
17749         unsigned long long gull;
17750         errno = 0;
17751         gull = strtouq(s, 0, 10);
17752         if (!((gull == eull) && (errno == een)))
17753                 bad++;
17754 }
17755 int main() {
17756         check(" 1",                                        1LL, 0);
17757         check(" 0",                                        0LL, 0);
17758         check("18446744073709551615",  18446744073709551615ULL, 0);
17759         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17760 #if 0 /* strtouq() for /^-/ strings is undefined. */
17761         check("-1",                    18446744073709551615ULL, 0);
17762         check("-18446744073709551614",                     2LL, 0);
17763         check("-18446744073709551615",                     1LL, 0);
17764         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17765         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17766 #endif
17767         if (!bad)
17768                 printf("ok\n");
17769         return 0;
17770 }
17771 EOCP
17772         set try
17773         if eval $compile; then
17774                 case "`$run ./try`" in
17775                 ok) echo "Your strtouq() seems to be working okay." ;;
17776                 *) cat <<EOM >&4
17777 Your strtouq() doesn't seem to be working okay.
17778 EOM
17779                    d_strtouq="$undef"
17780                    ;;
17781                 esac
17782         else
17783                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17784                 d_strtouq="$undef"
17785         fi
17786         ;;
17787 esac
17788
17789 : see if strxfrm exists
17790 set strxfrm d_strxfrm
17791 eval $inlibc
17792
17793 : see if symlink exists
17794 set symlink d_symlink
17795 eval $inlibc
17796
17797 : see if syscall exists
17798 set syscall d_syscall
17799 eval $inlibc
17800
17801 : see if prototype for syscall is available
17802 echo " "
17803 set d_syscallproto syscall $i_unistd unistd.h
17804 eval $hasproto
17805
17806 : see if sysconf exists
17807 set sysconf d_sysconf
17808 eval $inlibc
17809
17810 : see if system exists
17811 set system d_system
17812 eval $inlibc
17813
17814 : see if tcgetpgrp exists
17815 set tcgetpgrp d_tcgetpgrp
17816 eval $inlibc
17817
17818 : see if tcsetpgrp exists
17819 set tcsetpgrp d_tcsetpgrp
17820 eval $inlibc
17821
17822 : see if prototype for telldir is available
17823 echo " "
17824 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17825 eval $hasproto
17826
17827 : see if time exists
17828 echo " "
17829 if test "X$d_time" = X -o X"$timetype" = X; then
17830     if set time val -f d_time; eval $csym; $val; then
17831                 echo 'time() found.' >&4
17832                 val="$define"
17833                 rp="What is the type returned by time() on this system?"
17834                 set time_t timetype long stdio.h sys/types.h
17835                 eval $typedef_ask
17836     else
17837                 echo 'time() not found, hope that will do.' >&4
17838                 val="$undef"
17839                 timetype='int';
17840     fi
17841     set d_time
17842     eval $setvar
17843 fi
17844
17845 : see if this is a sys/times.h system
17846 set sys/times.h i_systimes
17847 eval $inhdr
17848
17849 : see if times exists
17850 echo " "
17851 if set times val -f d_times; eval $csym; $val; then
17852         echo 'times() found.' >&4
17853         d_times="$define"
17854         inc=''
17855         case "$i_systimes" in
17856         "$define") inc='sys/times.h';;
17857         esac
17858         rp="What is the type returned by times() on this system?"
17859         set clock_t clocktype long stdio.h sys/types.h $inc
17860         eval $typedef_ask
17861 else
17862         echo 'times() NOT found, hope that will do.' >&4
17863         d_times="$undef"
17864         clocktype='int'
17865 fi
17866
17867 : see if tmpnam_r exists
17868 set tmpnam_r d_tmpnam_r
17869 eval $inlibc
17870 case "$d_tmpnam_r" in
17871 "$define")
17872         hdrs="$i_systypes sys/types.h define stdio.h "
17873         case "$d_tmpnam_r_proto:$usethreads" in
17874         ":define")      d_tmpnam_r_proto=define
17875                 set d_tmpnam_r_proto tmpnam_r $hdrs
17876                 eval $hasproto ;;
17877         *)      ;;
17878         esac
17879         case "$d_tmpnam_r_proto" in
17880         define)
17881         case "$tmpnam_r_proto" in
17882         ''|0) try='char* tmpnam_r(char*);'
17883         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17884         esac
17885         case "$tmpnam_r_proto" in
17886         ''|0)   d_tmpnam_r=undef
17887                 tmpnam_r_proto=0
17888                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17889         * )     case "$tmpnam_r_proto" in
17890                 REENTRANT_PROTO*) ;;
17891                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17892                 esac
17893                 echo "Prototype: $try" ;;
17894         esac
17895         ;;
17896         *)      case "$usethreads" in
17897                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17898                 esac
17899                 d_tmpnam_r=undef
17900                 tmpnam_r_proto=0
17901                 ;;
17902         esac
17903         ;;
17904 *)      tmpnam_r_proto=0
17905         ;;
17906 esac
17907
17908 : see if truncate exists
17909 set truncate d_truncate
17910 eval $inlibc
17911
17912 : see if ttyname_r exists
17913 set ttyname_r d_ttyname_r
17914 eval $inlibc
17915 case "$d_ttyname_r" in
17916 "$define")
17917         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17918         case "$d_ttyname_r_proto:$usethreads" in
17919         ":define")      d_ttyname_r_proto=define
17920                 set d_ttyname_r_proto ttyname_r $hdrs
17921                 eval $hasproto ;;
17922         *)      ;;
17923         esac
17924         case "$d_ttyname_r_proto" in
17925         define)
17926         case "$ttyname_r_proto" in
17927         ''|0) try='int ttyname_r(int, char*, size_t);'
17928         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17929         esac
17930         case "$ttyname_r_proto" in
17931         ''|0) try='int ttyname_r(int, char*, int);'
17932         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17933         esac
17934         case "$ttyname_r_proto" in
17935         ''|0) try='char* ttyname_r(int, char*, int);'
17936         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17937         esac
17938         case "$ttyname_r_proto" in
17939         ''|0)   d_ttyname_r=undef
17940                 ttyname_r_proto=0
17941                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17942         * )     case "$ttyname_r_proto" in
17943                 REENTRANT_PROTO*) ;;
17944                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17945                 esac
17946                 echo "Prototype: $try" ;;
17947         esac
17948         ;;
17949         *)      case "$usethreads" in
17950                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17951                 esac
17952                 d_ttyname_r=undef
17953                 ttyname_r_proto=0
17954                 ;;
17955         esac
17956         ;;
17957 *)      ttyname_r_proto=0
17958         ;;
17959 esac
17960
17961 : see if tzname[] exists
17962 echo " "
17963 if set tzname val -a d_tzname; eval $csym; $val; then
17964         val="$define"
17965         echo 'tzname[] found.' >&4
17966 else
17967         val="$undef"
17968         echo 'tzname[] NOT found.' >&4
17969 fi
17970 set d_tzname
17971 eval $setvar
17972
17973 case "$osname" in
17974 next|rhapsody|darwin) multiarch="$define" ;;
17975 esac
17976 case "$multiarch" in
17977 ''|[nN]*) multiarch="$undef" ;;
17978 esac
17979
17980 : check for ordering of bytes in a UV
17981 echo " "
17982 case "$usecrosscompile$multiarch" in
17983 *$define*)
17984         $cat <<EOM
17985 You seem to be either cross-compiling or doing a multiarchitecture build,
17986 skipping the byteorder check.
17987
17988 EOM
17989         byteorder='ffff'
17990         ;;
17991 *)
17992         case "$byteorder" in
17993         '')
17994                 $cat <<'EOM'
17995 In the following, larger digits indicate more significance.  A big-endian
17996 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17997 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17998 machines may have weird orders like 3412.  A Cray will report 87654321,
17999 an Alpha will report 12345678. If the test program works the default is
18000 probably right.
18001 I'm now running the test program...
18002 EOM
18003                 $cat >try.c <<EOCP
18004 #include <stdio.h>
18005 #$i_stdlib I_STDLIB
18006 #ifdef I_STDLIB
18007 #include <stdlib.h>
18008 #endif
18009 #include <sys/types.h>
18010 typedef $uvtype UV;
18011 int main()
18012 {
18013         int i;
18014         union {
18015                 UV l;
18016                 char c[$uvsize];
18017         } u;
18018
18019         if ($uvsize > 4)
18020                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18021         else
18022                 u.l = (UV)0x04030201;
18023         for (i = 0; i < $uvsize; i++)
18024                 printf("%c", u.c[i]+'0');
18025         printf("\n");
18026         exit(0);
18027 }
18028 EOCP
18029                 xxx_prompt=y
18030                 set try
18031                 if eval $compile && $run ./try > /dev/null; then
18032                         dflt=`$run ./try`
18033                         case "$dflt" in
18034                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18035                                 echo "(The test program ran ok.)"
18036                                 echo "byteorder=$dflt"
18037                                 xxx_prompt=n
18038                         ;;
18039                         ????|????????) echo "(The test program ran ok.)" ;;
18040                         *) echo "(The test program didn't run right for some reason.)" ;;
18041                         esac
18042                 else
18043                         dflt='4321'
18044                         cat <<'EOM'
18045 (I can't seem to compile the test program.  Guessing big-endian...)
18046 EOM
18047                 fi
18048                 case "$xxx_prompt" in
18049                 y)
18050                         rp="What is the order of bytes in $uvtype?"
18051                         . ./myread
18052                         byteorder="$ans"
18053                         ;;
18054                 *)      byteorder=$dflt
18055                         ;;
18056                 esac
18057                 ;;
18058         esac
18059         $rm_try
18060         ;;
18061 esac
18062
18063 $cat <<EOM
18064
18065 Checking to see whether you can access character data unalignedly...
18066 EOM
18067 case "$d_u32align" in
18068 '')   $cat >try.c <<EOCP
18069 #include <stdio.h>
18070 #$i_stdlib I_STDLIB
18071 #ifdef I_STDLIB
18072 #include <stdlib.h>
18073 #endif
18074 #define U32 $u32type
18075 #define BYTEORDER 0x$byteorder
18076 #define U8 $u8type
18077 #include <signal.h>
18078 #ifdef SIGBUS
18079 $signal_t bletch(int s) { exit(4); }
18080 #endif
18081 int main() {
18082 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18083     U8 buf[8];
18084     U32 *up;
18085     int i;
18086
18087     if (sizeof(U32) != 4) {
18088         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18089         exit(1);
18090     }
18091
18092     fflush(stdout);
18093
18094 #ifdef SIGBUS
18095     signal(SIGBUS, bletch);
18096 #endif
18097
18098     buf[0] = 0;
18099     buf[1] = 0;
18100     buf[2] = 0;
18101     buf[3] = 1;
18102     buf[4] = 0;
18103     buf[5] = 0;
18104     buf[6] = 0;
18105     buf[7] = 1;
18106
18107     for (i = 0; i < 4; i++) {
18108         up = (U32*)(buf + i);
18109         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18110                (*up == 1 << (8*(3-i)))  /* little-endian */
18111               )
18112            )
18113         {
18114             printf("read failed (%x)\n", *up);
18115             exit(2);
18116         }
18117     }
18118
18119     /* write test */
18120     for (i = 0; i < 4; i++) {
18121         up = (U32*)(buf + i);
18122         *up = 0xBeef;
18123         if (*up != 0xBeef) {
18124             printf("write failed (%x)\n", *up);
18125             exit(3);
18126         }
18127     }
18128
18129     exit(0);
18130 #else
18131     printf("1\n");
18132     exit(1);
18133 #endif
18134     return 0;
18135 }
18136 EOCP
18137 set try
18138 if eval $compile_ok; then
18139         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18140         $run ./try 2>&1 >/dev/null
18141         case "$?" in
18142         0)      cat >&4 <<EOM
18143 You can access character data pretty unalignedly.
18144 EOM
18145                 d_u32align="$undef"
18146                 ;;
18147         *)      cat >&4 <<EOM
18148 It seems that you must access character data in an aligned manner.
18149 EOM
18150                 d_u32align="$define"
18151                 ;;
18152         esac
18153 else
18154         rp='Can you access character data at unaligned addresses?'
18155         dflt='n'
18156         . ./myread
18157         case "$ans" in
18158         [yY]*)  d_u32align="$undef"  ;;
18159         *)      d_u32align="$define" ;;
18160         esac
18161 fi
18162 $rm_try
18163 ;;
18164 esac
18165
18166 : see if ualarm exists
18167 set ualarm d_ualarm
18168 eval $inlibc
18169
18170 : see if umask exists
18171 set umask d_umask
18172 eval $inlibc
18173
18174 : see if unordered exists
18175 set unordered d_unordered
18176 eval $inlibc
18177
18178 : see if unsetenv exists
18179 set unsetenv d_unsetenv
18180 eval $inlibc
18181
18182 : see if usleep exists
18183 set usleep d_usleep
18184 eval $inlibc
18185
18186 : see if prototype for usleep is available
18187 echo " "
18188 set d_usleepproto usleep $i_unistd unistd.h
18189 eval $hasproto
18190
18191 : see if ustat exists
18192 set ustat d_ustat
18193 eval $inlibc
18194
18195 : see if closedir exists
18196 set closedir d_closedir
18197 eval $inlibc
18198
18199 case "$d_closedir" in
18200 "$define")
18201         echo " "
18202         echo "Checking whether closedir() returns a status..." >&4
18203         cat > try.c <<EOM
18204 #$i_dirent I_DIRENT             /**/
18205 #$i_sysdir I_SYS_DIR            /**/
18206 #$i_sysndir I_SYS_NDIR          /**/
18207 #$i_systypes I_SYS_TYPES        /**/
18208
18209 #if defined(I_SYS_TYPES)
18210 #include <sys/types.h>
18211 #endif
18212 #if defined(I_DIRENT)
18213 #include <dirent.h>
18214 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18215 #include <sys/dir.h>
18216 #endif
18217 #else
18218 #ifdef I_SYS_NDIR
18219 #include <sys/ndir.h>
18220 #else
18221 #ifdef I_SYS_DIR
18222 #ifdef hp9000s500
18223 #include <ndir.h>       /* may be wrong in the future */
18224 #else
18225 #include <sys/dir.h>
18226 #endif
18227 #endif
18228 #endif
18229 #endif
18230 int main() { return closedir(opendir(".")); }
18231 EOM
18232         set try
18233         if eval $compile_ok; then
18234                 if $run ./try > /dev/null 2>&1 ; then
18235                         echo "Yes, it does."
18236                         val="$undef"
18237                 else
18238                         echo "No, it doesn't."
18239                         val="$define"
18240                 fi
18241         else
18242                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18243                 val="$define"
18244         fi
18245         ;;
18246 *)
18247         val="$undef";
18248         ;;
18249 esac
18250 set d_void_closedir
18251 eval $setvar
18252 $rm_try
18253
18254 : see if there is a wait4
18255 set wait4 d_wait4
18256 eval $inlibc
18257
18258 : see if waitpid exists
18259 set waitpid d_waitpid
18260 eval $inlibc
18261
18262 : see if wcstombs exists
18263 set wcstombs d_wcstombs
18264 eval $inlibc
18265
18266 : see if wctomb exists
18267 set wctomb d_wctomb
18268 eval $inlibc
18269
18270 : see if writev exists
18271 set writev d_writev
18272 eval $inlibc
18273
18274 : preserve RCS keywords in files with variable substitution, grrr
18275 Date='$Date'
18276 Id='$Id'
18277 Log='$Log'
18278 RCSfile='$RCSfile'
18279 Revision='$Revision'
18280
18281 : check for alignment requirements
18282 echo " "
18283 case "$usecrosscompile$multiarch" in
18284 *$define*)
18285         $cat <<EOM
18286 You seem to be either cross-compiling or doing a multiarchitecture build,
18287 skipping the memory alignment check.
18288
18289 EOM
18290         case "$alignbytes" in
18291         '') alignbytes=8 ;;
18292         esac
18293         ;;
18294 *)
18295         case "$alignbytes" in
18296         '') echo "Checking alignment constraints..." >&4
18297                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18298                         $cat >try.c <<'EOCP'
18299 typedef long double NV;
18300 EOCP
18301                 else
18302                         $cat >try.c <<'EOCP'
18303 typedef double NV;
18304 EOCP
18305                 fi
18306                 $cat >>try.c <<'EOCP'
18307 #include <stdio.h>
18308 struct foobar {
18309         char foo;
18310         NV bar;
18311 } try_algn;
18312 int main()
18313 {
18314     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18315     return(0);
18316 }
18317 EOCP
18318                 set try
18319                 if eval $compile_ok; then
18320                         dflt=`$run ./try`
18321                 else
18322                         dflt='8'
18323                         echo "(I can't seem to compile the test program...)"
18324                 fi
18325                 ;;
18326         *) dflt="$alignbytes"
18327                 ;;
18328         esac
18329         rp="Doubles must be aligned on a how-many-byte boundary?"
18330         . ./myread
18331         alignbytes="$ans"
18332         $rm_try
18333         ;;
18334 esac
18335
18336
18337 : set the base revision
18338 baserev=5.0
18339
18340 : how do we concatenate cpp tokens here?
18341 echo " "
18342 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18343 $cat >cpp_stuff.c <<'EOCP'
18344 #define RCAT(a,b)a/**/b
18345 #define ACAT(a,b)a ## b
18346 RCAT(Rei,ser)
18347 ACAT(Cir,cus)
18348 EOCP
18349 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18350 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18351         echo "Oh!  Smells like ANSI's been here." >&4
18352         echo "We can catify or stringify, separately or together!"
18353         cpp_stuff=42
18354 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18355         echo "Ah, yes!  The good old days!" >&4
18356         echo "However, in the good old days we don't know how to stringify and"
18357         echo "catify at the same time."
18358         cpp_stuff=1
18359 else
18360         $cat >&4 <<EOM
18361 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18362 You're going to have to edit the values of CAT[2-5] in config.h...
18363 EOM
18364         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18365 fi
18366 $rm -f cpp_stuff.*
18367
18368 : see if this is a db.h system
18369 set db.h i_db
18370 eval $inhdr
18371
18372 case "$i_db" in
18373 $define)
18374         : Check db version.
18375         echo " "
18376         echo "Checking Berkeley DB version ..." >&4
18377         $cat >try.c <<EOCP
18378 #$d_const HASCONST
18379 #ifndef HASCONST
18380 #define const
18381 #endif
18382 #include <sys/types.h>
18383 #include <stdio.h>
18384 #$i_stdlib I_STDLIB
18385 #ifdef I_STDLIB
18386 #include <stdlib.h>
18387 #endif
18388 #include <db.h>
18389 int main(int argc, char *argv[])
18390 {
18391 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18392     int Major, Minor, Patch ;
18393     unsigned long Version ;
18394     (void)db_version(&Major, &Minor, &Patch) ;
18395     if (argc == 2) {
18396         printf("%d %d %d %d %d %d\n",
18397                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18398                Major, Minor, Patch);
18399         exit(0);
18400     }
18401     printf("You have Berkeley DB Version 2 or greater.\n");
18402
18403     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18404                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18405     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18406                 Major, Minor, Patch) ;
18407
18408     /* check that db.h & libdb are compatible */
18409     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18410         printf("db.h and libdb are incompatible.\n") ;
18411         exit(3);
18412     }
18413
18414     printf("db.h and libdb are compatible.\n") ;
18415
18416     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18417                 + DB_VERSION_PATCH ;
18418
18419     /* needs to be >= 2.3.4 */
18420     if (Version < 2003004) {
18421     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18422         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18423         exit(2);
18424     }
18425
18426     exit(0);
18427 #else
18428 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18429     if (argc == 2) {
18430         printf("1 0 0\n");
18431         exit(0);
18432     }
18433     printf("You have Berkeley DB Version 1.\n");
18434     exit(0);    /* DB version < 2: the coast is clear. */
18435 #else
18436     exit(1);    /* <db.h> not Berkeley DB? */
18437 #endif
18438 #endif
18439 }
18440 EOCP
18441         set try
18442         if eval $compile_ok && $run ./try; then
18443                 echo 'Looks OK.' >&4
18444                 set `$run ./try 1`
18445                 db_version_major=$1
18446                 db_version_minor=$2
18447                 db_version_patch=$3
18448         else
18449                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18450                 i_db=$undef
18451                 case " $libs " in
18452                 *"-ldb "*)
18453                         : Remove db from list of libraries to use
18454                         echo "Removing unusable -ldb from library list" >&4
18455                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18456                         shift
18457                         libs="$*"
18458                         echo "libs = $libs" >&4
18459                         ;;
18460                 esac
18461         fi
18462         $rm_try
18463         ;;
18464 esac
18465
18466 case "$i_db" in
18467 define)
18468         : Check the return type needed for hash
18469         echo " "
18470         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18471         $cat >try.c <<EOCP
18472 #$d_const HASCONST
18473 #ifndef HASCONST
18474 #define const
18475 #endif
18476 #include <sys/types.h>
18477 #include <db.h>
18478
18479 #ifndef DB_VERSION_MAJOR
18480 u_int32_t hash_cb (ptr, size)
18481 const void *ptr;
18482 size_t size;
18483 {
18484 }
18485 HASHINFO info;
18486 int main()
18487 {
18488         info.hash = hash_cb;
18489 }
18490 #endif
18491 EOCP
18492         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18493                 if $contains warning try.out >>/dev/null 2>&1 ; then
18494                         db_hashtype='int'
18495                 else
18496                         db_hashtype='u_int32_t'
18497                 fi
18498         else
18499                 : XXX Maybe we should just give up here.
18500                 db_hashtype=u_int32_t
18501                 $cat try.out >&4
18502                 echo "Help:  I can't seem to compile the db test program." >&4
18503                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18504         fi
18505         $rm_try
18506         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18507         ;;
18508 *)      db_hashtype=u_int32_t
18509         ;;
18510 esac
18511 case "$i_db" in
18512 define)
18513         : Check the return type needed for prefix
18514         echo " "
18515         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18516         cat >try.c <<EOCP
18517 #$d_const HASCONST
18518 #ifndef HASCONST
18519 #define const
18520 #endif
18521 #include <sys/types.h>
18522 #include <db.h>
18523
18524 #ifndef DB_VERSION_MAJOR
18525 size_t prefix_cb (key1, key2)
18526 const DBT *key1;
18527 const DBT *key2;
18528 {
18529 }
18530 BTREEINFO info;
18531 int main()
18532 {
18533         info.prefix = prefix_cb;
18534 }
18535 #endif
18536 EOCP
18537         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18538                 if $contains warning try.out >>/dev/null 2>&1 ; then
18539                         db_prefixtype='int'
18540                 else
18541                         db_prefixtype='size_t'
18542                 fi
18543         else
18544                 db_prefixtype='size_t'
18545                 : XXX Maybe we should just give up here.
18546                 $cat try.out >&4
18547                 echo "Help:  I can't seem to compile the db test program." >&4
18548                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18549         fi
18550         $rm_try
18551         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18552         ;;
18553 *)      db_prefixtype='size_t'
18554         ;;
18555 esac
18556
18557 : How can we generate normalized random numbers ?
18558 echo " "
18559 echo "Looking for a random number function..." >&4
18560 case "$randfunc" in
18561 '')
18562         if set drand48 val -f; eval $csym; $val; then
18563                 dflt="drand48"
18564                 echo "Good, found drand48()." >&4
18565         elif set random val -f; eval $csym; $val; then
18566                 dflt="random"
18567                 echo "OK, found random()." >&4
18568         else
18569                 dflt="rand"
18570                 echo "Yick, looks like I have to use rand()." >&4
18571         fi
18572         echo " "
18573         ;;
18574 *)
18575         dflt="$randfunc"
18576         ;;
18577 esac
18578 cont=true
18579
18580 case "$ccflags" in
18581 *-Dmy_rand=*|*-Dmy_srand=*)
18582         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18583         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18584         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18585         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18586         ;;
18587 esac
18588
18589 while $test "$cont"; do
18590         rp="Use which function to generate random numbers?"
18591         . ./myread
18592         if $test "$ans" = "$dflt"; then
18593                 : null
18594         else
18595                 randbits=''
18596         fi
18597         randfunc="$ans"
18598         if set $ans val -f; eval $csym; $val; then
18599                 cont=''
18600         else
18601                 dflt=y
18602                 rp="I cannot find function $ans. Use that name anyway?"
18603                 . ./myread
18604                 dflt=rand
18605                 case "$ans" in
18606                         [yY]*) cont='';;
18607                 esac
18608         fi
18609         case "$cont" in
18610         '')
18611                 case "$randfunc" in
18612                 drand48)
18613                         drand01="drand48()"
18614                         seedfunc="srand48"
18615                         randbits=48
18616                         randseedtype=long
18617                         ;;
18618                 rand|random)
18619                         case "$randbits" in
18620                         '')
18621 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18622                                 $cat >try.c <<EOCP
18623 #$i_unistd I_UNISTD
18624 #$i_stdlib I_STDLIB
18625 #include <stdio.h>
18626 #ifdef I_UNISTD
18627 #  include <unistd.h>
18628 #endif
18629 #ifdef I_STDLIB
18630 #  include <stdlib.h>
18631 #endif
18632 int main()
18633 {
18634         register int i;
18635         register unsigned long tmp;
18636         register unsigned long max = 0L;
18637
18638         for (i = 1000; i; i--) {
18639                 tmp = (unsigned long) $randfunc();
18640                 if (tmp > max) max = tmp;
18641         }
18642         for (i = 0; max; i++)
18643                 max /= 2;
18644         printf("%d\n",i);
18645 }
18646 EOCP
18647                                 set try
18648                                 if eval $compile_ok; then
18649                                         dflt=`try`
18650                                 else
18651                                         dflt='?'
18652                                         echo "(I can't seem to compile the test program...)"
18653                                 fi
18654                                 ;;
18655                         *)
18656                                 dflt="$randbits"
18657                                 ;;
18658                         esac
18659                         rp="How many bits does your $randfunc() function produce?"
18660                         . ./myread
18661                         randbits="$ans"
18662                         $rm_try
18663                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18664                         seedfunc="s$randfunc"
18665                         randseedtype=unsigned
18666                         ;;
18667                 *)
18668                         dflt="31"
18669                         rp="How many bits does your $randfunc() function produce?"
18670                         . ./myread
18671                         randbits="$ans"
18672                         seedfunc="s$randfunc"
18673                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18674                         if set $seedfunc val -f; eval $csym; $val; then
18675                                 echo "(Using $seedfunc() to seed random generator)"
18676                         else
18677                                 echo "(Warning: no $seedfunc() to seed random generator)"
18678                                 seedfunc=rand
18679                         fi
18680                         randseedtype=unsigned
18681                         ;;
18682                 esac
18683                 ;;
18684         esac
18685 done
18686
18687 echo " "
18688 echo "Determining whether or not we are on an EBCDIC system..." >&4
18689 $cat >try.c <<'EOM'
18690 int main()
18691 {
18692   if ('M'==0xd4) return 0;
18693   return 1;
18694 }
18695 EOM
18696
18697 val=$undef
18698 set try
18699 if eval $compile_ok; then
18700         if $run ./try; then
18701                 echo "You seem to speak EBCDIC." >&4
18702                 val="$define"
18703         else
18704                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18705         fi
18706 else
18707         echo "I'm unable to compile the test program." >&4
18708         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18709 fi
18710 $rm_try
18711 set ebcdic
18712 eval $setvar
18713
18714 echo " "
18715 $cat >&4 <<EOM
18716 Checking how to flush all pending stdio output...
18717 EOM
18718 # I only know how to find the first 32 possibly open files on SunOS.
18719 # See also hints/sunos_4_1.sh and util.c  --AD
18720 case "$osname" in
18721 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18722 esac
18723 $cat >>try.c <<EOCP
18724 #include <stdio.h>
18725 #$i_stdlib I_STDLIB
18726 #ifdef I_STDLIB
18727 #include <stdlib.h>
18728 #endif
18729 #$i_unistd I_UNISTD
18730 #ifdef I_UNISTD
18731 # include <unistd.h>
18732 #endif
18733 #$d_sysconf HAS_SYSCONF
18734 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18735 #ifdef HAS_STDIO_STREAM_ARRAY
18736 # define STDIO_STREAM_ARRAY $stdio_stream_array
18737 #endif
18738 int main() {
18739   FILE* p;
18740   unlink("try.out");
18741   p = fopen("try.out", "w");
18742 #ifdef TRY_FPUTC
18743   fputc('x', p);
18744 #else
18745 # ifdef TRY_FPRINTF
18746   fprintf(p, "x");
18747 # endif
18748 #endif
18749 #ifdef TRY_FFLUSH_NULL
18750   fflush(NULL);
18751 #endif
18752 #ifdef TRY_FFLUSH_ALL
18753   {
18754     long open_max = -1;
18755 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18756     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18757 # else
18758 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18759     open_max = sysconf(_SC_OPEN_MAX);
18760 #  else
18761 #   ifdef FOPEN_MAX
18762     open_max = FOPEN_MAX;
18763 #   else
18764 #    ifdef OPEN_MAX
18765     open_max = OPEN_MAX;
18766 #    else
18767 #     ifdef _NFILE
18768     open_max = _NFILE;
18769 #     endif
18770 #    endif
18771 #   endif
18772 #  endif
18773 # endif
18774 # ifdef HAS_STDIO_STREAM_ARRAY
18775     if (open_max > 0) {
18776       long i;
18777       for (i = 0; i < open_max; i++)
18778             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18779                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18780                 STDIO_STREAM_ARRAY[i]._flag)
18781                 fflush(&STDIO_STREAM_ARRAY[i]);
18782     }
18783   }
18784 # endif
18785 #endif
18786   _exit(42);
18787 }
18788 EOCP
18789 : first we have to find out how _not_ to flush
18790 $to try.c
18791 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18792     output=''
18793     set try -DTRY_FPUTC
18794     if eval $compile; then
18795             $run ./try 2>/dev/null
18796             code="$?"
18797             $from try.out
18798             if $test ! -s try.out -a "X$code" = X42; then
18799                 output=-DTRY_FPUTC
18800             fi
18801     fi
18802     case "$output" in
18803     '')
18804             set try -DTRY_FPRINTF
18805             if eval $compile; then
18806                     $run ./try 2>/dev/null
18807                     code="$?"
18808                     $from try.out
18809                     if $test ! -s try.out -a "X$code" = X42; then
18810                         output=-DTRY_FPRINTF
18811                     fi
18812             fi
18813         ;;
18814     esac
18815 fi
18816 : check for fflush NULL behaviour
18817 case "$fflushNULL" in
18818 '')     set try -DTRY_FFLUSH_NULL $output
18819         if eval $compile; then
18820                 $run ./try 2>/dev/null
18821                 code="$?"
18822                 $from try.out
18823                 if $test -s try.out -a "X$code" = X42; then
18824                         fflushNULL="`$cat try.out`"
18825                 else
18826                         if $test "X$code" != X42; then
18827                                 $cat >&4 <<EOM
18828 (If this test failed, don't worry, we'll try another method shortly.)
18829 EOM
18830                         fi
18831                 fi
18832         fi
18833         $rm_try
18834         case "$fflushNULL" in
18835         x)      $cat >&4 <<EOM
18836 Your fflush(NULL) works okay for output streams.
18837 Let's see if it clobbers input pipes...
18838 EOM
18839 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18840 # bug that improperly flushes the input end of pipes.  So we avoid the
18841 # autoflush on fork/system/exec support for now. :-(
18842 $cat >tryp.c <<EOCP
18843 #include <stdio.h>
18844 int
18845 main(int argc, char **argv)
18846 {
18847     char buf[1024];
18848     int i;
18849     char *bp = buf;
18850     while (1) {
18851         while ((i = getc(stdin)) != -1
18852                && (*bp++ = i) != '\n'
18853                && bp < &buf[1024])
18854         /* DO NOTHING */ ;
18855         *bp = '\0';
18856         fprintf(stdout, "%s", buf);
18857         fflush(NULL);
18858         if (i == -1)
18859             return 0;
18860         bp = buf;
18861     }
18862 }
18863 EOCP
18864                 fflushNULL="$define"
18865                 set tryp
18866                 if eval $compile; then
18867                     $rm -f tryp.out
18868                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18869                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18870                        $cat >&4 <<EOM
18871 fflush(NULL) seems to behave okay with input streams.
18872 EOM
18873                         fflushNULL="$define"
18874                     else
18875                         $cat >&4 <<EOM
18876 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18877 EOM
18878                         fflushNULL="$undef"
18879                     fi
18880                 fi
18881                 $rm -f core tryp.c tryp.core core.tryp.*
18882                 ;;
18883         '')     $cat >&4 <<EOM
18884 Your fflush(NULL) isn't working (contrary to ANSI C).
18885 EOM
18886                 fflushNULL="$undef"
18887                 ;;
18888         *)      $cat >&4 <<EOM
18889 Cannot figure out whether your fflush(NULL) works or not.
18890 I'm assuming it doesn't (contrary to ANSI C).
18891 EOM
18892                 fflushNULL="$undef"
18893                 ;;
18894         esac
18895         ;;
18896 $define|true|[yY]*)
18897         fflushNULL="$define"
18898         ;;
18899 *)
18900         fflushNULL="$undef"
18901         ;;
18902 esac
18903 : check explicit looping only if NULL did not work, and if the pipe
18904 : bug does not show up on an explicit flush too
18905 case "$fflushNULL" in
18906 "$undef")
18907         $cat >tryp.c <<EOCP
18908 #include <stdio.h>
18909 int
18910 main(int argc, char **argv)
18911 {
18912     char buf[1024];
18913     int i;
18914     char *bp = buf;
18915     while (1) {
18916         while ((i = getc(stdin)) != -1
18917                && (*bp++ = i) != '\n'
18918                && bp < &buf[1024])
18919         /* DO NOTHING */ ;
18920         *bp = '\0';
18921         fprintf(stdout, "%s", buf);
18922         fflush(stdin);
18923         if (i == -1)
18924             return 0;
18925         bp = buf;
18926     }
18927 }
18928 EOCP
18929         set tryp
18930         if eval $compile; then
18931             $rm -f tryp.out
18932             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18933             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18934                $cat >&4 <<EOM
18935 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18936 EOM
18937                 : now check for fflushall behaviour
18938                 case "$fflushall" in
18939                 '')     set try -DTRY_FFLUSH_ALL $output
18940                         if eval $compile; then
18941                                 $cat >&4 <<EOM
18942 (Now testing the other method--but note that this also may fail.)
18943 EOM
18944                                 $run ./try 2>/dev/null
18945                                 code=$?
18946                                 $from try.out
18947                                 if $test -s try.out -a "X$code" = X42; then
18948                                         fflushall="`$cat try.out`"
18949                                 fi
18950                         fi
18951                         $rm_try
18952                         case "$fflushall" in
18953                         x)      $cat >&4 <<EOM
18954 Whew. Flushing explicitly all the stdio streams works.
18955 EOM
18956                                 fflushall="$define"
18957                                 ;;
18958                         '')     $cat >&4 <<EOM
18959 Sigh. Flushing explicitly all the stdio streams doesn't work.
18960 EOM
18961                                 fflushall="$undef"
18962                                 ;;
18963                         *)      $cat >&4 <<EOM
18964 Cannot figure out whether flushing stdio streams explicitly works or not.
18965 I'm assuming it doesn't.
18966 EOM
18967                                 fflushall="$undef"
18968                                 ;;
18969                         esac
18970                         ;;
18971                 "$define"|true|[yY]*)
18972                         fflushall="$define"
18973                         ;;
18974                 *)
18975                         fflushall="$undef"
18976                         ;;
18977                 esac
18978             else
18979                 $cat >&4 <<EOM
18980 All is futile.  Even fflush(stdin) clobbers input pipes!
18981 EOM
18982                 fflushall="$undef"
18983             fi
18984         else
18985             fflushall="$undef"
18986         fi
18987         $rm -f core tryp.c tryp.core core.tryp.*
18988         ;;
18989 *)      fflushall="$undef"
18990         ;;
18991 esac
18992
18993 case "$fflushNULL$fflushall" in
18994 undefundef)
18995         $cat <<EOM
18996 OK, I give up.  I cannot figure out how to flush pending stdio output.
18997 We won't be flushing handles at all before fork/exec/popen.
18998 EOM
18999         ;;
19000 esac
19001 $rm_try
19002
19003 : Store the full pathname to the ar program for use in the C program
19004 : Respect a hint or command line value for full_ar.
19005 case "$full_ar" in
19006 '') full_ar=$ar ;;
19007 esac
19008
19009 : Store the full pathname to the sed program for use in the C program
19010 full_sed=$sed
19011
19012 : see what type gids are declared as in the kernel
19013 echo " "
19014 echo "Looking for the type for group ids returned by getgid()."
19015 set gid_t gidtype xxx stdio.h sys/types.h
19016 eval $typedef
19017 case "$gidtype" in
19018 xxx)
19019         xxx=`./findhdr sys/user.h`
19020         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19021         case $1 in
19022         unsigned) dflt="$1 $2" ;;
19023         *) dflt="$1" ;;
19024         esac
19025         ;;
19026 *) dflt="$gidtype";;
19027 esac
19028 case "$gidtype" in
19029 gid_t) echo "gid_t found." ;;
19030 *)      rp="What is the type for group ids returned by getgid()?"
19031         . ./myread
19032         gidtype="$ans"
19033         ;;
19034 esac
19035
19036 echo " "
19037 case "$gidtype" in
19038 *_t) zzz="$gidtype"     ;;
19039 *)   zzz="gid"          ;;
19040 esac
19041 echo "Checking the size of $zzz..." >&4 
19042 cat > try.c <<EOCP
19043 #include <sys/types.h>
19044 #include <stdio.h>
19045 #$i_stdlib I_STDLIB
19046 #ifdef I_STDLIB
19047 #include <stdlib.h>
19048 #endif
19049 int main() {
19050     printf("%d\n", (int)sizeof($gidtype));
19051     exit(0);
19052 }
19053 EOCP
19054 set try
19055 if eval $compile_ok; then
19056         yyy=`$run ./try`
19057         case "$yyy" in
19058         '')     gidsize=4
19059                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19060                 ;;
19061         *)      gidsize=$yyy
19062                 echo "Your $zzz is $gidsize bytes long."
19063                 ;;
19064         esac
19065 else
19066         gidsize=4
19067         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19068 fi
19069
19070
19071 echo " "
19072 case "$gidtype" in
19073 *_t) zzz="$gidtype"     ;;
19074 *)   zzz="gid"          ;;
19075 esac
19076 echo "Checking the sign of $zzz..." >&4 
19077 cat > try.c <<EOCP
19078 #include <sys/types.h>
19079 #include <stdio.h>
19080 int main() {
19081         $gidtype foo = -1;
19082         if (foo < 0)
19083                 printf("-1\n");
19084         else
19085                 printf("1\n");
19086 }
19087 EOCP
19088 set try
19089 if eval $compile; then
19090         yyy=`$run ./try`
19091         case "$yyy" in
19092         '')     gidsign=1
19093                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19094                 ;;
19095         *)      gidsign=$yyy
19096                 case "$gidsign" in
19097                  1) echo "Your $zzz is unsigned." ;;
19098                 -1) echo "Your $zzz is signed."   ;;
19099                 esac
19100                 ;;
19101         esac
19102 else
19103         gidsign=1
19104         echo "(I can't compile the test program--guessing unsigned.)" >&4
19105 fi
19106
19107
19108 echo " "
19109
19110 if $test X"$quadtype" != X; then
19111
19112 echo "Checking how to print 64-bit integers..." >&4
19113
19114 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19115         $cat >try.c <<'EOCP'
19116 #include <sys/types.h>
19117 #include <stdio.h>
19118 int main() {
19119   int q = 12345678901;
19120   printf("%ld\n", q);
19121 }
19122 EOCP
19123         set try
19124         if eval $compile; then
19125                 yyy=`$run ./try`
19126                 case "$yyy" in
19127                 12345678901)
19128                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19129                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19130                         echo "We will use %d."
19131                         ;;
19132                 esac
19133         fi
19134 fi
19135
19136 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19137         $cat >try.c <<'EOCP'
19138 #include <sys/types.h>
19139 #include <stdio.h>
19140 int main() {
19141   long q = 12345678901;
19142   printf("%ld\n", q);
19143 }
19144 EOCP
19145         set try
19146         if eval $compile; then
19147                 yyy=`$run ./try`
19148                 case "$yyy" in
19149                 12345678901)
19150                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19151                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19152                         echo "We will use %ld."
19153                         ;;
19154                 esac
19155         fi
19156 fi
19157
19158 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19159         $cat >try.c <<'EOCP'
19160 #include <sys/types.h>
19161 #include <inttypes.h>
19162 #include <stdio.h>
19163 int main() {
19164   int64_t q = 12345678901;
19165   printf("%" PRId64 "\n", q);
19166 }
19167 EOCP
19168         set try
19169         if eval $compile; then
19170                 yyy=`$run ./try`
19171                 case "$yyy" in
19172                 12345678901)
19173                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19174                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19175                         echo "We will use the C9X style."
19176                         ;;
19177                 esac
19178         fi
19179 fi
19180
19181 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19182         $cat >try.c <<EOCP
19183 #include <sys/types.h>
19184 #include <stdio.h>
19185 int main() {
19186   $quadtype q = 12345678901;
19187   printf("%Ld\n", q);
19188 }
19189 EOCP
19190         set try
19191         if eval $compile; then
19192                 yyy=`$run ./try`
19193                 case "$yyy" in
19194                 12345678901)
19195                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19196                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19197                         echo "We will use %Ld."
19198                         ;;
19199                 esac
19200         fi
19201 fi
19202
19203 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19204         $cat >try.c <<'EOCP'
19205 #include <sys/types.h>
19206 #include <stdio.h>
19207 int main() {
19208   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19209   printf("%lld\n", q);
19210 }
19211 EOCP
19212         set try
19213         if eval $compile; then
19214                 yyy=`$run ./try`
19215                 case "$yyy" in
19216                 12345678901)
19217                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19218                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19219                         echo "We will use the %lld style."
19220                         ;;
19221                 esac
19222         fi
19223 fi
19224
19225 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19226         $cat >try.c <<EOCP
19227 #include <sys/types.h>
19228 #include <stdio.h>
19229 int main() {
19230   $quadtype q = 12345678901;
19231   printf("%qd\n", q);
19232 }
19233 EOCP
19234         set try
19235         if eval $compile; then
19236                 yyy=`$run ./try`
19237                 case "$yyy" in
19238                 12345678901)
19239                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19240                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19241                         echo "We will use %qd."
19242                         ;;
19243                 esac
19244         fi
19245 fi
19246
19247 if $test X"$sPRId64" = X; then
19248         echo "Cannot figure out how to print 64-bit integers." >&4
19249 fi
19250 $rm_try
19251
19252 fi
19253
19254 case "$sPRId64" in
19255 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19256         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19257         ;;
19258 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19259         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19260         ;;
19261 esac
19262
19263
19264 echo " "
19265 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19266
19267 if $test X"$ivsize" = X8; then
19268         ivdformat="$sPRId64"
19269         uvuformat="$sPRIu64"
19270         uvoformat="$sPRIo64"
19271         uvxformat="$sPRIx64"
19272         uvXUformat="$sPRIXU64"
19273 else
19274         if $test X"$ivsize" = X"$longsize"; then
19275                 ivdformat='"ld"'
19276                 uvuformat='"lu"'
19277                 uvoformat='"lo"'
19278                 uvxformat='"lx"'
19279                 uvXUformat='"lX"'
19280         else
19281                 if $test X"$ivsize" = X"$intsize"; then
19282                         ivdformat='"d"'
19283                         uvuformat='"u"'
19284                         uvoformat='"o"'
19285                         uvxformat='"x"'
19286                         uvXUformat='"X"'
19287                 else
19288                         : far out
19289                         if $test X"$ivsize" = X"$shortsize"; then
19290                                 ivdformat='"hd"'
19291                                 uvuformat='"hu"'
19292                                 uvoformat='"ho"'
19293                                 uvxformat='"hx"'
19294                                 uvXUformat='"hX"'
19295                         fi
19296                 fi
19297         fi
19298 fi
19299
19300 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19301         nveformat="$sPRIeldbl"
19302         nvfformat="$sPRIfldbl"
19303         nvgformat="$sPRIgldbl"
19304         nvEUformat="$sPRIEUldbl"
19305         nvFUformat="$sPRIFUldbl"
19306         nvGUformat="$sPRIGUldbl"
19307 else
19308         nveformat='"e"'
19309         nvfformat='"f"'
19310         nvgformat='"g"'
19311         nvEUformat='"E"'
19312         nvFUformat='"F"'
19313         nvGUformat='"G"'
19314 fi
19315
19316 case "$ivdformat" in
19317 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19318     exit 1
19319     ;;
19320 esac
19321
19322
19323 echo " "
19324 $echo "Checking the format string to be used for gids..." >&4
19325
19326 case "$gidsign" in
19327 -1)     if $test X"$gidsize" = X"$ivsize"; then
19328                 gidformat="$ivdformat"
19329         else
19330                 if $test X"$gidsize" = X"$longsize"; then
19331                         gidformat='"ld"'
19332                 else
19333                         if $test X"$gidsize" = X"$intsize"; then
19334                                 gidformat='"d"'
19335                         else
19336                                 if $test X"$gidsize" = X"$shortsize"; then
19337                                         gidformat='"hd"'
19338                                 fi
19339                         fi
19340                 fi
19341         fi
19342         ;;
19343 *)      if $test X"$gidsize" = X"$uvsize"; then
19344                 gidformat="$uvuformat"
19345         else
19346                 if $test X"$gidsize" = X"$longsize"; then
19347                         gidformat='"lu"'
19348                 else
19349                         if $test X"$gidsize" = X"$intsize"; then
19350                                 gidformat='"u"'
19351                         else
19352                                 if $test X"$gidsize" = X"$shortsize"; then
19353                                         gidformat='"hu"'
19354                                 fi
19355                         fi
19356                 fi
19357         fi
19358         ;;
19359 esac
19360
19361 : see if getgroups exists
19362 set getgroups d_getgrps
19363 eval $inlibc
19364
19365 : see if setgroups exists
19366 set setgroups d_setgrps
19367 eval $inlibc
19368
19369
19370 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19371 echo " "
19372 case "$d_getgrps$d_setgrps" in
19373 *define*)
19374         case "$groupstype" in
19375         '') dflt="$gidtype" ;;
19376         *)  dflt="$groupstype" ;;
19377         esac
19378         $cat <<EOM
19379 What type of pointer is the second argument to getgroups() and setgroups()?
19380 Usually this is the same as group ids, $gidtype, but not always.
19381
19382 EOM
19383         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19384         . ./myread
19385         groupstype="$ans"
19386         ;;
19387 *)  groupstype="$gidtype";;
19388 esac
19389
19390
19391 if $test $patchlevel -lt 9; then
19392 : MAD is not available in 5.8.x or earlier.
19393     ans=n;
19394 else
19395     case "$mad" in
19396     $define|true|[yY]*) dflt='y' ;;
19397     *)                  dflt='n' ;;
19398     esac
19399     cat <<EOM
19400
19401 Would you like to build with Misc Attribute Decoration? This is development
19402 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19403 overhead on the interpreter.
19404
19405 If this doesn't make any sense to you, just accept the default '$dflt'.
19406 EOM
19407     rp='Build Perl with MAD?'
19408     . ./myread
19409 fi
19410 case "$ans" in
19411 y|Y)    val="$define"
19412         madlyh='madly.h madly.act madly.tab'
19413         madlysrc='madly.c'
19414         madlyobj="madly$_o" ;;
19415 *)      val="$undef"
19416         madlyh=''
19417         madlysrc=''
19418         madlyobj='' ;;
19419 esac
19420 set mad
19421 eval $setvar
19422
19423 echo " "
19424 echo "Checking if your $make program sets \$(MAKE)..." >&4
19425 case "$make_set_make" in
19426 '')
19427         $sed 's/^X //' > testmake.mak << 'EOF'
19428 Xall:
19429 X       @echo 'maketemp="$(MAKE)"'
19430 EOF
19431         case "`$make -f testmake.mak 2>/dev/null`" in
19432         *maketemp=*) make_set_make='#' ;;
19433         *)      make_set_make="MAKE=$make" ;;
19434         esac
19435         $rm -f testmake.mak
19436         ;;
19437 esac
19438 case "$make_set_make" in
19439 '#') echo "Yup, it does.";;
19440 *) echo "Nope, it doesn't.";;
19441 esac
19442
19443 : see what type is used for mode_t
19444 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19445 set mode_t modetype int stdio.h sys/types.h
19446 eval $typedef_ask
19447
19448 : see if we need va_copy
19449 echo " "
19450 case "$i_stdarg" in
19451 "$define")
19452         $cat >try.c <<EOCP
19453 #include <stdarg.h>
19454 #include <stdio.h>
19455 #$i_stdlib I_STDLIB
19456 #ifdef I_STDLIB
19457 #include <stdlib.h>
19458 #endif
19459 #include <signal.h>
19460
19461 int
19462 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19463 {
19464   return vfprintf(f, fmt, *valp);
19465 }
19466
19467 int
19468 myvfprintf(FILE *f, const  char *fmt, va_list val)
19469 {
19470   return ivfprintf(f, fmt, &val);
19471 }
19472
19473 int
19474 myprintf(char *fmt, ...)
19475 {
19476   va_list val;
19477   va_start(val, fmt);
19478   return myvfprintf(stdout, fmt, val);
19479 }
19480
19481 int
19482 main(int ac, char **av)
19483 {
19484   signal(SIGSEGV, exit);
19485
19486   myprintf("%s%cs all right, then\n", "that", '\'');
19487   exit(0);
19488 }
19489 EOCP
19490         set try
19491         if eval $compile && $run ./try 2>&1 >/dev/null; then
19492                 case "`$run ./try`" in
19493                 "that's all right, then")
19494                         okay=yes
19495                         ;;
19496                 esac
19497         fi
19498         case "$okay" in
19499         yes)    echo "It seems that you don't need va_copy()." >&4
19500                 need_va_copy="$undef"
19501                 ;;
19502         *)      echo "It seems that va_copy() or similar will be needed." >&4
19503                 need_va_copy="$define"
19504                 ;;
19505         esac
19506         $rm_try
19507         ;;
19508 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19509         ;;
19510 esac
19511
19512 : see what type is used for size_t
19513 rp="What is the type used for the length parameter for string functions?"
19514 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19515 eval $typedef_ask
19516
19517 : check for type of arguments to gethostbyaddr. 
19518 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19519         case "$d_gethbyaddr" in
19520         $define)
19521                 $cat <<EOM
19522
19523 Checking to see what type of arguments are accepted by gethostbyaddr().
19524 EOM
19525                 hdrs="$define sys/types.h
19526                         $d_socket sys/socket.h 
19527                         $i_niin netinet/in.h 
19528                         $i_netdb netdb.h
19529                         $i_unistd unistd.h"
19530                 : The first arg can 'char *' or 'void *'
19531                 : The second arg is some of integral type
19532                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19533                         for yyy in size_t long int; do
19534                                 case "$netdb_host_type" in
19535                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19536                                         if ./protochk "$try" $hdrs; then
19537                                                 echo "Your system accepts $xxx for the first arg."
19538                                                 echo "...and $yyy for the second arg."
19539                                                 netdb_host_type="$xxx"
19540                                                 netdb_hlen_type="$yyy"
19541                                         fi
19542                                         ;;
19543                                 esac
19544                         done
19545                 done
19546                 : In case none of those worked, prompt the user.
19547                 case "$netdb_host_type" in
19548                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19549                         dflt='char *'
19550                         . ./myread
19551                         netdb_host_type=$ans
19552                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19553                         dflt="$sizetype"
19554                         . ./myread
19555                         netdb_hlen_type=$ans
19556                         ;;
19557                 esac
19558                 ;;
19559         *)      : no gethostbyaddr, so pick harmless defaults
19560                 netdb_host_type='char *'
19561                 netdb_hlen_type="$sizetype"
19562                 ;;
19563         esac
19564         # Remove the "const" if needed. -- but then we'll have a 
19565         # prototype clash!
19566         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19567 fi
19568
19569 : check for type of argument to gethostbyname. 
19570 if test "X$netdb_name_type" = X ; then
19571         case "$d_gethbyname" in
19572         $define)
19573                 $cat <<EOM
19574
19575 Checking to see what type of argument is accepted by gethostbyname().
19576 EOM
19577                 hdrs="$define sys/types.h
19578                         $d_socket sys/socket.h 
19579                         $i_niin netinet/in.h 
19580                         $i_netdb netdb.h
19581                         $i_unistd unistd.h"
19582                 for xxx in "const char *" "char *"; do
19583                         case "$netdb_name_type" in
19584                         '')     try="extern struct hostent *gethostbyname($xxx);"
19585                                 if ./protochk "$try" $hdrs; then
19586                                         echo "Your system accepts $xxx."
19587                                         netdb_name_type="$xxx"
19588                                 fi
19589                                 ;;
19590                         esac
19591                 done
19592                 : In case none of those worked, prompt the user.
19593                 case "$netdb_name_type" in
19594                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19595                         dflt='char *'
19596                         . ./myread
19597                         netdb_name_type=$ans
19598                         ;;
19599                 esac
19600                 ;;
19601         *)      : no gethostbyname, so pick harmless default
19602                 netdb_name_type='char *'
19603                 ;;
19604         esac
19605 fi
19606
19607 : check for type of 1st argument to getnetbyaddr. 
19608 if test "X$netdb_net_type" = X ; then
19609         case "$d_getnbyaddr" in
19610         $define)
19611                 $cat <<EOM
19612
19613 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19614 EOM
19615                 hdrs="$define sys/types.h
19616                         $d_socket sys/socket.h 
19617                         $i_niin netinet/in.h 
19618                         $i_netdb netdb.h
19619                         $i_unistd unistd.h"
19620                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19621                         case "$netdb_net_type" in
19622                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19623                                 if ./protochk "$try" $hdrs; then
19624                                         echo "Your system accepts $xxx."
19625                                         netdb_net_type="$xxx"
19626                                 fi
19627                                 ;;
19628                         esac
19629                 done
19630                 : In case none of those worked, prompt the user.
19631                 case "$netdb_net_type" in
19632                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19633                         dflt='long'
19634                         . ./myread
19635                         netdb_net_type=$ans
19636                         ;;
19637                 esac
19638                 ;;
19639         *)      : no getnetbyaddr, so pick harmless default
19640                 netdb_net_type='long'
19641                 ;;
19642         esac
19643 fi
19644 : locate the preferred pager for this system
19645 fn=f/
19646 case "$pager" in
19647 '')
19648         dflt=''
19649         case "$pg" in
19650         /*) dflt=$pg;;
19651         [a-zA-Z]:/*) dflt=$pg;;
19652         esac
19653         case "$more" in
19654         /*) dflt=$more;;
19655         [a-zA-Z]:/*) dflt=$more;;
19656         esac
19657         case "$less" in
19658         /*) dflt=$less;;
19659         [a-zA-Z]:/*) dflt=$less;;
19660         esac
19661         case "$dflt" in
19662         '') dflt=/usr/ucb/more;;
19663         esac
19664         ;;
19665 *)      dflt="$pager"
19666         : Instruct ./getfile to trust the hinted or previous pager value,
19667         : even if it does not begin with a slash.  For example, on os2,
19668         : pager might be cmd /c more.  See comments in UU/getfile.
19669         fn="f/($pager)"
19670         ;;
19671 esac
19672 echo " "
19673 rp='What pager is used on your system?'
19674 . ./getfile
19675 pager="$ans"
19676
19677 : see what type pids are declared as in the kernel
19678 rp="What is the type of process ids on this system?"
19679 set pid_t pidtype int stdio.h sys/types.h
19680 eval $typedef_ask
19681
19682 : see if ar generates random libraries by itself
19683 echo " "
19684 echo "Checking how to generate random libraries on your machine..." >&4
19685 echo 'int bar1() { return bar2(); }' > bar1.c
19686 echo 'int bar2() { return 2; }' > bar2.c
19687 $cat > foo.c <<EOP
19688 #$i_stdlib I_STDLIB
19689 #ifdef I_STDLIB
19690 #include <stdlib.h>
19691 #endif
19692 int main() { printf("%d\n", bar1()); exit(0); }
19693 EOP
19694 $cc $ccflags -c bar1.c >/dev/null 2>&1
19695 $cc $ccflags -c bar2.c >/dev/null 2>&1
19696 $cc $ccflags -c foo.c >/dev/null 2>&1
19697 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19698 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19699         $run ./foobar >/dev/null 2>&1; then
19700         echo "$ar appears to generate random libraries itself."
19701         orderlib=false
19702         if [ "X$ranlib" = "X" ]; then
19703             ranlib=":"
19704         fi
19705 elif $ar s bar$_a >/dev/null 2>&1 &&
19706         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19707         $run ./foobar >/dev/null 2>&1; then
19708                 echo "a table of contents needs to be added with '$ar s'."
19709                 orderlib=false
19710                 ranlib="$ar s"
19711 elif $ar ts bar$_a >/dev/null 2>&1 &&
19712         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19713         $run ./foobar >/dev/null 2>&1; then
19714                 echo "a table of contents needs to be added with '$ar ts'."
19715                 orderlib=false
19716                 ranlib="$ar ts"
19717 else
19718         case "$ranlib" in
19719         :) ranlib='';;
19720         '')
19721                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19722                 $test -f $ranlib || ranlib=''
19723                 ;;
19724         esac
19725         if $test -n "$ranlib"; then
19726                 echo "your system has '$ranlib'; we'll use that."
19727                 orderlib=false
19728         else
19729                 echo "your system doesn't seem to support random libraries"
19730                 echo "so we'll use lorder and tsort to order the libraries."
19731                 orderlib=true
19732                 ranlib=":"
19733         fi
19734 fi
19735 $rm -f foo* bar*
19736
19737 : check for type of arguments to select. 
19738 case "$selecttype" in
19739 '') case "$d_select" in
19740         $define)
19741                 echo " "
19742                 $cat <<EOM
19743 Checking to see what type of arguments are accepted by select().
19744 EOM
19745                 hdrs="$define sys/types.h
19746                         $i_systime sys/time.h 
19747                         $i_sysselct sys/select.h
19748                         $d_socket sys/socket.h"
19749                 : The first arg can be int, unsigned, or size_t
19750                 : The last arg may or may not be 'const'
19751                 val=''
19752                 : void pointer has been seen but using that
19753                 : breaks the selectminbits test
19754                 for xxx in 'fd_set *' 'int *'; do
19755                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19756                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19757                                         case "$val" in
19758                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19759                                                 if ./protochk "$try" $hdrs; then
19760                                                         echo "Your system accepts $xxx."
19761                                                         val="$xxx"
19762                                                 fi
19763                                                 ;;
19764                                         esac
19765                                 done
19766                         done
19767                 done
19768                 case "$val" in
19769                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19770                         case "$d_fd_set" in
19771                                 $define) dflt="fd_set *" ;;
19772                                 *)              dflt="int *" ;;
19773                         esac
19774                         . ./myread
19775                         val=$ans
19776                         ;;
19777                 esac
19778                 selecttype="$val"
19779                 ;;
19780         *)      : no select, so pick a harmless default
19781                 selecttype='int *'
19782                 ;;
19783         esac
19784         ;;
19785 esac
19786
19787 : check for the select 'width'
19788 case "$selectminbits" in
19789 '') safebits=`expr $ptrsize \* 8`
19790     case "$d_select" in
19791         $define)
19792                 $cat <<EOM
19793
19794 Checking to see on how many bits at a time your select() operates...
19795 EOM
19796                 $cat >try.c <<EOCP
19797 #include <sys/types.h>
19798 #$i_time I_TIME
19799 #$i_systime I_SYS_TIME
19800 #$i_systimek I_SYS_TIME_KERNEL
19801 #ifdef I_TIME
19802 #   include <time.h>
19803 #endif
19804 #ifdef I_SYS_TIME
19805 #   ifdef I_SYS_TIME_KERNEL
19806 #       define KERNEL
19807 #   endif
19808 #   include <sys/time.h>
19809 #   ifdef I_SYS_TIME_KERNEL
19810 #       undef KERNEL
19811 #   endif
19812 #endif
19813 #$i_sysselct I_SYS_SELECT
19814 #ifdef I_SYS_SELECT
19815 #include <sys/select.h>
19816 #endif
19817 #$d_socket HAS_SOCKET
19818 #ifdef HAS_SOCKET
19819 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19820 #endif
19821 #include <stdio.h>
19822 #$i_stdlib I_STDLIB
19823 #ifdef I_STDLIB
19824 #include <stdlib.h>
19825 #endif
19826 $selecttype b;
19827 #define S sizeof(*(b))
19828 #define MINBITS 64
19829 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19830 #define NBITS  (NBYTES * 8)
19831 int main() {
19832     char *s = (char *)malloc(NBYTES);
19833     struct timeval t;
19834     int i;
19835     FILE* fp;
19836     int fd;
19837
19838     if (!s)
19839         exit(1);
19840     fclose(stdin);
19841     fp = fopen("try.c", "r");
19842     if (fp == 0)
19843       exit(2);
19844     fd = fileno(fp);
19845     if (fd < 0)
19846       exit(3);
19847     b = ($selecttype)s;
19848     for (i = 0; i < NBITS; i++)
19849         FD_SET(i, b);
19850     t.tv_sec  = 0;
19851     t.tv_usec = 0;
19852     select(fd + 1, b, 0, 0, &t);
19853     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19854     free(s);
19855     printf("%d\n", i + 1);
19856     return 0;
19857 }
19858 EOCP
19859                 set try
19860                 if eval $compile_ok; then
19861                         selectminbits=`$run ./try`
19862                         case "$selectminbits" in
19863                         '')     cat >&4 <<EOM
19864 Cannot figure out on how many bits at a time your select() operates.
19865 I'll play safe and guess it is $safebits bits.
19866 EOM
19867                                 selectminbits=$safebits
19868                                 bits="$safebits bits"
19869                                 ;;
19870                         1)      bits="1 bit" ;;
19871                         *)      bits="$selectminbits bits" ;;
19872                         esac
19873                         echo "Your select() operates on $bits at a time." >&4
19874                 else
19875                         rp='What is the minimum number of bits your select() operates on?'
19876                         case "$byteorder" in
19877                         12345678)       dflt=64 ;;
19878                         1234)           dflt=32 ;;
19879                         *)              dflt=1  ;;
19880                         esac
19881                         . ./myread
19882                         val=$ans
19883                         selectminbits="$val"
19884                 fi
19885                 $rm_try
19886                 ;;
19887         *)      : no select, so pick a harmless default
19888                 selectminbits=$safebits
19889                 ;;
19890         esac
19891         ;;
19892 esac
19893
19894 : Trace out the files included by signal.h, then look for SIGxxx names.
19895 : Remove SIGARRAYSIZE used by HPUX.
19896 : Remove SIGSTKSIZE used by Linux.
19897 : Remove SIGSTKSZ used by Posix.
19898 : Remove SIGTYP void lines used by OS2.
19899 : Some cpps, like os390, dont give the file name anywhere
19900 if [ "X$fieldn" = X ]; then
19901         : Just make some guesses.  We check them later.
19902         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19903 else
19904         xxx=`echo '#include <signal.h>' |
19905         $cppstdin $cppminus $cppflags 2>/dev/null |
19906         $grep '^[       ]*#.*include' | 
19907         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19908 fi
19909 : Check this list of files to be sure we have parsed the cpp output ok.
19910 : This will also avoid potentially non-existent files, such 
19911 : as ../foo/bar.h
19912 xxxfiles=''
19913 for xx in $xxx /dev/null ; do
19914         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19915 done
19916 : If we have found no files, at least try signal.h
19917 case "$xxxfiles" in
19918 '')     xxxfiles=`./findhdr signal.h` ;;
19919 esac
19920 xxx=`awk '
19921 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19922         print substr($2, 4, 20)
19923 }
19924 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19925         print substr($3, 4, 20)
19926 }' $xxxfiles`
19927 : Append some common names just in case the awk scan failed.
19928 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19929 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19930 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19931 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19932 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19933
19934 : generate a few handy files for later
19935 $cat > signal.c <<EOCP
19936 #include <sys/types.h>
19937 #include <signal.h>
19938 #$i_stdlib I_STDLIB
19939 #ifdef I_STDLIB
19940 #include <stdlib.h>
19941 #endif
19942 #include <stdio.h>
19943 int main() {
19944
19945 /* Strange style to avoid deeply-nested #if/#else/#endif */
19946 #ifndef NSIG
19947 #  ifdef _NSIG
19948 #    define NSIG (_NSIG)
19949 #  endif
19950 #endif
19951
19952 #ifndef NSIG
19953 #  ifdef SIGMAX
19954 #    define NSIG (SIGMAX+1)
19955 #  endif
19956 #endif
19957
19958 #ifndef NSIG
19959 #  ifdef SIG_MAX
19960 #    define NSIG (SIG_MAX+1)
19961 #  endif
19962 #endif
19963
19964 #ifndef NSIG
19965 #  ifdef _SIG_MAX
19966 #    define NSIG (_SIG_MAX+1)
19967 #  endif
19968 #endif
19969
19970 #ifndef NSIG
19971 #  ifdef MAXSIG
19972 #    define NSIG (MAXSIG+1)
19973 #  endif
19974 #endif
19975
19976 #ifndef NSIG
19977 #  ifdef MAX_SIG
19978 #    define NSIG (MAX_SIG+1)
19979 #  endif
19980 #endif
19981
19982 #ifndef NSIG
19983 #  ifdef SIGARRAYSIZE
19984 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19985 #  endif
19986 #endif
19987
19988 #ifndef NSIG
19989 #  ifdef _sys_nsig
19990 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19991 #  endif
19992 #endif
19993
19994 /* Default to some arbitrary number that's big enough to get most
19995    of the common signals.
19996 */
19997 #ifndef NSIG
19998 #    define NSIG 50
19999 #endif
20000
20001 printf("NSIG %d\n", NSIG);
20002
20003 #ifndef JUST_NSIG
20004
20005 EOCP
20006
20007 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20008 {
20009         printf "#ifdef SIG"; printf $1; printf "\n"
20010         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20011         printf $1; printf ");\n"
20012         printf "#endif\n"
20013 }
20014 END {
20015         printf "#endif /* JUST_NSIG */\n";
20016         printf "exit(0);\n}\n";
20017 }
20018 ' >>signal.c
20019 $cat >signal.awk <<'EOP'
20020 BEGIN { ndups = 0 }
20021 $1 ~ /^NSIG$/ { nsig = $2 }
20022 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20023     if ($2 > maxsig) { maxsig = $2 }
20024     if (sig_name[$2]) {
20025         dup_name[ndups] = $1
20026         dup_num[ndups] = $2
20027         ndups++ 
20028     }
20029     else {
20030         sig_name[$2] = $1
20031         sig_num[$2] = $2
20032     }
20033 }
20034 END { 
20035     if (nsig == 0) {
20036         nsig = maxsig + 1
20037     }
20038     printf("NSIG %d\n", nsig);
20039     for (n = 1; n < nsig; n++) {
20040         if (sig_name[n]) {
20041             printf("%s %d\n", sig_name[n], sig_num[n])
20042         }
20043         else {
20044             printf("NUM%d %d\n", n, n) 
20045         }
20046     }
20047     for (n = 0; n < ndups; n++) {
20048         printf("%s %d\n", dup_name[n], dup_num[n])
20049     }
20050 }
20051 EOP
20052 $cat >signal_cmd <<EOS
20053 $startsh
20054 if $test -s signal.lst; then
20055     echo "Using your existing signal.lst file"
20056         exit 0
20057 fi
20058 xxx="$xxx"
20059 EOS
20060 $cat >>signal_cmd <<'EOS'
20061
20062 set signal
20063 if eval $compile_ok; then
20064         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
20065 else
20066         echo "(I can't seem be able to compile the whole test program)" >&4
20067         echo "(I'll try it in little pieces.)" >&4
20068         set signal -DJUST_NSIG
20069         if eval $compile_ok; then
20070                 $run ./signal$_exe > signal.nsg
20071                 $cat signal.nsg
20072         else
20073                 echo "I can't seem to figure out how many signals you have." >&4
20074                 echo "Guessing 50." >&4
20075                 echo 'NSIG 50' > signal.nsg
20076         fi
20077         : Now look at all the signal names, one at a time.
20078         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20079                 $cat > signal.c <<EOCP
20080 #include <sys/types.h>
20081 #include <signal.h>
20082 #include <stdio.h>
20083 int main() {
20084 printf("$xx %d\n", SIG${xx});
20085 return 0;
20086 }
20087 EOCP
20088                 set signal
20089                 if eval $compile; then
20090                         echo "SIG${xx} found."
20091                         $run ./signal$_exe  >> signal.ls1
20092                 else
20093                         echo "SIG${xx} NOT found."
20094                 fi
20095         done
20096         if $test -s signal.ls1; then
20097                 $cat signal.nsg signal.ls1 |
20098                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20099         fi
20100
20101 fi
20102 if $test -s signal.lst; then
20103         :
20104 else
20105         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20106         echo 'kill -l' >signal
20107         set X `csh -f <signal`
20108         $rm -f signal
20109         shift
20110         case $# in
20111         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20112         esac
20113         echo $@ | $tr ' ' $trnl | \
20114             $awk '{ printf "%s %d\n", $1, ++s; }
20115                   END { printf "NSIG %d\n", ++s }' >signal.lst
20116 fi
20117 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20118 EOS
20119 chmod a+x signal_cmd
20120 $eunicefix signal_cmd
20121
20122 : generate list of signal names
20123 echo " "
20124 case "$sig_name_init" in
20125 '') doinit=yes ;;
20126 *)  case "$sig_num_init" in
20127     ''|*,*) doinit=yes ;;
20128     esac ;;
20129 esac
20130 case "$doinit" in
20131 yes)
20132         echo "Generating a list of signal names and numbers..." >&4
20133         . ./signal_cmd
20134         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20135         sig_name=`$awk 'BEGIN { printf "ZERO " }
20136                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20137         sig_num=`$awk  'BEGIN { printf "0 " }
20138                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20139         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20140                              !/^NSIG/   { printf "\"%s\", ", $1 }
20141                              END        { printf "0\n" }' signal.lst`
20142         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20143                              !/^NSIG/   { printf "%d, ", $2}
20144                              END        { printf "0\n"}' signal.lst`
20145         ;;
20146 esac
20147 echo "The following $sig_count signals are available:"
20148 echo " "
20149 echo $sig_name | $awk \
20150 'BEGIN { linelen = 0 }
20151 {
20152         for (i = 1; i <= NF; i++) {
20153                 name = "SIG" $i " "
20154                 linelen = linelen + length(name)
20155                 if (linelen > 70) {
20156                         printf "\n"
20157                         linelen = length(name)
20158                 }
20159                 printf "%s", name
20160         }
20161         printf "\n"
20162 }'
20163 sig_size=`echo $sig_name | awk '{print NF}'`
20164 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
20165
20166 echo " "
20167 case "$sizetype" in
20168 *_t) zzz="$sizetype"    ;;
20169 *)   zzz="filesize"     ;;
20170 esac
20171 echo "Checking the size of $zzz..." >&4 
20172 cat > try.c <<EOCP
20173 #include <sys/types.h>
20174 #include <stdio.h>
20175 #$i_stdlib I_STDLIB
20176 #ifdef I_STDLIB
20177 #include <stdlib.h>
20178 #endif
20179 int main() {
20180     printf("%d\n", (int)sizeof($sizetype));
20181     exit(0);
20182 }
20183 EOCP
20184 set try
20185 if eval $compile_ok; then
20186         yyy=`$run ./try`
20187         case "$yyy" in
20188         '')     sizesize=4
20189                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20190                 ;;
20191         *)      sizesize=$yyy
20192                 echo "Your $zzz size is $sizesize bytes."
20193                 ;;
20194         esac
20195 else
20196         sizesize=4
20197         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20198 fi
20199
20200
20201 : check for socklen_t
20202 echo " "
20203 echo "Checking to see if you have socklen_t..." >&4
20204 $cat >try.c <<EOCP
20205 #include <sys/types.h>
20206 #$d_socket HAS_SOCKET
20207 #ifdef HAS_SOCKET
20208 #include <sys/socket.h>
20209 #endif
20210 int main() { socklen_t x = 16; }
20211 EOCP
20212 set try
20213 if eval $compile; then
20214         val="$define"
20215         echo "You have socklen_t."
20216 else
20217         val="$undef"
20218         echo "You do not have socklen_t."
20219         case "$sizetype" in
20220         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20221         esac
20222 fi
20223 $rm_try
20224 set d_socklen_t
20225 eval $setvar
20226
20227 : see if this is a socks.h system
20228 set socks.h i_socks
20229 eval $inhdr
20230
20231 : check for type of the size argument to socket calls
20232 case "$d_socket" in
20233 "$define")
20234         $cat <<EOM
20235
20236 Checking to see what type is the last argument of accept().
20237 EOM
20238         yyy=''
20239         case "$d_socklen_t" in
20240         "$define") yyy="$yyy socklen_t"
20241         esac
20242         yyy="$yyy $sizetype int long unsigned"
20243         for xxx in $yyy; do
20244                 case "$socksizetype" in
20245                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20246                         case "$usesocks" in
20247                         "$define")
20248                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20249                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20250                                         socksizetype="$xxx"
20251                                 fi
20252                                 ;;
20253                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20254                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20255                                         socksizetype="$xxx"
20256                                 fi
20257                                 ;;
20258                         esac
20259                         ;;
20260                 esac
20261         done
20262 : In case none of those worked, prompt the user.
20263         case "$socksizetype" in
20264         '')     rp='What is the type for socket address structure sizes?'
20265                 dflt='int'
20266                 . ./myread
20267                 socksizetype=$ans
20268                 ;;
20269         esac
20270         ;;
20271 *)      : no sockets, so pick relatively harmless default
20272         socksizetype='int'
20273         ;;
20274 esac
20275
20276 : see what type is used for signed size_t
20277 set ssize_t ssizetype int stdio.h sys/types.h
20278 eval $typedef
20279 dflt="$ssizetype"
20280 $cat > try.c <<EOM
20281 #include <stdio.h>
20282 #$i_stdlib I_STDLIB
20283 #ifdef I_STDLIB
20284 #include <stdlib.h>
20285 #endif
20286 #include <sys/types.h>
20287 #define Size_t $sizetype
20288 #define SSize_t $dflt
20289 int main()
20290 {
20291         if (sizeof(Size_t) == sizeof(SSize_t))
20292                 printf("$dflt\n");
20293         else if (sizeof(Size_t) == sizeof(int))
20294                 printf("int\n");
20295         else
20296                 printf("long\n");
20297         exit(0);
20298 }
20299 EOM
20300 echo " "
20301 set try
20302 if eval $compile_ok && $run ./try > /dev/null; then
20303         ssizetype=`$run ./try`
20304         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20305 else
20306         $cat >&4 <<EOM
20307 Help! I can't compile and run the ssize_t test program: please enlighten me!
20308 (This is probably a misconfiguration in your system or libraries, and
20309 you really ought to fix it.  Still, I'll try anyway.)
20310
20311 I need a type that is the same size as $sizetype, but is guaranteed to
20312 be signed.  Common values are ssize_t, int and long.
20313
20314 EOM
20315         rp="What signed type is the same size as $sizetype?"
20316         . ./myread
20317         ssizetype="$ans"
20318 fi
20319 $rm_try
20320
20321 : see what type of char stdio uses.
20322 echo " "
20323 echo '#include <stdio.h>' > stdio.c
20324 $cppstdin $cppminus < stdio.c > stdioh
20325 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20326         echo "Your stdio uses unsigned chars." >&4
20327         stdchar="unsigned char"
20328 else
20329         echo "Your stdio uses signed chars." >&4
20330         stdchar="char"
20331 fi
20332 $rm -f stdio.* stdioh
20333
20334 : see what type uids are declared as in the kernel
20335 echo " "
20336 echo "Looking for the type for user ids returned by getuid()."
20337 set uid_t uidtype xxx stdio.h sys/types.h
20338 eval $typedef
20339 case "$uidtype" in
20340 xxx)
20341         xxx=`./findhdr sys/user.h`
20342         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20343         case $1 in
20344         unsigned) dflt="$1 $2" ;;
20345         *) dflt="$1" ;;
20346         esac
20347         ;;
20348 *) dflt="$uidtype";;
20349 esac
20350 case "$uidtype" in
20351 uid_t)  echo "uid_t found." ;;
20352 *)      rp="What is the type for user ids returned by getuid()?"
20353         . ./myread
20354         uidtype="$ans"
20355         ;;
20356 esac
20357
20358 echo " "
20359 case "$uidtype" in
20360 *_t) zzz="$uidtype"     ;;
20361 *)   zzz="uid"          ;;
20362 esac
20363 echo "Checking the size of $zzz..." >&4 
20364 cat > try.c <<EOCP
20365 #include <sys/types.h>
20366 #include <stdio.h>
20367 #$i_stdlib I_STDLIB
20368 #ifdef I_STDLIB
20369 #include <stdlib.h>
20370 #endif
20371 int main() {
20372     printf("%d\n", (int)sizeof($uidtype));
20373     exit(0);
20374 }
20375 EOCP
20376 set try
20377 if eval $compile_ok; then
20378         yyy=`$run ./try`
20379         case "$yyy" in
20380         '')     uidsize=4
20381                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20382                 ;;
20383         *)      uidsize=$yyy
20384                 echo "Your $zzz is $uidsize bytes long."
20385                 ;;
20386         esac
20387 else
20388         uidsize=4
20389         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20390 fi
20391
20392 echo " "
20393 case "$uidtype" in
20394 *_t) zzz="$uidtype"     ;;
20395 *)   zzz="uid"          ;;
20396 esac
20397 echo "Checking the sign of $zzz..." >&4
20398 cat > try.c <<EOCP
20399 #include <sys/types.h>
20400 #include <stdio.h>
20401 int main() {
20402         $uidtype foo = -1;
20403         if (foo < 0)
20404                 printf("-1\n");
20405         else
20406                 printf("1\n");
20407 }
20408 EOCP
20409 set try
20410 if eval $compile; then
20411         yyy=`$run ./try`
20412         case "$yyy" in
20413         '')     uidsign=1
20414                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20415                 ;;
20416         *)      uidsign=$yyy
20417                 case "$uidsign" in
20418                  1) echo "Your $zzz is unsigned." ;;
20419                 -1) echo "Your $zzz is signed."   ;;
20420                 esac
20421                 ;;
20422         esac
20423 else
20424         uidsign=1
20425         echo "(I can't compile the test program--guessing unsigned.)" >&4
20426 fi
20427
20428
20429
20430 echo " "
20431 $echo "Checking the format string to be used for uids..." >&4
20432
20433 case "$uidsign" in
20434 -1)     if $test X"$uidsize" = X"$ivsize"; then
20435                 uidformat="$ivdformat"
20436         else
20437                 if $test X"$uidsize" = X"$longsize"; then
20438                         uidformat='"ld"'
20439                 else
20440                         if $test X"$uidsize" = X"$intsize"; then
20441                                 uidformat='"d"'
20442                         else
20443                                 if $test X"$uidsize" = X"$shortsize"; then
20444                                         uidformat='"hd"'
20445                                 fi
20446                         fi
20447                 fi
20448         fi
20449         ;;
20450 *)      if $test X"$uidsize" = X"$uvsize"; then
20451                 uidformat="$uvuformat"
20452         else
20453                 if $test X"$uidsize" = X"$longsize"; then
20454                         uidformat='"lu"'
20455                 else
20456                         if $test X"$uidsize" = X"$intsize"; then
20457                                 uidformat='"u"'
20458                         else
20459                                 if $test X"$uidsize" = X"$shortsize"; then
20460                                         uidformat='"hu"'
20461                                 fi
20462                         fi
20463                 fi
20464         fi
20465         ;;
20466 esac
20467
20468
20469 case "$usesitecustomize" in
20470     $define|true|[Yy]*)
20471         usesitecustomize="$define"
20472         ;;
20473     *)
20474         usesitecustomize="$undef"
20475         ;;
20476     esac
20477
20478 : determine compiler compiler
20479 case "$yacc" in
20480 '')
20481         dflt=yacc;;
20482 *)
20483         dflt="$yacc";;
20484 esac
20485 echo " "
20486 comp='yacc'
20487 if $test -f "$byacc$_exe"; then
20488         dflt="$byacc"
20489         comp="byacc or $comp"
20490 fi
20491 if $test -f "$bison$_exe"; then
20492         comp="$comp or bison -y"
20493 fi
20494 rp="Which compiler compiler ($comp) shall I use?"
20495 . ./myread
20496 yacc="$ans"
20497 case "$yacc" in
20498 *bis*)
20499         case "$yacc" in
20500         *-y*) ;;
20501         *)
20502                 yacc="$yacc -y"
20503                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20504                 ;;
20505         esac
20506         ;;
20507 esac
20508
20509 : see if this is a fp.h system
20510 set fp.h i_fp
20511 eval $inhdr
20512
20513 : see if this is a fp_class.h system
20514 set fp_class.h i_fp_class
20515 eval $inhdr
20516
20517 : see if gdbm.h is available
20518 set gdbm.h t_gdbm
20519 eval $inhdr
20520 case "$t_gdbm" in
20521 $define)
20522         : see if gdbm_open exists
20523         set gdbm_open d_gdbm_open
20524         eval $inlibc
20525         case "$d_gdbm_open" in
20526         $undef)
20527                 t_gdbm="$undef"
20528                 echo "We won't be including <gdbm.h>"
20529                 ;;
20530         esac
20531         ;;
20532 esac
20533 val="$t_gdbm"
20534 set i_gdbm
20535 eval $setvar
20536
20537 : see if this is a ieeefp.h system
20538 case "$i_ieeefp" in
20539 '' ) set ieeefp.h i_ieeefp
20540      eval $inhdr
20541      ;;
20542 esac
20543
20544 : see if this is a libutil.h system
20545 set libutil.h i_libutil
20546 eval $inhdr
20547
20548 : see if mach cthreads are available
20549 if test "X$usethreads" = "X$define"; then
20550         set mach/cthreads.h i_machcthr
20551         eval $inhdr
20552 else
20553         i_machcthr="$undef"
20554 fi
20555
20556
20557
20558 : see if this is a mntent.h system
20559 set mntent.h i_mntent
20560 eval $inhdr
20561
20562 : see if ndbm.h is available
20563 set ndbm.h t_ndbm
20564 eval $inhdr
20565
20566 case "$t_ndbm" in
20567 $undef)
20568     # Some Linux distributions such as RedHat 7.1 put the
20569     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20570     if $test -f /usr/include/gdbm/ndbm.h; then
20571         echo '<gdbm/ndbm.h> found.'
20572         ccflags="$ccflags -I/usr/include/gdbm"
20573         cppflags="$cppflags -I/usr/include/gdbm"
20574         t_ndbm=$define
20575     fi
20576     ;;
20577 esac
20578
20579 case "$t_ndbm" in
20580 $define)
20581         : see if dbm_open exists
20582         set dbm_open d_dbm_open
20583         eval $inlibc
20584         case "$d_dbm_open" in
20585         $undef)
20586                 t_ndbm="$undef"
20587                 echo "We won't be including <ndbm.h>"
20588                 ;;
20589         esac
20590         ;;
20591 esac
20592 val="$t_ndbm"
20593 set i_ndbm
20594 eval $setvar
20595
20596 : see if net/errno.h is available
20597 val=''
20598 set net/errno.h val
20599 eval $inhdr
20600
20601 : Unfortunately, it causes problems on some systems.  Arrgh.
20602 case "$val" in
20603 $define)
20604         cat > try.c <<'EOM'
20605 #include <stdio.h>
20606 #include <errno.h>
20607 #include <net/errno.h>
20608 int func()
20609 {
20610         return ENOTSOCK;
20611 }
20612 EOM
20613         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20614                 echo "We'll be including <net/errno.h>." >&4
20615         else
20616                 echo "We won't be including <net/errno.h>." >&4
20617                 val="$undef"
20618         fi
20619         $rm_try
20620         ;;
20621 esac
20622 set i_neterrno
20623 eval $setvar
20624
20625 : see if netinet/tcp.h is available
20626 set netinet/tcp.h i_netinettcp
20627 eval $inhdr
20628
20629 : see if this is a poll.h system
20630 set poll.h i_poll
20631 eval $inhdr
20632
20633 : see if this is a prot.h system
20634 set prot.h i_prot
20635 eval $inhdr
20636
20637 echo " "
20638 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20639 $cat <<'EOSH' > Cppsym.know
20640 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20641 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20642 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20643 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20644 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20645 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20646 bull c cadmus clipper CMU COFF COMPILER_VERSION
20647 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20648 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20649 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20650 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20651 GLIBC GLIBC_MINOR
20652 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20653 H3050R H3050RX hbullx20 hcx host_mips
20654 hp200 hp300 hp700 HP700 hp800 hp9000
20655 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20656 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20657 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20658 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20659 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20660 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20661 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20662 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20663 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20664 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20665 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20666 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20667 MATH_HAS_NO_SIDE_EFFECTS
20668 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20669 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20670 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20671 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20672 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20673 NetBSD news1500 news1700 news1800 news1900 news3700
20674 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20675 ns32016 ns32332 ns32k nsc32000
20676 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20677 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20678 pc532 pdp11 PGC PIC plexus PORTAR posix
20679 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20680 POSIX_C_SOURCE POSIX_SOURCE POWER
20681 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20682 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20683 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20684 sony sony_news sonyrisc sparc sparclite spectrum
20685 stardent stdc STDC_EXT stratos sun sun3 sun386
20686 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20687 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20688 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20689 sysV68 sysV88 Tek4132 Tek4300 titan
20690 TM3200 TM5400 TM5600
20691 tower tower32 tower32_200 tower32_600 tower32_700
20692 tower32_800 tower32_850 tss
20693 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20694 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20695 unix UNIX95 UNIX99 unixpc unos
20696 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20697 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20698 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20699 USGr4 USGr4_2
20700 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20701 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20702 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20703 z8000
20704 EOSH
20705 # Maybe put other stuff here too.
20706 cat <<EOSH >>Cppsym.know
20707 $osname
20708 EOSH
20709 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20710 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20711 $cat Cppsym.know > Cppsym.c
20712 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20713 $rm -f Cppsym.a Cppsym.b Cppsym.c
20714 cat <<EOSH > Cppsym
20715 $startsh
20716 if $test \$# -gt 0; then
20717     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20718     if $test -s Cppsym.got; then
20719         $rm -f Cppsym.got
20720         exit 0
20721     fi
20722     $rm -f Cppsym.got
20723     exit 1
20724 else
20725     $tr " " "$trnl" | ./Cppsym.try
20726     exit 0
20727 fi
20728 EOSH
20729 chmod +x Cppsym
20730 $eunicefix Cppsym
20731 cat <<EOSH > Cppsym.try
20732 $startsh
20733 cat <<'EOCP' > try.c
20734 #include <stdio.h>
20735 #if cpp_stuff == 1
20736 #define STRINGIFY(a)    "a"
20737 #endif
20738 #if cpp_stuff == 42
20739 #define StGiFy(a)  #a
20740 #define STRINGIFY(a)    StGiFy(a)
20741 #endif
20742 #if $cpp_stuff != 1 && $cpp_stuff != 42
20743 #   include "Bletch: How does this C preprocessor stringify macros?"
20744 #endif
20745 int main() {
20746 EOCP
20747 $awk \\
20748 EOSH
20749 cat <<'EOSH' >> Cppsym.try
20750 'length($1) > 0 {
20751     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20752     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20753     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20754     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20755 }'       >> try.c
20756 echo 'return 0;}' >> try.c
20757 EOSH
20758 cat <<EOSH >> Cppsym.try
20759 ccflags="$ccflags"
20760 case "$osname-$gccversion" in
20761 irix-) ccflags="\$ccflags -woff 1178" ;;
20762 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20763 esac
20764 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20765 EOSH
20766 chmod +x Cppsym.try
20767 $eunicefix Cppsym.try
20768 ./Cppsym < Cppsym.know > Cppsym.true
20769 : Add in any linux cpp "predefined macros":
20770 case "$osname::$gccversion" in
20771   *linux*::*.*)
20772     tHdrH=_tmpHdr
20773     rm -f $tHdrH'.h' $tHdrH
20774     touch $tHdrH'.h'
20775     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20776        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20777        if [ -s $tHdrH'_cppsym.real' ]; then
20778           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20779        fi
20780     fi
20781     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20782   ;;
20783 esac
20784 : now check the C compiler for additional symbols
20785 postprocess_cc_v=''
20786 case "$osname" in
20787 aix) postprocess_cc_v="|$tr , ' '" ;;
20788 esac
20789 $cat >ccsym <<EOS
20790 $startsh
20791 $cat >tmp.c <<EOF
20792 extern int foo;
20793 EOF
20794 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20795 do
20796         case "\$i" in
20797         -D*) echo "\$i" | $sed 's/^-D//';;
20798         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20799         esac
20800 done
20801 $rm_try
20802 EOS
20803 postprocess_cc_v=''
20804 chmod +x ccsym
20805 $eunicefix ccsym
20806 ./ccsym > ccsym1.raw
20807 if $test -s ccsym1.raw; then
20808        $sort ccsym1.raw | $uniq >ccsym.raw
20809 else
20810        mv ccsym1.raw ccsym.raw
20811 fi
20812
20813 $awk '/\=/ { print $0; next }
20814         { print $0"=1" }' ccsym.raw >ccsym.list
20815 $comm -13 Cppsym.true ccsym.list >ccsym.own
20816 $comm -12 Cppsym.true ccsym.list >ccsym.com
20817 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20818 also=''
20819 if $test -z ccsym.raw; then
20820         echo "Your C compiler doesn't seem to define any symbols!" >&4
20821         echo " "
20822         echo "However, your C preprocessor defines the following symbols:"
20823         $cat Cppsym.true
20824         ccsymbols=''
20825         cppsymbols=`$cat Cppsym.true`
20826         cppsymbols=`echo $cppsymbols`
20827         cppccsymbols="$cppsymbols"
20828 else
20829         if $test -s ccsym.com; then
20830                 echo "Your C compiler and pre-processor define these symbols:"
20831                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20832                 also='also '
20833                 symbols='ones'
20834                 cppccsymbols=`$cat ccsym.com`
20835                 cppccsymbols=`echo $cppccsymbols`
20836                 $test "$silent" || sleep 1
20837         fi
20838         if $test -s ccsym.cpp; then
20839                 $test "$also" && echo " "
20840                 echo "Your C pre-processor ${also}defines the following symbols:"
20841                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20842                 also='further '
20843                 cppsymbols=`$cat ccsym.cpp`
20844                 cppsymbols=`echo $cppsymbols`
20845                 $test "$silent" || sleep 1
20846         fi
20847         if $test -s ccsym.own; then
20848                 $test "$also" && echo " "
20849                 echo "Your C compiler ${also}defines the following cpp symbols:"
20850                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20851                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20852                 ccsymbols=`$cat ccsym.own`
20853                 ccsymbols=`echo $ccsymbols`
20854                 $test "$silent" || sleep 1
20855         fi
20856 fi
20857
20858 : see if this is a termio system
20859 val="$undef"
20860 val2="$undef"
20861 val3="$undef"
20862 if $test `./findhdr termios.h`; then
20863         set tcsetattr i_termios
20864         eval $inlibc
20865         val3="$i_termios"
20866 fi
20867 echo " "
20868 case "$val3" in
20869 "$define") echo "You have POSIX termios.h... good!" >&4;;
20870 *) if ./Cppsym pyr; then
20871                 case "`/bin/universe`" in
20872                 ucb) if $test `./findhdr sgtty.h`; then
20873                                 val2="$define"
20874                                 echo "<sgtty.h> found." >&4
20875                         else
20876                                 echo "System is pyramid with BSD universe."
20877                                 echo "<sgtty.h> not found--you could have problems." >&4
20878                         fi;;
20879                 *) if $test `./findhdr termio.h`; then
20880                                 val="$define"
20881                                 echo "<termio.h> found." >&4
20882                         else
20883                                 echo "System is pyramid with USG universe."
20884                                 echo "<termio.h> not found--you could have problems." >&4
20885                         fi;;
20886                 esac
20887         elif ./usg; then
20888                 if $test `./findhdr termio.h`; then
20889                         echo "<termio.h> found." >&4
20890                         val="$define"
20891                 elif $test `./findhdr sgtty.h`; then
20892                         echo "<sgtty.h> found." >&4
20893                         val2="$define"
20894                 else
20895 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20896                 fi
20897         else
20898                 if $test `./findhdr sgtty.h`; then
20899                         echo "<sgtty.h> found." >&4
20900                         val2="$define"
20901                 elif $test `./findhdr termio.h`; then
20902                         echo "<termio.h> found." >&4
20903                         val="$define"
20904                 else
20905 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20906                 fi
20907         fi;;
20908 esac
20909 set i_termio; eval $setvar
20910 val=$val2; set i_sgtty; eval $setvar
20911 val=$val3; set i_termios; eval $setvar
20912
20913 : see if stddef is available
20914 set stddef.h i_stddef
20915 eval $inhdr
20916
20917 : see if sys/access.h is available
20918 set sys/access.h i_sysaccess
20919 eval $inhdr
20920
20921 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20922 set sys/filio.h i_sysfilio
20923 eval $inhdr
20924 echo " "
20925 if $test `./findhdr sys/ioctl.h`; then
20926         val="$define"
20927         echo '<sys/ioctl.h> found.' >&4
20928 else
20929         val="$undef"
20930         if $test $i_sysfilio = "$define"; then
20931             echo '<sys/ioctl.h> NOT found.' >&4
20932         else
20933                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20934                 $test $i_termio = "$define" && xxx="termio.h"
20935                 $test $i_termios = "$define" && xxx="termios.h"
20936 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20937         fi
20938 fi
20939 set i_sysioctl
20940 eval $setvar
20941
20942 : see if socket ioctl defs are in sys/sockio.h
20943 echo " "
20944 xxx=`./findhdr sys/sockio.h`
20945 if $test "$xxx"; then
20946         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20947                 val="$define"
20948                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20949         else
20950                 val="$undef"
20951                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20952         fi
20953 else
20954         val="$undef"
20955         $cat <<EOM
20956 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20957 EOM
20958 fi
20959 set i_syssockio
20960 eval $setvar
20961
20962
20963 : see if this is a syslog.h system
20964 set syslog.h i_syslog
20965 eval $inhdr
20966
20967
20968 : see if this is a sys/mode.h system
20969 set sys/mode.h i_sysmode
20970 eval $inhdr
20971
20972 : see if sys/resource.h has to be included
20973 set sys/resource.h i_sysresrc
20974 eval $inhdr
20975
20976 : see if sys/security.h is available
20977 set sys/security.h i_syssecrt
20978 eval $inhdr
20979
20980 : see if this is a sys/statvfs.h system
20981 set sys/statvfs.h i_sysstatvfs
20982 eval $inhdr
20983
20984 : see if this is a sys/un.h system
20985 set sys/un.h i_sysun
20986 eval $inhdr
20987
20988
20989 : see if this is a sys/utsname.h system
20990 set sys/utsname.h i_sysutsname
20991 eval $inhdr
20992
20993 : see if this is a syswait system
20994 set sys/wait.h i_syswait
20995 eval $inhdr
20996
20997 : see if this is a ustat.h system
20998 set ustat.h i_ustat
20999 eval $inhdr
21000
21001 : see if this is an utime system
21002 set utime.h i_utime
21003 eval $inhdr
21004
21005 : see if this is a values.h system
21006 set values.h i_values
21007 eval $inhdr
21008
21009 : see if this is a vfork system
21010 case "$d_vfork" in
21011 "$define")
21012         set vfork.h i_vfork
21013         eval $inhdr
21014         ;;
21015 *)
21016         i_vfork="$undef"
21017         ;;
21018 esac
21019
21020 echo " "
21021 echo "Looking for extensions..." >&4
21022 : If we are using the old config.sh, known_extensions may contain
21023 : old or inaccurate or duplicate values.
21024 known_extensions=''
21025 nonxs_extensions=''
21026 : We do not use find because it might not be available.
21027 : We do not just use MANIFEST because the user may have dropped
21028 : some additional extensions into the source tree and expect them
21029 : to be built.
21030
21031 : Function to recursively find available extensions, ignoring DynaLoader
21032 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21033 find_extensions='
21034     for xxx in *; do
21035         case "$xxx" in
21036             DynaLoader|dynaload) ;;
21037             *)
21038             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21039                 known_extensions="$known_extensions $1$xxx";
21040             elif $test -f $xxx/Makefile.PL; then
21041                 nonxs_extensions="$nonxs_extensions $1$xxx";
21042             else
21043                 if $test -d $xxx -a $# -lt 10; then
21044                     set $1$xxx/ $*;
21045                     cd "$xxx";
21046                     eval $find_extensions;
21047                     cd ..;
21048                     shift;
21049                 fi;
21050             fi
21051             ;;
21052         esac;
21053     done'
21054 tdir=`pwd`
21055 cd "$rsrc/ext"
21056 set X
21057 shift
21058 eval $find_extensions
21059 # Special case:  Add in threads/shared since it is not picked up by the
21060 # recursive find above (and adding in general recursive finding breaks
21061 # SDBM_File/sdbm).  A.D.  10/25/2001.
21062 known_extensions="$known_extensions threads/shared"
21063 set X $known_extensions
21064 shift
21065 known_extensions="$*"
21066 set X $nonxs_extensions
21067 shift
21068 nonxs_extensions="$*"
21069 cd "$tdir"
21070
21071 : Now see which are supported on this system.
21072 avail_ext=''
21073 for xxx in $known_extensions ; do
21074         case "$xxx" in
21075         DB_File|db_file)
21076                 case "$i_db" in
21077                 $define) avail_ext="$avail_ext $xxx" ;;
21078                 esac
21079                 ;;
21080         GDBM_File|gdbm_fil)
21081                 case "$i_gdbm" in
21082                 $define) avail_ext="$avail_ext $xxx" ;;
21083                 esac
21084                 ;;
21085         I18N/Langinfo|i18n_lan)
21086                 case "$i_langinfo$d_nl_langinfo" in
21087                 $define$define) avail_ext="$avail_ext $xxx" ;;
21088                 esac
21089                 ;;
21090         IPC/SysV|ipc/sysv)
21091                 : XXX Do we need a useipcsysv variable here
21092                 case "${d_msg}${d_sem}${d_shm}" in
21093                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21094                 esac
21095                 ;;
21096         NDBM_File|ndbm_fil)
21097                 case "$i_ndbm" in
21098                 $define)
21099                     case "$osname-$use64bitint" in
21100                     hpux-define)
21101                         case "$libs" in
21102                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21103                         esac
21104                         ;;
21105                     *) avail_ext="$avail_ext $xxx" ;;
21106                     esac
21107                     ;;
21108                 esac
21109                 ;;
21110         ODBM_File|odbm_fil)
21111                 case "${i_dbm}${i_rpcsvcdbm}" in
21112                 *"${define}"*)
21113                     case "$d_cplusplus" in
21114                     define) ;; # delete as a function name will not work
21115                     *)  case "$osname-$use64bitint" in
21116                         hpux-define)
21117                             case "$libs" in
21118                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21119                             esac
21120                             ;;
21121                         *) avail_ext="$avail_ext $xxx" ;;
21122                         esac
21123                         ;;
21124                     esac
21125                     ;;
21126                 esac
21127                 ;;
21128         Opcode|opcode)
21129                 case "$useopcode" in
21130                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21131                 esac
21132                 ;;
21133         POSIX|posix)
21134                 case "$useposix" in
21135                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21136                 esac
21137                 ;;
21138         Socket|socket)
21139                 case "$d_socket" in
21140                 true|$define|y)
21141                     case "$osname" in
21142                     beos) ;; # not unless BONE
21143                     *) avail_ext="$avail_ext $xxx" ;;
21144                     esac
21145                     ;;
21146                 esac
21147                 ;;
21148         Sys/Syslog|sys/syslog)
21149                 : XXX syslog requires socket
21150                 case "$d_socket" in
21151                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21152                 esac
21153                 ;;
21154         Thread|thread)
21155                 case "$usethreads" in
21156                 true|$define|y)
21157                         case "$use5005threads" in
21158                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21159                         esac
21160                 esac
21161                 ;;
21162         threads|threads/shared)
21163                 # threads and threads::shared are special cases.
21164                 # To stop people from asking "Perl 5.8.0 was supposed
21165                 # to have this new fancy threads implementation but my
21166                 # perl doesn't have it" and from people trying to
21167                 # (re)install the threads module using CPAN.pm and
21168                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21169                 # the threads.pm and threads/shared.pm will always be
21170                 # there, croaking informatively ("you need to rebuild
21171                 # all of Perl with threads, sorry") when threads haven't
21172                 # been compiled in.
21173                 # --jhi
21174                 avail_ext="$avail_ext $xxx"
21175                 ;;
21176         Win32*)
21177                 case "$osname" in
21178                 cygwin) avail_ext="$avail_ext $xxx" ;;
21179                 esac
21180                 ;;
21181         XS/APItest|xs/apitest)
21182                 # This is just for testing.  Skip it unless we have dynamic loading.
21183
21184                 case "$usedl" in
21185                 $define) avail_ext="$avail_ext $xxx" ;;
21186                 esac
21187                 ;;
21188         XS/Typemap|xs/typemap)
21189                 # This is just for testing.  Skip it unless we have dynamic loading.
21190                 case "$usedl" in
21191                 $define) avail_ext="$avail_ext $xxx" ;;
21192                 esac
21193                 ;;
21194         *)      avail_ext="$avail_ext $xxx"
21195                 ;;
21196         esac
21197 done
21198
21199 set X $avail_ext
21200 shift
21201 avail_ext="$*"
21202
21203 case "$onlyextensions" in
21204 '') ;;
21205 *)  keepextensions=''
21206     echo "You have requested that only certains extensions be included..." >&4
21207     for i in $onlyextensions; do
21208         case " $avail_ext " in
21209         *" $i "*)
21210             echo "Keeping extension $i."
21211             keepextensions="$keepextensions $i"
21212             ;;
21213         *) echo "Ignoring extension $i." ;;
21214         esac
21215     done
21216     avail_ext="$keepextensions"
21217     ;;
21218 esac
21219
21220 case "$noextensions" in
21221 '') ;;
21222 *)  keepextensions=''
21223     echo "You have requested that certain extensions be ignored..." >&4
21224     for i in $avail_ext; do
21225         case " $noextensions " in
21226         *" $i "*) echo "Ignoring extension $i." ;;
21227         *) echo "Keeping extension $i.";
21228            keepextensions="$keepextensions $i"
21229            ;;
21230         esac
21231     done
21232     avail_ext="$keepextensions"
21233     ;;
21234 esac
21235
21236 : Now see which nonxs extensions are supported on this system.
21237 : For now assume all are.
21238 nonxs_ext=''
21239 for xxx in $nonxs_extensions ; do
21240         case "$xxx" in
21241         *)      nonxs_ext="$nonxs_ext $xxx"
21242                 ;;
21243         esac
21244 done
21245
21246 set X $nonxs_ext
21247 shift
21248 nonxs_ext="$*"
21249
21250 case $usedl in
21251 $define)
21252         $cat <<EOM
21253 A number of extensions are supplied with $package.  You may choose to
21254 compile these extensions for dynamic loading (the default), compile
21255 them into the $package executable (static loading), or not include
21256 them at all.  Answer "none" to include no extensions.
21257 Note that DynaLoader is always built and need not be mentioned here.
21258
21259 EOM
21260         case "$dynamic_ext" in
21261         '')
21262                 : Exclude those listed in static_ext
21263                 dflt=''
21264                 for xxx in $avail_ext; do
21265                         case " $static_ext " in
21266                         *" $xxx "*) ;;
21267                         *) dflt="$dflt $xxx" ;;
21268                         esac
21269                 done
21270                 set X $dflt
21271                 shift
21272                 dflt="$*"
21273                 ;;
21274         *)      dflt="$dynamic_ext"
21275                 # Perhaps we are reusing an old out-of-date config.sh.
21276                 case "$hint" in
21277                 previous)
21278                         if test X"$dynamic_ext" != X"$avail_ext"; then
21279                                 $cat <<EOM
21280 NOTICE:  Your previous config.sh list may be incorrect.
21281 The extensions now available to you are
21282         ${avail_ext}
21283 but the default list from your previous config.sh is
21284         ${dynamic_ext}
21285
21286 EOM
21287                         fi
21288                         ;;
21289                 esac
21290                 ;;
21291         esac
21292         case "$dflt" in
21293         '')     dflt=none;;
21294         esac
21295         rp="What extensions do you wish to load dynamically?"
21296         . ./myread
21297         case "$ans" in
21298         none) dynamic_ext=' ' ;;
21299         *) dynamic_ext="$ans" ;;
21300         esac
21301
21302         case "$static_ext" in
21303         '')
21304                 : Exclude those already listed in dynamic linking
21305                 dflt=''
21306                 for xxx in $avail_ext; do
21307                         case " $dynamic_ext " in
21308                         *" $xxx "*) ;;
21309                         *) dflt="$dflt $xxx" ;;
21310                         esac
21311                 done
21312                 set X $dflt
21313                 shift
21314                 dflt="$*"
21315                 ;;
21316         *)  dflt="$static_ext"
21317                 ;;
21318         esac
21319
21320         case "$dflt" in
21321         '')     dflt=none;;
21322         esac
21323         rp="What extensions do you wish to load statically?"
21324         . ./myread
21325         case "$ans" in
21326         none) static_ext=' ' ;;
21327         *) static_ext="$ans" ;;
21328         esac
21329         ;;
21330 *)
21331         $cat <<EOM
21332 A number of extensions are supplied with $package.  Answer "none"
21333 to include no extensions.
21334 Note that DynaLoader is always built and need not be mentioned here.
21335
21336 EOM
21337         case "$static_ext" in
21338         '') dflt="$avail_ext" ;;
21339         *)      dflt="$static_ext"
21340                 # Perhaps we are reusing an old out-of-date config.sh.
21341                 case "$hint" in
21342                 previous)
21343                         if test X"$static_ext" != X"$avail_ext"; then
21344                                 $cat <<EOM
21345 NOTICE:  Your previous config.sh list may be incorrect.
21346 The extensions now available to you are
21347         ${avail_ext}
21348 but the default list from your previous config.sh is
21349         ${static_ext}
21350
21351 EOM
21352                         fi
21353                         ;;
21354                 esac
21355                 ;;
21356         esac
21357         : Exclude those that are not xs extensions
21358         case "$dflt" in
21359         '')     dflt=none;;
21360         esac
21361         rp="What extensions do you wish to include?"
21362         . ./myread
21363         case "$ans" in
21364         none) static_ext=' ' ;;
21365         *) static_ext="$ans" ;;
21366         esac
21367         ;;
21368 esac
21369 #
21370 # Encode is a special case.  If we are building Encode as a static
21371 # extension, we need to explicitly list its subextensions as well.
21372 # For other nested extensions, this is handled automatically by
21373 # the appropriate Makefile.PL.
21374 case " $static_ext " in
21375         *" Encode "*) # Add the subextensions of Encode
21376         cd "$rsrc/ext"
21377         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21378                 static_ext="$static_ext Encode/$xxx"
21379         done
21380         cd "$tdir"
21381         ;;
21382 esac
21383
21384 set X $dynamic_ext $static_ext $nonxs_ext
21385 shift
21386 extensions="$*"
21387
21388 # Sanity check:  We require an extension suitable for use with
21389 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21390 # should show up as failures in the test suite, but it's helpful to
21391 # catch them now.) The 'extensions' list is normally sorted
21392 # alphabetically, so we need to accept either
21393 #    DB_File ... Fcntl ... IO  ....
21394 # or something like
21395 #    Fcntl ... NDBM_File ... IO  ....
21396 case " $extensions"  in
21397 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21398 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21399 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21400 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21401    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21402    ;;
21403 esac
21404
21405 : Remove libraries needed only for extensions
21406 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21407 : The exception is SunOS 4.x, which needs them.
21408 case "${osname}X${osvers}" in
21409 sunos*X4*)
21410     perllibs="$libs"
21411     ;;
21412 *) case "$usedl" in
21413     $define|true|[yY]*)
21414             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21415             shift
21416             perllibs="$*"
21417             ;;
21418     *)  perllibs="$libs"
21419             ;;
21420     esac
21421     ;;
21422 esac
21423
21424 : Remove build directory name from cppstdin so it can be used from
21425 : either the present location or the final installed location.
21426 echo " "
21427 : Get out of the UU directory to get correct path name.
21428 cd ..
21429 case "$cppstdin" in
21430 `pwd`/cppstdin)
21431         echo "Stripping down cppstdin path name"
21432         cppstdin=cppstdin
21433         ;;
21434 esac
21435 cd UU
21436
21437 : end of configuration questions
21438 echo " "
21439 echo "End of configuration questions."
21440 echo " "
21441
21442 : back to where it started
21443 if test -d ../UU; then
21444         cd ..
21445 fi
21446
21447 : configuration may be patched via a 'config.arch' file
21448 if $test -f config.arch; then
21449         echo "I see a config.arch file, loading it."
21450         . ./config.arch
21451 fi
21452
21453 : configuration may be patched via a 'config.over' file
21454 if $test -f config.over; then
21455         echo " "
21456         dflt=y
21457         rp='I see a config.over file.  Do you wish to load it?'
21458         . UU/myread
21459         case "$ans" in
21460         n*) echo "OK, I'll ignore it.";;
21461         *)      . ./config.over
21462                 echo "Configuration override changes have been loaded."
21463                 ;;
21464         esac
21465 fi
21466
21467 : in case they want portability, strip down executable paths
21468 case "$d_portable" in
21469 "$define")
21470         echo " "
21471         echo "Stripping down executable paths..." >&4
21472         for file in $loclist $trylist; do
21473                 eval temp=\$$file
21474                 eval $file=`basename $temp`
21475         done
21476         ;;
21477 esac
21478
21479 : create config.sh file
21480 echo " "
21481 echo "Creating config.sh..." >&4
21482 $spitshell <<EOT >config.sh
21483 $startsh
21484 #
21485 # This file was produced by running the Configure script. It holds all the
21486 # definitions figured out by Configure. Should you modify one of these values,
21487 # do not forget to propagate your changes by running "Configure -der". You may
21488 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21489 #
21490
21491 # Package name      : $package
21492 # Source directory  : $src
21493 # Configuration time: $cf_time
21494 # Configured by     : $cf_by
21495 # Target system     : $myuname
21496
21497 Author='$Author'
21498 Date='$Date'
21499 Header='$Header'
21500 Id='$Id'
21501 Locker='$Locker'
21502 Log='$Log'
21503 Mcc='$Mcc'
21504 RCSfile='$RCSfile'
21505 Revision='$Revision'
21506 Source='$Source'
21507 State='$State'
21508 _a='$_a'
21509 _exe='$_exe'
21510 _o='$_o'
21511 afs='$afs'
21512 afsroot='$afsroot'
21513 alignbytes='$alignbytes'
21514 ansi2knr='$ansi2knr'
21515 aphostname='$aphostname'
21516 api_revision='$api_revision'
21517 api_subversion='$api_subversion'
21518 api_version='$api_version'
21519 api_versionstring='$api_versionstring'
21520 ar='$ar'
21521 archlib='$archlib'
21522 archlibexp='$archlibexp'
21523 archname64='$archname64'
21524 archname='$archname'
21525 archobjs='$archobjs'
21526 asctime_r_proto='$asctime_r_proto'
21527 awk='$awk'
21528 baserev='$baserev'
21529 bash='$bash'
21530 bin='$bin'
21531 binexp='$binexp'
21532 bison='$bison'
21533 byacc='$byacc'
21534 byteorder='$byteorder'
21535 c='$c'
21536 castflags='$castflags'
21537 cat='$cat'
21538 cc='$cc'
21539 cccdlflags='$cccdlflags'
21540 ccdlflags='$ccdlflags'
21541 ccflags='$ccflags'
21542 ccflags_uselargefiles='$ccflags_uselargefiles'
21543 ccname='$ccname'
21544 ccsymbols='$ccsymbols'
21545 ccversion='$ccversion'
21546 cf_by='$cf_by'
21547 cf_email='$cf_email'
21548 cf_time='$cf_time'
21549 charsize='$charsize'
21550 chgrp='$chgrp'
21551 chmod='$chmod'
21552 chown='$chown'
21553 clocktype='$clocktype'
21554 comm='$comm'
21555 compress='$compress'
21556 contains='$contains'
21557 cp='$cp'
21558 cpio='$cpio'
21559 cpp='$cpp'
21560 cpp_stuff='$cpp_stuff'
21561 cppccsymbols='$cppccsymbols'
21562 cppflags='$cppflags'
21563 cpplast='$cpplast'
21564 cppminus='$cppminus'
21565 cpprun='$cpprun'
21566 cppstdin='$cppstdin'
21567 cppsymbols='$cppsymbols'
21568 crypt_r_proto='$crypt_r_proto'
21569 cryptlib='$cryptlib'
21570 csh='$csh'
21571 ctermid_r_proto='$ctermid_r_proto'
21572 ctime_r_proto='$ctime_r_proto'
21573 d_Gconvert='$d_Gconvert'
21574 d_PRIEUldbl='$d_PRIEUldbl'
21575 d_PRIFUldbl='$d_PRIFUldbl'
21576 d_PRIGUldbl='$d_PRIGUldbl'
21577 d_PRIXU64='$d_PRIXU64'
21578 d_PRId64='$d_PRId64'
21579 d_PRIeldbl='$d_PRIeldbl'
21580 d_PRIfldbl='$d_PRIfldbl'
21581 d_PRIgldbl='$d_PRIgldbl'
21582 d_PRIi64='$d_PRIi64'
21583 d_PRIo64='$d_PRIo64'
21584 d_PRIu64='$d_PRIu64'
21585 d_PRIx64='$d_PRIx64'
21586 d_SCNfldbl='$d_SCNfldbl'
21587 d__fwalk='$d__fwalk'
21588 d_access='$d_access'
21589 d_accessx='$d_accessx'
21590 d_aintl='$d_aintl'
21591 d_alarm='$d_alarm'
21592 d_archlib='$d_archlib'
21593 d_asctime_r='$d_asctime_r'
21594 d_atolf='$d_atolf'
21595 d_atoll='$d_atoll'
21596 d_attribute_format='$d_attribute_format'
21597 d_attribute_malloc='$d_attribute_malloc'
21598 d_attribute_nonnull='$d_attribute_nonnull'
21599 d_attribute_noreturn='$d_attribute_noreturn'
21600 d_attribute_pure='$d_attribute_pure'
21601 d_attribute_unused='$d_attribute_unused'
21602 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21603 d_bcmp='$d_bcmp'
21604 d_bcopy='$d_bcopy'
21605 d_bsd='$d_bsd'
21606 d_bsdgetpgrp='$d_bsdgetpgrp'
21607 d_bsdsetpgrp='$d_bsdsetpgrp'
21608 d_builtin_choose_expr='$d_builtin_choose_expr'
21609 d_builtin_expect='$d_builtin_expect'
21610 d_bzero='$d_bzero'
21611 d_c99_variadic_macros='$d_c99_variadic_macros'
21612 d_casti32='$d_casti32'
21613 d_castneg='$d_castneg'
21614 d_charvspr='$d_charvspr'
21615 d_chown='$d_chown'
21616 d_chroot='$d_chroot'
21617 d_chsize='$d_chsize'
21618 d_class='$d_class'
21619 d_clearenv='$d_clearenv'
21620 d_closedir='$d_closedir'
21621 d_cmsghdr_s='$d_cmsghdr_s'
21622 d_const='$d_const'
21623 d_copysignl='$d_copysignl'
21624 d_cplusplus='$d_cplusplus'
21625 d_crypt='$d_crypt'
21626 d_crypt_r='$d_crypt_r'
21627 d_csh='$d_csh'
21628 d_ctermid='$d_ctermid'
21629 d_ctermid_r='$d_ctermid_r'
21630 d_ctime_r='$d_ctime_r'
21631 d_cuserid='$d_cuserid'
21632 d_dbl_dig='$d_dbl_dig'
21633 d_dbminitproto='$d_dbminitproto'
21634 d_difftime='$d_difftime'
21635 d_dir_dd_fd='$d_dir_dd_fd'
21636 d_dirfd='$d_dirfd'
21637 d_dirnamlen='$d_dirnamlen'
21638 d_dlerror='$d_dlerror'
21639 d_dlopen='$d_dlopen'
21640 d_dlsymun='$d_dlsymun'
21641 d_dosuid='$d_dosuid'
21642 d_drand48_r='$d_drand48_r'
21643 d_drand48proto='$d_drand48proto'
21644 d_dup2='$d_dup2'
21645 d_eaccess='$d_eaccess'
21646 d_endgrent='$d_endgrent'
21647 d_endgrent_r='$d_endgrent_r'
21648 d_endhent='$d_endhent'
21649 d_endhostent_r='$d_endhostent_r'
21650 d_endnent='$d_endnent'
21651 d_endnetent_r='$d_endnetent_r'
21652 d_endpent='$d_endpent'
21653 d_endprotoent_r='$d_endprotoent_r'
21654 d_endpwent='$d_endpwent'
21655 d_endpwent_r='$d_endpwent_r'
21656 d_endsent='$d_endsent'
21657 d_endservent_r='$d_endservent_r'
21658 d_eofnblk='$d_eofnblk'
21659 d_eunice='$d_eunice'
21660 d_faststdio='$d_faststdio'
21661 d_fchdir='$d_fchdir'
21662 d_fchmod='$d_fchmod'
21663 d_fchown='$d_fchown'
21664 d_fcntl='$d_fcntl'
21665 d_fcntl_can_lock='$d_fcntl_can_lock'
21666 d_fd_macros='$d_fd_macros'
21667 d_fd_set='$d_fd_set'
21668 d_fds_bits='$d_fds_bits'
21669 d_fgetpos='$d_fgetpos'
21670 d_finite='$d_finite'
21671 d_finitel='$d_finitel'
21672 d_flexfnam='$d_flexfnam'
21673 d_flock='$d_flock'
21674 d_flockproto='$d_flockproto'
21675 d_fork='$d_fork'
21676 d_fp_class='$d_fp_class'
21677 d_fpathconf='$d_fpathconf'
21678 d_fpclass='$d_fpclass'
21679 d_fpclassify='$d_fpclassify'
21680 d_fpclassl='$d_fpclassl'
21681 d_fpos64_t='$d_fpos64_t'
21682 d_frexpl='$d_frexpl'
21683 d_fs_data_s='$d_fs_data_s'
21684 d_fseeko='$d_fseeko'
21685 d_fsetpos='$d_fsetpos'
21686 d_fstatfs='$d_fstatfs'
21687 d_fstatvfs='$d_fstatvfs'
21688 d_fsync='$d_fsync'
21689 d_ftello='$d_ftello'
21690 d_ftime='$d_ftime'
21691 d_futimes='$d_futimes'
21692 d_getcwd='$d_getcwd'
21693 d_getespwnam='$d_getespwnam'
21694 d_getfsstat='$d_getfsstat'
21695 d_getgrent='$d_getgrent'
21696 d_getgrent_r='$d_getgrent_r'
21697 d_getgrgid_r='$d_getgrgid_r'
21698 d_getgrnam_r='$d_getgrnam_r'
21699 d_getgrps='$d_getgrps'
21700 d_gethbyaddr='$d_gethbyaddr'
21701 d_gethbyname='$d_gethbyname'
21702 d_gethent='$d_gethent'
21703 d_gethname='$d_gethname'
21704 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21705 d_gethostbyname_r='$d_gethostbyname_r'
21706 d_gethostent_r='$d_gethostent_r'
21707 d_gethostprotos='$d_gethostprotos'
21708 d_getitimer='$d_getitimer'
21709 d_getlogin='$d_getlogin'
21710 d_getlogin_r='$d_getlogin_r'
21711 d_getmnt='$d_getmnt'
21712 d_getmntent='$d_getmntent'
21713 d_getnbyaddr='$d_getnbyaddr'
21714 d_getnbyname='$d_getnbyname'
21715 d_getnent='$d_getnent'
21716 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21717 d_getnetbyname_r='$d_getnetbyname_r'
21718 d_getnetent_r='$d_getnetent_r'
21719 d_getnetprotos='$d_getnetprotos'
21720 d_getpagsz='$d_getpagsz'
21721 d_getpbyname='$d_getpbyname'
21722 d_getpbynumber='$d_getpbynumber'
21723 d_getpent='$d_getpent'
21724 d_getpgid='$d_getpgid'
21725 d_getpgrp2='$d_getpgrp2'
21726 d_getpgrp='$d_getpgrp'
21727 d_getppid='$d_getppid'
21728 d_getprior='$d_getprior'
21729 d_getprotobyname_r='$d_getprotobyname_r'
21730 d_getprotobynumber_r='$d_getprotobynumber_r'
21731 d_getprotoent_r='$d_getprotoent_r'
21732 d_getprotoprotos='$d_getprotoprotos'
21733 d_getprpwnam='$d_getprpwnam'
21734 d_getpwent='$d_getpwent'
21735 d_getpwent_r='$d_getpwent_r'
21736 d_getpwnam_r='$d_getpwnam_r'
21737 d_getpwuid_r='$d_getpwuid_r'
21738 d_getsbyname='$d_getsbyname'
21739 d_getsbyport='$d_getsbyport'
21740 d_getsent='$d_getsent'
21741 d_getservbyname_r='$d_getservbyname_r'
21742 d_getservbyport_r='$d_getservbyport_r'
21743 d_getservent_r='$d_getservent_r'
21744 d_getservprotos='$d_getservprotos'
21745 d_getspnam='$d_getspnam'
21746 d_getspnam_r='$d_getspnam_r'
21747 d_gettimeod='$d_gettimeod'
21748 d_gmtime_r='$d_gmtime_r'
21749 d_gnulibc='$d_gnulibc'
21750 d_grpasswd='$d_grpasswd'
21751 d_hasmntopt='$d_hasmntopt'
21752 d_htonl='$d_htonl'
21753 d_ilogbl='$d_ilogbl'
21754 d_inc_version_list='$d_inc_version_list'
21755 d_index='$d_index'
21756 d_inetaton='$d_inetaton'
21757 d_int64_t='$d_int64_t'
21758 d_isascii='$d_isascii'
21759 d_isfinite='$d_isfinite'
21760 d_isinf='$d_isinf'
21761 d_isnan='$d_isnan'
21762 d_isnanl='$d_isnanl'
21763 d_killpg='$d_killpg'
21764 d_lchown='$d_lchown'
21765 d_ldbl_dig='$d_ldbl_dig'
21766 d_libm_lib_version='$d_libm_lib_version'
21767 d_link='$d_link'
21768 d_localtime_r='$d_localtime_r'
21769 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21770 d_locconv='$d_locconv'
21771 d_lockf='$d_lockf'
21772 d_longdbl='$d_longdbl'
21773 d_longlong='$d_longlong'
21774 d_lseekproto='$d_lseekproto'
21775 d_lstat='$d_lstat'
21776 d_madvise='$d_madvise'
21777 d_malloc_good_size='$d_malloc_good_size'
21778 d_malloc_size='$d_malloc_size'
21779 d_mblen='$d_mblen'
21780 d_mbstowcs='$d_mbstowcs'
21781 d_mbtowc='$d_mbtowc'
21782 d_memchr='$d_memchr'
21783 d_memcmp='$d_memcmp'
21784 d_memcpy='$d_memcpy'
21785 d_memmove='$d_memmove'
21786 d_memset='$d_memset'
21787 d_mkdir='$d_mkdir'
21788 d_mkdtemp='$d_mkdtemp'
21789 d_mkfifo='$d_mkfifo'
21790 d_mkstemp='$d_mkstemp'
21791 d_mkstemps='$d_mkstemps'
21792 d_mktime='$d_mktime'
21793 d_mmap='$d_mmap'
21794 d_modfl='$d_modfl'
21795 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21796 d_modflproto='$d_modflproto'
21797 d_mprotect='$d_mprotect'
21798 d_msg='$d_msg'
21799 d_msg_ctrunc='$d_msg_ctrunc'
21800 d_msg_dontroute='$d_msg_dontroute'
21801 d_msg_oob='$d_msg_oob'
21802 d_msg_peek='$d_msg_peek'
21803 d_msg_proxy='$d_msg_proxy'
21804 d_msgctl='$d_msgctl'
21805 d_msgget='$d_msgget'
21806 d_msghdr_s='$d_msghdr_s'
21807 d_msgrcv='$d_msgrcv'
21808 d_msgsnd='$d_msgsnd'
21809 d_msync='$d_msync'
21810 d_munmap='$d_munmap'
21811 d_mymalloc='$d_mymalloc'
21812 d_nice='$d_nice'
21813 d_nl_langinfo='$d_nl_langinfo'
21814 d_nv_preserves_uv='$d_nv_preserves_uv'
21815 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21816 d_off64_t='$d_off64_t'
21817 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21818 d_oldpthreads='$d_oldpthreads'
21819 d_oldsock='$d_oldsock'
21820 d_open3='$d_open3'
21821 d_pathconf='$d_pathconf'
21822 d_pause='$d_pause'
21823 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21824 d_phostname='$d_phostname'
21825 d_pipe='$d_pipe'
21826 d_poll='$d_poll'
21827 d_portable='$d_portable'
21828 d_printf_format_null='$d_printf_format_null'
21829 d_procselfexe='$d_procselfexe'
21830 d_pseudofork='$d_pseudofork'
21831 d_pthread_atfork='$d_pthread_atfork'
21832 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21833 d_pthread_yield='$d_pthread_yield'
21834 d_pwage='$d_pwage'
21835 d_pwchange='$d_pwchange'
21836 d_pwclass='$d_pwclass'
21837 d_pwcomment='$d_pwcomment'
21838 d_pwexpire='$d_pwexpire'
21839 d_pwgecos='$d_pwgecos'
21840 d_pwpasswd='$d_pwpasswd'
21841 d_pwquota='$d_pwquota'
21842 d_qgcvt='$d_qgcvt'
21843 d_quad='$d_quad'
21844 d_random_r='$d_random_r'
21845 d_readdir64_r='$d_readdir64_r'
21846 d_readdir='$d_readdir'
21847 d_readdir_r='$d_readdir_r'
21848 d_readlink='$d_readlink'
21849 d_readv='$d_readv'
21850 d_recvmsg='$d_recvmsg'
21851 d_rename='$d_rename'
21852 d_rewinddir='$d_rewinddir'
21853 d_rmdir='$d_rmdir'
21854 d_safebcpy='$d_safebcpy'
21855 d_safemcpy='$d_safemcpy'
21856 d_sanemcmp='$d_sanemcmp'
21857 d_sbrkproto='$d_sbrkproto'
21858 d_scalbnl='$d_scalbnl'
21859 d_sched_yield='$d_sched_yield'
21860 d_scm_rights='$d_scm_rights'
21861 d_seekdir='$d_seekdir'
21862 d_select='$d_select'
21863 d_sem='$d_sem'
21864 d_semctl='$d_semctl'
21865 d_semctl_semid_ds='$d_semctl_semid_ds'
21866 d_semctl_semun='$d_semctl_semun'
21867 d_semget='$d_semget'
21868 d_semop='$d_semop'
21869 d_sendmsg='$d_sendmsg'
21870 d_setegid='$d_setegid'
21871 d_seteuid='$d_seteuid'
21872 d_setgrent='$d_setgrent'
21873 d_setgrent_r='$d_setgrent_r'
21874 d_setgrps='$d_setgrps'
21875 d_sethent='$d_sethent'
21876 d_sethostent_r='$d_sethostent_r'
21877 d_setitimer='$d_setitimer'
21878 d_setlinebuf='$d_setlinebuf'
21879 d_setlocale='$d_setlocale'
21880 d_setlocale_r='$d_setlocale_r'
21881 d_setnent='$d_setnent'
21882 d_setnetent_r='$d_setnetent_r'
21883 d_setpent='$d_setpent'
21884 d_setpgid='$d_setpgid'
21885 d_setpgrp2='$d_setpgrp2'
21886 d_setpgrp='$d_setpgrp'
21887 d_setprior='$d_setprior'
21888 d_setproctitle='$d_setproctitle'
21889 d_setprotoent_r='$d_setprotoent_r'
21890 d_setpwent='$d_setpwent'
21891 d_setpwent_r='$d_setpwent_r'
21892 d_setregid='$d_setregid'
21893 d_setresgid='$d_setresgid'
21894 d_setresuid='$d_setresuid'
21895 d_setreuid='$d_setreuid'
21896 d_setrgid='$d_setrgid'
21897 d_setruid='$d_setruid'
21898 d_setsent='$d_setsent'
21899 d_setservent_r='$d_setservent_r'
21900 d_setsid='$d_setsid'
21901 d_setvbuf='$d_setvbuf'
21902 d_sfio='$d_sfio'
21903 d_shm='$d_shm'
21904 d_shmat='$d_shmat'
21905 d_shmatprototype='$d_shmatprototype'
21906 d_shmctl='$d_shmctl'
21907 d_shmdt='$d_shmdt'
21908 d_shmget='$d_shmget'
21909 d_sigaction='$d_sigaction'
21910 d_signbit='$d_signbit'
21911 d_sigprocmask='$d_sigprocmask'
21912 d_sigsetjmp='$d_sigsetjmp'
21913 d_sitearch='$d_sitearch'
21914 d_snprintf='$d_snprintf'
21915 d_sockatmark='$d_sockatmark'
21916 d_sockatmarkproto='$d_sockatmarkproto'
21917 d_socket='$d_socket'
21918 d_socklen_t='$d_socklen_t'
21919 d_sockpair='$d_sockpair'
21920 d_socks5_init='$d_socks5_init'
21921 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21922 d_sqrtl='$d_sqrtl'
21923 d_srand48_r='$d_srand48_r'
21924 d_srandom_r='$d_srandom_r'
21925 d_sresgproto='$d_sresgproto'
21926 d_sresuproto='$d_sresuproto'
21927 d_statblks='$d_statblks'
21928 d_statfs_f_flags='$d_statfs_f_flags'
21929 d_statfs_s='$d_statfs_s'
21930 d_statvfs='$d_statvfs'
21931 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21932 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21933 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21934 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21935 d_stdio_stream_array='$d_stdio_stream_array'
21936 d_stdiobase='$d_stdiobase'
21937 d_stdstdio='$d_stdstdio'
21938 d_strchr='$d_strchr'
21939 d_strcoll='$d_strcoll'
21940 d_strctcpy='$d_strctcpy'
21941 d_strerrm='$d_strerrm'
21942 d_strerror='$d_strerror'
21943 d_strerror_r='$d_strerror_r'
21944 d_strftime='$d_strftime'
21945 d_strlcat='$d_strlcat'
21946 d_strlcpy='$d_strlcpy'
21947 d_strtod='$d_strtod'
21948 d_strtol='$d_strtol'
21949 d_strtold='$d_strtold'
21950 d_strtoll='$d_strtoll'
21951 d_strtoq='$d_strtoq'
21952 d_strtoul='$d_strtoul'
21953 d_strtoull='$d_strtoull'
21954 d_strtouq='$d_strtouq'
21955 d_strxfrm='$d_strxfrm'
21956 d_suidsafe='$d_suidsafe'
21957 d_symlink='$d_symlink'
21958 d_syscall='$d_syscall'
21959 d_syscallproto='$d_syscallproto'
21960 d_sysconf='$d_sysconf'
21961 d_sysernlst='$d_sysernlst'
21962 d_syserrlst='$d_syserrlst'
21963 d_system='$d_system'
21964 d_tcgetpgrp='$d_tcgetpgrp'
21965 d_tcsetpgrp='$d_tcsetpgrp'
21966 d_telldir='$d_telldir'
21967 d_telldirproto='$d_telldirproto'
21968 d_time='$d_time'
21969 d_times='$d_times'
21970 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21971 d_tm_tm_zone='$d_tm_tm_zone'
21972 d_tmpnam_r='$d_tmpnam_r'
21973 d_truncate='$d_truncate'
21974 d_ttyname_r='$d_ttyname_r'
21975 d_tzname='$d_tzname'
21976 d_u32align='$d_u32align'
21977 d_ualarm='$d_ualarm'
21978 d_umask='$d_umask'
21979 d_uname='$d_uname'
21980 d_union_semun='$d_union_semun'
21981 d_unordered='$d_unordered'
21982 d_unsetenv='$d_unsetenv'
21983 d_usleep='$d_usleep'
21984 d_usleepproto='$d_usleepproto'
21985 d_ustat='$d_ustat'
21986 d_vendorarch='$d_vendorarch'
21987 d_vendorbin='$d_vendorbin'
21988 d_vendorlib='$d_vendorlib'
21989 d_vendorscript='$d_vendorscript'
21990 d_vfork='$d_vfork'
21991 d_void_closedir='$d_void_closedir'
21992 d_voidsig='$d_voidsig'
21993 d_voidtty='$d_voidtty'
21994 d_volatile='$d_volatile'
21995 d_vprintf='$d_vprintf'
21996 d_vsnprintf='$d_vsnprintf'
21997 d_wait4='$d_wait4'
21998 d_waitpid='$d_waitpid'
21999 d_wcstombs='$d_wcstombs'
22000 d_wctomb='$d_wctomb'
22001 d_writev='$d_writev'
22002 d_xenix='$d_xenix'
22003 date='$date'
22004 db_hashtype='$db_hashtype'
22005 db_prefixtype='$db_prefixtype'
22006 db_version_major='$db_version_major'
22007 db_version_minor='$db_version_minor'
22008 db_version_patch='$db_version_patch'
22009 defvoidused='$defvoidused'
22010 direntrytype='$direntrytype'
22011 dlext='$dlext'
22012 dlsrc='$dlsrc'
22013 doublesize='$doublesize'
22014 drand01='$drand01'
22015 drand48_r_proto='$drand48_r_proto'
22016 dynamic_ext='$dynamic_ext'
22017 eagain='$eagain'
22018 ebcdic='$ebcdic'
22019 echo='$echo'
22020 egrep='$egrep'
22021 emacs='$emacs'
22022 endgrent_r_proto='$endgrent_r_proto'
22023 endhostent_r_proto='$endhostent_r_proto'
22024 endnetent_r_proto='$endnetent_r_proto'
22025 endprotoent_r_proto='$endprotoent_r_proto'
22026 endpwent_r_proto='$endpwent_r_proto'
22027 endservent_r_proto='$endservent_r_proto'
22028 eunicefix='$eunicefix'
22029 exe_ext='$exe_ext'
22030 expr='$expr'
22031 extensions='$extensions'
22032 extras='$extras'
22033 fflushNULL='$fflushNULL'
22034 fflushall='$fflushall'
22035 find='$find'
22036 firstmakefile='$firstmakefile'
22037 flex='$flex'
22038 fpossize='$fpossize'
22039 fpostype='$fpostype'
22040 freetype='$freetype'
22041 from='$from'
22042 full_ar='$full_ar'
22043 full_csh='$full_csh'
22044 full_sed='$full_sed'
22045 gccansipedantic='$gccansipedantic'
22046 gccosandvers='$gccosandvers'
22047 gccversion='$gccversion'
22048 getgrent_r_proto='$getgrent_r_proto'
22049 getgrgid_r_proto='$getgrgid_r_proto'
22050 getgrnam_r_proto='$getgrnam_r_proto'
22051 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22052 gethostbyname_r_proto='$gethostbyname_r_proto'
22053 gethostent_r_proto='$gethostent_r_proto'
22054 getlogin_r_proto='$getlogin_r_proto'
22055 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22056 getnetbyname_r_proto='$getnetbyname_r_proto'
22057 getnetent_r_proto='$getnetent_r_proto'
22058 getprotobyname_r_proto='$getprotobyname_r_proto'
22059 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22060 getprotoent_r_proto='$getprotoent_r_proto'
22061 getpwent_r_proto='$getpwent_r_proto'
22062 getpwnam_r_proto='$getpwnam_r_proto'
22063 getpwuid_r_proto='$getpwuid_r_proto'
22064 getservbyname_r_proto='$getservbyname_r_proto'
22065 getservbyport_r_proto='$getservbyport_r_proto'
22066 getservent_r_proto='$getservent_r_proto'
22067 getspnam_r_proto='$getspnam_r_proto'
22068 gidformat='$gidformat'
22069 gidsign='$gidsign'
22070 gidsize='$gidsize'
22071 gidtype='$gidtype'
22072 glibpth='$glibpth'
22073 gmake='$gmake'
22074 gmtime_r_proto='$gmtime_r_proto'
22075 gnulibc_version='$gnulibc_version'
22076 grep='$grep'
22077 groupcat='$groupcat'
22078 groupstype='$groupstype'
22079 gzip='$gzip'
22080 h_fcntl='$h_fcntl'
22081 h_sysfile='$h_sysfile'
22082 hint='$hint'
22083 hostcat='$hostcat'
22084 html1dir='$html1dir'
22085 html1direxp='$html1direxp'
22086 html3dir='$html3dir'
22087 html3direxp='$html3direxp'
22088 i16size='$i16size'
22089 i16type='$i16type'
22090 i32size='$i32size'
22091 i32type='$i32type'
22092 i64size='$i64size'
22093 i64type='$i64type'
22094 i8size='$i8size'
22095 i8type='$i8type'
22096 i_arpainet='$i_arpainet'
22097 i_bsdioctl='$i_bsdioctl'
22098 i_crypt='$i_crypt'
22099 i_db='$i_db'
22100 i_dbm='$i_dbm'
22101 i_dirent='$i_dirent'
22102 i_dld='$i_dld'
22103 i_dlfcn='$i_dlfcn'
22104 i_fcntl='$i_fcntl'
22105 i_float='$i_float'
22106 i_fp='$i_fp'
22107 i_fp_class='$i_fp_class'
22108 i_gdbm='$i_gdbm'
22109 i_grp='$i_grp'
22110 i_ieeefp='$i_ieeefp'
22111 i_inttypes='$i_inttypes'
22112 i_langinfo='$i_langinfo'
22113 i_libutil='$i_libutil'
22114 i_limits='$i_limits'
22115 i_locale='$i_locale'
22116 i_machcthr='$i_machcthr'
22117 i_malloc='$i_malloc'
22118 i_math='$i_math'
22119 i_memory='$i_memory'
22120 i_mntent='$i_mntent'
22121 i_ndbm='$i_ndbm'
22122 i_netdb='$i_netdb'
22123 i_neterrno='$i_neterrno'
22124 i_netinettcp='$i_netinettcp'
22125 i_niin='$i_niin'
22126 i_poll='$i_poll'
22127 i_prot='$i_prot'
22128 i_pthread='$i_pthread'
22129 i_pwd='$i_pwd'
22130 i_rpcsvcdbm='$i_rpcsvcdbm'
22131 i_sfio='$i_sfio'
22132 i_sgtty='$i_sgtty'
22133 i_shadow='$i_shadow'
22134 i_socks='$i_socks'
22135 i_stdarg='$i_stdarg'
22136 i_stddef='$i_stddef'
22137 i_stdlib='$i_stdlib'
22138 i_string='$i_string'
22139 i_sunmath='$i_sunmath'
22140 i_sysaccess='$i_sysaccess'
22141 i_sysdir='$i_sysdir'
22142 i_sysfile='$i_sysfile'
22143 i_sysfilio='$i_sysfilio'
22144 i_sysin='$i_sysin'
22145 i_sysioctl='$i_sysioctl'
22146 i_syslog='$i_syslog'
22147 i_sysmman='$i_sysmman'
22148 i_sysmode='$i_sysmode'
22149 i_sysmount='$i_sysmount'
22150 i_sysndir='$i_sysndir'
22151 i_sysparam='$i_sysparam'
22152 i_sysresrc='$i_sysresrc'
22153 i_syssecrt='$i_syssecrt'
22154 i_sysselct='$i_sysselct'
22155 i_syssockio='$i_syssockio'
22156 i_sysstat='$i_sysstat'
22157 i_sysstatfs='$i_sysstatfs'
22158 i_sysstatvfs='$i_sysstatvfs'
22159 i_systime='$i_systime'
22160 i_systimek='$i_systimek'
22161 i_systimes='$i_systimes'
22162 i_systypes='$i_systypes'
22163 i_sysuio='$i_sysuio'
22164 i_sysun='$i_sysun'
22165 i_sysutsname='$i_sysutsname'
22166 i_sysvfs='$i_sysvfs'
22167 i_syswait='$i_syswait'
22168 i_termio='$i_termio'
22169 i_termios='$i_termios'
22170 i_time='$i_time'
22171 i_unistd='$i_unistd'
22172 i_ustat='$i_ustat'
22173 i_utime='$i_utime'
22174 i_values='$i_values'
22175 i_varargs='$i_varargs'
22176 i_varhdr='$i_varhdr'
22177 i_vfork='$i_vfork'
22178 ignore_versioned_solibs='$ignore_versioned_solibs'
22179 inc_version_list='$inc_version_list'
22180 inc_version_list_init='$inc_version_list_init'
22181 incpath='$incpath'
22182 inews='$inews'
22183 initialinstalllocation='$initialinstalllocation'
22184 installarchlib='$installarchlib'
22185 installbin='$installbin'
22186 installhtml1dir='$installhtml1dir'
22187 installhtml3dir='$installhtml3dir'
22188 installman1dir='$installman1dir'
22189 installman3dir='$installman3dir'
22190 installprefix='$installprefix'
22191 installprefixexp='$installprefixexp'
22192 installprivlib='$installprivlib'
22193 installscript='$installscript'
22194 installsitearch='$installsitearch'
22195 installsitebin='$installsitebin'
22196 installsitehtml1dir='$installsitehtml1dir'
22197 installsitehtml3dir='$installsitehtml3dir'
22198 installsitelib='$installsitelib'
22199 installsiteman1dir='$installsiteman1dir'
22200 installsiteman3dir='$installsiteman3dir'
22201 installsitescript='$installsitescript'
22202 installstyle='$installstyle'
22203 installusrbinperl='$installusrbinperl'
22204 installvendorarch='$installvendorarch'
22205 installvendorbin='$installvendorbin'
22206 installvendorhtml1dir='$installvendorhtml1dir'
22207 installvendorhtml3dir='$installvendorhtml3dir'
22208 installvendorlib='$installvendorlib'
22209 installvendorman1dir='$installvendorman1dir'
22210 installvendorman3dir='$installvendorman3dir'
22211 installvendorscript='$installvendorscript'
22212 intsize='$intsize'
22213 issymlink='$issymlink'
22214 ivdformat='$ivdformat'
22215 ivsize='$ivsize'
22216 ivtype='$ivtype'
22217 known_extensions='$known_extensions'
22218 ksh='$ksh'
22219 ld='$ld'
22220 lddlflags='$lddlflags'
22221 ldflags='$ldflags'
22222 ldflags_uselargefiles='$ldflags_uselargefiles'
22223 ldlibpthname='$ldlibpthname'
22224 less='$less'
22225 lib_ext='$lib_ext'
22226 libc='$libc'
22227 libperl='$libperl'
22228 libpth='$libpth'
22229 libs='$libs'
22230 libsdirs='$libsdirs'
22231 libsfiles='$libsfiles'
22232 libsfound='$libsfound'
22233 libspath='$libspath'
22234 libswanted='$libswanted'
22235 libswanted_uselargefiles='$libswanted_uselargefiles'
22236 line='$line'
22237 lint='$lint'
22238 lkflags='$lkflags'
22239 ln='$ln'
22240 lns='$lns'
22241 localtime_r_proto='$localtime_r_proto'
22242 locincpth='$locincpth'
22243 loclibpth='$loclibpth'
22244 longdblsize='$longdblsize'
22245 longlongsize='$longlongsize'
22246 longsize='$longsize'
22247 lp='$lp'
22248 lpr='$lpr'
22249 ls='$ls'
22250 lseeksize='$lseeksize'
22251 lseektype='$lseektype'
22252 mad='$mad'
22253 madlyh='$madlyh'
22254 madlyobj='$madlyobj'
22255 madlysrc='$madlysrc'
22256 mail='$mail'
22257 mailx='$mailx'
22258 make='$make'
22259 make_set_make='$make_set_make'
22260 mallocobj='$mallocobj'
22261 mallocsrc='$mallocsrc'
22262 malloctype='$malloctype'
22263 man1dir='$man1dir'
22264 man1direxp='$man1direxp'
22265 man1ext='$man1ext'
22266 man3dir='$man3dir'
22267 man3direxp='$man3direxp'
22268 man3ext='$man3ext'
22269 mips_type='$mips_type'
22270 mistrustnm='$mistrustnm'
22271 mkdir='$mkdir'
22272 mmaptype='$mmaptype'
22273 modetype='$modetype'
22274 more='$more'
22275 multiarch='$multiarch'
22276 mv='$mv'
22277 myarchname='$myarchname'
22278 mydomain='$mydomain'
22279 myhostname='$myhostname'
22280 myuname='$myuname'
22281 n='$n'
22282 need_va_copy='$need_va_copy'
22283 netdb_hlen_type='$netdb_hlen_type'
22284 netdb_host_type='$netdb_host_type'
22285 netdb_name_type='$netdb_name_type'
22286 netdb_net_type='$netdb_net_type'
22287 nm='$nm'
22288 nm_opt='$nm_opt'
22289 nm_so_opt='$nm_so_opt'
22290 nonxs_ext='$nonxs_ext'
22291 nroff='$nroff'
22292 nvEUformat='$nvEUformat'
22293 nvFUformat='$nvFUformat'
22294 nvGUformat='$nvGUformat'
22295 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22296 nveformat='$nveformat'
22297 nvfformat='$nvfformat'
22298 nvgformat='$nvgformat'
22299 nvsize='$nvsize'
22300 nvtype='$nvtype'
22301 o_nonblock='$o_nonblock'
22302 obj_ext='$obj_ext'
22303 old_pthread_create_joinable='$old_pthread_create_joinable'
22304 optimize='$optimize'
22305 orderlib='$orderlib'
22306 osname='$osname'
22307 osvers='$osvers'
22308 otherlibdirs='$otherlibdirs'
22309 package='$package'
22310 pager='$pager'
22311 passcat='$passcat'
22312 patchlevel='$patchlevel'
22313 path_sep='$path_sep'
22314 perl5='$perl5'
22315 perl='$perl'
22316 perl_patchlevel='$perl_patchlevel'
22317 perladmin='$perladmin'
22318 perllibs='$perllibs'
22319 perlpath='$perlpath'
22320 pg='$pg'
22321 phostname='$phostname'
22322 pidtype='$pidtype'
22323 plibpth='$plibpth'
22324 pmake='$pmake'
22325 pr='$pr'
22326 prefix='$prefix'
22327 prefixexp='$prefixexp'
22328 privlib='$privlib'
22329 privlibexp='$privlibexp'
22330 procselfexe='$procselfexe'
22331 prototype='$prototype'
22332 ptrsize='$ptrsize'
22333 quadkind='$quadkind'
22334 quadtype='$quadtype'
22335 randbits='$randbits'
22336 randfunc='$randfunc'
22337 random_r_proto='$random_r_proto'
22338 randseedtype='$randseedtype'
22339 ranlib='$ranlib'
22340 rd_nodata='$rd_nodata'
22341 readdir64_r_proto='$readdir64_r_proto'
22342 readdir_r_proto='$readdir_r_proto'
22343 revision='$revision'
22344 rm='$rm'
22345 rm_try='$rm_try'
22346 rmail='$rmail'
22347 run='$run'
22348 runnm='$runnm'
22349 sPRIEUldbl='$sPRIEUldbl'
22350 sPRIFUldbl='$sPRIFUldbl'
22351 sPRIGUldbl='$sPRIGUldbl'
22352 sPRIXU64='$sPRIXU64'
22353 sPRId64='$sPRId64'
22354 sPRIeldbl='$sPRIeldbl'
22355 sPRIfldbl='$sPRIfldbl'
22356 sPRIgldbl='$sPRIgldbl'
22357 sPRIi64='$sPRIi64'
22358 sPRIo64='$sPRIo64'
22359 sPRIu64='$sPRIu64'
22360 sPRIx64='$sPRIx64'
22361 sSCNfldbl='$sSCNfldbl'
22362 sched_yield='$sched_yield'
22363 scriptdir='$scriptdir'
22364 scriptdirexp='$scriptdirexp'
22365 sed='$sed'
22366 seedfunc='$seedfunc'
22367 selectminbits='$selectminbits'
22368 selecttype='$selecttype'
22369 sendmail='$sendmail'
22370 setgrent_r_proto='$setgrent_r_proto'
22371 sethostent_r_proto='$sethostent_r_proto'
22372 setlocale_r_proto='$setlocale_r_proto'
22373 setnetent_r_proto='$setnetent_r_proto'
22374 setprotoent_r_proto='$setprotoent_r_proto'
22375 setpwent_r_proto='$setpwent_r_proto'
22376 setservent_r_proto='$setservent_r_proto'
22377 sh='$sh'
22378 shar='$shar'
22379 sharpbang='$sharpbang'
22380 shmattype='$shmattype'
22381 shortsize='$shortsize'
22382 shrpenv='$shrpenv'
22383 shsharp='$shsharp'
22384 sig_count='$sig_count'
22385 sig_name='$sig_name'
22386 sig_name_init='$sig_name_init'
22387 sig_num='$sig_num'
22388 sig_num_init='$sig_num_init'
22389 sig_size='$sig_size'
22390 signal_t='$signal_t'
22391 sitearch='$sitearch'
22392 sitearchexp='$sitearchexp'
22393 sitebin='$sitebin'
22394 sitebinexp='$sitebinexp'
22395 sitehtml1dir='$sitehtml1dir'
22396 sitehtml1direxp='$sitehtml1direxp'
22397 sitehtml3dir='$sitehtml3dir'
22398 sitehtml3direxp='$sitehtml3direxp'
22399 sitelib='$sitelib'
22400 sitelib_stem='$sitelib_stem'
22401 sitelibexp='$sitelibexp'
22402 siteman1dir='$siteman1dir'
22403 siteman1direxp='$siteman1direxp'
22404 siteman3dir='$siteman3dir'
22405 siteman3direxp='$siteman3direxp'
22406 siteprefix='$siteprefix'
22407 siteprefixexp='$siteprefixexp'
22408 sitescript='$sitescript'
22409 sitescriptexp='$sitescriptexp'
22410 sizesize='$sizesize'
22411 sizetype='$sizetype'
22412 sleep='$sleep'
22413 smail='$smail'
22414 so='$so'
22415 sockethdr='$sockethdr'
22416 socketlib='$socketlib'
22417 socksizetype='$socksizetype'
22418 sort='$sort'
22419 spackage='$spackage'
22420 spitshell='$spitshell'
22421 srand48_r_proto='$srand48_r_proto'
22422 srandom_r_proto='$srandom_r_proto'
22423 src='$src'
22424 ssizetype='$ssizetype'
22425 startperl='$startperl'
22426 startsh='$startsh'
22427 static_ext='$static_ext'
22428 stdchar='$stdchar'
22429 stdio_base='$stdio_base'
22430 stdio_bufsiz='$stdio_bufsiz'
22431 stdio_cnt='$stdio_cnt'
22432 stdio_filbuf='$stdio_filbuf'
22433 stdio_ptr='$stdio_ptr'
22434 stdio_stream_array='$stdio_stream_array'
22435 strerror_r_proto='$strerror_r_proto'
22436 strings='$strings'
22437 submit='$submit'
22438 subversion='$subversion'
22439 sysman='$sysman'
22440 tail='$tail'
22441 tar='$tar'
22442 targetarch='$targetarch'
22443 tbl='$tbl'
22444 tee='$tee'
22445 test='$test'
22446 timeincl='$timeincl'
22447 timetype='$timetype'
22448 tmpnam_r_proto='$tmpnam_r_proto'
22449 to='$to'
22450 touch='$touch'
22451 tr='$tr'
22452 trnl='$trnl'
22453 troff='$troff'
22454 ttyname_r_proto='$ttyname_r_proto'
22455 u16size='$u16size'
22456 u16type='$u16type'
22457 u32size='$u32size'
22458 u32type='$u32type'
22459 u64size='$u64size'
22460 u64type='$u64type'
22461 u8size='$u8size'
22462 u8type='$u8type'
22463 uidformat='$uidformat'
22464 uidsign='$uidsign'
22465 uidsize='$uidsize'
22466 uidtype='$uidtype'
22467 uname='$uname'
22468 uniq='$uniq'
22469 uquadtype='$uquadtype'
22470 use5005threads='$use5005threads'
22471 use64bitall='$use64bitall'
22472 use64bitint='$use64bitint'
22473 usecrosscompile='$usecrosscompile'
22474 usedl='$usedl'
22475 usefaststdio='$usefaststdio'
22476 useithreads='$useithreads'
22477 uselargefiles='$uselargefiles'
22478 uselongdouble='$uselongdouble'
22479 usemallocwrap='$usemallocwrap'
22480 usemorebits='$usemorebits'
22481 usemultiplicity='$usemultiplicity'
22482 usemymalloc='$usemymalloc'
22483 usenm='$usenm'
22484 useopcode='$useopcode'
22485 useperlio='$useperlio'
22486 useposix='$useposix'
22487 usereentrant='$usereentrant'
22488 userelocatableinc='$userelocatableinc'
22489 usesfio='$usesfio'
22490 useshrplib='$useshrplib'
22491 usesitecustomize='$usesitecustomize'
22492 usesocks='$usesocks'
22493 usethreads='$usethreads'
22494 usevendorprefix='$usevendorprefix'
22495 usevfork='$usevfork'
22496 usrinc='$usrinc'
22497 uuname='$uuname'
22498 uvXUformat='$uvXUformat'
22499 uvoformat='$uvoformat'
22500 uvsize='$uvsize'
22501 uvtype='$uvtype'
22502 uvuformat='$uvuformat'
22503 uvxformat='$uvxformat'
22504 vendorarch='$vendorarch'
22505 vendorarchexp='$vendorarchexp'
22506 vendorbin='$vendorbin'
22507 vendorbinexp='$vendorbinexp'
22508 vendorhtml1dir='$vendorhtml1dir'
22509 vendorhtml1direxp='$vendorhtml1direxp'
22510 vendorhtml3dir='$vendorhtml3dir'
22511 vendorhtml3direxp='$vendorhtml3direxp'
22512 vendorlib='$vendorlib'
22513 vendorlib_stem='$vendorlib_stem'
22514 vendorlibexp='$vendorlibexp'
22515 vendorman1dir='$vendorman1dir'
22516 vendorman1direxp='$vendorman1direxp'
22517 vendorman3dir='$vendorman3dir'
22518 vendorman3direxp='$vendorman3direxp'
22519 vendorprefix='$vendorprefix'
22520 vendorprefixexp='$vendorprefixexp'
22521 vendorscript='$vendorscript'
22522 vendorscriptexp='$vendorscriptexp'
22523 version='$version'
22524 version_patchlevel_string='$version_patchlevel_string'
22525 versiononly='$versiononly'
22526 vi='$vi'
22527 voidflags='$voidflags'
22528 xlibpth='$xlibpth'
22529 yacc='$yacc'
22530 yaccflags='$yaccflags'
22531 zcat='$zcat'
22532 zip='$zip'
22533 EOT
22534
22535 : Add in command line options if available
22536 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22537
22538 : add special variables
22539 $test -f $src/patchlevel.h && \
22540 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22541 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22542 echo "PERL_CONFIG_SH=true" >>config.sh
22543
22544 : propagate old symbols
22545 if $test -f UU/config.sh; then
22546         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22547         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22548         $sort | $uniq -u >UU/oldsyms
22549         set X `cat UU/oldsyms`
22550         shift
22551         case $# in
22552         0) ;;
22553         *)
22554                 cat <<EOM
22555 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22556 EOM
22557                 echo "# Variables propagated from previous config.sh file." >>config.sh
22558                 for sym in `cat UU/oldsyms`; do
22559                         echo "    Propagating $hint variable "'$'"$sym..."
22560                         eval 'tmp="$'"${sym}"'"'
22561                         echo "$tmp" | \
22562                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22563                 done
22564                 ;;
22565         esac
22566 fi
22567
22568 : Finish up by extracting the .SH files
22569 case "$alldone" in
22570 exit)
22571         $rm -rf UU
22572         echo "Extraction done."
22573         exit 0
22574         ;;
22575 cont)
22576         ;;
22577 '')
22578         dflt=''
22579         nostick=true
22580         $cat <<EOM
22581
22582 If you'd like to make any changes to the config.sh file before I begin
22583 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22584
22585 EOM
22586         rp="Press return or use a shell escape to edit config.sh:"
22587         . UU/myread
22588         nostick=''
22589         case "$ans" in
22590         '') ;;
22591         *) : in case they cannot read
22592                 sh 1>&4 -c "$ans";;
22593         esac
22594         ;;
22595 esac
22596
22597 : if this fails, just run all the .SH files by hand
22598 . ./config.sh
22599
22600 echo " "
22601 exec 1>&4
22602 pwd=`pwd`
22603 . ./UU/extract
22604 cd "$pwd"
22605
22606 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22607         dflt=y
22608         case "$silent" in
22609         true) ;;
22610         *)
22611                 $cat <<EOM
22612
22613 Now you need to generate make dependencies by running "$make depend".
22614 You might prefer to run it in background: "$make depend > makedepend.out &"
22615 It can take a while, so you might not want to run it right now.
22616
22617 EOM
22618                 ;;
22619         esac
22620         rp="Run $make depend now?"
22621         . UU/myread
22622         case "$ans" in
22623         y*)
22624                 $make depend && echo "Now you must run '$make'."
22625                 ;;
22626         *)
22627                 echo "You must run '$make depend' then '$make'."
22628                 ;;
22629         esac
22630 elif test -f [Mm]akefile; then
22631         echo " "
22632         echo "Now you must run a $make."
22633 else
22634         echo "Configure done."
22635 fi
22636
22637 if $test -f Policy.sh; then
22638     $cat <<EOM
22639
22640 If you compile $package on a different machine or from a different object
22641 directory, copy the Policy.sh file from this object directory to the
22642 new one before you run Configure -- this will help you with most of
22643 the policy defaults.
22644
22645 EOM
22646 fi
22647 if $test -f config.msg; then
22648     echo "Hmm.  I also noted the following information while running:"
22649     echo " "
22650     $cat config.msg >&4
22651     $rm -f config.msg
22652 fi
22653 $rm -f kit*isdone ark*isdone
22654 $rm -rf UU
22655
22656 : End of Configure
22657