Similiarly Perl_newHV() can become a mathom by making newHV() a
[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 Mon Oct  8 10:22:27 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 test -x "${newsh}" || unset newsh
185
186 : if needed set CDPATH to a harmless value that is not chatty
187 : avoid bash 2.02 problems with empty CDPATH.
188 case "$CDPATH" in
189 '')     ;;
190 *)      case "$SHELL" in
191         *bash*) CDPATH='.' ;;
192         *)              CDPATH='' ;;
193         esac
194         ;;
195 esac
196 : Configure runs within the UU subdirectory
197 test -d UU || mkdir UU
198 cd UU && rm -f ./*
199
200 ccname=''
201 ccversion=''
202 ccsymbols=''
203 cppccsymbols=''
204 cppsymbols=''
205 from=''
206 run=''
207 targetarch=''
208 to=''
209 usecrosscompile=''
210 mistrustnm=''
211 perllibs=''
212 dynamic_ext=''
213 extensions=''
214 known_extensions=''
215 nonxs_ext=''
216 static_ext=''
217 useopcode=''
218 useposix=''
219 extras=''
220 d_bsd=''
221 d_eunice=''
222 d_xenix=''
223 eunicefix=''
224 Mcc=''
225 ar=''
226 awk=''
227 bash=''
228 bison=''
229 byacc=''
230 cat=''
231 chgrp=''
232 chmod=''
233 chown=''
234 comm=''
235 compress=''
236 cp=''
237 cpio=''
238 cpp=''
239 csh=''
240 date=''
241 echo=''
242 egrep=''
243 emacs=''
244 expr=''
245 find=''
246 flex=''
247 gmake=''
248 grep=''
249 gzip=''
250 inews=''
251 ksh=''
252 less=''
253 line=''
254 lint=''
255 ln=''
256 lp=''
257 lpr=''
258 ls=''
259 mail=''
260 mailx=''
261 make=''
262 mkdir=''
263 more=''
264 mv=''
265 nm=''
266 nroff=''
267 perl=''
268 pg=''
269 pmake=''
270 pr=''
271 rm=''
272 rmail=''
273 sed=''
274 sendmail=''
275 shar=''
276 sleep=''
277 smail=''
278 sort=''
279 submit=''
280 tail=''
281 tar=''
282 tbl=''
283 tee=''
284 test=''
285 touch=''
286 tr=''
287 troff=''
288 uname=''
289 uniq=''
290 uuname=''
291 vi=''
292 zcat=''
293 zip=''
294 full_ar=''
295 full_sed=''
296 libswanted=''
297 hint=''
298 myuname=''
299 osname=''
300 osvers=''
301 Author=''
302 Date=''
303 Header=''
304 Id=''
305 Locker=''
306 Log=''
307 RCSfile=''
308 Revision=''
309 Source=''
310 State=''
311 _a=''
312 _exe=''
313 _o=''
314 archobjs=''
315 exe_ext=''
316 firstmakefile=''
317 lib_ext=''
318 obj_ext=''
319 path_sep=''
320 rm_try=''
321 afs=''
322 afsroot=''
323 alignbytes=''
324 ansi2knr=''
325 archlib=''
326 archlibexp=''
327 d_archlib=''
328 installarchlib=''
329 archname=''
330 myarchname=''
331 d_atolf=''
332 d_atoll=''
333 baserev=''
334 bin=''
335 binexp=''
336 initialinstalllocation=''
337 installbin=''
338 userelocatableinc=''
339 byteorder=''
340 cc=''
341 ccflags=''
342 cppflags=''
343 ldflags=''
344 lkflags=''
345 locincpth=''
346 optimize=''
347 cf_email=''
348 cf_by=''
349 cf_time=''
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 append:symbol=value   append value to symbol
1692          -A symbol=value          like append:, but with a separating space
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               -A ccflags=-DSOME_MACRO
1702   -V : print version number and exit (with a zero status).
1703 EOM
1704         exit 1
1705         ;;
1706 esac
1707
1708 : Sanity checks
1709 case "$fastread$alldone" in
1710 yescont|yesexit) ;;
1711 *)
1712         case "$extractsh" in
1713         true) ;;
1714         *)
1715                 if test ! -t 0; then
1716                         echo "Say 'sh Configure', not 'sh <Configure'"
1717                         exit 1
1718                 fi
1719                 ;;
1720         esac
1721         ;;
1722 esac
1723
1724 exec 4>&1
1725 case "$silent" in
1726 true) exec 1>/dev/null;;
1727 esac
1728
1729 : run the defines and the undefines, if any, but leave the file out there...
1730 touch optdef.sh
1731 . ./optdef.sh
1732 : create the posthint manipulation script and leave the file out there...
1733 touch posthint.sh
1734
1735 : set package name
1736 package=perl5
1737 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1738 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1739 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1740 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1741 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1742 esac
1743
1744 : Some greps do not return status, grrr.
1745 echo "grimblepritz" >grimble
1746 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1747         contains=contains
1748 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1749         contains=grep
1750 else
1751         contains=contains
1752 fi
1753 rm -f grimble
1754 : the following should work in any shell
1755 case "$contains" in
1756 contains*)
1757         echo " "
1758         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1759         cat >contains <<'EOSS'
1760 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1761 EOSS
1762 chmod +x contains
1763 esac
1764
1765 : Find the path to the source tree
1766 case "$src" in
1767 '') case "$0" in
1768     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1769          case "$src" in
1770          /*)    ;;
1771          .)     ;;
1772          *)     src=`cd ../$src && pwd` ;;
1773          esac
1774          ;;
1775     *)   src='.';;
1776     esac;;
1777 esac
1778 case "$src" in
1779 '')     src=/
1780         rsrc=/
1781         ;;
1782 /*) rsrc="$src";;
1783 *) rsrc="../$src";;
1784 esac
1785 if test -f $rsrc/Configure && \
1786         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1787 then
1788    : found it, so we are ok.
1789 else
1790         rsrc=''
1791         for src in . .. ../.. ../../.. ../../../..; do
1792                 if test -f ../$src/Configure && \
1793                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1794                 then
1795                         rsrc=../$src
1796                         break
1797                 fi
1798         done
1799 fi
1800 case "$rsrc" in
1801 '')
1802         cat <<EOM >&4
1803
1804 Sorry, I can't seem to locate the source dir for $package.  Please start
1805 Configure with an explicit path -- i.e. /some/path/Configure.
1806
1807 EOM
1808         exit 1
1809         ;;
1810 ../.)   rsrc='..';;
1811 *)
1812         echo " "
1813         echo "Sources for $package found in \"$src\"." >&4
1814         ;;
1815 esac
1816
1817 : script used to extract .SH files with variable substitutions
1818 cat >extract <<'EOS'
1819 PERL_CONFIG_SH=true
1820 echo "Doing variable substitutions on .SH files..."
1821 if test -f MANIFEST; then
1822         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1823 else
1824         echo "(Looking for .SH files under the source directory.)"
1825         set x `(cd "$src"; find . -name "*.SH" -print)`
1826 fi
1827 shift
1828 case $# in
1829 0) set x `(cd "$src"; echo *.SH)`; shift;;
1830 esac
1831 if test ! -f "$src/$1"; then
1832         shift
1833 fi
1834 mkdir_p='
1835 name=$1;
1836 create="";
1837 while test $name; do
1838         if test ! -d "$name"; then
1839                 create="$name $create";
1840                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1841                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1842         else
1843                 name="";
1844         fi;
1845 done;
1846 for file in $create; do
1847         mkdir $file;
1848 done
1849 '
1850 for file in $*; do
1851         case "$src" in
1852         ".")
1853                 case "$file" in
1854                 */*)
1855                         dir=`expr X$file : 'X\(.*\)/'`
1856                         file=`expr X$file : 'X.*/\(.*\)'`
1857                         (cd "$dir" && . ./$file)
1858                         ;;
1859                 *)
1860                         . ./$file
1861                         ;;
1862                 esac
1863                 ;;
1864         *)
1865                 case "$file" in
1866                 */*)
1867                         dir=`expr X$file : 'X\(.*\)/'`
1868                         file=`expr X$file : 'X.*/\(.*\)'`
1869                         (set x $dir; shift; eval $mkdir_p)
1870                         sh <"$src/$dir/$file"
1871                         ;;
1872                 *)
1873                         sh <"$src/$file"
1874                         ;;
1875                 esac
1876                 ;;
1877         esac
1878 done
1879 if test -f "$src/config_h.SH"; then
1880         if test ! -f config.h; then
1881         : oops, they left it out of MANIFEST, probably, so do it anyway.
1882         . "$src/config_h.SH"
1883         fi
1884 fi
1885 EOS
1886
1887 : extract files and exit if asked to do so
1888 case "$extractsh" in
1889 true)
1890         case "$realsilent" in
1891         true) ;;
1892         *) exec 1>&4;;
1893         esac
1894         case "$config_sh" in
1895         '') config_sh='config.sh';;
1896         esac
1897         echo " "
1898         echo "Fetching answers from $config_sh..."
1899         cd ..
1900         . $config_sh
1901         test "$override" && . ./optdef.sh
1902         echo " "
1903         . UU/extract
1904         rm -rf UU
1905         echo "Extraction done."
1906         exit 0
1907         ;;
1908 esac
1909
1910 : Eunice requires " " instead of "", can you believe it
1911 echo " "
1912 : Here we go...
1913 echo "Beginning of configuration questions for $package."
1914
1915 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1916
1917 : first determine how to suppress newline on echo command
1918 echo " "
1919 echo "Checking echo to see how to suppress newlines..."
1920 (echo "hi there\c" ; echo " ") >.echotmp
1921 if $contains c .echotmp >/dev/null 2>&1 ; then
1922         echo "...using -n."
1923         n='-n'
1924         c=''
1925 else
1926         cat <<'EOM'
1927 ...using \c
1928 EOM
1929         n=''
1930         c='\c'
1931 fi
1932 echo $n "The star should be here-->$c"
1933 echo '*'
1934 rm -f .echotmp
1935
1936 : Now test for existence of everything in MANIFEST
1937 echo " "
1938 if test -f "$rsrc/MANIFEST"; then
1939         echo "First let's make sure your kit is complete.  Checking..." >&4
1940         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1941         rm -f missing
1942         tmppwd=`pwd`
1943         for filelist in x??; do
1944                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1945         done
1946         if test -s missing; then
1947                 cat missing >&4
1948                 cat >&4 <<'EOM'
1949
1950 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1951
1952 You have the option of continuing the configuration process, despite the
1953 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1954 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1955 and contact the author (perlbug@perl.org).
1956
1957 EOM
1958                 echo $n "Continue? [n] $c" >&4
1959                 read ans
1960                 case "$ans" in
1961                 y*)
1962                         echo "Continuing..." >&4
1963                         rm -f missing
1964                         ;;
1965                 *)
1966                         echo "ABORTING..." >&4
1967                         kill $$
1968                         ;;
1969                 esac
1970         else
1971                 echo "Looks good..."
1972         fi
1973 else
1974         echo "There is no MANIFEST file.  I hope your kit is complete !"
1975 fi
1976 rm -f missing x??
1977
1978 echo " "
1979 : Find the appropriate value for a newline for tr
1980 if test -n "$DJGPP"; then
1981        trnl='\012'
1982 fi
1983 if test X"$trnl" = X; then
1984         case "`echo foo|tr '\n' x 2>/dev/null`" in
1985         foox) trnl='\n' ;;
1986         esac
1987 fi
1988 if test X"$trnl" = X; then
1989         case "`echo foo|tr '\012' x 2>/dev/null`" in
1990         foox) trnl='\012' ;;
1991         esac
1992 fi
1993 if test X"$trnl" = X; then
1994        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1995        fooxy) trnl='\n\r' ;;
1996        esac
1997 fi
1998 if test X"$trnl" = X; then
1999         cat <<EOM >&2
2000
2001 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2002
2003 EOM
2004         exit 1
2005 fi
2006
2007 : compute the number of columns on the terminal for proper question formatting
2008 case "$COLUMNS" in
2009 '') COLUMNS='80';;
2010 esac
2011
2012 : set up the echo used in my read
2013 myecho="case \"\$xxxm\" in
2014 '') echo $n \"\$rp $c\" >&4;;
2015 *) case \"\$rp\" in
2016         '') echo $n \"[\$xxxm] $c\";;
2017         *)
2018                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2019                         echo \"\$rp\" >&4
2020                         echo $n \"[\$xxxm] $c\" >&4
2021                 else
2022                         echo $n \"\$rp [\$xxxm] $c\" >&4
2023                 fi
2024                 ;;
2025         esac;;
2026 esac"
2027
2028 : now set up to do reads with possible shell escape and default assignment
2029 cat <<EOSC >myread
2030 $startsh
2031 xxxm=\$dflt
2032 $myecho
2033 ans='!'
2034 case "\$fastread" in
2035 yes) case "\$dflt" in
2036         '') ;;
2037         *) ans='';
2038                 case "\$silent-\$rp" in
2039                 true-) ;;
2040                 *) echo " " >&4;;
2041                 esac;;
2042         esac;;
2043 *) case "\$silent" in
2044         true) case "\$rp" in
2045                 '') ans='';;
2046                 esac;;
2047         esac;;
2048 esac
2049 while expr "X\$ans" : "X!" >/dev/null; do
2050         read answ
2051         set x \$xxxm
2052         shift
2053         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2054         case  "\$answ" in
2055         "!")
2056                 sh 1>&4
2057                 echo " "
2058                 $myecho
2059                 ;;
2060         !*)
2061                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2062                 shift
2063                 sh 1>&4 -c "\$*"
2064                 echo " "
2065                 $myecho
2066                 ;;
2067         "\$ans")
2068                 case "\$ans" in
2069                 \\&*)
2070                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2071                         shift
2072                         case "\$1" in
2073                         -d)
2074                                 fastread=yes
2075                                 echo "(OK, I'll run with -d after this question.)" >&4
2076                                 ;;
2077                         -*)
2078                                 echo "*** Sorry, \$1 not supported yet." >&4
2079                                 ;;
2080                         esac
2081                         $myecho
2082                         ans=!
2083                         ;;
2084                 esac;;
2085         *)
2086                 case "\$aok" in
2087                 y)
2088                         echo "*** Substitution done -- please confirm."
2089                         xxxm="\$ans"
2090                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2091                         xxxm="\$ans"
2092                         ans=!
2093                         ;;
2094                 *)
2095                         echo "*** Error -- try again."
2096                         ans=!
2097                         ;;
2098                 esac
2099                 $myecho
2100                 ;;
2101         esac
2102         case "\$ans\$xxxm\$nostick" in
2103         '')
2104                 ans=!
2105                 $myecho
2106                 ;;
2107         esac
2108 done
2109 case "\$ans" in
2110 '') ans="\$xxxm";;
2111 esac
2112 EOSC
2113
2114 : create .config dir to save info across Configure sessions
2115 test -d ../.config || mkdir ../.config
2116 cat >../.config/README <<EOF
2117 This directory created by Configure to save information that should
2118 persist across sessions for $package.
2119
2120 You may safely delete it if you wish.
2121 EOF
2122
2123 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2124 case "$usedevel" in
2125 $define|true|[yY]*) ;;
2126 *) case "$xversion" in
2127    *[13579])
2128         cat >&4 <<EOH
2129 *** WHOA THERE!!! ***
2130
2131     This is an UNSTABLE DEVELOPMENT release.
2132     The version of this $package distribution is $xversion, that is, odd,
2133     (as opposed to even) and that signifies a development release.
2134     If you want a maintenance release, you want an even-numbered version.
2135
2136     Do ***NOT*** install this into production use.
2137     Data corruption and crashes are possible.
2138
2139     It is most seriously suggested that you do not continue any further
2140     unless you want to help in developing and debugging Perl.
2141
2142     If you *still* want to build perl, you can answer 'y' now,
2143     or pass -Dusedevel to Configure.
2144
2145 EOH
2146         rp='Do you really want to continue?'
2147         dflt='n'
2148         . ./myread
2149         case "$ans" in
2150         [yY]) echo >&4 "Okay, continuing."
2151               usedevel="$define" ;;
2152         *) echo >&4 "Okay, bye."
2153            exit 1
2154            ;;
2155         esac
2156         ;;
2157     esac
2158     ;;
2159 esac
2160 case "$usedevel" in
2161 $define|true|[yY]*)
2162         case "$versiononly" in
2163         '') versiononly="$define" ;;
2164         esac
2165         case "$installusrbinperl" in
2166         '') installusrbinperl="$undef" ;;
2167         esac
2168         ;;
2169 esac
2170
2171 : general instructions
2172 needman=true
2173 firsttime=true
2174 user=`(logname) 2>/dev/null`
2175 case "$user" in
2176 '') user=`whoami 2>&1`;;
2177 esac
2178 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2179         firsttime=false
2180         echo " "
2181         rp='Would you like to see the instructions?'
2182         dflt=n
2183         . ./myread
2184         case "$ans" in
2185         [yY]*) ;;
2186         *) needman=false;;
2187         esac
2188 fi
2189 if $needman; then
2190         cat <<EOH
2191
2192 This installation shell script will examine your system and ask you questions
2193 to determine how the perl5 package should be installed. If you get
2194 stuck on a question, you may use a ! shell escape to start a subshell or
2195 execute a command.  Many of the questions will have default answers in square
2196 brackets; typing carriage return will give you the default.
2197
2198 On some of the questions which ask for file or directory names you are allowed
2199 to use the ~name construct to specify the login directory belonging to "name",
2200 even if you don't have a shell which knows about that.  Questions where this is
2201 allowed will be marked "(~name ok)".
2202
2203 EOH
2204         rp=''
2205         dflt='Type carriage return to continue'
2206         . ./myread
2207         cat <<'EOH'
2208
2209 The prompter used in this script allows you to use shell variables and
2210 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2211 in the default answer, as if the default line was a set of arguments given to a
2212 script shell.  This means you may also use $* to repeat the whole default line,
2213 so you do not have to re-type everything to add something to the default.
2214
2215 Everytime there is a substitution, you will have to confirm.  If there is an
2216 error (e.g. an unmatched backtick), the default answer will remain unchanged
2217 and you will be prompted again.
2218
2219 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2220 the questions and use the computed defaults (or the previous answers if there
2221 was already a config.sh file). Type 'Configure -h' for a list of options.
2222 You may also start interactively and then answer '& -d' at any prompt to turn
2223 on the non-interactive behaviour for the remainder of the execution.
2224
2225 EOH
2226         . ./myread
2227         cat <<EOH
2228
2229 Much effort has been expended to ensure that this shell script will run on any
2230 Unix system.  If despite that it blows up on yours, your best bet is to edit
2231 Configure and run it again.  If you can't run Configure for some reason,
2232 you'll have to generate a config.sh file by hand.  Whatever problems you
2233 have, let me (perlbug@perl.org) know how I blew it.
2234
2235 This installation script affects things in two ways:
2236
2237 1) it may do direct variable substitutions on some of the files included
2238    in this kit.
2239 2) it builds a config.h file for inclusion in C programs.  You may edit
2240    any of these files as the need arises after running this script.
2241
2242 If you make a mistake on a question, there is no easy way to back up to it
2243 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2244 files.  Configure will offer to let you do this before it runs the SH files.
2245
2246 EOH
2247         dflt='Type carriage return to continue'
2248         . ./myread
2249         case "$firsttime" in
2250         true) echo $user >>../.config/instruct;;
2251         esac
2252 fi
2253
2254 : find out where common programs are
2255 echo " "
2256 echo "Locating common programs..." >&4
2257 cat <<EOSC >loc
2258 $startsh
2259 case \$# in
2260 0) exit 1;;
2261 esac
2262 thing=\$1
2263 shift
2264 dflt=\$1
2265 shift
2266 for dir in \$*; do
2267         case "\$thing" in
2268         .)
2269         if test -d \$dir/\$thing; then
2270                 echo \$dir
2271                 exit 0
2272         fi
2273         ;;
2274         *)
2275         for thisthing in \$dir/\$thing; do
2276                 : just loop through to pick last item
2277         done
2278         if test -f \$thisthing; then
2279                 echo \$thisthing
2280                 exit 0
2281         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2282                 echo \$thisthing
2283                 exit 0
2284         elif test -f \$dir/\$thing.exe; then
2285                 if test -n "$DJGPP"; then
2286                         echo \$dir/\$thing.exe
2287                 elif test "$eunicefix" != ":"; then
2288                         : on Eunice apparently
2289                         echo \$dir/\$thing
2290                         exit 0
2291                 fi
2292                 exit 0
2293         fi
2294         ;;
2295         esac
2296 done
2297 echo \$dflt
2298 exit 1
2299 EOSC
2300 chmod +x loc
2301 $eunicefix loc
2302 loclist="
2303 awk
2304 cat
2305 chmod
2306 comm
2307 cp
2308 echo
2309 expr
2310 grep
2311 ls
2312 mkdir
2313 rm
2314 sed
2315 sort
2316 touch
2317 tr
2318 uniq
2319 "
2320 trylist="
2321 Mcc
2322 ar
2323 bison
2324 byacc
2325 cpp
2326 csh
2327 date
2328 egrep
2329 gmake
2330 gzip
2331 less
2332 ln
2333 make
2334 more
2335 nm
2336 nroff
2337 pg
2338 test
2339 uname
2340 zip
2341 "
2342 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2343 pth="$pth /lib /usr/lib"
2344 for file in $loclist; do
2345         eval xxx=\$$file
2346         case "$xxx" in
2347         /*|?:[\\/]*)
2348                 if test -f "$xxx"; then
2349                         : ok
2350                 else
2351                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2352                         xxx=`./loc $file $file $pth`
2353                 fi
2354                 ;;
2355         '') xxx=`./loc $file $file $pth`;;
2356         *) xxx=`./loc $xxx $xxx $pth`;;
2357         esac
2358         eval $file=$xxx$_exe
2359         eval _$file=$xxx
2360         case "$xxx" in
2361         /*)
2362                 echo $file is in $xxx.
2363                 ;;
2364         ?:[\\/]*)
2365                 echo $file is in $xxx.
2366                 ;;
2367         *)
2368                 echo "I don't know where '$file' is, and my life depends on it." >&4
2369                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2370                 exit 1
2371                 ;;
2372         esac
2373 done
2374 echo " "
2375 echo "Don't worry if any of the following aren't found..."
2376 say=offhand
2377 for file in $trylist; do
2378         eval xxx=\$$file
2379         case "$xxx" in
2380         /*|?:[\\/]*)
2381                 if test -f "$xxx"; then
2382                         : ok
2383                 else
2384                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2385                         xxx=`./loc $file $file $pth`
2386                 fi
2387                 ;;
2388         '') xxx=`./loc $file $file $pth`;;
2389         *) xxx=`./loc $xxx $xxx $pth`;;
2390         esac
2391         eval $file=$xxx$_exe
2392         eval _$file=$xxx
2393         case "$xxx" in
2394         /*)
2395                 echo $file is in $xxx.
2396                 ;;
2397         ?:[\\/]*)
2398                 echo $file is in $xxx.
2399                 ;;
2400         *)
2401                 echo "I don't see $file out there, $say."
2402                 say=either
2403                 ;;
2404         esac
2405 done
2406 case "$egrep" in
2407 egrep)
2408         echo "Substituting grep for egrep."
2409         egrep=$grep
2410         _egrep=$grep
2411         ;;
2412 esac
2413 case "$ln" in
2414 ln)
2415         echo "Substituting cp for ln."
2416         ln=$cp
2417         _ln=$cp
2418         ;;
2419 esac
2420 case "$make" in
2421 make)   
2422         case "$gmake" in
2423         gmake)
2424         echo "I can't find make or gmake, and my life depends on it." >&4
2425         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2426         exit 1
2427         ;;
2428         esac
2429         ;;
2430 esac    
2431 case "$gmake" in
2432 gmake)  ;;
2433 *)      # We can't have osname yet.
2434         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2435                 # Assume that gmake, if found, is definitely GNU make
2436                 # and prefer it over the system make.
2437                 echo "Substituting gmake for make."
2438                 make=$gmake
2439                 _make=$gmake
2440         fi
2441         ;;
2442 esac
2443 case "$test" in
2444 test)
2445         echo "Hopefully test is built into your sh."
2446         ;;
2447 *)
2448         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2449                 echo "Using the test built into your sh."
2450                 test=test
2451                 _test=test
2452         fi
2453         ;;
2454 esac
2455 case "$echo" in
2456 echo)
2457         echo "Hopefully echo is built into your sh."
2458         ;;
2459 '') ;;
2460 *)
2461         echo " "
2462 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2463         $echo $n "hi there$c" >foo1
2464         echo $n "hi there$c" >foo2
2465         if cmp foo1 foo2 >/dev/null 2>&1; then
2466                 echo "They are compatible.  In fact, they may be identical."
2467         else
2468                 case "$n" in
2469                 '-n') n='' c='\c';;
2470                 *) n='-n' c='';;
2471                 esac
2472                 cat <<FOO
2473 They are not compatible!  You are probably running ksh on a non-USG system.
2474 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2475 have echo built in and we may have to run some Bourne shell scripts.  That
2476 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2477
2478 FOO
2479                 $echo $n "The star should be here-->$c"
2480                 $echo "*"
2481         fi
2482         $rm -f foo1 foo2
2483         ;;
2484 esac
2485
2486 # This question was auctioned at YAPC::Europe-2007 in Vienna
2487 # I never promised you could answer it. I only auctioned the question.
2488 cat <<FOO
2489 The following message is sponsored by
2490
2491   Dresden.pm<--The stars should be here.
2492
2493 Dear Perl user, system administrator or package
2494 maintainer, the Perl community sends greetings to
2495 you. Do you (emblematical) greet back [Y/n]? n
2496
2497 FOO
2498
2499 cat <<EOS >trygcc
2500 $startsh
2501 EOS
2502 cat <<'EOSC' >>trygcc
2503 case "$cc" in
2504 '') ;;
2505 *)  $rm -f try try.*
2506     $cat >try.c <<EOM
2507 int main(int argc, char *argv[]) {
2508   return 0;
2509 }
2510 EOM
2511     if $cc -o try $ccflags $ldflags try.c; then
2512        :
2513     else
2514         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2515         despair=yes
2516         trygcc=yes
2517         case "$cc" in
2518         *gcc*) trygcc=no ;;
2519         esac
2520         # Skip this test because it gives a false match on output like:
2521         #    ./trygcc: line 23: cc: command not found
2522         # case "`$cc -v -c try.c 2>&1`" in
2523         # *gcc*) trygcc=no ;;
2524         # esac
2525         if $test X"$trygcc" = Xyes; then
2526             if gcc -o try -c try.c; then
2527                 echo " "
2528                 echo "You seem to have a working gcc, though." >&4
2529                 # Switching compilers may undo the work of hints files.
2530                 # The most common problem is -D_REENTRANT for threads.
2531                 # This heuristic catches that case, but gets false positives
2532                 # if -Dusethreads was not actually specified.  Better to
2533                 # bail out here with a useful message than fail 
2534                 # mysteriously later. Should we perhaps just try to
2535                 # re-invoke Configure -Dcc=gcc config_args ?
2536                 if $test -f usethreads.cbu; then
2537                         $cat >&4 <<EOM 
2538
2539 *** However, any setting of the C compiler flags (e.g. for thread support)
2540 *** will be lost.  It may be necessary for you to restart Configure and
2541 *** add -Dcc=gcc to your Configure command line.
2542
2543 EOM
2544                         rp="Would you like to go ahead and try gcc anyway?"
2545                         dflt=n
2546                 else
2547                         rp="Would you like to use it?"
2548                         dflt=y
2549                 fi
2550                 if $test -f myread; then
2551                     . ./myread
2552                 else
2553                     if $test -f UU/myread; then
2554                         . ./UU/myread
2555                     else
2556                         echo "Cannot find myread, sorry.  Aborting." >&2
2557                         exit 1
2558                     fi
2559                 fi  
2560                 case "$ans" in
2561                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2562                 esac
2563             fi
2564         fi
2565     fi
2566     $rm -f try try.*
2567     ;;
2568 esac
2569 EOSC
2570
2571 cat <<EOS >checkcc
2572 $startsh
2573 EOS
2574 cat <<'EOSC' >>checkcc
2575 case "$cc" in        
2576 '') ;;
2577 *)  $rm -f try try.*              
2578     $cat >try.c <<EOM
2579 int main(int argc, char *argv[]) {
2580   return 0;
2581 }
2582 EOM
2583     if $cc -o try $ccflags $ldflags try.c; then
2584        :
2585     else
2586         if $test X"$despair" = Xyes; then
2587            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2588         fi
2589         $cat >&4 <<EOM         
2590 You need to find a working C compiler.
2591 Either (purchase and) install the C compiler supplied by your OS vendor,
2592 or for a free C compiler try http://gcc.gnu.org/
2593 I cannot continue any further, aborting.
2594 EOM
2595         exit 1
2596     fi
2597     $rm -f try try.*
2598     ;;
2599 esac
2600 EOSC
2601
2602 : determine whether symbolic links are supported
2603 echo " "
2604 $touch blurfl
2605 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2606         echo "Symbolic links are supported." >&4
2607         lns="$ln -s"
2608 else
2609         echo "Symbolic links are NOT supported." >&4
2610         lns="$ln"
2611 fi
2612 $rm -f blurfl sym
2613
2614 : determine whether symbolic links are supported
2615 echo " "
2616 case "$lns" in
2617 *"ln"*" -s")
2618         echo "Checking how to test for symbolic links..." >&4
2619         $lns blurfl sym
2620         if $test "X$issymlink" = X; then
2621                 case "$newsh" in
2622                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2623                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2624                 esac
2625                 if test $? = 0; then
2626                         issymlink="test -h"
2627                 else
2628                         echo "Your builtin 'test -h' may be broken." >&4
2629                         case "$test" in
2630                         /*)     ;;
2631                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2632                                 for p in $pth
2633                                 do
2634                                         if test -f "$p/$test"; then
2635                                                 test="$p/$test"
2636                                                 break
2637                                         fi
2638                                 done
2639                                 ;;
2640                         esac
2641                         case "$test" in
2642                         /*)
2643                                 echo "Trying external '$test -h'." >&4
2644                                 issymlink="$test -h"
2645                                 if $test ! -h sym >/dev/null 2>&1; then
2646                                         echo "External '$test -h' is broken, too." >&4
2647                                         issymlink=''
2648                                 fi
2649                                 ;;
2650                         *)      issymlink='' ;;
2651                         esac
2652                 fi              
2653         fi
2654         if $test "X$issymlink" = X; then
2655                 if $test -L sym 2>/dev/null; then
2656                         issymlink="$test -L"
2657                         echo "The builtin '$test -L' worked." >&4
2658                 fi
2659         fi
2660         if $test "X$issymlink" != X; then
2661                 echo "You can test for symbolic links with '$issymlink'." >&4
2662         else
2663                 echo "I do not know how you can test for symbolic links." >&4
2664         fi
2665         $rm -f blurfl sym
2666         ;;
2667 *)      echo "No symbolic links, so not testing for their testing..." >&4
2668         ;;
2669 esac
2670 echo " "
2671
2672
2673 case "$mksymlinks" in
2674 $define|true|[yY]*)
2675         case "$src" in
2676         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2677                 exit 1
2678                 ;;
2679         *)      case "$lns:$issymlink" in
2680                 *"ln"*" -s:"*"test -"?)
2681                         echo "Creating the symbolic links..." >&4
2682                         echo "(First creating the subdirectories...)" >&4
2683                         cd ..
2684                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2685                                 read directory
2686                                 test -z "$directory" && break
2687                                 mkdir -p $directory
2688                         done
2689                         # Sanity check 1.
2690                         if test ! -d t/base; then
2691                                 echo "Failed to create the subdirectories.  Aborting." >&4
2692                                 exit 1
2693                         fi
2694                         echo "(Then creating the symlinks...)" >&4
2695                         awk '{print $1}' $src/MANIFEST | while true; do
2696                                 read filename
2697                                 test -z "$filename" && break
2698                                 if test -f $filename; then
2699                                         if $issymlink $filename; then
2700                                                 rm -f $filename
2701                                         fi
2702                                 fi
2703                                 if test -f $filename; then
2704                                         echo "$filename already exists, not symlinking."
2705                                 else
2706                                         ln -s $src/$filename $filename
2707                                 fi
2708                         done
2709                         # Sanity check 2.
2710                         if test ! -f t/base/lex.t; then
2711                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2712                                 exit 1
2713                         fi
2714                         cd UU
2715                         ;;
2716                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2717                         ;;
2718                 esac
2719                 ;;
2720         esac
2721         ;;
2722 esac
2723
2724
2725 case "$usecrosscompile" in
2726 $define|true|[yY]*)
2727         $echo "Cross-compiling..."
2728         croak=''
2729         case "$cc" in
2730         *-*-gcc) # A cross-compiling gcc, probably.
2731             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2732             ar=$targetarch-ar
2733             # leave out ld, choosing it is more complex
2734             nm=$targetarch-nm
2735             ranlib=$targetarch-ranlib
2736             $echo 'extern int foo;' > try.c
2737             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2738             shift
2739             if $test $# -gt 0; then
2740                 incpth="$incpth $*"
2741                 incpth="`$echo $incpth|$sed 's/^ //'`"
2742                 echo "Guessing incpth '$incpth'." >&4
2743                 for i in $*; do
2744                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2745                     if $test -d $j; then
2746                         libpth="$libpth $j"
2747                     fi
2748                 done   
2749                 libpth="`$echo $libpth|$sed 's/^ //'`"
2750                 echo "Guessing libpth '$libpth'." >&4
2751             fi
2752             $rm -f try.c
2753             ;;
2754         esac
2755         case "$targetarch" in
2756         '') echo "Targetarch not defined." >&4; croak=y ;;
2757         *)  echo "Using targetarch $targetarch." >&4 ;;
2758         esac
2759         case "$incpth" in
2760         '') echo "Incpth not defined." >&4; croak=y ;;
2761         *)  echo "Using incpth '$incpth'." >&4 ;;
2762         esac
2763         case "$libpth" in
2764         '') echo "Libpth not defined." >&4; croak=y ;;
2765         *)  echo "Using libpth '$libpth'." >&4 ;;
2766         esac
2767         case "$usrinc" in
2768         '') for i in $incpth; do
2769                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2770                     usrinc=$i
2771                     echo "Guessing usrinc $usrinc." >&4
2772                     break
2773                 fi
2774             done
2775             case "$usrinc" in
2776             '') echo "Usrinc not defined." >&4; croak=y ;;
2777             esac
2778             ;;
2779         *)  echo "Using usrinc $usrinc." >&4 ;;
2780         esac
2781         case "$targethost" in
2782         '') echo "Targethost not defined." >&4; croak=y ;;
2783         *)  echo "Using targethost $targethost." >&4
2784         esac
2785         locincpth=' '
2786         loclibpth=' '
2787         case "$croak" in
2788         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2789         esac
2790         case "$src" in
2791         /*) run=$src/Cross/run
2792             targetmkdir=$src/Cross/mkdir
2793             to=$src/Cross/to
2794             from=$src/Cross/from
2795             ;;
2796         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2797             run=$pwd/Cross/run
2798             targetmkdir=$pwd/Cross/mkdir
2799             to=$pwd/Cross/to
2800             from=$pwd/Cross/from
2801             ;;
2802         esac
2803         case "$targetrun" in
2804         '') targetrun=ssh ;;
2805         esac
2806         case "$targetto" in
2807         '') targetto=scp ;;
2808         esac
2809         case "$targetfrom" in
2810         '') targetfrom=scp ;;
2811         esac
2812         run=$run-$targetrun
2813         to=$to-$targetto
2814         from=$from-$targetfrom
2815         case "$targetdir" in
2816         '')  targetdir=/tmp
2817              echo "Guessing targetdir $targetdir." >&4
2818              ;;
2819         esac
2820         case "$targetuser" in
2821         '')  targetuser=root
2822              echo "Guessing targetuser $targetuser." >&4
2823              ;;
2824         esac
2825         case "$targetfrom" in
2826         scp)    q=-q ;;
2827         *)      q='' ;;
2828         esac
2829         case "$targetrun" in
2830         ssh|rsh)
2831             cat >$run <<EOF
2832 #!/bin/sh
2833 case "\$1" in
2834 -cwd)
2835   shift
2836   cwd=\$1
2837   shift
2838   ;;
2839 esac
2840 case "\$cwd" in
2841 '') cwd=$targetdir ;;
2842 esac
2843 exe=\$1
2844 shift
2845 if $test ! -f \$exe.xok; then
2846   $to \$exe
2847   $touch \$exe.xok
2848 fi
2849 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2850 EOF
2851             ;;
2852         *)  echo "Unknown targetrun '$targetrun'" >&4
2853             exit 1
2854             ;;
2855         esac
2856         case "$targetmkdir" in
2857         */Cross/mkdir)
2858             cat >$targetmkdir <<EOF
2859 #!/bin/sh
2860 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2861 EOF
2862             $chmod a+rx $targetmkdir
2863             ;;
2864         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2865             exit 1
2866             ;;
2867         esac
2868         case "$targetto" in
2869         scp|rcp)
2870             cat >$to <<EOF
2871 #!/bin/sh
2872 for f in \$@
2873 do
2874   case "\$f" in
2875   /*)
2876     $targetmkdir \`dirname \$f\`
2877     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2878     ;;
2879   *)
2880     $targetmkdir $targetdir/\`dirname \$f\`
2881     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2882     ;;
2883   esac
2884 done
2885 exit 0
2886 EOF
2887             ;;
2888         cp) cat >$to <<EOF
2889 #!/bin/sh
2890 for f in \$@
2891 do
2892   case "\$f" in
2893   /*)
2894     $mkdir -p $targetdir/\`dirname \$f\`
2895     $cp \$f $targetdir/\$f || exit 1
2896     ;;
2897   *)
2898     $targetmkdir $targetdir/\`dirname \$f\`
2899     $cp \$f $targetdir/\$f || exit 1
2900     ;;
2901   esac
2902 done
2903 exit 0
2904 EOF
2905             ;;
2906         *)  echo "Unknown targetto '$targetto'" >&4
2907             exit 1
2908             ;;
2909         esac
2910         case "$targetfrom" in
2911         scp|rcp)
2912           cat >$from <<EOF
2913 #!/bin/sh
2914 for f in \$@
2915 do
2916   $rm -f \$f
2917   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2918 done
2919 exit 0
2920 EOF
2921             ;;
2922         cp) cat >$from <<EOF
2923 #!/bin/sh
2924 for f in \$@
2925 do
2926   $rm -f \$f
2927   cp $targetdir/\$f . || exit 1
2928 done
2929 exit 0
2930 EOF
2931             ;;
2932         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2933             exit 1
2934             ;;
2935         esac
2936         if $test ! -f $run; then
2937             echo "Target 'run' script '$run' not found." >&4
2938         else
2939             $chmod a+rx $run
2940         fi
2941         if $test ! -f $to; then
2942             echo "Target 'to' script '$to' not found." >&4
2943         else
2944             $chmod a+rx $to
2945         fi
2946         if $test ! -f $from; then
2947             echo "Target 'from' script '$from' not found." >&4
2948         else
2949             $chmod a+rx $from
2950         fi
2951         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2952             exit 1
2953         fi
2954         cat >&4 <<EOF
2955 Using '$run' for remote execution,
2956 and '$from' and '$to'
2957 for remote file transfer.
2958 EOF
2959         ;;
2960 *)      run=''
2961         to=:
2962         from=:
2963         usecrosscompile='undef'
2964         targetarch=''
2965         ;;
2966 esac
2967
2968 : see whether [:lower:] and [:upper:] are supported character classes
2969 echo " "
2970 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2971 ABYZ)
2972         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2973         up='[:upper:]'
2974         low='[:lower:]'
2975         ;;
2976 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2977         # (0xd9 and 0xe2), therefore that is a nice testing point.
2978         if test "X$up" = X -o "X$low" = X; then
2979             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2980             rs) up='[A-Z]'
2981                 low='[a-z]'
2982                 ;;
2983             esac
2984         fi
2985         if test "X$up" = X -o "X$low" = X; then
2986             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2987             rs) up='A-Z'
2988                 low='a-z'
2989                 ;;
2990             esac
2991         fi
2992         if test "X$up" = X -o "X$low" = X; then
2993             case "`echo RS | od -x 2>/dev/null`" in
2994             *D9E2*|*d9e2*)
2995                 echo "Hey, this might be EBCDIC." >&4
2996                 if test "X$up" = X -o "X$low" = X; then
2997                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2998                     rs) up='[A-IJ-RS-Z]'
2999                         low='[a-ij-rs-z]'
3000                         ;;
3001                     esac
3002                 fi
3003                 if test "X$up" = X -o "X$low" = X; then
3004                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3005                     rs) up='A-IJ-RS-Z'
3006                         low='a-ij-rs-z'
3007                         ;;
3008                     esac
3009                 fi
3010                 ;;
3011             esac
3012         fi
3013 esac
3014 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3015 rs)
3016     echo "Using $up and $low to convert case." >&4
3017     ;;
3018 *)
3019     echo "I don't know how to translate letters from upper to lower case." >&4
3020     echo "Your tr is not acting any way I know of." >&4
3021     exit 1
3022     ;;
3023 esac
3024 : set up the translation script tr, must be called with ./tr of course
3025 cat >tr <<EOSC
3026 $startsh
3027 case "\$1\$2" in
3028 '[A-Z][a-z]') exec $tr '$up' '$low';;
3029 '[a-z][A-Z]') exec $tr '$low' '$up';;
3030 esac
3031 exec $tr "\$@"
3032 EOSC
3033 chmod +x tr
3034 $eunicefix tr
3035
3036 : Try to determine whether config.sh was made on this system
3037 case "$config_sh" in
3038 '')
3039 myuname=`$uname -a 2>/dev/null`
3040 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3041 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3042 # because the A-Z/a-z are not consecutive.
3043 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3044         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3045 newmyuname="$myuname"
3046 dflt=n
3047 case "$knowitall" in
3048 '')
3049         if test -f ../config.sh; then
3050                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3051                         eval "`grep myuname= ../config.sh`"
3052                 fi
3053                 if test "X$myuname" = "X$newmyuname"; then
3054                         dflt=y
3055                 fi
3056         fi
3057         ;;
3058 *) dflt=y;;
3059 esac
3060
3061 : Get old answers from old config file if Configure was run on the
3062 : same system, otherwise use the hints.
3063 hint=default
3064 cd ..
3065 if test -f config.sh; then
3066         echo " "
3067         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3068         . UU/myread
3069         case "$ans" in
3070         n*|N*) echo "OK, I'll ignore it."
3071                 mv config.sh config.sh.old
3072                 myuname="$newmyuname"
3073                 ;;
3074         *)  echo "Fetching default answers from your old config.sh file..." >&4
3075                 tmp_n="$n"
3076                 tmp_c="$c"
3077                 tmp_sh="$sh"
3078                 . ./config.sh
3079                 cp config.sh UU
3080                 n="$tmp_n"
3081                 c="$tmp_c"
3082                 : Older versions did not always set $sh.  Catch re-use of such
3083                 : an old config.sh.
3084                 case "$sh" in
3085                 '') sh="$tmp_sh" ;;
3086                 esac
3087                 hint=previous
3088                 ;;
3089         esac
3090 fi
3091 . ./UU/checkcc
3092 if test ! -f config.sh; then
3093         $cat <<EOM
3094
3095 First time through, eh?  I have some defaults handy for some systems
3096 that need some extra help getting the Configure answers right:
3097
3098 EOM
3099         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3100         dflt=''
3101         : Half the following guesses are probably wrong... If you have better
3102         : tests or hints, please send them to perlbug@perl.org
3103         : The metaconfig authors would also appreciate a copy...
3104         $test -f /irix && osname=irix
3105         $test -f /xenix && osname=sco_xenix
3106         $test -f /dynix && osname=dynix
3107         $test -f /dnix && osname=dnix
3108         $test -f /lynx.os && osname=lynxos
3109         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3110         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3111         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3112         $test -f /bin/mips && /bin/mips && osname=mips
3113         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3114                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3115         $test -d /usr/apollo/bin && osname=apollo
3116         $test -f /etc/saf/_sactab && osname=svr4
3117         $test -d /usr/include/minix && osname=minix
3118         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3119         if $test -d /MachTen -o -d /MachTen_Folder; then
3120                 osname=machten
3121                 if $test -x /sbin/version; then
3122                         osvers=`/sbin/version | $awk '{print $2}' |
3123                         $sed -e 's/[A-Za-z]$//'`
3124                 elif $test -x /usr/etc/version; then
3125                         osvers=`/usr/etc/version | $awk '{print $2}' |
3126                         $sed -e 's/[A-Za-z]$//'`
3127                 else
3128                         osvers="$2.$3"
3129                 fi
3130         fi
3131
3132         $test -f /sys/posix.dll &&
3133                 $test -f /usr/bin/what &&
3134                 set X `/usr/bin/what /sys/posix.dll` &&
3135                 $test "$3" = UWIN &&
3136                 osname=uwin &&
3137                 osvers="$5"
3138
3139         if $test -f $uname; then
3140                 set X $myuname
3141                 shift
3142
3143                 case "$5" in
3144                 fps*) osname=fps ;;
3145                 mips*)
3146                         case "$4" in
3147                         umips) osname=umips ;;
3148                         *) osname=mips ;;
3149                         esac;;
3150                 [23]100) osname=mips ;;
3151                 next*) osname=next ;;
3152                 i386*)
3153                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3154                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3155                                 osname='sco'
3156                                 osvers=$tmp
3157                         elif $test -f /etc/kconfig; then
3158                                 osname=isc
3159                                 if test "$lns" = "$ln -s"; then
3160                                         osvers=4
3161                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3162                                         osvers=3
3163                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3164                                         osvers=2
3165                                 fi
3166                         fi
3167                         tmp=''
3168                         ;;
3169                 pc*)
3170                         if test -n "$DJGPP"; then
3171                                 osname=dos
3172                                 osvers=djgpp
3173                         fi
3174                         ;;
3175                 esac
3176
3177                 case "$1" in
3178                 aix) osname=aix
3179                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3180                         case "$tmp" in
3181                         # oslevel can fail with:
3182                         # oslevel: Unable to acquire lock.
3183                         *not\ found) osvers="$4"."$3" ;;
3184                         '<3240'|'<>3240') osvers=3.2.0 ;;
3185                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3186                         '=3250'|'>3250') osvers=3.2.5 ;;
3187                         *) osvers=$tmp;;
3188                         esac
3189                         ;;
3190                 bsd386) osname=bsd386
3191                         osvers=`$uname -r`
3192                         ;;
3193                 cygwin*) osname=cygwin
3194                         osvers="$3"
3195                         ;;
3196                 *dc.osx) osname=dcosx
3197                         osvers="$3"
3198                         ;;
3199                 dnix) osname=dnix
3200                         osvers="$3"
3201                         ;;
3202                 domainos) osname=apollo
3203                         osvers="$3"
3204                         ;;
3205                 dgux)   osname=dgux
3206                         osvers="$3"
3207                         ;;
3208                 dragonfly) osname=dragonfly
3209                         osvers="$3"
3210                         ;;
3211                 dynixptx*) osname=dynixptx
3212                         osvers=`echo "$4"|sed 's/^v//'`
3213                         ;;
3214                 freebsd) osname=freebsd
3215                         osvers="$3" ;;
3216                 genix)  osname=genix ;;
3217                 gnu)    osname=gnu
3218                         osvers="$3" ;;
3219                 hp*)    osname=hpux
3220                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3221                         ;;
3222                 irix*)  osname=irix
3223                         case "$3" in
3224                         4*) osvers=4 ;;
3225                         5*) osvers=5 ;;
3226                         *)      osvers="$3" ;;
3227                         esac
3228                         ;;
3229                 linux)  osname=linux
3230                         case "$3" in
3231                         *)      osvers="$3" ;;
3232                         esac
3233                         ;;
3234                 MiNT)   osname=mint
3235                         ;;
3236                 netbsd*) osname=netbsd
3237                         osvers="$3"
3238                         ;;
3239                 news-os) osvers="$3"
3240                         case "$3" in
3241                         4*) osname=newsos4 ;;
3242                         *) osname=newsos ;;
3243                         esac
3244                         ;;
3245                 next*) osname=next ;;
3246                 nonstop-ux) osname=nonstopux ;;
3247                 openbsd) osname=openbsd
3248                         osvers="$3"
3249                         ;;
3250                 os2)    osname=os2
3251                         osvers="$4"
3252                         ;;
3253                 POSIX-BC | posix-bc ) osname=posix-bc
3254                         osvers="$3"
3255                         ;;
3256                 powerux | power_ux | powermax_os | powermaxos | \
3257                 powerunix | power_unix) osname=powerux
3258                         osvers="$3"
3259                         ;;
3260                 qnx) osname=qnx
3261                         osvers="$4"
3262                         ;;
3263                 solaris) osname=solaris
3264                         case "$3" in
3265                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3266                         *)      osvers="$3" ;;
3267                         esac
3268                         ;;
3269                 sunos) osname=sunos
3270                         case "$3" in
3271                         5*) osname=solaris
3272                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3273                         *)      osvers="$3" ;;
3274                         esac
3275                         ;;
3276                 titanos) osname=titanos
3277                         case "$3" in
3278                         1*) osvers=1 ;;
3279                         2*) osvers=2 ;;
3280                         3*) osvers=3 ;;
3281                         4*) osvers=4 ;;
3282                         *)      osvers="$3" ;;
3283                         esac
3284                         ;;
3285                 ultrix) osname=ultrix
3286                         osvers="$3"
3287                         ;;
3288                 osf1|mls+)      case "$5" in
3289                                 alpha)
3290                                         osname=dec_osf
3291                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3292                                         case "$osvers" in
3293                                         [1-9].[0-9]*) ;;
3294                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3295                                         esac
3296                                         ;;
3297                         hp*)    osname=hp_osf1  ;;
3298                         mips)   osname=mips_osf1 ;;
3299                         esac
3300                         ;;
3301                 # UnixWare 7.1.2 is known as Open UNIX 8
3302                 openunix|unixware) osname=svr5
3303                         osvers="$4"
3304                         ;;
3305                 uts)    osname=uts
3306                         osvers="$3"
3307                         ;;
3308                 vos) osvers="$3"
3309                         ;;
3310                 $2) case "$osname" in
3311                         *isc*) ;;
3312                         *freebsd*) ;;
3313                         svr*)
3314                                 : svr4.x or possibly later
3315                                 case "svr$3" in
3316                                 ${osname}*)
3317                                         osname=svr$3
3318                                         osvers=$4
3319                                         ;;
3320                                 esac
3321                                 case "$osname" in
3322                                 svr4.0)
3323                                         : Check for ESIX
3324                                         if test -f /stand/boot ; then
3325                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3326                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3327                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3328                                                         if test -n "$isesix"; then
3329                                                                 osname=esix4
3330                                                         fi
3331                                                 fi
3332                                         fi
3333                                         ;;
3334                                 esac
3335                                 ;;
3336                         *)      if test -f /etc/systemid; then
3337                                         osname=sco
3338                                         set `echo $3 | $sed 's/\./ /g'` $4
3339                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3340                                                 osvers=$1.$2.$3
3341                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3342                                                 osvers=$1.$2
3343                                         elif $test -f $src/hints/sco_$1.sh; then
3344                                                 osvers=$1
3345                                         fi
3346                                 else
3347                                         case "$osname" in
3348                                         '') : Still unknown.  Probably a generic Sys V.
3349                                                 osname="sysv"
3350                                                 osvers="$3"
3351                                                 ;;
3352                                         esac
3353                                 fi
3354                                 ;;
3355                         esac
3356                         ;;
3357                 *)      case "$osname" in
3358                         '') : Still unknown.  Probably a generic BSD.
3359                                 osname="$1"
3360                                 osvers="$3"
3361                                 ;;
3362                         esac
3363                         ;;
3364                 esac
3365         else
3366                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3367                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3368                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3369                                 osname=news_os
3370                         fi
3371                         $rm -f UU/kernel.what
3372                 elif test -d c:/. -o -n "$is_os2" ; then
3373                         set X $myuname
3374                         osname=os2
3375                         osvers="$5"
3376                 fi
3377         fi
3378
3379         case "$targetarch" in
3380         '') ;;
3381         *)  hostarch=$osname
3382             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3383             osvers=''
3384             ;;
3385         esac
3386
3387         : Now look for a hint file osname_osvers, unless one has been
3388         : specified already.
3389         case "$hintfile" in
3390         ''|' ')
3391                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3392                 : Also try without trailing minor version numbers.
3393                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3394                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3395                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3396                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3397                 case "$file" in
3398                 '') dflt=none ;;
3399                 *)  case "$osvers" in
3400                         '') dflt=$file
3401                                 ;;
3402                         *)  if $test -f $src/hints/$file.sh ; then
3403                                         dflt=$file
3404                                 elif $test -f $src/hints/$xfile.sh ; then
3405                                         dflt=$xfile
3406                                 elif $test -f $src/hints/$xxfile.sh ; then
3407                                         dflt=$xxfile
3408                                 elif $test -f $src/hints/$xxxfile.sh ; then
3409                                         dflt=$xxxfile
3410                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3411                                         dflt=$xxxxfile
3412                                 elif $test -f "$src/hints/${osname}.sh" ; then
3413                                         dflt="${osname}"
3414                                 else
3415                                         dflt=none
3416                                 fi
3417                                 ;;
3418                         esac
3419                         ;;
3420                 esac
3421                 if $test -f Policy.sh ; then
3422                         case "$dflt" in
3423                         *Policy*) ;;
3424                         none) dflt="Policy" ;;
3425                         *) dflt="Policy $dflt" ;;
3426                         esac
3427                 fi
3428                 ;;
3429         *)
3430                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3431                 ;;
3432         esac
3433
3434         if $test -f Policy.sh ; then
3435                 $cat <<EOM
3436
3437 There's also a Policy hint file available, which should make the
3438 site-specific (policy) questions easier to answer.
3439 EOM
3440
3441         fi
3442
3443         $cat <<EOM
3444
3445 You may give one or more space-separated answers, or "none" if appropriate.
3446 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3447 previous run of Configure, you may specify it as well as or instead of
3448 OS-specific hints.  If hints are provided for your OS, you should use them:
3449 although Perl can probably be built without hints on many platforms, using
3450 hints often improve performance and may enable features that Configure can't
3451 set up on its own. If there are no hints that match your OS, specify "none";
3452 DO NOT give a wrong version or a wrong OS.
3453
3454 EOM
3455
3456         rp="Which of these apply, if any?"
3457         . UU/myread
3458         tans=$ans
3459         for file in $tans; do
3460                 if $test X$file = XPolicy -a -f Policy.sh; then
3461                         . Policy.sh
3462                         $cat Policy.sh >> UU/config.sh
3463                 elif $test -f $src/hints/$file.sh; then
3464                         . $src/hints/$file.sh
3465                         $cat $src/hints/$file.sh >> UU/config.sh
3466                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3467                         : nothing
3468                 else
3469                         : Give one chance to correct a possible typo.
3470                         echo "$file.sh does not exist"
3471                         dflt=$file
3472                         rp="hint to use instead?"
3473                         . UU/myread
3474                         for file in $ans; do
3475                                 if $test -f "$src/hints/$file.sh"; then
3476                                         . $src/hints/$file.sh
3477                                         $cat $src/hints/$file.sh >> UU/config.sh
3478                                 elif $test X$ans = X -o X$ans = Xnone ; then
3479                                         : nothing
3480                                 else
3481                                         echo "$file.sh does not exist -- ignored."
3482                                 fi
3483                         done
3484                 fi
3485         done
3486
3487         hint=recommended
3488         : Remember our hint file for later.
3489         if $test -f "$src/hints/$file.sh" ; then
3490                 hintfile="$file"
3491         else
3492                 hintfile=''
3493         fi
3494 fi
3495 cd UU
3496 ;;
3497 *)
3498         echo " "
3499         echo "Fetching default answers from $config_sh..." >&4
3500         tmp_n="$n"
3501         tmp_c="$c"
3502         cd ..
3503         cp $config_sh config.sh 2>/dev/null
3504         chmod +w config.sh
3505         . ./config.sh
3506         cd UU
3507         cp ../config.sh .
3508         n="$tmp_n"
3509         c="$tmp_c"
3510         hint=previous
3511         ;;
3512 esac
3513 test "$override" && . ./optdef.sh
3514
3515 : Restore computed paths
3516 for file in $loclist $trylist; do
3517         eval $file="\$_$file"
3518 done
3519
3520 cat << EOM
3521
3522 Configure uses the operating system name and version to set some defaults.
3523 The default value is probably right if the name rings a bell. Otherwise,
3524 since spelling matters for me, either accept the default or answer "none"
3525 to leave it blank.
3526
3527 EOM
3528 case "$osname" in
3529         ''|' ')
3530                 case "$hintfile" in
3531                 ''|' '|none) dflt=none ;;
3532                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3533                 esac
3534                 ;;
3535         *) dflt="$osname" ;;
3536 esac
3537 rp="Operating system name?"
3538 . ./myread
3539 case "$ans" in
3540 none)  osname='' ;;
3541 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3542 esac
3543 echo " "
3544 case "$osvers" in
3545         ''|' ')
3546                 case "$hintfile" in
3547                 ''|' '|none) dflt=none ;;
3548                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3549                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3550                         case "$dflt" in
3551                         ''|' ') dflt=none ;;
3552                         esac
3553                         ;;
3554                 esac
3555                 ;;
3556         *) dflt="$osvers" ;;
3557 esac
3558 rp="Operating system version?"
3559 . ./myread
3560 case "$ans" in
3561 none)  osvers='' ;;
3562 *) osvers="$ans" ;;
3563 esac
3564
3565
3566 . ./posthint.sh
3567
3568 : who configured the system
3569 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3570 case "$cf_by" in
3571 "")
3572         cf_by=`(logname) 2>/dev/null`
3573         case "$cf_by" in
3574         "")
3575                 cf_by=`(whoami) 2>/dev/null`
3576                 case "$cf_by" in
3577                 "") cf_by=unknown ;;
3578                 esac ;;
3579         esac ;;
3580 esac
3581
3582 : decide how portable to be.  Allow command line overrides.
3583 case "$d_portable" in
3584 "$undef") ;;
3585 *)      d_portable="$define" ;;
3586 esac
3587
3588 : set up shell script to do ~ expansion
3589 cat >filexp <<EOSS
3590 $startsh
3591 : expand filename
3592 case "\$1" in
3593  ~/*|~)
3594         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3595         ;;
3596  ~*)
3597         if $test -f /bin/csh; then
3598                 /bin/csh -f -c "glob \$1"
3599                 failed=\$?
3600                 echo ""
3601                 exit \$failed
3602         else
3603                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3604                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3605                 if $test ! -d "\$dir"; then
3606                         me=\`basename \$0\`
3607                         echo "\$me: can't locate home directory for: \$name" >&2
3608                         exit 1
3609                 fi
3610                 case "\$1" in
3611                 */*)
3612                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3613                         ;;
3614                 *)
3615                         echo \$dir
3616                         ;;
3617                 esac
3618         fi
3619         ;;
3620 *)
3621         echo \$1
3622         ;;
3623 esac
3624 EOSS
3625 chmod +x filexp
3626 $eunicefix filexp
3627
3628 : now set up to get a file name
3629 cat <<EOS >getfile
3630 $startsh
3631 EOS
3632 cat <<'EOSC' >>getfile
3633 tilde=''
3634 fullpath=''
3635 already=''
3636 skip=''
3637 none_ok=''
3638 exp_file=''
3639 nopath_ok=''
3640 orig_rp="$rp"
3641 orig_dflt="$dflt"
3642 case "$gfpth" in
3643 '') gfpth='.' ;;
3644 esac
3645
3646 case "$fn" in
3647 *\(*)
3648         : getfile will accept an answer from the comma-separated list
3649         : enclosed in parentheses even if it does not meet other criteria.
3650         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3651         fn=`echo $fn | sed 's/(.*)//'`
3652         ;;
3653 esac
3654
3655 case "$fn" in
3656 *:*)
3657         loc_file=`expr $fn : '.*:\(.*\)'`
3658         fn=`expr $fn : '\(.*\):.*'`
3659         ;;
3660 esac
3661
3662 case "$fn" in
3663 *~*) tilde=true;;
3664 esac
3665 case "$fn" in
3666 */*) fullpath=true;;
3667 esac
3668 case "$fn" in
3669 *+*) skip=true;;
3670 esac
3671 case "$fn" in
3672 *n*) none_ok=true;;
3673 esac
3674 case "$fn" in
3675 *e*) exp_file=true;;
3676 esac
3677 case "$fn" in
3678 *p*) nopath_ok=true;;
3679 esac
3680
3681 case "$fn" in
3682 *f*) type='File';;
3683 *d*) type='Directory';;
3684 *l*) type='Locate';;
3685 esac
3686
3687 what="$type"
3688 case "$what" in
3689 Locate) what='File';;
3690 esac
3691
3692 case "$exp_file" in
3693 '')
3694         case "$d_portable" in
3695         "$define") ;;
3696         *) exp_file=true;;
3697         esac
3698         ;;
3699 esac
3700
3701 cd ..
3702 while test "$type"; do
3703         redo=''
3704         rp="$orig_rp"
3705         dflt="$orig_dflt"
3706         case "$tilde" in
3707         true) rp="$rp (~name ok)";;
3708         esac
3709         . UU/myread
3710         if test -f UU/getfile.ok && \
3711                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3712         then
3713                 value="$ans"
3714                 ansexp="$ans"
3715                 break
3716         fi
3717         case "$ans" in
3718         none)
3719                 value=''
3720                 ansexp=''
3721                 case "$none_ok" in
3722                 true) type='';;
3723                 esac
3724                 ;;
3725         *)
3726                 case "$tilde" in
3727                 '') value="$ans"
3728                         ansexp="$ans";;
3729                 *)
3730                         value=`UU/filexp $ans`
3731                         case $? in
3732                         0)
3733                                 if test "$ans" != "$value"; then
3734                                         echo "(That expands to $value on this system.)"
3735                                 fi
3736                                 ;;
3737                         *) value="$ans";;
3738                         esac
3739                         ansexp="$value"
3740                         case "$exp_file" in
3741                         '') value="$ans";;
3742                         esac
3743                         ;;
3744                 esac
3745                 case "$fullpath" in
3746                 true)
3747                         case "$ansexp" in
3748                         /*) value="$ansexp" ;;
3749                         [a-zA-Z]:/*) value="$ansexp" ;;
3750                         *)
3751                                 redo=true
3752                                 case "$already" in
3753                                 true)
3754                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3755                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3756                                         ;;
3757                                 *)
3758                                 echo "Please give a full path name, starting with slash." >&4
3759                                         case "$tilde" in
3760                                         true)
3761                                 echo "Note that using ~name is ok provided it expands well." >&4
3762                                                 already=true
3763                                                 ;;
3764                                         esac
3765                                 esac
3766                                 ;;
3767                         esac
3768                         ;;
3769                 esac
3770                 case "$redo" in
3771                 '')
3772                         case "$type" in
3773                         File)
3774                                 for fp in $gfpth; do
3775                                         if test "X$fp" = X.; then
3776                                             pf="$ansexp"
3777                                         else    
3778                                             pf="$fp/$ansexp"
3779                                         fi
3780                                         if test -f "$pf"; then
3781                                                 type=''
3782                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3783                                         then
3784                                                 echo "($value is not a plain file, but that's ok.)"
3785                                                 type=''
3786                                         fi
3787                                         if test X"$type" = X; then
3788                                             value="$pf"
3789                                             break
3790                                         fi
3791                                 done
3792                                 ;;
3793                         Directory)
3794                                 for fp in $gfpth; do
3795                                         if test "X$fp" = X.; then
3796                                             dir="$ans"
3797                                             direxp="$ansexp"
3798                                         else    
3799                                             dir="$fp/$ansexp"
3800                                             direxp="$fp/$ansexp"
3801                                         fi
3802                                         if test -d "$direxp"; then
3803                                                 type=''
3804                                                 value="$dir"
3805                                                 break
3806                                         fi
3807                                 done
3808                                 ;;
3809                         Locate)
3810                                 if test -d "$ansexp"; then
3811                                         echo "(Looking for $loc_file in directory $value.)"
3812                                         value="$value/$loc_file"
3813                                         ansexp="$ansexp/$loc_file"
3814                                 fi
3815                                 if test -f "$ansexp"; then
3816                                         type=''
3817                                 fi
3818                                 case "$nopath_ok" in
3819                                 true)   case "$value" in
3820                                         */*) ;;
3821                                         *)      echo "Assuming $value will be in people's path."
3822                                                 type=''
3823                                                 ;;
3824                                         esac
3825                                         ;;
3826                                 esac
3827                                 ;;
3828                         esac
3829
3830                         case "$skip" in
3831                         true) type='';
3832                         esac
3833
3834                         case "$type" in
3835                         '') ;;
3836                         *)
3837                                 if test "$fastread" = yes; then
3838                                         dflt=y
3839                                 else
3840                                         dflt=n
3841                                 fi
3842                                 rp="$what $value doesn't exist.  Use that name anyway?"
3843                                 . UU/myread
3844                                 dflt=''
3845                                 case "$ans" in
3846                                 y*) type='';;
3847                                 *) echo " ";;
3848                                 esac
3849                                 ;;
3850                         esac
3851                         ;;
3852                 esac
3853                 ;;
3854         esac
3855 done
3856 cd UU
3857 ans="$value"
3858 rp="$orig_rp"
3859 dflt="$orig_dflt"
3860 rm -f getfile.ok
3861 test "X$gfpthkeep" != Xy && gfpth=""
3862 EOSC
3863
3864 : determine root of directory hierarchy where package will be installed.
3865 case "$prefix" in
3866 '')
3867         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3868         ;;
3869 *?/)
3870         dflt=`echo "$prefix" | sed 's/.$//'`
3871         ;;
3872 *)
3873         dflt="$prefix"
3874         ;;
3875 esac
3876 $cat <<EOM
3877
3878 By default, $package will be installed in $dflt/bin, manual pages
3879 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3880 installation directories. Typically this is something like /usr/local.
3881 If you wish to have binaries under /usr/bin but other parts of the
3882 installation under /usr/local, that's ok: you will be prompted
3883 separately for each of the installation directories, the prefix being
3884 only used to set the defaults.
3885
3886 EOM
3887 fn=d~
3888 rp='Installation prefix to use?'
3889 . ./getfile
3890 oldprefix=''
3891 case "$prefix" in
3892 '') ;;
3893 *)
3894         case "$ans" in
3895         "$prefix") ;;
3896         *) oldprefix="$prefix";;
3897         esac
3898         ;;
3899 esac
3900 prefix="$ans"
3901 prefixexp="$ansexp"
3902
3903 case "$afsroot" in
3904 '')     afsroot=/afs ;;
3905 *)      afsroot=$afsroot ;;
3906 esac
3907
3908 : is AFS running?
3909 echo " "
3910 case "$afs" in
3911 $define|true)   afs=true ;;
3912 $undef|false)   afs=false ;;
3913 *)      if test -d $afsroot; then
3914                 afs=true
3915         else
3916                 afs=false
3917         fi
3918         ;;
3919 esac
3920 if $afs; then
3921         echo "AFS may be running... I'll be extra cautious then..." >&4
3922 else
3923         echo "AFS does not seem to be running..." >&4
3924 fi
3925
3926 : determine installation prefix for where package is to be installed.
3927 if $afs; then 
3928 $cat <<EOM
3929
3930 Since you are running AFS, I need to distinguish the directory in which
3931 files will reside from the directory in which they are installed (and from
3932 which they are presumably copied to the former directory by occult means).
3933
3934 EOM
3935         case "$installprefix" in
3936         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3937         *) dflt="$installprefix";;
3938         esac
3939 else
3940 $cat <<EOM
3941
3942 In some special cases, particularly when building $package for distribution,
3943 it is convenient to distinguish the directory in which files should be
3944 installed from the directory ($prefix) in which they will
3945 eventually reside.  For most users, these two directories are the same.
3946
3947 EOM
3948         case "$installprefix" in
3949         '') dflt=$prefix ;;
3950         *) dflt=$installprefix;;
3951         esac
3952 fi
3953 fn=d~
3954 rp='What installation prefix should I use for installing files?'
3955 . ./getfile
3956 installprefix="$ans"
3957 installprefixexp="$ansexp"
3958
3959 : Perform the prefixexp/installprefixexp correction if necessary
3960 cat <<EOS >installprefix
3961 $startsh
3962 EOS
3963 cat <<'EOSC' >>installprefix
3964 : Change installation prefix, if necessary.
3965 if $test X"$prefix" != X"$installprefix"; then
3966     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3967 else
3968     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3969 fi
3970 EOSC
3971 chmod +x installprefix
3972 $eunicefix installprefix
3973
3974 : Set variables such as privlib and privlibexp from the output of ./getfile
3975 : performing the prefixexp/installprefixexp correction if necessary.
3976 cat <<EOS >setprefixvar
3977 $startsh
3978 EOS
3979 cat <<'EOSC' >>setprefixvar
3980 eval "${prefixvar}=\"\$ans\""
3981 eval "${prefixvar}exp=\"\$ansexp\""
3982 . ./installprefix
3983 EOSC
3984 chmod +x setprefixvar
3985 $eunicefix setprefixvar
3986
3987 : set up the script used to warn in case of inconsistency
3988 cat <<EOS >whoa
3989 $startsh
3990 EOS
3991 cat <<'EOSC' >>whoa
3992 dflt=y
3993 case "$hint" in
3994     recommended)
3995         case "$hintfile" in
3996         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3997                 ;;
3998         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
3999                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4000                 ;;
4001         esac
4002         ;;
4003     *)  echo " "
4004         echo "*** WHOA THERE!!! ***" >&4
4005         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4006         ;;
4007 esac
4008 rp="    Keep the $hint value?"
4009 . ./myread
4010 case "$ans" in
4011 y) td=$was; tu=$was;;
4012 esac
4013 EOSC
4014
4015 : function used to set $1 to $val
4016 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4017 case "$val$was" in
4018 $define$undef) . ./whoa; eval "$var=\$td";;
4019 $undef$define) . ./whoa; eval "$var=\$tu";;
4020 *) eval "$var=$val";;
4021 esac'
4022
4023 case "$usesocks" in
4024 $define|true|[yY]*)     dflt='y';;
4025 *) dflt='n';;
4026 esac
4027 cat <<EOM
4028
4029 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4030 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4031 to use the PerlIO abstraction layer, this will be implicitly selected.
4032
4033 If this doesn't make any sense to you, just accept the default '$dflt'.
4034 EOM
4035 rp='Build Perl for SOCKS?'
4036 . ./myread
4037 case "$ans" in
4038 y|Y)    val="$define" ;;     
4039 *)      val="$undef" ;;
4040 esac
4041 set usesocks
4042 eval $setvar
4043
4044 case "$usesocks" in
4045 $define|true|[yY]*) useperlio="$define";;
4046 esac
4047
4048 case "$useperlio" in
4049 $define|true|[yY]*|'')  dflt='y';;
4050 *) dflt='n';;
4051 esac
4052 cat <<EOM
4053
4054 Previous version of $package used the standard IO mechanisms as
4055 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4056 alternate IO mechanisms via the PerlIO abstraction layer, but the
4057 stdio mechanism is still available if needed.  The abstraction layer
4058 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4059 Using PerlIO with sfio may cause problems with some extension modules.
4060
4061 If this doesn't make any sense to you, just accept the default '$dflt'.
4062 EOM
4063 rp='Use the PerlIO abstraction layer?'
4064 . ./myread
4065 case "$ans" in
4066 y|Y) 
4067         val="$define"
4068         ;;
4069 *)      
4070         echo "Ok, doing things the stdio way."
4071         val="$undef"
4072         ;;
4073 esac
4074 set useperlio
4075 eval $setvar 
4076
4077 case "$usesocks" in
4078 $define|true|[yY]*)
4079         case "$useperlio" in
4080         $define|true|[yY]*) ;;
4081         *)      cat >&4 <<EOM
4082
4083 You are using the SOCKS proxy protocol library which means that you
4084 should also use the PerlIO layer.  You may be headed for trouble.
4085
4086 EOM
4087                 ;;
4088         esac
4089         ;;
4090 esac
4091
4092         
4093 : get the patchlevel
4094 echo " "
4095 echo "Getting the current patchlevel..." >&4
4096 if $test -r $rsrc/patchlevel.h;then
4097         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4098         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4099         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4100         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4101         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4102         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4103         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4104 else
4105         revision=0
4106         patchlevel=0
4107         subversion=0
4108         api_revision=0
4109         api_version=0
4110         api_subversion=0
4111         perl_patchlevel=0
4112         $echo "(You do not have patchlevel.h.  Eek.)"
4113 fi
4114 if $test -r $rsrc/.patch ; then
4115         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4116                 perl_patchlevel=`cat $rsrc/.patch`
4117         fi
4118 fi
4119 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4120 version_patchlevel_string="version $patchlevel subversion $subversion"
4121 case "$perl_patchlevel" in
4122 0|'') ;;
4123 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4124 esac
4125
4126 $echo "(You have $package $version_patchlevel_string.)"
4127
4128 case "$osname" in
4129 dos|vms)
4130         : XXX Should be a Configure test for double-dots in filenames.
4131         version=`echo $revision $patchlevel $subversion | \
4132                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4133         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4134                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4135         ;;
4136 *)
4137         version=`echo $revision $patchlevel $subversion | \
4138                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4139         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4140                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4141         ;;
4142 esac
4143 : Special case the 5.005_xx maintenance series, which used 5.005
4144 : without any subversion label as a subdirectory in $sitelib
4145 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4146         api_versionstring='5.005'
4147 fi
4148
4149 case "$usethreads" in
4150 $define|true|[yY]*)     dflt='y';;
4151 *)     # Catch case where user specified ithreads or 5005threads but
4152        # forgot -Dusethreads (A.D. 4/2002)
4153        case "$useithreads$use5005threads" in
4154        *$define*)      
4155                 case "$useperlio" in
4156                 "$define")      dflt='y' ;;
4157                 *)              dflt='n' ;;
4158                 esac
4159                 ;;
4160        *)       dflt='n';;
4161        esac
4162        ;;
4163 esac
4164 cat <<EOM
4165
4166 Perl can be built to take advantage of threads on some systems.
4167 To do so, Configure can be run with -Dusethreads.
4168
4169 Note that Perl built with threading support runs slightly slower
4170 and uses more memory than plain Perl. The current implementation
4171 is believed to be stable, but it is fairly new, and so should be
4172 treated with caution.
4173
4174 If this doesn't make any sense to you, just accept the default '$dflt'.
4175 EOM
4176 rp='Build a threading Perl?'
4177 . ./myread
4178 case "$ans" in
4179 y|Y)    val="$define" ;;
4180 *)      val="$undef" ;;
4181 esac
4182 set usethreads
4183 eval $setvar
4184
4185 if $test $patchlevel -lt 9; then
4186     case "$usethreads" in
4187     $define)
4188         $cat <<EOM
4189
4190 Since release 5.6, Perl has had two different threading implementations,
4191 the newer interpreter-based version (ithreads) with one interpreter per
4192 thread, and the older 5.005 version (5005threads).
4193 The 5005threads version is effectively unmaintained and will probably be
4194 removed in Perl 5.10, so there should be no need to build a Perl using it
4195 unless needed for backwards compatibility with some existing 5.005threads
4196 code.
4197
4198 EOM
4199         : Default to ithreads unless overridden on command line or with
4200         : old config.sh
4201         dflt='y'
4202         case "$use5005threads" in
4203                 $define|true|[yY]*) dflt='n';;
4204         esac
4205         case "$useithreads" in
4206                 $undef|false|[nN]*) dflt='n';;
4207         esac
4208         rp='Use the newer interpreter-based ithreads?'
4209         . ./myread
4210         case "$ans" in
4211         y|Y)    val="$define" ;;
4212         *)      val="$undef" ;;
4213         esac
4214         set useithreads
4215         eval $setvar
4216         : Now set use5005threads to the opposite value.
4217         case "$useithreads" in
4218         $define) val="$undef" ;;
4219         *) val="$define" ;;
4220         esac
4221         set use5005threads
4222         eval $setvar
4223         ;;
4224     *)
4225         useithreads="$undef"
4226         use5005threads="$undef"
4227         ;;
4228     esac
4229
4230     case "$useithreads$use5005threads" in
4231     "$define$define")
4232         $cat >&4 <<EOM
4233
4234 You cannot have both the ithreads and the 5.005 threads enabled
4235 at the same time.  Disabling the 5.005 threads since they are
4236 much less stable than the ithreads.
4237
4238 EOM
4239         use5005threads="$undef"
4240         ;;
4241     esac
4242
4243 else
4244 : perl-5.9.x and later
4245
4246     if test X"$usethreads" = "X$define"; then
4247         case "$use5005threads" in
4248             $define|true|[yY]*)
4249                 $cat >&4 <<EOM
4250
4251 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4252
4253 EOM
4254             ;;
4255         esac
4256     fi
4257
4258     use5005threads="$undef"
4259     useithreads="$usethreads"
4260 fi
4261
4262 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4263         cat >&4 <<EOF
4264 ***
4265 *** To build with ithreads you must also use the PerlIO layer.
4266 *** Cannot continue, aborting.
4267 ***
4268 EOF
4269         exit 1
4270 fi
4271
4272 case "$d_oldpthreads" in
4273 '')     : Configure tests would be welcome here.  For now, assume undef.
4274         val="$undef" ;;
4275 *)      val="$d_oldpthreads" ;;
4276 esac
4277 set d_oldpthreads
4278 eval $setvar
4279
4280
4281 : Look for a hint-file generated 'call-back-unit'.  If the
4282 : user has specified that a threading perl is to be built,
4283 : we may need to set or change some other defaults.
4284 if $test -f usethreads.cbu; then
4285     echo "Your platform has some specific hints regarding threaded builds, using them..."
4286     . ./usethreads.cbu
4287 else
4288     case "$usethreads" in
4289         "$define"|true|[yY]*)
4290                 $cat <<EOM
4291 (Your platform does not have any specific hints for threaded builds.
4292  Assuming POSIX threads, then.)
4293 EOM
4294         ;;
4295     esac
4296 fi
4297
4298 cat <<EOM
4299
4300 Perl can be built so that multiple Perl interpreters can coexist
4301 within the same Perl executable.
4302 EOM
4303
4304 case "$useithreads" in
4305 $define)
4306         cat <<EOM
4307 This multiple interpreter support is required for interpreter-based threads.
4308 EOM
4309         val="$define"
4310         ;;
4311 *)      case "$usemultiplicity" in
4312         $define|true|[yY]*)     dflt='y';;
4313         *) dflt='n';;
4314         esac
4315         echo " "
4316         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4317         rp='Build Perl for multiplicity?'
4318         . ./myread
4319         case "$ans" in
4320         y|Y)    val="$define" ;;
4321         *)      val="$undef" ;;
4322         esac
4323         ;;
4324 esac
4325 set usemultiplicity
4326 eval $setvar
4327
4328
4329 case "$usemorebits" in
4330 "$define"|true|[yY]*)
4331         use64bitint="$define"
4332         uselongdouble="$define"
4333         usemorebits="$define"
4334         ;;
4335 *)      usemorebits="$undef"
4336         ;;
4337 esac
4338
4339 : make some quick guesses about what we are up against
4340 echo " "
4341 $echo $n "Hmm...  $c"
4342 echo exit 1 >bsd
4343 echo exit 1 >usg
4344 echo exit 1 >v7
4345 echo exit 1 >osf1
4346 echo exit 1 >eunice
4347 echo exit 1 >xenix
4348 echo exit 1 >venix
4349 echo exit 1 >os2
4350 d_bsd="$undef"
4351 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4352 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4353 then
4354         echo "Looks kind of like an OSF/1 system, but we'll see..."
4355         echo exit 0 >osf1
4356 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4357         xxx=`./loc addbib blurfl $pth`
4358         if $test -f $xxx; then
4359         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4360                 echo exit 0 >bsd
4361                 echo exit 0 >usg
4362         else
4363                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4364                         echo "Looks kind of like an extended USG system, but we'll see..."
4365                 else
4366                         echo "Looks kind of like a USG system, but we'll see..."
4367                 fi
4368                 echo exit 0 >usg
4369         fi
4370 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4371         echo "Looks kind of like a BSD system, but we'll see..."
4372         d_bsd="$define"
4373         echo exit 0 >bsd
4374 else
4375         echo "Looks kind of like a Version 7 system, but we'll see..."
4376         echo exit 0 >v7
4377 fi
4378 case "$eunicefix" in
4379 *unixtovms*)
4380         $cat <<'EOI'
4381 There is, however, a strange, musty smell in the air that reminds me of
4382 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4383 EOI
4384         echo exit 0 >eunice
4385         d_eunice="$define"
4386 : it so happens the Eunice I know will not run shell scripts in Unix format
4387         ;;
4388 *)
4389         echo " "
4390         echo "Congratulations.  You aren't running Eunice."
4391         d_eunice="$undef"
4392         ;;
4393 esac
4394 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4395 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4396 : semicolon as a patch separator
4397 case "$p_" in
4398 :) ;;
4399 *)
4400         $cat <<'EOI'
4401 I have the feeling something is not exactly right, however...don't tell me...
4402 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4403 (Or you may be running DOS with DJGPP.)
4404 EOI
4405         echo exit 0 >os2
4406         ;;
4407 esac
4408 if test -f /xenix; then
4409         echo "Actually, this looks more like a XENIX system..."
4410         echo exit 0 >xenix
4411         d_xenix="$define"
4412 else
4413         echo " "
4414         echo "It's not Xenix..."
4415         d_xenix="$undef"
4416 fi
4417 chmod +x xenix
4418 $eunicefix xenix
4419 if test -f /venix; then
4420         echo "Actually, this looks more like a VENIX system..."
4421         echo exit 0 >venix
4422 else
4423         echo " "
4424         if ./xenix; then
4425                 : null
4426         else
4427                 echo "Nor is it Venix..."
4428         fi
4429 fi
4430 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4431 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4432 $rm -f foo
4433
4434 case "$cc" in
4435 '') dflt=cc;;
4436 *) dflt="$cc";;
4437 esac
4438 rp="Use which C compiler?"
4439 . ./myread
4440 cc="$ans"
4441
4442 : See if they have not cc but they do have gcc
4443 . ./trygcc
4444 : Look for a hint-file generated 'call-back-unit'.  Now that the
4445 : user has specified the compiler, we may need to set or change some
4446 : other defaults.
4447 if $test -f cc.cbu; then
4448     . ./cc.cbu
4449 fi
4450 . ./checkcc
4451
4452 echo " "
4453 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4454 $cat >try.c <<EOM
4455 #include <stdio.h>
4456 int main() {
4457 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4458 #ifdef __VERSION__
4459         printf("%s\n", __VERSION__);
4460 #else
4461         printf("%s\n", "1");
4462 #endif
4463 #endif
4464         return(0);
4465 }
4466 EOM
4467 if $cc -o try $ccflags $ldflags try.c; then
4468         gccversion=`$run ./try`
4469         case "$gccversion" in
4470         '') echo "You are not using GNU cc." ;;
4471         *)  echo "You are using GNU cc $gccversion."
4472             ccname=gcc
4473             ;;
4474         esac
4475 else
4476         echo " "
4477         echo "*** WHOA THERE!!! ***" >&4
4478         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4479         case "$knowitall" in
4480         '')
4481         echo "    You'd better start hunting for one and let me know about it." >&4
4482                 exit 1
4483                 ;;
4484         esac
4485 fi
4486 $rm -f try try.*
4487 case "$gccversion" in
4488 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4489 esac
4490 case "$gccversion" in
4491 '') gccosandvers='' ;;
4492 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4493    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4494    gccshortvers=''
4495    case "$gccosandvers" in
4496    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4497    $osname$osvers) ;; # looking good
4498    $osname*) cat <<EOM >&4
4499
4500 *** WHOA THERE!!! ***
4501
4502     Your gcc has not been compiled for the exact release of
4503     your operating system ($gccosandvers versus $osname$osvers).
4504
4505     In general it is a good idea to keep gcc synchronized with
4506     the operating system because otherwise serious problems
4507     may ensue when trying to compile software, like Perl.
4508
4509     I'm trying to be optimistic here, though, and will continue.
4510     If later during the configuration and build icky compilation
4511     problems appear (headerfile conflicts being the most common
4512     manifestation), I suggest reinstalling the gcc to match
4513     your operating system release.
4514
4515 EOM
4516       ;;
4517    *) gccosandvers='' ;; # failed to parse, better be silent
4518    esac
4519    ;;
4520 esac
4521 case "$ccname" in
4522 '') ccname="$cc" ;;
4523 esac
4524
4525 # gcc 3.* complain about adding -Idirectories that they already know about,
4526 # so we will take those off from locincpth.
4527 case "$gccversion" in
4528 3*)
4529     echo "main(){}">try.c
4530     for incdir in $locincpth; do
4531        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4532              grep '^c[cp]p*[01]: warning: changing search order '`
4533        if test "X$warn" != X; then
4534            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4535        fi
4536     done
4537     $rm -f try try.*
4538 esac
4539
4540 : What should the include directory be ?
4541 echo " "
4542 $echo $n "Hmm...  $c"
4543 dflt='/usr/include'
4544 incpath=''
4545 mips_type=''
4546 if $test -f /bin/mips && /bin/mips; then
4547         echo "Looks like a MIPS system..."
4548         $cat >usr.c <<'EOCP'
4549 #ifdef SYSTYPE_BSD43
4550 /bsd43
4551 #endif
4552 EOCP
4553         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4554                 dflt='/bsd43/usr/include'
4555                 incpath='/bsd43'
4556                 mips_type='BSD 4.3'
4557         else
4558                 mips_type='System V'
4559         fi
4560         $rm -f usr.c usr.out
4561         echo "and you're compiling with the $mips_type compiler and libraries."
4562         xxx_prompt=y
4563         echo "exit 0" >mips
4564 else
4565         echo "Doesn't look like a MIPS system."
4566         xxx_prompt=n
4567         echo "exit 1" >mips
4568 fi
4569 chmod +x mips
4570 $eunicefix mips
4571 case "$usrinc" in
4572 '') ;;
4573 *) dflt="$usrinc";;
4574 esac
4575 case "$xxx_prompt" in
4576 y)      fn=d/
4577         echo " "
4578         rp='Where are the include files you want to use?'
4579         . ./getfile
4580         usrinc="$ans"
4581         ;;
4582 *)      usrinc="$dflt"
4583         ;;
4584 esac
4585
4586 : see how we invoke the C preprocessor
4587 echo " "
4588 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4589 cat <<'EOT' >testcpp.c
4590 #define ABC abc
4591 #define XYZ xyz
4592 ABC.XYZ
4593 EOT
4594 cd ..
4595 if test ! -f cppstdin; then
4596         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4597                 # AIX cc -E doesn't show the absolute headerfile
4598                 # locations but we'll cheat by using the -M flag.
4599                 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
4600         else
4601                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4602         fi
4603 else
4604         echo "Keeping your $hint cppstdin wrapper."
4605 fi
4606 chmod 755 cppstdin
4607 wrapper=`pwd`/cppstdin
4608 ok='false'
4609 cd UU
4610
4611 if $test "X$cppstdin" != "X" && \
4612         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4613         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4614 then
4615         echo "You used to use $cppstdin $cppminus so we'll use that again."
4616         case "$cpprun" in
4617         '') echo "But let's see if we can live without a wrapper..." ;;
4618         *)
4619                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4620                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4621                 then
4622                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4623                         ok='true'
4624                 else
4625                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4626                 fi
4627                 ;;
4628         esac
4629 else
4630         case "$cppstdin" in
4631         '') ;;
4632         *)
4633                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4634                 ;;
4635         esac
4636 fi
4637
4638 if $ok; then
4639         : nothing
4640 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4641         $cc -E <testcpp.c >testcpp.out 2>&1; \
4642         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4643         echo "Yup, it does."
4644         x_cpp="$cc -E"
4645         x_minus='';
4646 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4647         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4648         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4649         echo "Yup, it does."
4650         x_cpp="$cc -E"
4651         x_minus='-';
4652 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4653         $cc -P <testcpp.c >testcpp.out 2>&1; \
4654         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4655         echo "Yipee, that works!"
4656         x_cpp="$cc -P"
4657         x_minus='';
4658 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4659         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4660         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4661         echo "At long last!"
4662         x_cpp="$cc -P"
4663         x_minus='-';
4664 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4665         $cpp <testcpp.c >testcpp.out 2>&1; \
4666         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4667         echo "It works!"
4668         x_cpp="$cpp"
4669         x_minus='';
4670 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4671         $cpp - <testcpp.c >testcpp.out 2>&1; \
4672         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4673         echo "Hooray, it works!  I was beginning to wonder."
4674         x_cpp="$cpp"
4675         x_minus='-';
4676 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4677         $wrapper <testcpp.c >testcpp.out 2>&1; \
4678         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4679         x_cpp="$wrapper"
4680         x_minus=''
4681         echo "Eureka!"
4682 else
4683         dflt=''
4684         rp="No dice.  I can't find a C preprocessor.  Name one:"
4685         . ./myread
4686         x_cpp="$ans"
4687         x_minus=''
4688         $x_cpp <testcpp.c >testcpp.out 2>&1
4689         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4690                 echo "OK, that will do." >&4
4691         else
4692 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4693                 exit 1
4694         fi
4695 fi
4696
4697 case "$ok" in
4698 false)
4699         cppstdin="$x_cpp"
4700         cppminus="$x_minus"
4701         cpprun="$x_cpp"
4702         cpplast="$x_minus"
4703         set X $x_cpp
4704         shift
4705         case "$1" in
4706         "$cpp")
4707                 echo "Perhaps can we force $cc -E using a wrapper..."
4708                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4709                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4710                 then
4711                         echo "Yup, we can."
4712                         cppstdin="$wrapper"
4713                         cppminus='';
4714                 else
4715                         echo "Nope, we'll have to live without it..."
4716                 fi
4717                 ;;
4718         esac
4719         case "$cpprun" in
4720         "$wrapper")
4721                 cpprun=''
4722                 cpplast=''
4723                 ;;
4724         esac
4725         ;;
4726 esac
4727
4728 case "$cppstdin" in
4729 "$wrapper"|'cppstdin') ;;
4730 *) $rm -f $wrapper;;
4731 esac
4732 $rm -f testcpp.c testcpp.out
4733
4734 : Set private lib path
4735 case "$plibpth" in
4736 '') if ./mips; then
4737                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4738         fi;;
4739 esac
4740 case "$libpth" in
4741 ' ') dlist='';;
4742 '') dlist="$loclibpth $plibpth $glibpth";;
4743 *) dlist="$libpth";;
4744 esac
4745
4746 : Now check and see which directories actually exist, avoiding duplicates
4747 libpth=''
4748 for xxx in $dlist
4749 do
4750     if $test -d $xxx; then
4751                 case " $libpth " in
4752                 *" $xxx "*) ;;
4753                 *) libpth="$libpth $xxx";;
4754                 esac
4755     fi
4756 done
4757 $cat <<'EOM'
4758
4759 Some systems have incompatible or broken versions of libraries.  Among
4760 the directories listed in the question below, please remove any you
4761 know not to be holding relevant libraries, and add any that are needed.
4762 Say "none" for none.
4763
4764 EOM
4765 case "$libpth" in
4766 '') dflt='none';;
4767 *)
4768         set X $libpth
4769         shift
4770         dflt=${1+"$@"}
4771         ;;
4772 esac
4773 rp="Directories to use for library searches?"
4774 . ./myread
4775 case "$ans" in
4776 none) libpth=' ';;
4777 *) libpth="$ans";;
4778 esac
4779
4780 : compute shared library extension
4781 case "$so" in
4782 '')
4783         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4784                 dflt='sl'
4785         else
4786                 dflt='so'
4787         fi
4788         ;;
4789 *) dflt="$so";;
4790 esac
4791 $cat <<EOM
4792
4793 On some systems, shared libraries may be available.  Answer 'none' if
4794 you want to suppress searching of shared libraries for the remainder
4795 of this configuration.
4796
4797 EOM
4798 rp='What is the file extension used for shared libraries?'
4799 . ./myread
4800 so="$ans"
4801
4802 : Define several unixisms.
4803 : Hints files or command line option can be used to override them.
4804 : The convoluted testing is in case hints files set either the old
4805 : or the new name.
4806 case "$_exe" in
4807 '')     case "$exe_ext" in
4808         '')     ;;
4809         *)      _exe="$exe_ext" ;;
4810         esac
4811         ;;
4812 esac
4813 case "$_a" in
4814 '')     case "$lib_ext" in
4815     '') _a='.a';;
4816         *)      _a="$lib_ext" ;;
4817         esac
4818         ;;
4819 esac
4820 case "$_o" in
4821 '') case "$obj_ext" in
4822         '')     _o='.o';;
4823         *)      _o="$obj_ext";;
4824         esac
4825         ;;
4826 esac
4827 case "$p_" in
4828 '') case "$path_sep" in
4829         '')     p_=':';;
4830         *)      p_="$path_sep";;
4831         esac
4832         ;;
4833 esac
4834 exe_ext=$_exe
4835 lib_ext=$_a
4836 obj_ext=$_o
4837 path_sep=$p_
4838
4839 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4840
4841 : Which makefile gets called first.  This is used by make depend.
4842 case "$firstmakefile" in
4843 '') firstmakefile='makefile';;
4844 esac
4845
4846 case "$ccflags" in
4847 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4848 esac
4849
4850 case "$uselongdouble" in
4851 $define|true|[yY]*)     dflt='y';;
4852 *) dflt='n';;
4853 esac
4854 cat <<EOM
4855
4856 Perl can be built to take advantage of long doubles which
4857 (if available) may give more accuracy and range for floating point numbers.
4858
4859 If this doesn't make any sense to you, just accept the default '$dflt'.
4860 EOM
4861 rp='Try to use long doubles if available?'
4862 . ./myread
4863 case "$ans" in
4864 y|Y)    val="$define"   ;;
4865 *)      val="$undef"    ;;
4866 esac
4867 set uselongdouble
4868 eval $setvar
4869
4870 case "$uselongdouble" in
4871 true|[yY]*) uselongdouble="$define" ;;
4872 esac
4873
4874 : Look for a hint-file generated 'call-back-unit'.  If the
4875 : user has specified that long doubles should be used,
4876 : we may need to set or change some other defaults.
4877 if $test -f uselongdouble.cbu; then
4878     echo "Your platform has some specific hints regarding long doubles, using them..."
4879     . ./uselongdouble.cbu
4880 else
4881     case "$uselongdouble" in
4882         $define)
4883                 $cat <<EOM
4884 (Your platform does not have any specific hints for long doubles.)
4885 EOM
4886         ;;
4887     esac
4888 fi
4889
4890 : Looking for optional libraries
4891 echo " "
4892 echo "Checking for optional libraries..." >&4
4893 case "$libs" in
4894 ' '|'') dflt='';;
4895 *) dflt="$libs";;
4896 esac
4897 case "$libswanted" in
4898 '') libswanted='c_s';;
4899 esac
4900 case "$usesocks" in
4901 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4902 esac
4903 libsfound=''
4904 libsfiles=''
4905 libsdirs=''
4906 libspath=''
4907 for thisdir in $libpth $xlibpth; do
4908   test -d $thisdir && libspath="$libspath $thisdir"
4909 done
4910 for thislib in $libswanted; do
4911         for thisdir in $libspath; do
4912             xxx=''
4913             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4914                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4915                 $test -f "$xxx" && eval $libscheck
4916                 $test -f "$xxx" && libstyle=shared
4917             fi
4918             if test ! -f "$xxx"; then
4919                 xxx=$thisdir/lib$thislib.$so
4920                 $test -f "$xxx" && eval $libscheck
4921                 $test -f "$xxx" && libstyle=shared
4922             fi  
4923             if test ! -f "$xxx"; then
4924                 xxx=$thisdir/lib$thislib$_a
4925                 $test -f "$xxx" && eval $libscheck
4926                 $test -f "$xxx" && libstyle=static
4927             fi
4928             if test ! -f "$xxx"; then
4929                 xxx=$thisdir/$thislib$_a
4930                 $test -f "$xxx" && eval $libscheck
4931                 $test -f "$xxx" && libstyle=static
4932             fi
4933             if test ! -f "$xxx"; then
4934                 xxx=$thisdir/lib${thislib}_s$_a
4935                 $test -f "$xxx" && eval $libscheck
4936                 $test -f "$xxx" && libstyle=static
4937                 $test -f "$xxx" && thislib=${thislib}_s
4938             fi
4939             if test ! -f "$xxx"; then
4940                 xxx=$thisdir/Slib$thislib$_a
4941                 $test -f "$xxx" && eval $libscheck
4942                 $test -f "$xxx" && libstyle=static
4943             fi
4944             if $test -f "$xxx"; then
4945                 case "$libstyle" in
4946                 shared) echo "Found -l$thislib (shared)." ;;
4947                 static) echo "Found -l$thislib." ;;
4948                 *)      echo "Found -l$thislib ($libstyle)." ;;
4949                 esac
4950                 case " $dflt " in
4951                 *"-l$thislib "*);;
4952                 *) dflt="$dflt -l$thislib"
4953                    libsfound="$libsfound $xxx"
4954                    yyy=`basename $xxx`
4955                    libsfiles="$libsfiles $yyy"
4956                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4957                    case " $libsdirs " in
4958                    *" $yyy "*) ;;
4959                    *) libsdirs="$libsdirs $yyy" ;;
4960                    esac
4961                    ;;
4962                 esac
4963                 break
4964             fi  
4965         done
4966         if $test ! -f "$xxx"; then
4967             echo "No -l$thislib."
4968         fi
4969 done
4970 set X $dflt
4971 shift
4972 dflt="$*"
4973 case "$libs" in
4974 '') dflt="$dflt";;
4975 *) dflt="$libs";;
4976 esac
4977 case "$dflt" in
4978 ' '|'') dflt='none';;
4979 esac
4980
4981 $cat <<EOM
4982
4983 In order to compile $package on your machine, a number of libraries
4984 are usually needed.  Include any other special libraries here as well.
4985 Say "none" for none.  The default list is almost always right.
4986 EOM
4987
4988 echo " "
4989 rp="What libraries to use?"
4990 . ./myread
4991 case "$ans" in
4992 none) libs=' ';;
4993 *) libs="$ans";;
4994 esac
4995
4996 : determine optimization, if desired, or use for debug flag also
4997 case "$optimize" in
4998 ' '|$undef) dflt='none';;
4999 '') dflt='-O';;
5000 *) dflt="$optimize";;
5001 esac
5002 $cat <<EOH
5003
5004 By default, $package compiles with the -O flag to use the optimizer.
5005 Alternately, you might want to use the symbolic debugger, which uses
5006 the -g flag (on traditional Unix systems).  Either flag can be
5007 specified here.  To use neither flag, specify the word "none".
5008
5009 EOH
5010 rp="What optimizer/debugger flag should be used?"
5011 . ./myread
5012 optimize="$ans"
5013 case "$optimize" in
5014 'none') optimize=" ";;
5015 esac
5016
5017 : Check what DEBUGGING is required from the command line
5018 : -DEBUGGING      or -DDEBUGGING or
5019 : -DEBUGGING=both                       = -g + -DDEBUGGING
5020 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5021 : -DEBUGGING=none or -UDEBUGGING        =
5022 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5023 case "$EBUGGING" in
5024 '')     ;;
5025 *)      DEBUGGING=$EBUGGING ;;
5026 esac
5027
5028 case "$DEBUGGING" in
5029 -g|both|$define)
5030     case "$optimize" in
5031         *-g*) ;;
5032         *)    optimize="$optimize -g" ;;
5033     esac ;;
5034 none|$undef)
5035     case "$optimize" in
5036         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5037                 shift
5038                 optimize="$*"
5039                 ;;
5040     esac ;;
5041 esac
5042
5043 dflt=''
5044 case "$DEBUGGING" in
5045 both|$define) dflt='-DDEBUGGING'
5046 esac
5047
5048 : argument order is deliberate, as the flag will start with - which set could
5049 : think is an option
5050 checkccflag='check=$1; flag=$2; callback=$3;
5051 echo " ";
5052 echo "Checking if your compiler accepts $flag" 2>&1;
5053 echo "int main(void) { return 0; }" > gcctest.c;
5054 if $cc -O2 $flag -o gcctest gcctest.c && ./gcctest; then
5055     echo "Yes, it does." 2>&1;
5056     case "$ccflags" in
5057     *$check*)
5058         echo "Leaving current flags $ccflags alone." 2>&1
5059         ;;
5060     *) dflt="$dflt $flag";
5061         eval $callback
5062         ;;
5063     esac
5064 else
5065     echo "Nope, it does not, but that is ok." 2>&1;
5066 fi
5067 '
5068
5069 : We will not override a previous value, but we might want to
5070 : augment a hint file
5071 case "$hint" in
5072 default|recommended)
5073         case "$gccversion" in
5074         1*) dflt="$dflt -fpcc-struct-return" ;;
5075         esac
5076         case "$optimize:$DEBUGGING" in
5077         *-g*:old) dflt="$dflt -DDEBUGGING";;
5078         esac
5079         case "$gccversion" in
5080         2*) if test -d /etc/conf/kconfig.d &&
5081                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5082                 then
5083                         # Interactive Systems (ISC) POSIX mode.
5084                         dflt="$dflt -posix"
5085                 fi
5086                 ;;
5087         esac
5088         case "$gccversion" in
5089         1*) ;;
5090         2.[0-8]*) ;;
5091         ?*)     set strict-aliasing -fno-strict-aliasing
5092                 eval $checkccflag
5093                 ;;
5094         esac
5095         # For gcc, adding -pipe speeds up compilations for some, but apparently
5096         # some assemblers can't read from stdin.  (It also slows down compilations
5097         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5098         case "$gccversion" in
5099         ?*)     set pipe -pipe
5100                 eval $checkccflag
5101                 ;;
5102         esac
5103
5104         # on x86_64 (at least) we require an extra library (libssp) in the
5105         # link command line. This library is not named, so I infer that it is
5106         # an implementation detail that may change. Hence the safest approach
5107         # is to add the flag to the flags passed to the compiler at link time,
5108         # as that way the compiler can do the right implementation dependant
5109         # thing. (NWC)
5110         case "$gccversion" in
5111         ?*)     set stack-protector -fstack-protector 'ldflags="$ldflags -fstack-protector"'
5112                 eval $checkccflag
5113                 ;;
5114         esac
5115         ;;
5116 esac
5117
5118 case "$mips_type" in
5119 *BSD*|'') inclwanted="$locincpth $usrinc";;
5120 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5121 esac
5122 for thisincl in $inclwanted; do
5123         if $test -d $thisincl; then
5124                 if $test x$thisincl != x$usrinc; then
5125                         case "$dflt" in
5126                         *" -I$thisincl "*);;
5127                         *) dflt="$dflt -I$thisincl ";;
5128                         esac
5129                 fi
5130         fi
5131 done
5132
5133 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5134         xxx=true;
5135 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5136         xxx=true;
5137 else
5138         xxx=false;
5139 fi;
5140 if $xxx; then
5141         case "$dflt" in
5142         *$2*);;
5143         *) dflt="$dflt -D$2";;
5144         esac;
5145 fi'
5146
5147 set signal.h LANGUAGE_C; eval $inctest
5148
5149 case "$usesocks" in
5150 $define)
5151         ccflags="$ccflags -DSOCKS"
5152         ;;
5153 esac
5154
5155 case "$hint" in
5156 default|recommended) dflt="$ccflags $dflt" ;;
5157 *) dflt="$ccflags";;
5158 esac
5159
5160 case "$dflt" in
5161 ''|' ') dflt=none;;
5162 esac
5163
5164 $cat <<EOH
5165
5166 Your C compiler may want other flags.  For this question you should include
5167 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5168 but you should NOT include libraries or ld flags like -lwhatever.  If you
5169 want $package to honor its debug switch, you should include -DDEBUGGING here.
5170 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5171
5172 To use no flags, specify the word "none".
5173
5174 EOH
5175 set X $dflt
5176 shift
5177 dflt=${1+"$@"}
5178 rp="Any additional cc flags?"
5179 . ./myread
5180 case "$ans" in
5181 none) ccflags='';;
5182 *) ccflags="$ans";;
5183 esac
5184
5185 : the following weeds options from ccflags that are of no interest to cpp
5186 case "$cppflags" in
5187 '') cppflags="$ccflags" ;;
5188 *)  cppflags="$cppflags $ccflags" ;;
5189 esac
5190 case "$gccversion" in
5191 1*) cppflags="$cppflags -D__GNUC__"
5192 esac
5193 case "$mips_type" in
5194 '');;
5195 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5196 esac
5197 case "$cppflags" in
5198 '');;
5199 *)
5200         echo " "
5201         echo "Let me guess what the preprocessor flags are..." >&4
5202         set X $cppflags
5203         shift
5204         cppflags=''
5205         $cat >cpp.c <<'EOM'
5206 #define BLURFL foo
5207
5208 BLURFL xx LFRULB
5209 EOM
5210         previous=''
5211         for flag in $*
5212         do
5213                 case "$flag" in
5214                 -*) ftry="$flag";;
5215                 *) ftry="$previous $flag";;
5216                 esac
5217                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5218                         >cpp1.out 2>/dev/null && \
5219                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5220                         >cpp2.out 2>/dev/null && \
5221                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5222                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5223                 then
5224                         cppflags="$cppflags $ftry"
5225                         previous=''
5226                 else
5227                         previous="$flag"
5228                 fi
5229         done
5230         set X $cppflags
5231         shift
5232         cppflags=${1+"$@"}
5233         case "$cppflags" in
5234         *-*)  echo "They appear to be: $cppflags";;
5235         esac
5236         $rm -f cpp.c cpp?.out
5237         ;;
5238 esac
5239
5240 : flags used in final linking phase
5241 case "$ldflags" in
5242 '') if ./venix; then
5243                 dflt='-i -z'
5244         else
5245                 dflt=''
5246         fi
5247         case "$ccflags" in
5248         *-posix*) dflt="$dflt -posix" ;;
5249         esac
5250         ;;
5251 *) dflt="$ldflags";;
5252 esac
5253
5254 : Try to guess additional flags to pick up local libraries.
5255 for thislibdir in $libpth; do
5256         case " $loclibpth " in
5257         *" $thislibdir "*)
5258                 case "$dflt " in
5259                 *"-L$thislibdir "*) ;;
5260                 *)  dflt="$dflt -L$thislibdir" ;;
5261                 esac
5262                 ;;
5263         esac
5264 done
5265
5266 case "$dflt" in
5267 '') dflt='none' ;;
5268 esac
5269
5270 $cat <<EOH
5271
5272 Your C linker may need flags.  For this question you should
5273 include -L/whatever and any other flags used by the C linker, but you
5274 should NOT include libraries like -lwhatever.
5275
5276 Make sure you include the appropriate -L/path flags if your C linker
5277 does not normally search all of the directories you specified above,
5278 namely
5279         $libpth
5280 To use no flags, specify the word "none".
5281
5282 EOH
5283
5284 rp="Any additional ld flags (NOT including libraries)?"
5285 . ./myread
5286 case "$ans" in
5287 none) ldflags='';;
5288 *) ldflags="$ans";;
5289 esac
5290 rmlist="$rmlist pdp11"
5291
5292 : coherency check
5293 echo " "
5294 echo "Checking your choice of C compiler and flags for coherency..." >&4
5295 $cat > try.c <<'EOF'
5296 #include <stdio.h>
5297 int main() { printf("Ok\n"); return(0); }
5298 EOF
5299 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5300 shift
5301 $cat >try.msg <<'EOM'
5302 I've tried to compile and run the following simple program:
5303
5304 EOM
5305 $cat try.c >> try.msg
5306
5307 $cat >> try.msg <<EOM
5308
5309 I used the command:
5310
5311         $*
5312         $run ./try
5313
5314 and I got the following output:
5315
5316 EOM
5317 dflt=y
5318 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5319         if $sh -c "$run ./try" >>try.msg 2>&1; then
5320                 xxx=`$run ./try`
5321                 case "$xxx" in
5322                 "Ok") dflt=n ;;
5323                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5324                         case " $libs " in
5325                         *" -lsfio "*)
5326                                 cat >> try.msg <<'EOQS'
5327 If $libs contains -lsfio, and sfio is mis-configured, then it
5328 sometimes (apparently) runs and exits with a 0 status, but with no
5329 output!  It may have to do with sfio's use of _exit vs. exit.
5330
5331 EOQS
5332                                 rp="You have a big problem.  Shall I abort Configure"
5333                                 dflt=y
5334                                 ;;
5335                         esac
5336                         ;;
5337                 esac
5338         else
5339                 echo "The program compiled OK, but exited with status $?." >>try.msg
5340                 rp="You have a problem.  Shall I abort Configure"
5341                 dflt=y
5342         fi
5343 else
5344         echo "I can't compile the test program." >>try.msg
5345         rp="You have a BIG problem.  Shall I abort Configure"
5346         dflt=y
5347 fi
5348 case "$dflt" in
5349 y)
5350         $cat try.msg >&4
5351         case "$knowitall" in
5352         '')
5353                 echo "(The supplied flags or libraries might be incorrect.)"
5354                 ;;
5355         *) dflt=n;;
5356         esac
5357         echo " "
5358         . ./myread
5359         case "$ans" in
5360         n*|N*) ;;
5361         *)      echo "Ok.  Stopping Configure." >&4
5362                 exit 1
5363                 ;;
5364         esac
5365         ;;
5366 n) echo "OK, that should do.";;
5367 esac
5368 $rm_try
5369
5370 : define a shorthand compile call
5371 compile='
5372 mc_file=$1;
5373 shift;
5374 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5375 : define a shorthand compile call for compilations that should be ok.
5376 compile_ok='
5377 mc_file=$1;
5378 shift;
5379 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5380
5381 : determine filename position in cpp output
5382 echo " "
5383 echo "Computing filename position in cpp output for #include directives..." >&4
5384 case "$osname" in
5385 vos) testaccess=-e ;;
5386 *)   testaccess=-r ;;
5387 esac
5388 echo '#include <stdio.h>' > foo.c
5389 $cat >fieldn <<EOF
5390 $startsh
5391 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5392 $grep '^[       ]*#.*stdio\.h' | \
5393 while read cline; do
5394         pos=1
5395         set \$cline
5396         while $test \$# -gt 0; do
5397                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5398                         echo "\$pos"
5399                         exit 0
5400                 fi
5401                 shift
5402                 pos=\`expr \$pos + 1\`
5403         done
5404 done
5405 EOF
5406 chmod +x fieldn
5407 fieldn=`./fieldn`
5408 $rm -f foo.c fieldn
5409 case $fieldn in
5410 '') pos='???';;
5411 1) pos=first;;
5412 2) pos=second;;
5413 3) pos=third;;
5414 *) pos="${fieldn}th";;
5415 esac
5416 echo "Your cpp writes the filename in the $pos field of the line."
5417
5418 case "$osname" in
5419 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5420 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5421 *)   cppfilter='' ;;
5422 esac
5423 : locate header file
5424 $cat >findhdr <<EOF
5425 $startsh
5426 wanted=\$1
5427 name=''
5428 for usrincdir in $usrinc
5429 do
5430         if test -f \$usrincdir/\$wanted; then
5431                 echo "\$usrincdir/\$wanted"
5432                 exit 0
5433         fi
5434 done
5435 awkprg='{ print \$$fieldn }'
5436 echo "#include <\$wanted>" > foo\$\$.c
5437 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5438 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5439 while read cline; do
5440         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5441         case "\$name" in
5442         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5443         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5444         *) exit 2;;
5445         esac;
5446 done;
5447 #
5448 # status = 0: grep returned 0 lines, case statement not executed
5449 # status = 1: headerfile found
5450 # status = 2: while loop executed, no headerfile found
5451 #
5452 status=\$?
5453 $rm -f foo\$\$.c;
5454 if test \$status -eq 1; then
5455         exit 0;
5456 fi
5457 exit 1
5458 EOF
5459 chmod +x findhdr
5460
5461 : define an alternate in-header-list? function
5462 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5463 cont=true; xxf="echo \"<\$1> found.\" >&4";
5464 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5465 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5466 esac;
5467 case $# in 4) instead=instead;; *) instead="at last";; esac;
5468 while $test "$cont"; do
5469         xxx=`./findhdr $1`
5470         var=$2; eval "was=\$$2";
5471         if $test "$xxx" && $test -r "$xxx";
5472         then eval $xxf;
5473         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5474                 cont="";
5475         else eval $xxnf;
5476         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5477         set $yyy; shift; shift; yyy=$@;
5478         case $# in 0) cont="";;
5479         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5480                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5481         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5482                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5483         esac;
5484 done;
5485 while $test "$yyy";
5486 do set $yyy; var=$2; eval "was=\$$2";
5487         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5488         set $yyy; shift; shift; yyy=$@;
5489 done'
5490
5491 : see if stdlib is available
5492 set stdlib.h i_stdlib
5493 eval $inhdr
5494
5495 : check for lengths of integral types
5496 echo " "
5497 case "$intsize" in
5498 '')
5499         echo "Checking to see how big your integers are..." >&4
5500         $cat >try.c <<EOCP
5501 #include <stdio.h>
5502 #$i_stdlib I_STDLIB
5503 #ifdef I_STDLIB
5504 #include <stdlib.h>
5505 #endif
5506 int main()
5507 {
5508         printf("intsize=%d;\n", (int)sizeof(int));
5509         printf("longsize=%d;\n", (int)sizeof(long));
5510         printf("shortsize=%d;\n", (int)sizeof(short));
5511         exit(0);
5512 }
5513 EOCP
5514         set try
5515         if eval $compile_ok && $run ./try > /dev/null; then
5516                 eval `$run ./try`
5517                 echo "Your integers are $intsize bytes long."
5518                 echo "Your long integers are $longsize bytes long."
5519                 echo "Your short integers are $shortsize bytes long."
5520         else
5521                 $cat >&4 <<EOM
5522 !
5523 Help! I can't compile and run the intsize test program: please enlighten me!
5524 (This is probably a misconfiguration in your system or libraries, and
5525 you really ought to fix it.  Still, I'll try anyway.)
5526 !
5527 EOM
5528                 dflt=4
5529                 rp="What is the size of an integer (in bytes)?"
5530                 . ./myread
5531                 intsize="$ans"
5532                 dflt=$intsize
5533                 rp="What is the size of a long integer (in bytes)?"
5534                 . ./myread
5535                 longsize="$ans"
5536                 dflt=2
5537                 rp="What is the size of a short integer (in bytes)?"
5538                 . ./myread
5539                 shortsize="$ans"
5540         fi
5541         ;;
5542 esac
5543 $rm_try
5544
5545 : check for long long
5546 echo " "
5547 echo "Checking to see if you have long long..." >&4
5548 echo 'int main() { long long x = 7; return 0; }' > try.c
5549 set try
5550 if eval $compile; then
5551         val="$define"
5552         echo "You have long long."
5553 else
5554         val="$undef"
5555         echo "You do not have long long."
5556 fi
5557 $rm_try
5558 set d_longlong
5559 eval $setvar
5560
5561 : check for length of long long
5562 case "${d_longlong}${longlongsize}" in
5563 $define)
5564         echo " "
5565         echo "Checking to see how big your long longs are..." >&4
5566         $cat >try.c <<'EOCP'
5567 #include <stdio.h>
5568 int main()
5569 {
5570     printf("%d\n", (int)sizeof(long long));
5571     return(0);
5572 }
5573 EOCP
5574         set try
5575         if eval $compile_ok; then
5576                 longlongsize=`$run ./try`
5577                 echo "Your long longs are $longlongsize bytes long."
5578         else
5579                 dflt='8'
5580                 echo " "
5581                 echo "(I can't seem to compile the test program.  Guessing...)"
5582                 rp="What is the size of a long long (in bytes)?"
5583                 . ./myread
5584                 longlongsize="$ans"
5585         fi
5586         if $test "X$longsize" = "X$longlongsize"; then
5587                 echo "(That isn't any different from an ordinary long.)"
5588         fi
5589         ;;
5590 esac
5591 $rm_try
5592
5593 : see if inttypes.h is available
5594 : we want a real compile instead of Inhdr because some systems
5595 : have an inttypes.h which includes non-existent headers
5596 echo " "
5597 $cat >try.c <<EOCP
5598 #include <inttypes.h>
5599 int main() {
5600         static int32_t foo32 = 0x12345678;
5601 }
5602 EOCP
5603 set try
5604 if eval $compile; then
5605         echo "<inttypes.h> found." >&4
5606         val="$define"
5607 else
5608         echo "<inttypes.h> NOT found." >&4
5609         val="$undef"
5610 fi
5611 $rm_try
5612 set i_inttypes
5613 eval $setvar
5614
5615 : check for int64_t
5616 echo " "
5617 echo "Checking to see if you have int64_t..." >&4
5618 $cat >try.c <<EOCP
5619 #include <sys/types.h>
5620 #$i_inttypes I_INTTYPES
5621 #ifdef I_INTTYPES
5622 #include <inttypes.h>
5623 #endif
5624 int main() { int64_t x = 7; }
5625 EOCP
5626 set try
5627 if eval $compile; then
5628         val="$define"
5629         echo "You have int64_t."
5630 else
5631         val="$undef"
5632         echo "You do not have int64_t."
5633 fi
5634 $rm_try
5635 set d_int64_t
5636 eval $setvar
5637
5638
5639 echo " "
5640 echo "Checking which 64-bit integer type we could use..." >&4
5641
5642 case "$intsize" in
5643 8) val=int
5644    set quadtype
5645    eval $setvar
5646    val='"unsigned int"'
5647    set uquadtype
5648    eval $setvar
5649    quadkind=1
5650    ;;
5651 *) case "$longsize" in
5652    8) val=long
5653       set quadtype
5654       eval $setvar
5655       val='"unsigned long"'
5656       set uquadtype
5657       eval $setvar
5658       quadkind=2
5659       ;;
5660    *) case "$d_longlong:$longlongsize" in
5661       define:8)
5662         val='"long long"'
5663         set quadtype
5664         eval $setvar
5665         val='"unsigned long long"'
5666         set uquadtype
5667         eval $setvar
5668         quadkind=3
5669         ;;
5670       *) case "$d_int64_t" in
5671          define)
5672            val=int64_t
5673            set quadtype
5674            eval $setvar
5675            val=uint64_t
5676            set uquadtype
5677            eval $setvar
5678            quadkind=4
5679            ;;
5680          esac
5681          ;;
5682       esac
5683       ;;
5684    esac
5685    ;;
5686 esac
5687
5688 case "$quadtype" in
5689 '')     echo "Alas, no 64-bit integer types in sight." >&4
5690         d_quad="$undef"
5691         ;;
5692 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5693         d_quad="$define"
5694         ;;
5695 esac
5696
5697
5698 case "$uselonglong" in
5699 "$define"|true|[yY]*)
5700         cat <<EOM >&4
5701
5702 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5703 EOM
5704         use64bitint="$define"
5705         ;;
5706 esac                          
5707 case "$use64bits" in
5708 "$define"|true|[yY]*)
5709         cat <<EOM >&4
5710
5711 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5712 EOM
5713         use64bitint="$define"
5714         ;;
5715 esac                          
5716 case "$use64bitints" in
5717 "$define"|true|[yY]*)
5718         cat <<EOM >&4
5719
5720 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5721 EOM
5722         use64bitint="$define"
5723         ;;
5724 esac                          
5725 case "$use64bitsint" in
5726 "$define"|true|[yY]*)
5727         cat <<EOM >&4
5728
5729 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5730 EOM
5731         use64bitint="$define"
5732         ;;
5733 esac                          
5734 case "$uselonglongs" in
5735 "$define"|true|[yY]*)
5736         cat <<EOM >&4
5737
5738 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5739 EOM
5740         use64bitint="$define"
5741         ;;
5742 esac                          
5743 case "$use64bitsall" in
5744 "$define"|true|[yY]*)
5745         cat <<EOM >&4
5746
5747 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5748 EOM
5749         use64bitall="$define"
5750         ;;
5751 esac                          
5752
5753 case "$ccflags" in
5754 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5755 esac
5756 case "$use64bitall" in
5757 "$define"|true|[yY]*) use64bitint="$define" ;;
5758 esac
5759
5760 case "$longsize" in
5761 8) cat <<EOM
5762
5763 You have natively 64-bit long integers.
5764 EOM
5765    val="$define"
5766    ;;
5767 *) case "$use64bitint" in
5768    "$define"|true|[yY]*) dflt='y';;
5769    *) dflt='n';;
5770    esac
5771    case "$d_quad" in
5772    "$define") ;;
5773    *) dflt='n' ;;
5774    esac
5775    cat <<EOM
5776
5777 Perl can be built to take advantage of 64-bit integer types
5778 on some systems.  To do so, Configure can be run with -Duse64bitint.
5779 Choosing this option will most probably introduce binary incompatibilities.
5780
5781 If this doesn't make any sense to you, just accept the default '$dflt'.
5782 (The default has been chosen based on your configuration.)
5783 EOM
5784    rp='Try to use 64-bit integers, if available?'
5785    . ./myread
5786    case "$ans" in
5787    [yY]*) val="$define" ;;
5788    *)     val="$undef"  ;;
5789    esac
5790    ;;
5791 esac
5792 set use64bitint
5793 eval $setvar
5794
5795 case "$use64bitall" in
5796 "$define"|true|[yY]*) dflt='y' ;;
5797 *) case "$longsize" in
5798    8) dflt='y' ;;
5799    *) dflt='n' ;;
5800    esac
5801    ;;
5802 esac    
5803 cat <<EOM
5804
5805 You may also choose to try maximal 64-bitness.  It means using as much
5806 64-bitness as possible on the platform.  This in turn means even more
5807 binary incompatibilities.  On the other hand, your platform may not
5808 have any more 64-bitness available than what you already have chosen.
5809
5810 If this doesn't make any sense to you, just accept the default '$dflt'.
5811 (The default has been chosen based on your configuration.)
5812 EOM
5813 rp='Try to use maximal 64-bit support, if available?'
5814 . ./myread
5815 case "$ans" in
5816 [yY]*) val="$define" ;;
5817 *)     val="$undef"  ;;
5818 esac
5819 set use64bitall
5820 eval $setvar
5821 case "$use64bitall" in
5822 "$define")
5823         case "$use64bitint" in
5824         "$undef")
5825                 cat <<EOM
5826
5827 Since you have chosen a maximally 64-bit build, I'm also turning on
5828 the use of 64-bit integers.
5829 EOM
5830                 use64bitint="$define" ;;
5831         esac
5832         ;;
5833 esac
5834
5835 : Look for a hint-file generated 'call-back-unit'.  If the
5836 : user has specified that a 64-bit perl is to be built,
5837 : we may need to set or change some other defaults.
5838 if $test -f use64bitint.cbu; then
5839         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5840         . ./use64bitint.cbu
5841 fi
5842 case "$use64bitint" in
5843 "$define"|true|[yY]*)
5844         case "$longsize" in
5845         4) case "$archname64" in
5846            '') archname64=64int ;;
5847            esac
5848            ;;
5849         esac
5850         ;;
5851 esac
5852
5853 : Look for a hint-file generated 'call-back-unit'.  If the
5854 : user has specified that a maximally 64-bit perl is to be built,
5855 : we may need to set or change some other defaults.
5856 if $test -f use64bitall.cbu; then
5857         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5858         . ./use64bitall.cbu
5859 fi
5860 case "$use64bitall" in
5861 "$define"|true|[yY]*)
5862         case "$longsize" in
5863         4) case "$archname64" in
5864            ''|64int) archname64=64all ;;
5865            esac
5866            ;;
5867         esac
5868         ;;
5869 esac
5870
5871 case "$d_quad:$use64bitint" in
5872 $undef:$define)
5873         cat >&4 <<EOF
5874
5875 *** You have chosen to use 64-bit integers,
5876 *** but none can be found.
5877 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5878 *** Cannot continue, aborting.
5879
5880 EOF
5881         exit 1
5882         ;;
5883 esac
5884
5885 : check for length of double
5886 echo " "
5887 case "$doublesize" in
5888 '')
5889         echo "Checking to see how big your double precision numbers are..." >&4
5890         $cat >try.c <<EOCP
5891 #include <stdio.h>
5892 #$i_stdlib I_STDLIB
5893 #ifdef I_STDLIB
5894 #include <stdlib.h>
5895 #endif
5896 int main()
5897 {
5898     printf("%d\n", (int)sizeof(double));
5899     exit(0);
5900 }
5901 EOCP
5902         set try
5903         if eval $compile_ok; then
5904                 doublesize=`$run ./try`
5905                 echo "Your double is $doublesize bytes long."
5906         else
5907                 dflt='8'
5908                 echo "(I can't seem to compile the test program.  Guessing...)"
5909                 rp="What is the size of a double precision number (in bytes)?"
5910                 . ./myread
5911                 doublesize="$ans"
5912         fi
5913         ;;
5914 esac
5915 $rm_try
5916
5917 : check for long doubles
5918 echo " "
5919 echo "Checking to see if you have long double..." >&4
5920 echo 'int main() { long double x = 7.0; }' > try.c
5921 set try
5922 if eval $compile; then
5923         val="$define"
5924         echo "You have long double."
5925 else
5926         val="$undef"
5927         echo "You do not have long double."
5928 fi
5929 $rm_try
5930 set d_longdbl
5931 eval $setvar
5932
5933 : check for length of long double
5934 case "${d_longdbl}${longdblsize}" in
5935 $define)
5936         echo " "
5937         echo "Checking to see how big your long doubles are..." >&4
5938         $cat >try.c <<'EOCP'
5939 #include <stdio.h>
5940 int main()
5941 {
5942         printf("%d\n", sizeof(long double));
5943 }
5944 EOCP
5945         set try
5946         set try
5947         if eval $compile; then
5948                 longdblsize=`$run ./try`
5949                 echo "Your long doubles are $longdblsize bytes long."
5950         else
5951                 dflt='8'
5952                 echo " "
5953                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5954                 rp="What is the size of a long double (in bytes)?"
5955                 . ./myread
5956                 longdblsize="$ans"
5957         fi
5958         if $test "X$doublesize" = "X$longdblsize"; then
5959                 echo "That isn't any different from an ordinary double."
5960                 echo "I'll keep your setting anyway, but you may see some"
5961                 echo "harmless compilation warnings."
5962         fi
5963         ;;
5964 esac
5965 $rm_try
5966
5967 : determine the architecture name
5968 echo " "
5969 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5970         tarch=`arch`"-$osname"
5971 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5972         if uname -m > tmparch 2>&1 ; then
5973                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5974                         -e 's/$/'"-$osname/" tmparch`
5975         else
5976                 tarch="$osname"
5977         fi
5978         $rm -f tmparch
5979 else
5980         tarch="$osname"
5981 fi
5982 case "$myarchname" in
5983 ''|"$tarch") ;;
5984 *)
5985         echo "(Your architecture name used to be $myarchname.)"
5986         archname=''
5987         ;;
5988 esac
5989 case "$targetarch" in
5990 '') ;;
5991 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5992 esac
5993 myarchname="$tarch"
5994 case "$archname" in
5995 '') dflt="$tarch";;
5996 *) dflt="$archname";;
5997 esac
5998 rp='What is your architecture name'
5999 . ./myread
6000 archname="$ans"
6001 case "$usethreads" in
6002 $define)
6003         echo "Threads selected." >&4
6004         case "$archname" in
6005         *-thread*) echo "...and architecture name already has -thread." >&4
6006                 ;;
6007         *)      archname="$archname-thread"
6008                 echo "...setting architecture name to $archname." >&4
6009                 ;;
6010         esac
6011         ;;
6012 esac
6013 case "$usemultiplicity" in
6014 $define)
6015         echo "Multiplicity selected." >&4
6016         case "$archname" in
6017         *-multi*) echo "...and architecture name already has -multi." >&4
6018                 ;;
6019         *)      archname="$archname-multi"
6020                 echo "...setting architecture name to $archname." >&4
6021                 ;;
6022         esac
6023         ;;
6024 esac
6025 case "$use64bitint$use64bitall" in
6026 *"$define"*)
6027         case "$archname64" in
6028         '')
6029                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6030                 ;;
6031         *)
6032                 case "$use64bitint" in
6033                 "$define") echo "64 bit integers selected." >&4 ;;
6034                 esac
6035                 case "$use64bitall" in
6036                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6037                 esac
6038                 case "$archname" in
6039                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6040                         ;;
6041                 *)      archname="$archname-$archname64"
6042                         echo "...setting architecture name to $archname." >&4
6043                         ;;
6044                 esac
6045                 ;;
6046         esac
6047 esac
6048 case "$uselongdouble" in
6049 $define)
6050         echo "Long doubles selected." >&4
6051         case "$longdblsize" in
6052         $doublesize)
6053                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6054                 ;;
6055         *)
6056                 case "$archname" in
6057                 *-ld*) echo "...and architecture name already has -ld." >&4
6058                         ;;
6059                 *)      archname="$archname-ld"
6060                         echo "...setting architecture name to $archname." >&4
6061                         ;;
6062                 esac
6063                 ;;
6064         esac
6065         ;;
6066 esac
6067 case "$useperlio" in
6068 $define)
6069         echo "Perlio selected." >&4
6070         ;;
6071 *)
6072         echo "Perlio not selected, using stdio." >&4
6073         case "$archname" in
6074         *-stdio*) echo "...and architecture name already has -stdio." >&4
6075                 ;;
6076         *)      archname="$archname-stdio"
6077                 echo "...setting architecture name to $archname." >&4
6078                 ;;
6079         esac
6080         ;;
6081 esac
6082 if $test -f archname.cbu; then
6083         echo "Your platform has some specific hints for architecture name, using them..."
6084         . ./archname.cbu
6085 fi
6086
6087 : set the prefixit variable, to compute a suitable default value
6088 prefixit='case "$3" in
6089 ""|none)
6090         case "$oldprefix" in
6091         "") eval "$1=\"\$$2\"";;
6092         *)
6093                 case "$3" in
6094                 "") eval "$1=";;
6095                 none)
6096                         eval "tp=\"\$$2\"";
6097                         case "$tp" in
6098                         ""|" ") eval "$1=\"\$$2\"";;
6099                         *) eval "$1=";;
6100                         esac;;
6101                 esac;;
6102         esac;;
6103 *)
6104         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6105         case "$tp" in
6106         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6107         /*-$oldprefix/*|\~*-$oldprefix/*)
6108                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6109         *) eval "$1=\"\$$2\"";;
6110         esac;;
6111 esac'
6112
6113 : determine installation style
6114 : For now, try to deduce it from prefix unless it is already set.
6115 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6116 case "$installstyle" in
6117 '')     case "$prefix" in
6118                 *perl*) dflt='lib';;
6119                 *) dflt='lib/perl5' ;;
6120         esac
6121         ;;
6122 *)      dflt="$installstyle" ;;
6123 esac
6124 : Probably not worth prompting for this since we prompt for all
6125 : the directories individually, and the prompt would be too long and
6126 : confusing anyway.
6127 installstyle=$dflt
6128
6129 : determine where public executables go
6130 echo " "
6131 set dflt bin bin
6132 eval $prefixit
6133 fn=d~
6134 rp='Pathname where the public executables will reside?'
6135 . ./getfile
6136 if $test "X$ansexp" != "X$binexp"; then
6137         installbin=''
6138 fi
6139 prefixvar=bin
6140 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6141 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6142 :     this via initialinstalllocation
6143 . ./setprefixvar
6144
6145 case "$userelocatableinc" in
6146 $define|true|[yY]*)     dflt='y' ;;
6147 *)                      dflt='n' ;;
6148 esac
6149 cat <<EOM
6150
6151 Would you like to build Perl so that the installation is relocatable, so that
6152 library paths in @INC are determined relative to the path of the perl binary?
6153 This is not advised for system Perl installs, or if you need to run setid
6154 scripts or scripts under taint mode.
6155
6156 If this doesn't make any sense to you, just accept the default '$dflt'.
6157 EOM
6158 rp='Use relocatable @INC?'
6159 . ./myread
6160 case "$ans" in
6161 y|Y)    val="$define" ;;
6162 *)      val="$undef"  ;;
6163 esac
6164 set userelocatableinc
6165 eval $setvar
6166
6167 initialinstalllocation="$binexp"
6168 : Default prefix is now "up one level from where the binaries are"
6169 case "$userelocatableinc" in
6170 $define|true|[yY]*)
6171     bin=".../"
6172     binexp=".../"
6173     prefix=".../.."
6174     prefixexp=".../.."
6175     installprefixexp=".../.."
6176     ;;
6177 esac
6178
6179 : determine where private library files go
6180 : Usual default is /usr/local/lib/perl5/$version.
6181 : Also allow things like /opt/perl/lib/$version, since
6182 : /opt/perl/lib/perl5... would be redundant.
6183 : The default "style" setting is made in installstyle.U
6184 case "$installstyle" in
6185 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6186 *)       set dflt privlib lib/$version ;;
6187 esac
6188 eval $prefixit
6189 $cat <<EOM
6190
6191 There are some auxiliary files for $package that need to be put into a
6192 private library directory that is accessible by everyone.
6193
6194 EOM
6195 fn=$binexp
6196 fn=d~+
6197 rp='Pathname where the private library files will reside?'
6198 . ./getfile
6199 prefixvar=privlib
6200 . ./setprefixvar
6201
6202 : set the prefixup variable, to restore leading tilda escape
6203 prefixup='case "$prefixexp" in
6204 "$prefix") ;;
6205 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6206 esac'
6207
6208 : determine where public architecture dependent libraries go
6209 set archlib archlib
6210 eval $prefixit
6211 : privlib default is /usr/local/lib/$package/$version
6212 : archlib default is /usr/local/lib/$package/$version/$archname
6213 : privlib may have an optional trailing /share.
6214 tdflt=`echo $privlib | $sed 's,/share$,,'`
6215 tdflt=$tdflt/$archname
6216 case "$archlib" in
6217 '')     dflt=$tdflt
6218         ;;
6219 *)      dflt="$archlib"
6220     ;;
6221 esac
6222 $cat <<EOM
6223
6224 $spackage contains architecture-dependent library files.  If you are
6225 sharing libraries in a heterogeneous environment, you might store
6226 these files in a separate location.  Otherwise, you can just include
6227 them with the rest of the public library files.
6228
6229 EOM
6230 fn=$binexp
6231 fn=d+~
6232 rp='Where do you want to put the public architecture-dependent libraries?'
6233 . ./getfile
6234 prefixvar=archlib
6235 . ./setprefixvar
6236 if $test X"$archlib" = X"$privlib"; then
6237         d_archlib="$undef"
6238 else
6239         d_archlib="$define"
6240 fi
6241
6242 : see if setuid scripts can be secure
6243 $cat <<EOM
6244
6245 Some kernels have a bug that prevents setuid #! scripts from being
6246 secure.  Some sites have disabled setuid #! scripts because of this.
6247
6248 First let's decide if your kernel supports secure setuid #! scripts.
6249 (If setuid #! scripts would be secure but have been disabled anyway,
6250 don't say that they are secure if asked.)
6251
6252 EOM
6253
6254 val="$undef"
6255 if $test -d /dev/fd; then
6256         echo "#!$ls" >reflect
6257         chmod +x,u+s reflect
6258         ./reflect >flect 2>&1
6259         if $contains "/dev/fd" flect >/dev/null; then
6260                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6261                 val="$define"
6262         else
6263                 $cat <<EOM
6264 If you are not sure if they are secure, I can check but I'll need a
6265 username and password different from the one you are using right now.
6266 If you don't have such a username or don't want me to test, simply
6267 enter 'none'.
6268
6269 EOM
6270                 rp='Other username to test security of setuid scripts with?'
6271                 dflt='none'
6272                 . ./myread
6273                 case "$ans" in
6274                 n|none)
6275                         case "$d_suidsafe" in
6276                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6277                                 dflt=n;;
6278                         "$undef")
6279                                 echo "Well, the $hint value is *not* secure." >&4
6280                                 dflt=n;;
6281                         *)      echo "Well, the $hint value *is* secure." >&4
6282                                 dflt=y;;
6283                         esac
6284                         ;;
6285                 *)
6286                         $rm -f reflect flect
6287                         echo "#!$ls" >reflect
6288                         chmod +x,u+s reflect
6289                         echo >flect
6290                         chmod a+w flect
6291                         echo '"su" will (probably) prompt you for '"$ans's password."
6292                         su $ans -c './reflect >flect'
6293                         if $contains "/dev/fd" flect >/dev/null; then
6294                                 echo "Okay, it looks like setuid scripts are secure." >&4
6295                                 dflt=y
6296                         else
6297                                 echo "I don't think setuid scripts are secure." >&4
6298                                 dflt=n
6299                         fi
6300                         ;;
6301                 esac
6302                 rp='Does your kernel have *secure* setuid scripts?'
6303                 . ./myread
6304                 case "$ans" in
6305                 [yY]*)  val="$define";;
6306                 *)      val="$undef";;
6307                 esac
6308         fi
6309 else
6310         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6311         echo "(That's for file descriptors, not floppy disks.)"
6312         val="$undef"
6313 fi
6314 set d_suidsafe
6315 eval $setvar
6316
6317 $rm -f reflect flect
6318
6319 : now see if they want to do setuid emulation
6320 echo " "
6321 val="$undef"
6322 case "$d_suidsafe" in
6323 "$define")
6324         val="$undef"
6325         echo "No need to emulate SUID scripts since they are secure here." >&4
6326         ;;
6327 *)
6328         $cat <<EOM
6329 Some systems have disabled setuid scripts, especially systems where
6330 setuid scripts cannot be secure.  On systems where setuid scripts have
6331 been disabled, the setuid/setgid bits on scripts are currently
6332 useless.  It is possible for $package to detect those bits and emulate
6333 setuid/setgid in a secure fashion.  This emulation will only work if
6334 setuid scripts have been disabled in your kernel.
6335
6336 EOM
6337         case "$d_dosuid" in
6338         "$define") dflt=y ;;
6339         *) dflt=n ;;
6340         esac
6341         rp="Do you want to do setuid/setgid emulation?"
6342         . ./myread
6343         case "$ans" in
6344         [yY]*)  val="$define";;
6345         *)      val="$undef";;
6346         esac
6347         ;;
6348 esac
6349 set d_dosuid
6350 eval $setvar
6351
6352 : Find perl5.005 or later.
6353 echo "Looking for a previously installed perl5.005 or later... "
6354 case "$perl5" in
6355 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6356                 : Check if this perl is recent and can load a simple module
6357                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6358                         perl5=$tdir/perl
6359                         break;
6360                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6361                         perl5=$tdir/perl5
6362                         break;
6363                 fi
6364         done
6365         ;;
6366 *)      perl5="$perl5"
6367         ;;
6368 esac
6369 case "$perl5" in
6370 '')     echo "None found.  That's ok.";;
6371 *)      echo "Using $perl5." ;;
6372 esac
6373
6374 $cat <<EOM
6375
6376 After $package is installed, you may wish to install various
6377 add-on modules and utilities.  Typically, these add-ons will
6378 be installed under $prefix with the rest
6379 of this package.  However, you may wish to install such add-ons
6380 elsewhere under a different prefix.
6381
6382 If you do not wish to put everything under a single prefix, that's
6383 ok.  You will be prompted for the individual locations; this siteprefix
6384 is only used to suggest the defaults.
6385
6386 The default should be fine for most people.
6387
6388 EOM
6389 fn=d~+
6390 rp='Installation prefix to use for add-on modules and utilities?'
6391 : XXX Here might be another good place for an installstyle setting.
6392 case "$siteprefix" in
6393 '') dflt=$prefix ;;
6394 *)  dflt=$siteprefix ;;
6395 esac
6396 . ./getfile
6397 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6398 oldsiteprefix=''
6399 case "$siteprefix" in
6400 '') ;;
6401 *)      case "$ans" in
6402         "$prefix") ;;
6403         *) oldsiteprefix="$prefix";;
6404         esac
6405         ;;
6406 esac
6407 siteprefix="$ans"
6408 siteprefixexp="$ansexp"
6409
6410 : determine where site specific libraries go.
6411 : Usual default is /usr/local/lib/perl5/site_perl/$version
6412 : The default "style" setting is made in installstyle.U
6413 : XXX No longer works with Prefixit stuff.
6414 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6415 case "$sitelib" in
6416 '') case "$installstyle" in
6417         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6418         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6419         esac
6420         ;;
6421 *)      dflt="$sitelib"
6422         ;;
6423 esac
6424 $cat <<EOM
6425
6426 The installation process will create a directory for
6427 site-specific extensions and modules.  Most users find it convenient
6428 to place all site-specific files in this directory rather than in the
6429 main distribution directory.
6430
6431 EOM
6432 fn=d~+
6433 rp='Pathname for the site-specific library files?'
6434 . ./getfile
6435 prefixvar=sitelib
6436 . ./setprefixvar
6437 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6438
6439 : Determine list of previous versions to include in @INC
6440 $cat > getverlist <<EOPL
6441 #!$perl5 -w
6442 use File::Basename;
6443 \$api_versionstring = "$api_versionstring";
6444 \$version = "$version";
6445 \$stem = "$sitelib_stem";
6446 \$archname = "$archname";
6447 EOPL
6448         $cat >> getverlist <<'EOPL'
6449 # The list found is store twice for each entry: the original name, and
6450 # the binary broken down version as pack "sss", so sorting is easy and
6451 # unambiguous. This will work for all versions that have a maximum of
6452 # three digit groups, separate by '.'s or '_'s. Names are extended with
6453 # ".0.0" to ensure at least three elements for the pack.
6454 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6455
6456 # Can't have leading @ because metaconfig interprets it as a command!
6457 ;@inc_version_list=();
6458 # XXX Redo to do opendir/readdir?
6459 if (-d $stem) {
6460     chdir($stem);
6461     ;@candidates = map {
6462         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6463 }
6464 else {
6465     ;@candidates = ();
6466 }
6467
6468 ($pversion, $aversion, $vsn5005) = map {
6469     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6470 foreach $d (@candidates) {
6471     if ($d->[1] lt $pversion) {
6472         if ($d->[1] ge $aversion) {
6473             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6474         }
6475         elsif ($d->[1] ge $vsn5005) {
6476             unshift(@inc_version_list, grep { -d } $d->[0]);
6477         }
6478     }
6479     else {
6480         # Skip newer version.  I.e. don't look in
6481         # 5.7.0 if we're installing 5.6.1.
6482     }
6483 }
6484
6485 if (@inc_version_list) {
6486     print join(' ', @inc_version_list);
6487 }
6488 else {
6489     # Blank space to preserve value for next Configure run.
6490     print " ";
6491 }
6492 EOPL
6493 chmod +x getverlist
6494 case "$inc_version_list" in
6495 '')     if test -x "$perl5$exe_ext"; then
6496                 dflt=`$perl5 getverlist`
6497         else
6498                 dflt='none'
6499         fi
6500         ;;
6501 $undef) dflt='none' ;;
6502 *)  eval dflt=\"$inc_version_list\" ;;
6503 esac
6504 case "$dflt" in
6505 ''|' ') dflt=none ;;
6506 esac
6507 case "$dflt" in
6508 5.005) dflt=none ;;
6509 esac
6510 $cat <<EOM
6511
6512 In order to ease the process of upgrading, this version of perl
6513 can be configured to use modules built and installed with earlier
6514 versions of perl that were installed under $prefix.  Specify here
6515 the list of earlier versions that this version of perl should check.
6516 If Configure detected no earlier versions of perl installed under
6517 $prefix, then the list will be empty.  Answer 'none' to tell perl
6518 to not search earlier versions.
6519
6520 The default should almost always be sensible, so if you're not sure,
6521 just accept the default.
6522 EOM
6523
6524 rp='List of earlier versions to include in @INC?'
6525 . ./myread
6526 case "$ans" in
6527 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6528 *) inc_version_list="$ans" ;;
6529 esac
6530 case "$inc_version_list" in
6531 ''|' ')
6532         inc_version_list_init='0'
6533         d_inc_version_list="$undef"
6534         ;;
6535 *)      inc_version_list_init=`echo $inc_version_list |
6536                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6537         d_inc_version_list="$define"
6538         ;;
6539 esac
6540 $rm -f getverlist
6541
6542 : see if this is a malloc.h system
6543 : we want a real compile instead of Inhdr because some systems have a
6544 : malloc.h that just gives a compile error saying to use stdlib.h instead
6545 echo " "
6546 $cat >try.c <<EOCP
6547 #include <stdlib.h>
6548 #include <malloc.h>
6549 int main () { return 0; }
6550 EOCP
6551 set try
6552 if eval $compile; then
6553     echo "<malloc.h> found." >&4
6554     val="$define"
6555 else
6556     echo "<malloc.h> NOT found." >&4
6557     val="$undef"
6558 fi
6559 $rm_try
6560 set i_malloc
6561 eval $setvar
6562
6563 : check for void type
6564 echo " "
6565 echo "Checking to see how well your C compiler groks the void type..." >&4
6566 case "$voidflags" in
6567 '')
6568         $cat >try.c <<EOCP
6569 #$i_stdlib I_STDLIB
6570 #ifdef I_STDLIB
6571 #include <stdlib.h>
6572 #endif
6573 #if TRY & 1
6574 void sub() {
6575 #else
6576 sub() {
6577 #endif
6578         extern void moo();      /* function returning void */
6579         void (*goo)();          /* ptr to func returning void */
6580 #if TRY & 8
6581         void *hue;              /* generic ptr */
6582 #endif
6583 #if TRY & 2
6584         void (*foo[10])();
6585 #endif
6586
6587 #if TRY & 4
6588         if(goo == moo) {
6589                 exit(0);
6590         }
6591 #endif
6592         exit(0);
6593 }
6594 int main() { sub(); }
6595 EOCP
6596         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6597                 voidflags=$defvoidused
6598         echo "Good.  It appears to support void to the level $package wants.">&4
6599                 if $contains warning .out >/dev/null 2>&1; then
6600                         echo "However, you might get some warnings that look like this:"
6601                         $cat .out
6602                 fi
6603         else
6604 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6605                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6606                         echo "It supports 1..."
6607                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6608                                 echo "It also supports 2..."
6609                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6610                                         voidflags=7
6611                                         echo "And it supports 4 but not 8 definitely."
6612                                 else
6613                                         echo "It doesn't support 4..."
6614                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6615                                                 voidflags=11
6616                                                 echo "But it supports 8."
6617                                         else
6618                                                 voidflags=3
6619                                                 echo "Neither does it support 8."
6620                                         fi
6621                                 fi
6622                         else
6623                                 echo "It does not support 2..."
6624                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6625                                         voidflags=13
6626                                         echo "But it supports 4 and 8."
6627                                 else
6628                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6629                                                 voidflags=5
6630                                                 echo "And it supports 4 but has not heard about 8."
6631                                         else
6632                                                 echo "However it supports 8 but not 4."
6633                                         fi
6634                                 fi
6635                         fi
6636                 else
6637                         echo "There is no support at all for void."
6638                         voidflags=0
6639                 fi
6640         fi
6641 esac
6642 case "$voidflags" in
6643 "$defvoidused") ;;
6644 *)      $cat >&4 <<'EOM'
6645   Support flag bits are:
6646     1: basic void declarations.
6647     2: arrays of pointers to functions returning void.
6648     4: operations between pointers to and addresses of void functions.
6649     8: generic void pointers.
6650 EOM
6651         dflt="$voidflags";
6652         rp="Your void support flags add up to what?"
6653         . ./myread
6654         voidflags="$ans"
6655         ;;
6656 esac
6657 $rm_try
6658
6659 : check for length of pointer
6660 echo " "
6661 case "$ptrsize" in
6662 '')
6663         echo "Checking to see how big your pointers are..." >&4
6664         if test "$voidflags" -gt 7; then
6665                 echo '#define VOID_PTR char *' > try.c
6666         else
6667                 echo '#define VOID_PTR void *' > try.c
6668         fi
6669         $cat >>try.c <<EOCP
6670 #include <stdio.h>
6671 #$i_stdlib I_STDLIB
6672 #ifdef I_STDLIB
6673 #include <stdlib.h>
6674 #endif
6675 int main()
6676 {
6677     printf("%d\n", (int)sizeof(VOID_PTR));
6678     exit(0);
6679 }
6680 EOCP
6681         set try
6682         if eval $compile_ok; then
6683                 ptrsize=`$run ./try`
6684                 echo "Your pointers are $ptrsize bytes long."
6685         else
6686                 dflt='4'
6687                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6688                 rp="What is the size of a pointer (in bytes)?"
6689                 . ./myread
6690                 ptrsize="$ans"
6691         fi
6692         ;;
6693 esac
6694 $rm_try
6695 case "$use64bitall" in
6696 "$define"|true|[yY]*)
6697         case "$ptrsize" in
6698         4)      cat <<EOM >&4
6699
6700 *** You have chosen a maximally 64-bit build,
6701 *** but your pointers are only 4 bytes wide.
6702 *** Please rerun Configure without -Duse64bitall.
6703 EOM
6704                 case "$d_quad" in
6705                 define)
6706                         cat <<EOM >&4
6707 *** Since you have quads, you could possibly try with -Duse64bitint.
6708 EOM
6709                         ;;
6710                 esac
6711                 cat <<EOM >&4
6712 *** Cannot continue, aborting.
6713
6714 EOM
6715
6716                 exit 1
6717                 ;;
6718         esac
6719         ;;
6720 esac
6721
6722
6723 : determine whether to use malloc wrapping
6724 echo " "
6725 case "$usemallocwrap" in
6726 [yY]*|true|$define)     dflt='y' ;;
6727 [nN]*|false|$undef)     dflt='n' ;;
6728 *)      case "$usedevel" in
6729         [yY]*|true|$define)     dflt='y' ;;
6730         *) dflt='n' ;;
6731         esac
6732         ;;
6733 esac
6734 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6735 . ./myread
6736 usemallocwrap="$ans"
6737 case "$ans" in
6738 y*|true)
6739         usemallocwrap="$define" ;;
6740 *)
6741         usemallocwrap="$undef" ;;
6742 esac
6743
6744 : determine which malloc to compile in
6745 echo " "
6746 case "$usemymalloc" in
6747 [yY]*|true|$define)     dflt='y' ;;
6748 [nN]*|false|$undef)     dflt='n' ;;
6749 *)      case "$ptrsize" in
6750         4) dflt='y' ;;
6751         *) dflt='n' ;;
6752         esac
6753         ;;
6754 esac
6755 rp="Do you wish to attempt to use the malloc that comes with $package?"
6756 . ./myread
6757 usemymalloc="$ans"
6758 case "$ans" in
6759 y*|true)
6760         usemymalloc='y'
6761         mallocsrc='malloc.c'
6762         mallocobj="malloc$_o"
6763         d_mymalloc="$define"
6764         case "$libs" in
6765         *-lmalloc*)
6766                 : Remove malloc from list of libraries to use
6767                 echo "Removing unneeded -lmalloc from library list" >&4
6768                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6769                 shift
6770                 libs="$*"
6771                 echo "libs = $libs" >&4
6772                 ;;
6773         esac
6774         ;;
6775 *)
6776         usemymalloc='n'
6777         mallocsrc=''
6778         mallocobj=''
6779         d_mymalloc="$undef"
6780         ;;
6781 esac
6782
6783 : compute the return types of malloc and free
6784 echo " "
6785 $cat >malloc.c <<END
6786 #$i_malloc I_MALLOC
6787 #$i_stdlib I_STDLIB
6788 #include <stdio.h>
6789 #include <sys/types.h>
6790 #ifdef I_MALLOC
6791 #include <malloc.h>
6792 #endif
6793 #ifdef I_STDLIB
6794 #include <stdlib.h>
6795 #endif
6796 #ifdef TRY_MALLOC
6797 void *malloc();
6798 #endif
6799 #ifdef TRY_FREE
6800 void free();
6801 #endif
6802 END
6803 case "$malloctype" in
6804 '')
6805         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6806                 malloctype='void *'
6807         else
6808                 malloctype='char *'
6809         fi
6810         ;;
6811 esac
6812 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6813
6814 case "$freetype" in
6815 '')
6816         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6817                 freetype='void'
6818         else
6819                 freetype='int'
6820         fi
6821         ;;
6822 esac
6823 echo "Your system uses $freetype free(), it would seem." >&4
6824 $rm -f malloc.[co]
6825 : determine where site specific architecture-dependent libraries go.
6826 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6827 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6828 : sitelib may have an optional trailing /share.
6829 case "$sitearch" in
6830 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6831         dflt="$dflt/$archname"
6832         ;;
6833 *)      dflt="$sitearch"
6834         ;;
6835 esac
6836 set sitearch sitearch none
6837 eval $prefixit
6838 $cat <<EOM
6839
6840 The installation process will also create a directory for
6841 architecture-dependent site-specific extensions and modules.
6842
6843 EOM
6844 fn=d~+
6845 rp='Pathname for the site-specific architecture-dependent library files?'
6846 . ./getfile
6847 prefixvar=sitearch
6848 . ./setprefixvar
6849 if $test X"$sitearch" = X"$sitelib"; then
6850         d_sitearch="$undef"
6851 else
6852         d_sitearch="$define"
6853 fi
6854
6855 $cat <<EOM
6856
6857 The installation process will also create a directory for
6858 vendor-supplied add-ons.  Vendors who supply perl with their system
6859 may find it convenient to place all vendor-supplied files in this
6860 directory rather than in the main distribution directory.  This will
6861 ease upgrades between binary-compatible maintenance versions of perl.
6862
6863 Of course you may also use these directories in whatever way you see
6864 fit.  For example, you might use them to access modules shared over a
6865 company-wide network.
6866
6867 The default answer should be fine for most people.
6868 This causes further questions about vendor add-ons to be skipped
6869 and no vendor-specific directories will be configured for perl.
6870
6871 EOM
6872 rp='Do you want to configure vendor-specific add-on directories?'
6873 case "$usevendorprefix" in
6874 define|true|[yY]*) dflt=y ;;
6875 *)      : User may have set vendorprefix directly on Configure command line.
6876         case "$vendorprefix" in
6877         ''|' ') dflt=n ;;
6878         *)      dflt=y ;;
6879         esac
6880         ;;
6881 esac
6882 . ./myread
6883 case "$ans" in
6884 [yY]*)  fn=d~+
6885         rp='Installation prefix to use for vendor-supplied add-ons?'
6886         case "$vendorprefix" in
6887         '') dflt='' ;;
6888         *)  dflt=$vendorprefix ;;
6889         esac
6890         . ./getfile
6891         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6892         oldvendorprefix=''
6893         case "$vendorprefix" in
6894         '') ;;
6895         *)      case "$ans" in
6896                 "$prefix") ;;
6897                 *) oldvendorprefix="$prefix";;
6898                 esac
6899                 ;;
6900         esac
6901         usevendorprefix="$define"
6902         vendorprefix="$ans"
6903         vendorprefixexp="$ansexp"
6904         ;;
6905 *)      usevendorprefix="$undef"
6906         vendorprefix=''
6907         vendorprefixexp=''
6908         ;;
6909 esac
6910
6911 case "$vendorprefix" in
6912 '')     d_vendorlib="$undef"
6913         vendorlib=''
6914         vendorlibexp=''
6915         ;;
6916 *)      d_vendorlib="$define"
6917         : determine where vendor-supplied modules go.
6918         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6919         case "$vendorlib" in
6920         '')
6921                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6922                 case "$installstyle" in
6923                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6924                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6925                 esac
6926                 ;;
6927         *)      dflt="$vendorlib"
6928                 ;;
6929         esac
6930         fn=d~+
6931         rp='Pathname for the vendor-supplied library files?'
6932         . ./getfile
6933         vendorlib="$ans"
6934         vendorlibexp="$ansexp"
6935         ;;
6936 esac
6937 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6938 prefixvar=vendorlib
6939 . ./installprefix
6940
6941 case "$vendorprefix" in
6942 '')     d_vendorarch="$undef"
6943         vendorarch=''
6944         vendorarchexp=''
6945         ;;
6946 *)      d_vendorarch="$define"
6947         : determine where vendor-supplied architecture-dependent libraries go.
6948         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6949         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6950         : vendorlib may have an optional trailing /share.
6951         case "$vendorarch" in
6952         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6953                 dflt="$dflt/$archname"
6954                 ;;
6955         *)      dflt="$vendorarch" ;;
6956         esac
6957         fn=d~+
6958         rp='Pathname for vendor-supplied architecture-dependent files?'
6959         . ./getfile
6960         vendorarch="$ans"
6961         vendorarchexp="$ansexp"
6962         ;;
6963 esac
6964 prefixvar=vendorarch
6965 . ./installprefix
6966
6967 : Final catch-all directories to search
6968 $cat <<EOM
6969
6970 Lastly, you can have perl look in other directories for extensions and
6971 modules in addition to those already specified.
6972 These directories will be searched after 
6973         $sitearch 
6974         $sitelib 
6975 EOM
6976 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6977 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6978 echo ' '
6979 case "$otherlibdirs" in
6980 ''|' ') dflt='none' ;;
6981 *)      dflt="$otherlibdirs" ;;
6982 esac
6983 $cat <<EOM
6984 Enter a colon-separated set of extra paths to include in perl's @INC
6985 search path, or enter 'none' for no extra paths.
6986
6987 EOM
6988
6989 rp='Colon-separated list of additional directories for perl to search?'
6990 . ./myread
6991 case "$ans" in
6992 ' '|''|none)    otherlibdirs=' ' ;;     
6993 *)      otherlibdirs="$ans" ;;
6994 esac
6995 case "$otherlibdirs" in
6996 ' ') val=$undef ;;
6997 *)      val=$define ;;
6998 esac
6999 set d_perl_otherlibdirs
7000 eval $setvar
7001
7002 : Cruising for prototypes
7003 echo " "
7004 echo "Checking out function prototypes..." >&4
7005 $cat >prototype.c <<EOCP
7006 #$i_stdlib I_STDLIB
7007 #ifdef I_STDLIB
7008 #include <stdlib.h>
7009 #endif
7010 int main(int argc, char *argv[]) {
7011         exit(0);}
7012 EOCP
7013 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7014         echo "Your C compiler appears to support function prototypes."
7015         val="$define"
7016 else
7017         echo "Your C compiler doesn't seem to understand function prototypes."
7018         val="$undef"
7019 fi
7020 set prototype
7021 eval $setvar
7022 $rm -f prototype*
7023
7024 case "$prototype" in
7025 "$define") ;;
7026 *)      ansi2knr='ansi2knr'
7027         echo " "
7028         cat <<EOM >&4
7029
7030 $me:  FATAL ERROR:
7031 This version of $package can only be compiled by a compiler that 
7032 understands function prototypes.  Unfortunately, your C compiler 
7033         $cc $ccflags
7034 doesn't seem to understand them.  Sorry about that.
7035
7036 If GNU cc is available for your system, perhaps you could try that instead.  
7037
7038 Eventually, we hope to support building Perl with pre-ANSI compilers.
7039 If you would like to help in that effort, please contact <perlbug@perl.org>.
7040
7041 Aborting Configure now.
7042 EOM
7043         exit 2
7044         ;;
7045 esac
7046
7047 echo " "
7048 case "$extras" in
7049 '') dflt='n';;
7050 *) dflt='y';;
7051 esac
7052 cat <<EOM
7053 Perl can be built with extra modules or bundles of modules which
7054 will be fetched from the CPAN and installed alongside Perl.
7055
7056 Notice that you will need access to the CPAN; either via the Internet,
7057 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7058 be asked later to configure the CPAN.pm module which will in turn do
7059 the installation of the rest of the extra modules or bundles.)
7060
7061 Notice also that if the modules require any external software such as
7062 libraries and headers (the libz library and the zlib.h header for the
7063 Compress::Zlib module, for example) you MUST have any such software
7064 already installed, this configuration process will NOT install such
7065 things for you.
7066
7067 If this doesn't make any sense to you, just accept the default '$dflt'.
7068 EOM
7069 rp='Install any extra modules (y or n)?'
7070 . ./myread
7071 case "$ans" in
7072 y|Y)
7073         cat <<EOM
7074
7075 Please list any extra modules or bundles to be installed from CPAN,
7076 with spaces between the names.  The names can be in any format the
7077 'install' command of CPAN.pm will understand.  (Answer 'none',
7078 without the quotes, to install no extra modules or bundles.)
7079 EOM
7080         rp='Extras?'
7081         dflt="$extras"
7082         . ./myread
7083         extras="$ans"
7084 esac
7085 case "$extras" in
7086 ''|'none')
7087         val=''
7088         $rm -f ../extras.lst
7089         ;;
7090 *)      echo "(Saving the list of extras for later...)"
7091         echo "$extras" > ../extras.lst
7092         val="'$extras'"
7093         ;;
7094 esac
7095 set extras
7096 eval $setvar
7097 echo " "
7098
7099 : determine where html pages for programs go
7100 set html1dir html1dir none
7101 eval $prefixit
7102 $cat <<EOM
7103
7104 If you wish to install html files for programs in $spackage, indicate
7105 the appropriate directory here.  To skip installing html files,
7106 answer "none".
7107 EOM
7108 case "$html1dir" in
7109 ''|none|$undef|' ') dflt=none ;;
7110 *) dflt=$html1dir ;;
7111 esac
7112 fn=dn+~
7113 rp="Directory for the main $spackage html pages?"
7114 . ./getfile
7115 prefixvar=html1dir
7116 . ./setprefixvar
7117 : Use ' ' for none so value is preserved next time through Configure
7118 $test X"$html1dir" = "X" && html1dir=' '
7119
7120 : determine where html pages for libraries and modules go
7121 set html3dir html3dir none
7122 eval $prefixit
7123 $cat <<EOM
7124
7125 If you wish to install html files for modules associated with $spackage,
7126 indicate the appropriate directory here.  To skip installing html files,
7127 answer "none".
7128 EOM
7129 : There is no obvious default.  If they have specified html1dir, then
7130 : try to key off that, possibly changing .../html1 into .../html3.
7131 case "$html3dir" in
7132 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7133 *) dflt=$html3dir ;;
7134 esac
7135 fn=dn+~
7136 rp="Directory for the $spackage module html pages?"
7137 . ./getfile
7138 prefixvar=html3dir
7139 . ./setprefixvar
7140 : Use ' ' for none so value is preserved next time through Configure
7141 $test X"$html3dir" = "X" && html3dir=' '
7142
7143 : determine whether to install perl also as /usr/bin/perl
7144
7145 echo " "
7146 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7147         $cat <<EOM
7148 Many scripts expect perl to be installed as /usr/bin/perl.
7149
7150 If you want to, I can install the perl you are about to compile
7151 as /usr/bin/perl (in addition to $bin/perl).
7152 EOM
7153         if test -f /usr/bin/perl; then
7154             $cat <<EOM
7155
7156 However, please note that because you already have a /usr/bin/perl,
7157 overwriting that with a new Perl would very probably cause problems.
7158 Therefore I'm assuming you don't want to do that (unless you insist).
7159
7160 EOM
7161             case "$installusrbinperl" in
7162             "$define"|[yY]*)    dflt='y';;
7163             *)                  dflt='n';;
7164             esac
7165         else
7166             $cat <<EOM
7167
7168 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7169
7170 EOM
7171             case "$installusrbinperl" in
7172             "$undef"|[nN]*)     dflt='n';;
7173             *)                  dflt='y';;
7174             esac
7175         fi
7176         rp="Do you want to install perl as /usr/bin/perl?"
7177         . ./myread
7178         case "$ans" in
7179         [yY]*)  val="$define";;
7180         *)      val="$undef" ;;
7181         esac
7182 else
7183         val="$undef"
7184 fi
7185 set installusrbinperl
7186 eval $setvar
7187
7188 echo " "
7189 echo "Checking for GNU C Library..." >&4
7190 cat >try.c <<'EOCP'
7191 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7192    alone are insufficient to distinguish different versions, such as
7193    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7194    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7195 */
7196 #include <stdio.h>
7197 int main(void)
7198 {
7199 #ifdef __GLIBC__
7200 #   ifdef __GLIBC_MINOR__
7201 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7202 #           include <gnu/libc-version.h>
7203             printf("%s\n",  gnu_get_libc_version());
7204 #       else
7205             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7206 #       endif
7207 #   else
7208         printf("%d\n",  __GLIBC__);
7209 #   endif
7210     return 0;
7211 #else
7212     return 1;
7213 #endif
7214 }
7215 EOCP
7216 set try
7217 if eval $compile_ok && $run ./try > glibc.ver; then
7218         val="$define"
7219         gnulibc_version=`$cat glibc.ver`
7220         echo "You are using the GNU C Library version $gnulibc_version"
7221 else
7222         val="$undef"
7223         gnulibc_version=''
7224         echo "You are not using the GNU C Library"
7225 fi
7226 $rm_try glibc.ver
7227 set d_gnulibc
7228 eval $setvar
7229
7230 : see if nm is to be used to determine whether a symbol is defined or not
7231 case "$usenm" in
7232 '')
7233         dflt=''
7234         case "$d_gnulibc" in
7235         "$define")
7236                 echo " "
7237                 echo "nm probably won't work on the GNU C Library." >&4
7238                 dflt=n
7239                 ;;
7240         esac
7241         case "$dflt" in
7242         '') 
7243                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7244                         echo " "
7245                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7246                         echo "'nm' won't be sufficient on this sytem." >&4
7247                         dflt=n
7248                 fi
7249                 ;;
7250         esac
7251         case "$dflt" in
7252         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7253                 if $test $dflt -gt 20; then
7254                         dflt=y
7255                 else
7256                         dflt=n
7257                 fi
7258                 ;;
7259         esac
7260         ;;
7261 *)
7262         case "$usenm" in
7263         true|$define) dflt=y;;
7264         *) dflt=n;;
7265         esac
7266         ;;
7267 esac
7268 $cat <<EOM
7269
7270 I can use $nm to extract the symbols from your C libraries. This
7271 is a time consuming task which may generate huge output on the disk (up
7272 to 3 megabytes) but that should make the symbols extraction faster. The
7273 alternative is to skip the 'nm' extraction part and to compile a small
7274 test program instead to determine whether each symbol is present. If
7275 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7276 this may be the best solution.
7277
7278 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7279
7280 EOM
7281 rp="Shall I use $nm to extract C symbols from the libraries?"
7282 . ./myread
7283 case "$ans" in
7284 [Nn]*) usenm=false;;
7285 *) usenm=true;;
7286 esac
7287
7288 runnm=$usenm
7289 case "$reuseval" in
7290 true) runnm=false;;
7291 esac
7292
7293 : nm options which may be necessary
7294 case "$nm_opt" in
7295 '') if $test -f /mach_boot; then
7296                 nm_opt=''       # Mach
7297         elif $test -d /usr/ccs/lib; then
7298                 nm_opt='-p'     # Solaris (and SunOS?)
7299         elif $test -f /dgux; then
7300                 nm_opt='-p'     # DG-UX
7301         elif $test -f /lib64/rld; then
7302                 nm_opt='-p'     # 64-bit Irix
7303         else
7304                 nm_opt=''
7305         fi;;
7306 esac
7307
7308 : nm options which may be necessary for shared libraries but illegal
7309 : for archive libraries.  Thank you, Linux.
7310 case "$nm_so_opt" in
7311 '')     case "$myuname" in
7312         *linux*|gnu*)
7313                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7314                         nm_so_opt='--dynamic'
7315                 fi
7316                 ;;
7317         esac
7318         ;;
7319 esac
7320
7321 case "$runnm" in
7322 true)
7323 : get list of predefined functions in a handy place
7324 echo " "
7325 case "$libc" in
7326 '') libc=unknown
7327         case "$libs" in
7328         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7329         esac
7330         ;;
7331 esac
7332 case "$libs" in
7333 '') ;;
7334 *)  for thislib in $libs; do
7335         case "$thislib" in
7336         -lc|-lc_s)
7337                 : Handle C library specially below.
7338                 ;;
7339         -l*)
7340                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7341                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7342                         :
7343                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7344                         :
7345                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7346                         :
7347                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7348                         :
7349                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7350                         :
7351                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7352                         :
7353                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7354                         :
7355                 else
7356                         try=''
7357                 fi
7358                 libnames="$libnames $try"
7359                 ;;
7360         *) libnames="$libnames $thislib" ;;
7361         esac
7362         done
7363         ;;
7364 esac
7365 xxx=normal
7366 case "$libc" in
7367 unknown)
7368         set /lib/libc.$so
7369         for xxx in $libpth; do
7370                 $test -r $1 || set $xxx/libc.$so
7371                 : The messy sed command sorts on library version numbers.
7372                 $test -r $1 || \
7373                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7374                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7375                                 h
7376                                 s/[0-9][0-9]*/0000&/g
7377                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7378                                 G
7379                                 s/\n/ /' | \
7380                          $sort | $sed -e 's/^.* //'`
7381                 eval set \$$#
7382         done
7383         $test -r $1 || set /usr/ccs/lib/libc.$so
7384         $test -r $1 || set /lib/libsys_s$_a
7385         ;;
7386 *)
7387         set blurfl
7388         ;;
7389 esac
7390 if $test -r "$1"; then
7391         echo "Your (shared) C library seems to be in $1."
7392         libc="$1"
7393 elif $test -r /lib/libc && $test -r /lib/clib; then
7394         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7395         xxx=apollo
7396         libc='/lib/clib /lib/libc'
7397         if $test -r /lib/syslib; then
7398                 echo "(Your math library is in /lib/syslib.)"
7399                 libc="$libc /lib/syslib"
7400         fi
7401 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7402         echo "Your C library seems to be in $libc, as you said before."
7403 elif $test -r $incpath/usr/lib/libc$_a; then
7404         libc=$incpath/usr/lib/libc$_a;
7405         echo "Your C library seems to be in $libc.  That's fine."
7406 elif $test -r /lib/libc$_a; then
7407         libc=/lib/libc$_a;
7408         echo "Your C library seems to be in $libc.  You're normal."
7409 else
7410         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7411                 :
7412         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7413                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7414         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7415                 :
7416         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7417                 :
7418         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7419                 :
7420         else
7421                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7422         fi
7423         if $test -r "$tans"; then
7424                 echo "Your C library seems to be in $tans, of all places."
7425                 libc=$tans
7426         else
7427                 libc='blurfl'
7428         fi
7429 fi
7430 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7431         dflt="$libc"
7432         cat <<EOM
7433
7434 If the guess above is wrong (which it might be if you're using a strange
7435 compiler, or your machine supports multiple models), you can override it here.
7436
7437 EOM
7438 else
7439         dflt=''
7440         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7441         cat >&4 <<EOM
7442 I can't seem to find your C library.  I've looked in the following places:
7443
7444 EOM
7445         $sed 's/^/      /' libpath
7446         cat <<EOM
7447
7448 None of these seems to contain your C library. I need to get its name...
7449
7450 EOM
7451 fi
7452 fn=f
7453 rp='Where is your C library?'
7454 . ./getfile
7455 libc="$ans"
7456
7457 echo " "
7458 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7459 set X `cat libnames`
7460 shift
7461 xxx=files
7462 case $# in 1) xxx=file; esac
7463 echo "Extracting names from the following $xxx for later perusal:" >&4
7464 echo " "
7465 $sed 's/^/      /' libnames >&4
7466 echo " "
7467 $echo $n "This may take a while...$c" >&4
7468
7469 for file in $*; do
7470         case $file in
7471         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7472         *) $nm $nm_opt $file 2>/dev/null;;
7473         esac
7474 done >libc.tmp
7475
7476 $echo $n ".$c"
7477 $grep fprintf libc.tmp > libc.ptf
7478 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7479 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7480 xxx='[ADTSIW]'
7481 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7482         eval $xscan;\
7483         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7484                 eval $xrun
7485 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7486         eval $xscan;\
7487         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7488                 eval $xrun
7489 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7490         eval $xscan;\
7491         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7492                 eval $xrun
7493 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7494         eval $xscan;\
7495         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7496                 eval $xrun
7497 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7498         eval $xscan;\
7499         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7500                 eval $xrun
7501 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7502         eval $xscan;\
7503         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7504                 eval $xrun
7505 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7506                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7507         eval $xscan;\
7508         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7509                 eval $xrun
7510 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7511         eval $xscan;\
7512         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7513                 eval $xrun
7514 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7515         eval $xscan;\
7516         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7517                 eval $xrun
7518 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7519         eval $xscan;\
7520         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7521                 eval $xrun
7522 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7523         eval $xscan;\
7524         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7525                 eval $xrun
7526 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7527         eval $xscan;\
7528         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7529                 eval $xrun
7530 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7531         eval $xscan;\
7532         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7533                 eval $xrun
7534 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7535         eval $xscan;\
7536         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7537                 eval $xrun
7538 else
7539         $nm -p $* 2>/dev/null >libc.tmp
7540         $grep fprintf libc.tmp > libc.ptf
7541         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7542                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7543         then
7544                 nm_opt='-p'
7545                 eval $xrun
7546         else
7547                 echo " "
7548                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7549                 com=''
7550                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7551                         for thisname in $libnames $libc; do
7552                                 $ar t $thisname >>libc.tmp
7553                         done
7554                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7555                         echo "Ok." >&4
7556                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7557                         # Repeat libc to extract forwarders to DLL entries too
7558                         for thisname in $libnames $libc; do
7559                                 $ar tv $thisname >>libc.tmp
7560                                 # Revision 50 of EMX has bug in $ar.
7561                                 # it will not extract forwarders to DLL entries
7562                                 # Use emximp which will extract exactly them.
7563                                 emximp -o tmp.imp $thisname \
7564                                     2>/dev/null && \
7565                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7566                                     < tmp.imp >>libc.tmp
7567                                 $rm tmp.imp
7568                         done
7569                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7570                         echo "Ok." >&4
7571                 else
7572                         echo "$ar didn't seem to work right." >&4
7573                         echo "Maybe this is a Cray...trying bld instead..." >&4
7574                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7575                         then
7576                                 for thisname in $libnames; do
7577                                         bld t $libnames | \
7578                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7579                                         $ar t $thisname >>libc.tmp
7580                                 done
7581                                 echo "Ok." >&4
7582                         else
7583                                 echo "That didn't work either.  Giving up." >&4
7584                                 exit 1
7585                         fi
7586                 fi
7587         fi
7588 fi
7589 nm_extract="$com"
7590 case "$PASE" in
7591 define)
7592     echo " "
7593     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7594     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7595     ;;
7596 *)  if $test -f /lib/syscalls.exp; then
7597         echo " "
7598         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7599         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7600     fi
7601     ;;
7602 esac
7603 ;;
7604 esac
7605 $rm -f libnames libpath
7606
7607 : see if dld is available
7608 set dld.h i_dld
7609 eval $inhdr
7610
7611
7612 echo " "
7613 echo "Checking for C++..." >&4
7614 $cat >try.c <<'EOCP'
7615 #include <stdio.h>
7616 int main(void)
7617 {
7618 #ifdef __cplusplus
7619     return 0;
7620 #else
7621     return 1;
7622 #endif
7623 }
7624 EOCP
7625 set try
7626 if eval $compile_ok && $run ./try; then
7627         val="$define"
7628         echo "You are using a C++ compiler."
7629 else
7630         val="$undef"
7631         echo "You are not using a C++ compiler."
7632 fi
7633 $rm_try cplusplus$$
7634 set d_cplusplus
7635 eval $setvar
7636
7637 : is a C symbol defined?
7638 csym='tlook=$1;
7639 case "$3" in
7640 -v) tf=libc.tmp; tdc="";;
7641 -a) tf=libc.tmp; tdc="[]";;
7642 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7643 esac;
7644 tx=yes;
7645 case "$reuseval-$4" in
7646 true-) ;;
7647 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7648 esac;
7649 case "$tx" in
7650 yes)
7651         tval=false;
7652         case "$d_cplusplus" in
7653                 $define) extern_C=\"C\";;
7654         esac;
7655         if $test "$runnm" = true; then
7656                 if $contains $tlook $tf >/dev/null 2>&1; then
7657                         tval=true;
7658                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7659                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7660                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7661                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7662                         $rm_try;
7663                 fi;
7664         else
7665                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7666                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7667                 $rm_try;
7668         fi;
7669         ;;
7670 *)
7671         case "$tval" in
7672         $define) tval=true;;
7673         *) tval=false;;
7674         esac;
7675         ;;
7676 esac;
7677 eval "$2=$tval"'
7678
7679 : define an is-in-libc? function
7680 inlibc='echo " "; td=$define; tu=$undef;
7681 sym=$1; var=$2; eval "was=\$$2";
7682 tx=yes;
7683 case "$reuseval$was" in
7684 true) ;;
7685 true*) tx=no;;
7686 esac;
7687 case "$tx" in
7688 yes)
7689         set $sym tres -f;
7690         eval $csym;
7691         case "$tres" in
7692         true)
7693                 echo "$sym() found." >&4;
7694                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7695         *)
7696                 echo "$sym() NOT found." >&4;
7697                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7698         esac;;
7699 *)
7700         case "$was" in
7701         $define) echo "$sym() found." >&4;;
7702         *) echo "$sym() NOT found." >&4;;
7703         esac;;
7704 esac'
7705
7706 : see if dlopen exists
7707 xxx_runnm="$runnm"
7708 xxx_ccflags="$ccflags"
7709 runnm=false
7710 : with g++ one needs -shared to get is-in-libc to work for dlopen
7711 case "$gccversion" in
7712 '')     ;;
7713 *)      case "$d_cplusplus" in
7714         "$define") ccflags="$ccflags -shared" ;;
7715         esac
7716         ;;
7717 esac
7718 set dlopen d_dlopen
7719 eval $inlibc
7720 runnm="$xxx_runnm"
7721 ccflags="$xxx_ccflags"
7722
7723 : see if this is a unistd.h system
7724 set unistd.h i_unistd
7725 eval $inhdr
7726
7727 : determine which dynamic loading, if any, to compile in
7728 echo " "
7729 dldir="ext/DynaLoader"
7730 case "$usedl" in
7731 $define|y|true)
7732         dflt='y'
7733         usedl="$define"
7734         ;;
7735 $undef|n|false)
7736         dflt='n'
7737         usedl="$undef"
7738         ;;
7739 *)
7740         dflt='n'
7741         case "$d_dlopen" in
7742             $define) dflt='y' ;;
7743         esac
7744         case "$i_dld" in
7745             $define) dflt='y' ;;
7746         esac
7747         : Does a dl_xxx.xs file exist for this operating system
7748         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7749         ;;
7750 esac
7751 rp="Do you wish to use dynamic loading?"
7752 . ./myread
7753 usedl="$ans"
7754 case "$ans" in
7755 y*) usedl="$define"
7756         case "$dlsrc" in
7757         '')
7758                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7759                         dflt="$dldir/dl_${osname}.xs"
7760                 elif $test "$d_dlopen" = "$define" ; then
7761                         dflt="$dldir/dl_dlopen.xs"
7762                 elif $test "$i_dld" = "$define" ; then
7763                         dflt="$dldir/dl_dld.xs"
7764                 else
7765                         dflt=''
7766                 fi
7767                 ;;
7768         *)      dflt="$dldir/$dlsrc"
7769                 ;;
7770         esac
7771     echo "The following dynamic loading files are available:"
7772         : Can not go over to $dldir because getfile has path hard-coded in.
7773         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7774         rp="Source file to use for dynamic loading"
7775         fn="fne"
7776         gfpth="$src"
7777         . ./getfile
7778         usedl="$define"
7779         : emulate basename
7780         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7781
7782         $cat << EOM
7783
7784 Some systems may require passing special flags to $cc -c to
7785 compile modules that will be used to create a shared library.
7786 To use no flags, say "none".
7787
7788 EOM
7789     case "$cccdlflags" in
7790     '') case "$gccversion" in
7791                 '') case "$osname" in
7792                         hpux)   dflt='+z' ;;
7793                         next)   dflt='none' ;;
7794                         irix*)  dflt='-KPIC' ;;
7795                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7796                         sunos)  dflt='-pic' ;;
7797                         *)      dflt='none' ;;
7798                     esac
7799                         ;;
7800                 *)  case "$osname" in
7801                         darwin) dflt='none' ;;
7802                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7803                         *)      dflt='-fpic' ;;
7804                     esac ;;
7805             esac ;;
7806         ' ') dflt='none' ;;
7807     *)  dflt="$cccdlflags" ;;
7808     esac
7809     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7810     . ./myread
7811     case "$ans" in
7812     none) cccdlflags=' ' ;;
7813     *) cccdlflags="$ans" ;;
7814     esac
7815
7816     cat << EOM
7817
7818 Some systems use ld to create libraries that can be dynamically loaded,
7819 while other systems (such as those using ELF) use $cc.
7820
7821 EOM
7822         case "$ld" in
7823         '')     $cat >try.c <<EOM
7824 /* Test for whether ELF binaries are produced */
7825 #include <fcntl.h>
7826 #$i_stdlib I_STDLIB
7827 #ifdef I_STDLIB
7828 #include <stdlib.h>
7829 #endif
7830 #$i_unistd I_UNISTD
7831 #ifdef I_UNISTD
7832 #include <unistd.h>
7833 #endif
7834 int main() {
7835         char b[4];
7836         int i = open("a.out",O_RDONLY);
7837         if(i == -1)
7838                 exit(1); /* fail */
7839         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7840                 exit(0); /* succeed (yes, it's ELF) */
7841         else
7842                 exit(1); /* fail */
7843 }
7844 EOM
7845                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7846                         cat <<EOM
7847 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7848 EOM
7849                         dflt="$cc"
7850                 else
7851                         echo "I'll use ld to build dynamic libraries."
7852                         dflt='ld'
7853                 fi
7854                 $rm_try
7855                 ;;
7856         *)      dflt="$ld"
7857                 ;;
7858         esac
7859
7860     rp="What command should be used to create dynamic libraries?"
7861     . ./myread
7862         ld="$ans"
7863
7864     cat << EOM
7865
7866 Some systems may require passing special flags to $ld to create a
7867 library that can be dynamically loaded.  If your ld flags include
7868 -L/other/path options to locate libraries outside your loader's normal
7869 search path, you may need to specify those -L options here as well.  To
7870 use no flags, say "none".
7871
7872 EOM
7873     case "$lddlflags" in
7874     '') case "$osname" in
7875                         beos) dflt='-nostart' ;;
7876                         hpux) dflt='-b';
7877                               case "$gccversion" in
7878                               '') dflt="$dflt +vnocompatwarnings" ;;
7879                               esac
7880                               ;;
7881                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7882                         next)  dflt='none' ;;
7883                         solaris) dflt='-G' ;;
7884                         sunos) dflt='-assert nodefinitions' ;;
7885                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7886                 *)     dflt='none' ;;
7887                         esac
7888                         ;;
7889     *) dflt="$lddlflags" ;;
7890     esac
7891
7892         : Try to guess additional flags to pick up local libraries.
7893         : Be careful not to append to a plain 'none'
7894         case "$dflt" in
7895         none) dflt='' ;;
7896         esac
7897         for thisflag in $ldflags; do
7898                 case "$thisflag" in
7899                 -L*|-R*|-Wl,-R*)
7900                         case " $dflt " in
7901                         *" $thisflag "*) ;;
7902                         *) dflt="$dflt $thisflag" ;;
7903                         esac
7904                         ;;
7905                 esac
7906         done
7907
7908         case "$dflt" in
7909         ''|' ') dflt='none' ;;
7910         esac
7911
7912     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7913     . ./myread
7914     case "$ans" in
7915     none) lddlflags=' ' ;;
7916     *) lddlflags="$ans" ;;
7917     esac
7918
7919         cat <<EOM
7920
7921 Some systems may require passing special flags to $cc to indicate that
7922 the resulting executable will use dynamic linking.  To use no flags,
7923 say "none".
7924
7925 EOM
7926     case "$ccdlflags" in
7927     '') case "$osname" in
7928             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7929             next|sunos) dflt='none' ;;
7930             *)          dflt='none' ;;
7931             esac ;;
7932     ' ')  dflt='none' ;;
7933     *)  dflt="$ccdlflags" ;;
7934     esac
7935     rp="Any special flags to pass to $cc to use dynamic linking?"
7936     . ./myread
7937     case "$ans" in
7938     none) ccdlflags=' ' ;;
7939     *) ccdlflags="$ans" ;;
7940     esac
7941     ;;
7942 *)  usedl="$undef"
7943         ld='ld'
7944     dlsrc='dl_none.xs'
7945     lddlflags=''
7946     ccdlflags=''
7947     ;;
7948 esac
7949
7950 also=''
7951 case "$usedl" in
7952 $undef)
7953         # No dynamic loading being used, so don't bother even to prompt.
7954         useshrplib='false'
7955         ;;
7956 *)      case "$useshrplib" in
7957         '')     case "$osname" in
7958                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7959                         dflt=y
7960                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7961                         ;;
7962                 next*)
7963                         case "$osvers" in
7964                         4*)     dflt=y
7965                                 also='Building a shared libperl is needed for MAB support.'
7966                                 ;;
7967                         *)      dflt=n
7968                                 ;;
7969                         esac
7970                         ;;
7971                 *)      dflt=n
7972                         ;;
7973                 esac
7974                 ;;
7975         $define|true|[Yy]*)
7976                 dflt=y
7977                 ;;
7978         *)      dflt=n
7979                 ;;
7980         esac
7981         $cat << EOM
7982
7983 The perl executable is normally obtained by linking perlmain.c with
7984 libperl${_a}, any static extensions (usually just DynaLoader), and
7985 any other libraries needed on this system (such as -lm, etc.).  Since
7986 your system supports dynamic loading, it is probably possible to build
7987 a shared libperl.$so.  If you will have more than one executable linked
7988 to libperl.$so, this will significantly reduce the size of each
7989 executable, but it may have a noticeable effect on performance.  The
7990 default is probably sensible for your system.
7991 $also
7992
7993 EOM
7994         rp="Build a shared libperl.$so (y/n)"
7995         . ./myread
7996         case "$ans" in
7997         true|$define|[Yy]*)
7998                 useshrplib='true'  ;;
7999         *)      useshrplib='false' ;;
8000         esac
8001         ;;
8002 esac
8003
8004 case "$useshrplib" in
8005 true)
8006         case "$libperl" in
8007         '')
8008                 # Figure out a good name for libperl.so.  Since it gets stored in
8009                 # a version-specific architecture-dependent library, the version
8010                 # number isn't really that important, except for making cc/ld happy.
8011                 #
8012                 # A name such as libperl.so.3.1
8013                 majmin="libperl.$so.$patchlevel.$subversion"
8014                 # A name such as libperl.so.301
8015                 majonly=`echo $patchlevel $subversion |
8016                         $awk '{printf "%d%02d", $1, $2}'`
8017                 majonly=libperl.$so.$majonly
8018                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8019                 # rely on figuring it out from the naming of libc.
8020                 case "${osname}${osvers}" in
8021                 next4*)
8022                         dflt=libperl.5.$so
8023                         # XXX How handle the --version stuff for MAB?
8024                         ;;
8025                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8026                         dflt=libperl.$so
8027                         ;;
8028                 cygwin*) # ld links against an importlib
8029                         dflt=libperl$lib_ext
8030                         ;;
8031                 *)      # Try to guess based on whether libc has major.minor.
8032                         case "$libc" in
8033                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8034                         *libc.$so.[0-9]*) dflt=$majonly ;;
8035                         *)      dflt=libperl.$so ;;
8036                         esac
8037                         ;;
8038                 esac
8039                 ;;
8040         *)      dflt=$libperl
8041                 ;;
8042         esac
8043         cat << EOM
8044
8045 I need to select a good name for the shared libperl.  If your system uses
8046 library names with major and minor numbers, then you might want something
8047 like $majmin.  Alternatively, if your system uses a single version
8048 number for shared libraries, then you might want to use $majonly.
8049 Or, your system might be quite happy with a simple libperl.$so.
8050
8051 Since the shared libperl will get installed into a version-specific
8052 architecture-dependent directory, the version number of the shared perl
8053 library probably isn't important, so the default should be o.k.
8054
8055 EOM
8056         rp='What name do you want to give to the shared libperl?'
8057         . ./myread
8058         libperl=$ans
8059         echo "Ok, I'll use $libperl"
8060         ;;
8061 *)
8062         libperl="libperl${_a}"
8063         ;;
8064 esac
8065
8066 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8067 case "$shrpdir" in
8068 '') ;;
8069 *)      $cat >&4 <<EOM
8070 WARNING:  Use of the shrpdir variable for the installation location of
8071 the shared $libperl is not supported.  It was never documented and
8072 will not work in this version.  Let me (perlbug@perl.org)
8073 know of any problems this may cause.
8074
8075 EOM
8076         case "$shrpdir" in
8077         "$archlibexp/CORE")
8078                 $cat >&4 <<EOM
8079 But your current setting of $shrpdir is
8080 the default anyway, so it's harmless.
8081 EOM
8082                 ;;
8083         *)
8084                 $cat >&4 <<EOM
8085 Further, your current attempted setting of $shrpdir
8086 conflicts with the value of $archlibexp/CORE
8087 that installperl will use.
8088 EOM
8089                 ;;
8090         esac
8091         ;;
8092 esac
8093
8094 # How will the perl executable find the installed shared $libperl?
8095 # Add $xxx to ccdlflags.
8096 # If we can't figure out a command-line option, use $shrpenv to
8097 # set env LD_RUN_PATH.  The main perl makefile uses this.
8098 shrpdir=$archlibexp/CORE
8099 xxx=''
8100 tmp_shrpenv=''
8101 if "$useshrplib"; then
8102     case "$osname" in 
8103         aix)
8104                 # We'll set it in Makefile.SH...
8105                 ;;
8106         solaris)
8107                 xxx="-R $shrpdir"
8108                 ;;
8109         freebsd|netbsd|openbsd|interix|dragonfly)
8110                 xxx="-Wl,-R$shrpdir"
8111                 ;;
8112         bsdos|linux|irix*|dec_osf|gnu*)
8113                 xxx="-Wl,-rpath,$shrpdir"
8114                 ;;
8115         next)
8116                 # next doesn't like the default...
8117                 ;;
8118         beos)
8119                 # beos doesn't like the default, either.
8120                 ;;
8121         hpux*)
8122                 # hpux doesn't like the default, either.
8123                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8124                 ;;
8125         *)
8126                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8127                 ;;
8128         esac
8129         case "$xxx" in
8130         '') ;;
8131         *)      
8132                 # Only add $xxx if it isn't already in ccdlflags.
8133                 case " $ccdlflags " in
8134                 *" $xxx "*)     ;;
8135                 *)      ccdlflags="$ccdlflags $xxx"
8136                         cat <<EOM >&4
8137
8138 Adding $xxx to the flags
8139 passed to $ld so that the perl executable will find the 
8140 installed shared $libperl.
8141
8142 EOM
8143                         ;;
8144                 esac
8145                 ;;
8146         esac
8147 fi
8148 # Fix ccdlflags in AIX for building external extensions.
8149 # (For building Perl itself bare -bE:perl.exp is needed,
8150 #  Makefile.SH takes care of this.)
8151 case "$osname" in
8152 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8153 esac
8154 # Respect a hint or command-line value.
8155 case "$shrpenv" in
8156 '') shrpenv="$tmp_shrpenv" ;;
8157 esac
8158 case "$ldlibpthname" in
8159 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8160 none)   ldlibpthname='' ;;
8161 esac
8162
8163 : determine where manual pages are on this system
8164 echo " "
8165 case "$sysman" in
8166 '') 
8167         syspath='/usr/share/man/man1 /usr/man/man1'
8168         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8169         syspath="$syspath /usr/man/u_man/man1"
8170         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8171         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8172         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8173         sysman=`./loc . /usr/man/man1 $syspath`
8174         ;;
8175 esac
8176 if $test -d "$sysman"; then
8177         echo "System manual is in $sysman." >&4
8178 else
8179         echo "Could not find manual pages in source form." >&4
8180 fi
8181
8182 : determine where manual pages go
8183 set man1dir man1dir none
8184 eval $prefixit
8185 $cat <<EOM
8186
8187 $spackage has manual pages available in source form.
8188 EOM
8189 case "$nroff" in
8190 nroff)
8191         echo "However, you don't have nroff, so they're probably useless to you."
8192         case "$man1dir" in
8193         '') man1dir="none";;
8194         esac;;
8195 esac
8196 echo "If you don't want the manual sources installed, answer 'none'."
8197 case "$man1dir" in
8198 ' ') dflt=none
8199         ;;
8200 '')
8201         lookpath="$prefixexp/share/man/man1"
8202         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8203         lookpath="$lookpath $prefixexp/man/p_man/man1"
8204         lookpath="$lookpath $prefixexp/man/u_man/man1"
8205         lookpath="$lookpath $prefixexp/man/man.1"
8206         case "$sysman" in
8207         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8208         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8209         esac
8210         set dflt
8211         eval $prefixup
8212         ;;
8213 *)  dflt="$man1dir"
8214         ;;
8215 esac
8216 echo " "
8217 fn=dn+~
8218 rp="Where do the main $spackage manual pages (source) go?"
8219 . ./getfile
8220 if $test "X$man1direxp" != "X$ansexp"; then
8221         installman1dir=''
8222 fi
8223 prefixvar=man1dir
8224 . ./setprefixvar
8225
8226 case "$man1dir" in
8227 '')     man1dir=' '
8228         installman1dir='';;
8229 esac
8230
8231 : What suffix to use on installed man pages
8232
8233 case "$man1dir" in
8234 ' ')
8235         man1ext='0'
8236         ;;
8237 *)
8238         rp="What suffix should be used for the main $spackage man pages?"
8239         case "$man1ext" in
8240         '')     case "$man1dir" in
8241                 *1)  dflt=1 ;;
8242                 *1p) dflt=1p ;;
8243                 *1pm) dflt=1pm ;;
8244                 *l) dflt=l;;
8245                 *n) dflt=n;;
8246                 *o) dflt=o;;
8247                 *p) dflt=p;;
8248                 *C) dflt=C;;
8249                 *L) dflt=L;;
8250                 *L1) dflt=L1;;
8251                 *) dflt=1;;
8252                 esac
8253                 ;;
8254         *)      dflt="$man1ext";;
8255         esac
8256         . ./myread
8257         man1ext="$ans"
8258         ;;
8259 esac
8260
8261 : see if we can have long filenames
8262 echo " "
8263 first=123456789abcdef
8264 $rm -f $first
8265 if (echo hi >$first) 2>/dev/null; then
8266         if $test -f 123456789abcde; then
8267                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8268                 val="$undef"
8269         else
8270                 echo 'You can have filenames longer than 14 characters.'>&4
8271                 val="$define"
8272         fi
8273 else
8274         $cat <<'EOM'
8275 You can't have filenames longer than 14 chars.
8276 You can't even think about them!
8277 EOM
8278         val="$undef"
8279 fi 
8280 set d_flexfnam
8281 eval $setvar
8282 $rm -rf 123456789abcde*
8283
8284 : determine where library module manual pages go
8285 set man3dir man3dir none
8286 eval $prefixit
8287 $cat <<EOM
8288
8289 $spackage has manual pages for many of the library modules.
8290 EOM
8291
8292 case "$nroff" in
8293 nroff)
8294         $cat <<'EOM'
8295 However, you don't have nroff, so they're probably useless to you.
8296 EOM
8297         case "$man3dir" in
8298         '') man3dir="none";;
8299         esac;;
8300 esac
8301
8302 case "$d_flexfnam" in
8303 undef)
8304         $cat <<'EOM'
8305 However, your system can't handle the long file names like File::Basename.3.
8306 EOM
8307         case "$man3dir" in
8308         '') man3dir="none";;
8309         esac;;
8310 esac
8311
8312 echo "If you don't want the manual sources installed, answer 'none'."
8313 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8314 case "$man3dir" in
8315 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8316         if $test -d "$privlib/man/man3"; then
8317                 cat <<EOM >&4
8318
8319 WARNING:  Previous versions of perl installed man3 pages into
8320 $privlib/man/man3.  This version will suggest a
8321 new default of $dflt.
8322 EOM
8323                 tdflt=$dflt
8324                 dflt='n'
8325                 rp='Do you wish to preserve the old behavior?(y/n)'
8326                 . ./myread
8327                 case "$ans" in
8328                 y*) dflt="$privlib/man/man3" ;;
8329                 *)  dflt=$tdflt ;;
8330                 esac
8331     fi
8332         ;;
8333 *)      dflt="$man3dir" ;;
8334 esac
8335 case "$dflt" in
8336 ' ') dflt=none ;;
8337 esac
8338 echo " "
8339 fn=dn+~
8340 rp="Where do the $package library man pages (source) go?"
8341 . ./getfile
8342 prefixvar=man3dir
8343 . ./setprefixvar
8344
8345 case "$man3dir" in
8346 '')     man3dir=' '
8347         installman3dir='';;
8348 esac
8349
8350 : What suffix to use on installed man pages
8351 case "$man3dir" in
8352 ' ')
8353         man3ext='0'
8354         ;;
8355 *)
8356         rp="What suffix should be used for the $package library man pages?"
8357         case "$man3ext" in
8358         '')     case "$man3dir" in
8359                 *3)  dflt=3 ;;
8360                 *3p) dflt=3p ;;
8361                 *3pm) dflt=3pm ;;
8362                 *l) dflt=l;;
8363                 *n) dflt=n;;
8364                 *o) dflt=o;;
8365                 *p) dflt=p;;
8366                 *C) dflt=C;;
8367                 *L) dflt=L;;
8368                 *L3) dflt=L3;;
8369                 *) dflt=3;;
8370                 esac
8371                 ;;
8372         *)      dflt="$man3ext";;
8373         esac
8374         . ./myread
8375         man3ext="$ans"
8376         ;;
8377 esac
8378
8379 : see if we have to deal with yellow pages, now NIS.
8380 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8381         if $test -f /usr/etc/nibindd; then
8382                 echo " "
8383                 echo "I'm fairly confident you're on a NeXT."
8384                 echo " "
8385                 rp='Do you get the hosts file via NetInfo?'
8386                 dflt=y
8387                 case "$hostcat" in
8388                 nidump*) ;;
8389                 '') ;;
8390                 *) dflt=n;;
8391                 esac
8392                 . ./myread
8393                 case "$ans" in
8394                 y*) hostcat='nidump hosts .';;
8395                 *)      case "$hostcat" in
8396                         nidump*) hostcat='';;
8397                         esac
8398                         ;;
8399                 esac
8400         fi
8401         case "$hostcat" in
8402         nidump*) ;;
8403         *)
8404                 case "$hostcat" in
8405                 *ypcat*) dflt=y;;
8406                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8407                                 dflt=y
8408                         else
8409                                 dflt=n
8410                         fi;;
8411                 *) dflt=n;;
8412                 esac
8413                 echo " "
8414                 rp='Are you getting the hosts file via yellow pages?'
8415                 . ./myread
8416                 case "$ans" in
8417                 y*) hostcat='ypcat hosts';;
8418                 *) hostcat='cat /etc/hosts';;
8419                 esac
8420                 ;;
8421         esac
8422 fi
8423 case "$hostcat" in
8424 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8425 esac
8426 case "$groupcat" in
8427 '') test -f /etc/group && groupcat='cat /etc/group';;
8428 esac
8429 case "$passcat" in
8430 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8431 esac
8432
8433 : now get the host name
8434 echo " "
8435 echo "Figuring out host name..." >&4
8436 case "$myhostname" in
8437 '') cont=true
8438         echo 'Maybe "hostname" will work...'
8439         if tans=`sh -c hostname 2>&1` ; then
8440                 myhostname=$tans
8441                 phostname=hostname
8442                 cont=''
8443         fi
8444         ;;
8445 *) cont='';;
8446 esac
8447 if $test "$cont"; then
8448         if ./xenix; then
8449                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8450                 if tans=`cat /etc/systemid 2>&1` ; then
8451                         myhostname=$tans
8452                         phostname='cat /etc/systemid'
8453                         echo "Whadyaknow.  Xenix always was a bit strange..."
8454                         cont=''
8455                 fi
8456         elif $test -r /etc/systemid; then
8457                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8458         fi
8459 fi
8460 if $test "$cont"; then
8461         echo 'No, maybe "uuname -l" will work...'
8462         if tans=`sh -c 'uuname -l' 2>&1` ; then
8463                 myhostname=$tans
8464                 phostname='uuname -l'
8465         else
8466                 echo 'Strange.  Maybe "uname -n" will work...'
8467                 if tans=`sh -c 'uname -n' 2>&1` ; then
8468                         myhostname=$tans
8469                         phostname='uname -n'
8470                 else
8471                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8472                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8473                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8474                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8475                         else
8476                                 case "$myhostname" in
8477                                 '') echo "Does this machine have an identity crisis or something?"
8478                                         phostname='';;
8479                                 *)
8480                                         echo "Well, you said $myhostname before..."
8481                                         phostname='echo $myhostname';;
8482                                 esac
8483                         fi
8484                 fi
8485         fi
8486 fi
8487 case "$myhostname" in
8488 '') myhostname=noname ;;
8489 esac
8490 : you do not want to know about this
8491 set $myhostname
8492 myhostname=$1
8493
8494 : verify guess
8495 if $test "$myhostname" ; then
8496         dflt=y
8497         rp='Your host name appears to be "'$myhostname'".'" Right?"
8498         . ./myread
8499         case "$ans" in
8500         y*) ;;
8501         *) myhostname='';;
8502         esac
8503 fi
8504
8505 : bad guess or no guess
8506 while $test "X$myhostname" = X ; do
8507         dflt=''
8508         rp="Please type the (one word) name of your host:"
8509         . ./myread
8510         myhostname="$ans"
8511 done
8512
8513 : translate upper to lower if necessary
8514 case "$myhostname" in
8515 *[A-Z]*)
8516         echo "(Normalizing case in your host name)"
8517         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8518         ;;
8519 esac
8520
8521 case "$myhostname" in
8522 *.*)
8523         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8524         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8525         echo "(Trimming domain name from host name--host name is now $myhostname)"
8526         ;;
8527 *) case "$mydomain" in
8528         '')
8529                 {
8530                         test "X$hostcat" = "Xypcat hosts" &&
8531                         ypmatch "$myhostname" hosts 2>/dev/null |\
8532                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8533                         $test -s hosts
8534                 } || {
8535                         test "X$hostcat" != "X" &&
8536                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8537                                         /[       ]$myhostname[  . ]/p" > hosts
8538                 }
8539                 tmp_re="[       . ]"
8540                 if $test -f hosts; then
8541                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8542                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8543                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8544                                 hosts | $sort | $uniq | \
8545                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8546                         case `$echo X$dflt` in
8547                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8548                                 dflt=.
8549                                 ;;
8550                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8551                                 ;;
8552                         esac
8553                 else
8554                         echo "(I cannot locate a hosts database anywhere)"
8555                         dflt=.
8556                 fi
8557                 case "$dflt" in
8558                 .)
8559                         tans=`./loc resolv.conf X /etc /usr/etc`
8560                         if $test -f "$tans"; then
8561                                 echo "(Attempting domain name extraction from $tans)"
8562                                 dflt=.`$sed -n -e 's/   / /g' \
8563                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8564                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8565                                 case "$dflt" in
8566                                 .) dflt=.`$sed -n -e 's/        / /g' \
8567                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8568                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8569                                         ;;
8570                                 esac
8571                         fi
8572                         ;;
8573                 esac
8574                 case "$dflt" in
8575                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8576                         dflt=.`sh -c domainname 2>/dev/null`
8577                         case "$dflt" in
8578                         '') dflt='.';;
8579                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8580                         esac
8581                         ;;
8582                 esac
8583                 case "$dflt$osname" in
8584                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8585                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8586                         ;;
8587                 esac
8588                 case "$dflt" in
8589                 .) echo "(Lost all hope -- silly guess then)"
8590                         dflt='.nonet'
8591                         ;;
8592                 esac
8593                 $rm -f hosts
8594                 ;;
8595         *) dflt="$mydomain";;
8596         esac;;
8597 esac
8598 echo " "
8599 rp="What is your domain name?"
8600 . ./myread
8601 tans="$ans"
8602 case "$ans" in
8603 '') ;;
8604 .*) ;;
8605 *) tans=".$tans";;
8606 esac
8607 mydomain="$tans"
8608
8609 : translate upper to lower if necessary
8610 case "$mydomain" in
8611 *[A-Z]*)
8612         echo "(Normalizing case in your domain name)"
8613         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8614         ;;
8615 esac
8616
8617 : a little sanity check here
8618 case "$phostname" in
8619 '') ;;
8620 *)
8621         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8622         $myhostname$mydomain|$myhostname) ;;
8623         *)
8624                 case "$phostname" in
8625                 sed*)
8626                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8627                         ;;
8628                 *)
8629                         echo "(That doesn't agree with your $phostname command, by the way.)"
8630                         ;;
8631                 esac
8632         ;;
8633         esac
8634         ;;
8635 esac
8636
8637 $cat <<EOM
8638
8639 I need to get your e-mail address in Internet format if possible, i.e.
8640 something like user@host.domain. Please answer accurately since I have
8641 no easy means to double check it. The default value provided below
8642 is most probably close to reality but may not be valid from outside
8643 your organization...
8644
8645 EOM
8646 cont=x
8647 while test "$cont"; do
8648         case "$cf_email" in
8649         '') dflt="$cf_by@$myhostname$mydomain";;
8650         *) dflt="$cf_email";;
8651         esac
8652         rp='What is your e-mail address?'
8653         . ./myread
8654         cf_email="$ans"
8655         case "$cf_email" in
8656         *@*.*) cont='' ;;
8657         *)
8658                 rp='Address does not look like an Internet one.  Use it anyway?'
8659                 case "$fastread" in
8660                 yes) dflt=y ;;
8661                 *) dflt=n ;;
8662                 esac
8663                 . ./myread
8664                 case "$ans" in
8665                 y*) cont='' ;;
8666                 *) echo " " ;;
8667                 esac
8668                 ;;
8669         esac
8670 done
8671
8672 $cat <<EOM
8673
8674 If you or somebody else will be maintaining perl at your site, please
8675 fill in the correct e-mail address here so that they may be contacted
8676 if necessary. Currently, the "perlbug" program included with perl
8677 will send mail to this address in addition to perlbug@perl.org. You may
8678 enter "none" for no administrator.
8679
8680 EOM
8681 case "$perladmin" in
8682 '') dflt="$cf_email";;
8683 *) dflt="$perladmin";;
8684 esac
8685 rp='Perl administrator e-mail address'
8686 . ./myread
8687 perladmin="$ans"
8688
8689 : determine whether to only install version-specific parts.
8690 echo " "
8691 $cat <<EOM
8692 Do you want to install only the version-specific parts of the perl
8693 distribution?  Usually you do *not* want to do this.
8694 EOM
8695 case "$versiononly" in
8696 "$define"|[Yy]*|true) dflt='y' ;;
8697 *) dflt='n';
8698 esac
8699 rp="Do you want to install only the version-specific parts of perl?"
8700 . ./myread
8701 case "$ans" in
8702 [yY]*)  val="$define";;
8703 *)      val="$undef" ;;
8704 esac
8705 set versiononly
8706 eval $setvar
8707
8708 case "$versiononly" in
8709 "$define") inc_version_list=''
8710            inc_version_list_init=0
8711            ;;
8712 esac
8713
8714 : figure out how to guarantee perl startup
8715 : XXX Note that this currently takes advantage of the bug that binexp ignores
8716 :     the Configure -Dinstallprefix setting, which in turn means that under
8717 :     relocatable @INC, initialinstalllocation is what binexp started as.
8718 case "$startperl" in
8719 '')
8720         case "$sharpbang" in
8721         *!)
8722                 $cat <<EOH
8723
8724 I can use the #! construct to start perl on your system. This will
8725 make startup of perl scripts faster, but may cause problems if you
8726 want to share those scripts and perl is not in a standard place
8727 ($initialinstalllocation/perl) on all your platforms. The alternative
8728 is to force a shell by starting the script with a single ':' character.
8729
8730 EOH
8731                 case "$versiononly" in
8732                 "$define")      dflt="$initialinstalllocation/perl$version";;
8733                 *)              dflt="$initialinstalllocation/perl";;
8734                 esac
8735                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8736                 . ./myread
8737                 case "$ans" in
8738                 none)   startperl=": # use perl";;
8739                 *)      startperl="#!$ans"
8740                         if $test 30 -lt `echo "$ans" | wc -c`; then
8741                                 $cat >&4 <<EOM
8742
8743 WARNING:  Some systems limit the #! command to 32 characters.
8744 If you experience difficulty running Perl scripts with #!, try
8745 installing Perl in a directory with a shorter pathname.
8746
8747 EOM
8748                         fi ;;
8749                 esac
8750                 ;;
8751         *) startperl=": # use perl"
8752                 ;;
8753         esac
8754         ;;
8755 esac
8756 echo "I'll use $startperl to start perl scripts."
8757
8758 : figure best path for perl in scripts
8759 case "$perlpath" in
8760 '')
8761         case "$versiononly" in
8762         "$define")      perlpath="$initialinstalllocation/perl$version";;
8763         *)              perlpath="$initialinstalllocation/perl";;
8764         esac
8765         case "$startperl" in
8766         *!*) ;;
8767         *)
8768                 $cat <<EOH
8769
8770 I will use the "eval 'exec'" idiom to start Perl on your system.
8771 I can use the full path of your Perl binary for this purpose, but
8772 doing so may cause problems if you want to share those scripts and
8773 Perl is not always in a standard place ($initialinstalllocation/perl).
8774
8775 EOH
8776                 dflt="$initialinstalllocation/perl"
8777                 rp="What path shall I use in \"eval 'exec'\"?"
8778                 . ./myread
8779                 perlpath="$ans"
8780                 ;;
8781         esac
8782         ;;
8783 esac
8784 case "$startperl" in
8785 *!*)    ;;
8786 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8787 esac
8788
8789 : determine where public executable scripts go
8790 set scriptdir scriptdir
8791 eval $prefixit
8792 case "$scriptdir" in
8793 '')
8794         dflt="$bin"
8795         : guess some guesses
8796         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8797         $test -d /usr/share/bin     && dflt=/usr/share/bin
8798         $test -d /usr/local/script  && dflt=/usr/local/script
8799         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8800         $test -d $prefixexp/script  && dflt=$prefixexp/script
8801         set dflt
8802         eval $prefixup
8803         ;;
8804 *)  dflt="$scriptdir"
8805         ;;
8806 esac
8807 $cat <<EOM
8808
8809 Some installations have a separate directory just for executable scripts so
8810 that they can mount it across multiple architectures but keep the scripts in
8811 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8812 Or you might just lump your scripts in with all your other executables.
8813
8814 EOM
8815 fn=d~
8816 rp='Where do you keep publicly executable scripts?'
8817 . ./getfile
8818 if $test "X$ansexp" != "X$scriptdirexp"; then
8819         installscript=''
8820 fi
8821 installscriptdir=''
8822 prefixvar=scriptdir
8823 . ./setprefixvar
8824 : A little fix up for an irregularly named variable.
8825 installscript="$installscriptdir"
8826
8827 : determine where add-on public executables go
8828 case "$sitebin" in
8829 '')     dflt=$siteprefix/bin ;;
8830 *)      dflt=$sitebin ;;
8831 esac
8832 fn=d~
8833 rp='Pathname where the add-on public executables should be installed?'
8834 . ./getfile
8835 prefixvar=sitebin
8836 . ./setprefixvar
8837
8838 : determine where add-on html pages go
8839 : There is no standard location, so try to copy the previously-selected
8840 : directory structure for the core html pages.
8841 case "$sitehtml1dir" in
8842 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8843 *)     dflt=$sitehtml1dir ;;
8844 esac
8845 case "$dflt" in
8846 ''|' ') dflt=none ;;
8847 esac
8848 fn=dn+~
8849 rp='Pathname where the site-specific html pages should be installed?'
8850 . ./getfile
8851 prefixvar=sitehtml1dir
8852 . ./setprefixvar
8853
8854 : determine where add-on library html pages go
8855 : There is no standard location, so try to copy the previously-selected
8856 : directory structure for the core html pages.
8857 case "$sitehtml3dir" in
8858 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8859 *)     dflt=$sitehtml3dir ;;
8860 esac
8861 case "$dflt" in
8862 ''|' ') dflt=none ;;
8863 esac
8864 fn=dn+~
8865 rp='Pathname where the site-specific library html pages should be installed?'
8866 . ./getfile
8867 prefixvar=sitehtml3dir
8868 . ./setprefixvar
8869
8870 : determine where add-on manual pages go
8871 case "$siteman1dir" in
8872 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8873 *)      dflt=$siteman1dir ;;
8874 esac
8875 case "$dflt" in
8876 ''|' ') dflt=none ;;
8877 esac
8878 fn=dn+~
8879 rp='Pathname where the site-specific manual pages should be installed?'
8880 . ./getfile
8881 prefixvar=siteman1dir
8882 . ./setprefixvar
8883
8884 : determine where add-on library man pages go
8885 case "$siteman3dir" in
8886 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8887 *)      dflt=$siteman3dir ;;
8888 esac
8889 case "$dflt" in
8890 ''|' ') dflt=none ;;
8891 esac
8892 fn=dn+~
8893 rp='Pathname where the site-specific library manual pages should be installed?'
8894 . ./getfile
8895 prefixvar=siteman3dir
8896 . ./setprefixvar
8897
8898 : determine where add-on public executable scripts go
8899 case "$sitescript" in
8900 '')     dflt=$siteprefix/script
8901         $test -d $dflt || dflt=$sitebin ;;
8902 *)  dflt="$sitescript" ;;
8903 esac
8904 fn=d~+
8905 rp='Pathname where add-on public executable scripts should be installed?'
8906 . ./getfile
8907 prefixvar=sitescript
8908 . ./setprefixvar
8909
8910 case "$usefaststdio" in
8911 $define|true|[yY]*|'')
8912         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8913         case "$xversion" in
8914         [68])   dflt='y' ;;
8915         *)      dflt='n' ;;
8916         esac
8917         ;;
8918 *) dflt='n';;
8919 esac
8920 cat <<EOM
8921
8922 Perl can be built to use 'fast stdio', which means using the stdio
8923 library but also directly manipulating the stdio buffers to enable
8924 faster I/O.  Using stdio is better for backward compatibility (especially
8925 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8926 interface has been preferred instead of stdio.
8927
8928 If this doesn't make any sense to you, just accept the default '$dflt'.
8929 EOM
8930 rp='Use the "fast stdio" if available?'
8931 . ./myread
8932 case "$ans" in
8933 y|Y)    val="$define" ;;     
8934 *)      val="$undef" ;;
8935 esac
8936 set usefaststdio
8937 eval $setvar
8938
8939
8940 : define an is-a-typedef? function
8941 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8942 case "$inclist" in
8943 "") inclist="sys/types.h";;
8944 esac;
8945 eval "varval=\$$var";
8946 case "$varval" in
8947 "")
8948         $rm -f temp.c;
8949         for inc in $inclist; do
8950                 echo "#include <$inc>" >>temp.c;
8951         done;
8952         echo "#ifdef $type" >> temp.c;
8953         echo "printf(\"We have $type\");" >> temp.c;
8954         echo "#endif" >> temp.c;
8955         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8956         if $contains $type temp.E >/dev/null 2>&1; then
8957                 eval "$var=\$type";
8958         else
8959                 eval "$var=\$def";
8960         fi;
8961         $rm -f temp.?;;
8962 *) eval "$var=\$varval";;
8963 esac'
8964
8965 : define an is-a-typedef? function that prompts if the type is not available.
8966 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8967 case "$inclist" in
8968 "") inclist="sys/types.h";;
8969 esac;
8970 eval "varval=\$$var";
8971 case "$varval" in
8972 "")
8973         $rm -f temp.c;
8974         for inc in $inclist; do
8975                 echo "#include <$inc>" >>temp.c;
8976         done;
8977         echo "#ifdef $type" >> temp.c;
8978         echo "printf(\"We have $type\");" >> temp.c;
8979         echo "#endif" >> temp.c;
8980         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8981         echo " " ;
8982         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8983         if $contains $type temp.E >/dev/null 2>&1; then
8984                 echo "$type found." >&4;
8985                 eval "$var=\$type";
8986         else
8987                 echo "$type NOT found." >&4;
8988                 dflt="$def";
8989                 . ./myread ;
8990                 eval "$var=\$ans";
8991         fi;
8992         $rm -f temp.?;;
8993 *) eval "$var=\$varval";;
8994 esac'
8995
8996 : see what type lseek is declared as in the kernel
8997 rp="What is the type used for lseek's offset on this system?"
8998 set off_t lseektype long stdio.h sys/types.h
8999 eval $typedef_ask
9000
9001 echo " "
9002 echo "Checking to see how big your file offsets are..." >&4
9003 $cat >try.c <<EOCP
9004 #include <sys/types.h>
9005 #include <stdio.h>
9006 int main()
9007 {
9008     printf("%d\n", (int)sizeof($lseektype));
9009     return(0);
9010 }
9011 EOCP
9012 set try
9013 if eval $compile_ok; then
9014         lseeksize=`$run ./try`
9015         echo "Your file offsets are $lseeksize bytes long."
9016 else
9017         dflt=$longsize
9018         echo " "
9019         echo "(I can't seem to compile the test program.  Guessing...)"
9020         rp="What is the size of your file offsets (in bytes)?"
9021         . ./myread
9022         lseeksize="$ans"
9023 fi
9024 $rm_try
9025
9026 : see what type file positions are declared as in the library
9027 rp="What is the type for file position used by fsetpos()?"
9028 set fpos_t fpostype long stdio.h sys/types.h
9029 eval $typedef_ask
9030
9031 echo " "
9032 case "$fpostype" in
9033 *_t) zzz="$fpostype"    ;;
9034 *)   zzz="fpos_t"       ;;
9035 esac
9036 echo "Checking the size of $zzz..." >&4 
9037 cat > try.c <<EOCP
9038 #include <sys/types.h>
9039 #include <stdio.h>
9040 #$i_stdlib I_STDLIB
9041 #ifdef I_STDLIB
9042 #include <stdlib.h>
9043 #endif
9044 int main() {
9045     printf("%d\n", (int)sizeof($fpostype));
9046     exit(0);
9047 }
9048 EOCP
9049 set try
9050 if eval $compile_ok; then
9051         yyy=`$run ./try`
9052         case "$yyy" in
9053         '')     fpossize=4
9054                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9055                 ;;
9056         *)      fpossize=$yyy
9057                 echo "Your $zzz is $fpossize bytes long."
9058                 ;;
9059         esac
9060 else
9061         dflt="$longsize"
9062         echo " " >&4
9063         echo "(I can't compile the test program.  Guessing...)" >&4
9064         rp="What is the size of your file positions (in bytes)?"
9065         . ./myread
9066         fpossize="$ans"
9067 fi
9068
9069 # Backward compatibility (uselfs is deprecated).
9070 case "$uselfs" in
9071 "$define"|true|[yY]*)
9072         cat <<EOM >&4
9073
9074 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9075 EOM
9076         uselargefiles="$define"
9077         ;;
9078 esac
9079
9080 case "$lseeksize:$fpossize" in
9081 8:8) cat <<EOM
9082
9083 You can have files larger than 2 gigabytes.
9084 EOM
9085    val="$define" ;;
9086 *)    case "$uselargefiles" in
9087    "$undef"|false|[nN]*) dflt='n' ;;
9088    *)   dflt='y' ;;
9089    esac
9090    cat <<EOM
9091
9092 Perl can be built to understand large files (files larger than 2 gigabytes)
9093 on some systems.  To do so, Configure can be run with -Duselargefiles.
9094
9095 If this doesn't make any sense to you, just accept the default '$dflt'.
9096 EOM
9097    rp='Try to understand large files, if available?'
9098    . ./myread
9099    case "$ans" in
9100    y|Y)         val="$define" ;;
9101    *)           val="$undef"  ;;
9102    esac
9103    ;;
9104 esac
9105 set uselargefiles
9106 eval $setvar
9107 : Look for a hint-file generated 'call-back-unit'.  If the
9108 : user has specified that a large files perl is to be built,
9109 : we may need to set or change some other defaults.
9110 if $test -f uselargefiles.cbu; then
9111         echo "Your platform has some specific hints regarding large file builds, using them..."
9112         . ./uselargefiles.cbu
9113 fi
9114 case "$uselargefiles" in
9115 "$define")
9116         if $test -f uselargefiles.cbu; then
9117                 echo " "
9118                 echo "Rechecking to see how big your file offsets are..." >&4
9119                 $cat >try.c <<EOCP
9120 #include <sys/types.h>
9121 #include <stdio.h>
9122 int main()
9123 {
9124     printf("%d\n", (int)sizeof($lseektype));
9125     return(0);
9126 }
9127 EOCP
9128                 set try
9129                 if eval $compile_ok; then
9130                         lseeksize=`$run ./try`
9131                         $echo "Your file offsets are now $lseeksize bytes long."
9132                 else
9133                         dflt="$lseeksize"
9134                         echo " "
9135                         echo "(I can't seem to compile the test program.  Guessing...)"
9136                         rp="What is the size of your file offsets (in bytes)?"
9137                         . ./myread
9138                         lseeksize="$ans"
9139                 fi
9140                 case "$fpostype" in
9141                 *_t) zzz="$fpostype"    ;;
9142                 *)   zzz="fpos_t"       ;;
9143                 esac
9144                 $echo $n "Rechecking the size of $zzz...$c" >&4
9145                 $cat > try.c <<EOCP
9146 #include <sys/types.h>
9147 #include <stdio.h>
9148 #$i_stdlib I_STDLIB
9149 #ifdef I_STDLIB
9150 #include <stdlib.h>
9151 #endif
9152 int main() {
9153     printf("%d\n", (int)sizeof($fpostype));
9154     return(0);
9155 }
9156 EOCP
9157                 set try
9158                 if eval $compile_ok; then
9159                         yyy=`$run ./try`
9160                         dflt="$lseeksize"
9161                         case "$yyy" in
9162                         '')     echo " "
9163                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9164                                 ;;
9165                         *)      fpossize=$yyy
9166                                 echo " $fpossize bytes." >&4
9167                                 ;;
9168                         esac
9169                 else
9170                         dflt="$fpossize"
9171                         echo " "
9172                         echo "(I can't compile the test program.  Guessing...)" >&4
9173                         rp="What is the size of your file positions (in bytes)?"
9174                         . ./myread
9175                         fpossize="$ans"
9176                 fi
9177                 $rm_try
9178         fi
9179         ;;
9180 esac
9181
9182 case "$vendorprefix" in
9183 '')     d_vendorbin="$undef"
9184         vendorbin=''
9185         vendorbinexp=''
9186         ;;
9187 *)      d_vendorbin="$define"
9188         : determine where vendor-supplied executables go.
9189         case "$vendorbin" in
9190         '') dflt=$vendorprefix/bin ;;
9191         *)      dflt="$vendorbin" ;;
9192         esac
9193         fn=d~+
9194         rp='Pathname for the vendor-supplied executables directory?'
9195         . ./getfile
9196         vendorbin="$ans"
9197         vendorbinexp="$ansexp"
9198         ;;
9199 esac
9200 prefixvar=vendorbin
9201 . ./installprefix
9202
9203 case "$vendorprefix" in
9204 '')     vendorhtml1dir=''
9205         vendorhtml1direxp=''
9206         ;;
9207 *)      : determine where vendor-supplied html pages go.
9208         : There is no standard location, so try to copy the previously-selected
9209         : directory structure for the core html pages.
9210         : XXX Better default suggestions would be welcome.
9211         case "$vendorhtml1dir" in
9212         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9213         *)      dflt=$vendorhtml1dir ;;
9214         esac
9215         case "$dflt" in
9216         ''|' ') dflt=none ;;
9217         esac
9218         fn=dn+~
9219         rp='Pathname for the vendor-supplied html pages?'
9220         . ./getfile
9221         vendorhtml1dir="$ans"
9222         vendorhtml1direxp="$ansexp"
9223         ;;
9224 esac
9225 : Use ' ' for none so value is preserved next time through Configure
9226 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9227 prefixvar=vendorhtml1dir
9228 . ./installprefix
9229
9230 case "$vendorprefix" in
9231 '')     vendorhtml3dir=''
9232         vendorhtml3direxp=''
9233         ;;
9234 *)      : determine where vendor-supplied module html pages go.
9235         : There is no standard location, so try to copy the previously-selected
9236         : directory structure for the core html pages.
9237         : XXX Better default suggestions would be welcome.
9238         case "$vendorhtml3dir" in
9239         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9240         *)      dflt=$vendorhtml3dir ;;
9241         esac
9242         case "$dflt" in
9243         ''|' ') dflt=none ;;
9244         esac
9245         fn=dn+~
9246         rp='Pathname for the vendor-supplied html pages?'
9247         . ./getfile
9248         vendorhtml3dir="$ans"
9249         vendorhtml3direxp="$ansexp"
9250         ;;
9251 esac
9252 : Use ' ' for none so value is preserved next time through Configure
9253 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9254 prefixvar=vendorhtml3dir
9255 . ./installprefix
9256
9257 case "$vendorprefix" in
9258 '')     vendorman1dir=''
9259         vendorman1direxp=''
9260         ;;
9261 *)      : determine where vendor-supplied manual pages go.
9262         case "$vendorman1dir" in
9263         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9264         *)      dflt=$vendorman1dir ;;
9265         esac
9266         case "$dflt" in
9267         ''|' ') dflt=none ;;
9268         esac
9269         fn=nd~+
9270         rp='Pathname for the vendor-supplied manual section 1 pages?'
9271         . ./getfile
9272         vendorman1dir="$ans"
9273         vendorman1direxp="$ansexp"
9274         ;;
9275 esac
9276 : Use ' ' for none so value is preserved next time through Configure
9277 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9278 prefixvar=vendorman1dir
9279 . ./installprefix
9280
9281 case "$vendorprefix" in
9282 '')     vendorman3dir=''
9283         vendorman3direxp=''
9284         ;;
9285 *)      : determine where vendor-supplied module manual pages go.
9286         case "$vendorman3dir" in
9287         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9288         *)      dflt=$vendorman3dir ;;
9289         esac
9290         case "$dflt" in
9291         ''|' ') dflt=none ;;
9292         esac
9293         fn=nd~+
9294         rp='Pathname for the vendor-supplied manual section 3 pages?'
9295         . ./getfile
9296         vendorman3dir="$ans"
9297         vendorman3direxp="$ansexp"
9298         ;;
9299 esac
9300 : Use ' ' for none so value is preserved next time through Configure
9301 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9302 prefixvar=vendorman3dir
9303 . ./installprefix
9304
9305 case "$vendorprefix" in
9306 '')     d_vendorscript="$undef"
9307         vendorscript=''
9308         vendorscriptexp=''
9309         ;;
9310 *)      d_vendorscript="$define"
9311         : determine where vendor-supplied scripts go.
9312         case "$vendorscript" in
9313         '')     dflt=$vendorprefix/script
9314                 $test -d $dflt || dflt=$vendorbin ;;
9315         *)  dflt="$vendorscript" ;;
9316         esac
9317         $cat <<EOM
9318
9319 The installation process will create a directory for
9320 vendor-supplied scripts.
9321
9322 EOM
9323         fn=d~+
9324         rp='Pathname for the vendor-supplied scripts directory?'
9325         . ./getfile
9326         vendorscript="$ans"
9327         vendorscriptexp="$ansexp"
9328         ;;
9329 esac
9330 prefixvar=vendorscript
9331 . ./installprefix
9332
9333 : see if qgcvt exists
9334 set qgcvt d_qgcvt
9335 eval $inlibc
9336
9337 echo " "
9338
9339 if $test X"$d_longdbl" = X"$define"; then
9340
9341 echo "Checking how to print long doubles..." >&4
9342
9343 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9344         $cat >try.c <<'EOCP'
9345 #include <sys/types.h>
9346 #include <stdio.h>
9347 int main() {
9348   double d = 123.456;
9349   printf("%.3f\n", d);
9350 }
9351 EOCP
9352         set try
9353         if eval $compile; then
9354                 yyy=`$run ./try`
9355                 case "$yyy" in
9356                 123.456)
9357                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9358                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9359                         echo "We will use %f."
9360                         ;;
9361                 esac
9362         fi
9363 fi
9364
9365 if $test X"$sPRIfldbl" = X; then
9366         $cat >try.c <<'EOCP'
9367 #include <sys/types.h>
9368 #include <stdio.h>
9369 int main() {
9370   long double d = 123.456;
9371   printf("%.3Lf\n", d);
9372 }
9373 EOCP
9374         set try
9375         if eval $compile; then
9376                 yyy=`$run ./try`
9377                 case "$yyy" in
9378                 123.456)
9379                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9380                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9381                         echo "We will use %Lf."
9382                         ;;
9383                 esac
9384         fi
9385 fi
9386
9387 if $test X"$sPRIfldbl" = X; then
9388         $cat >try.c <<'EOCP'
9389 #include <sys/types.h>
9390 #include <stdio.h>
9391 int main() {
9392   long double d = 123.456;
9393   printf("%.3llf\n", d);
9394 }
9395 EOCP
9396         set try
9397         if eval $compile; then
9398                 yyy=`$run ./try`
9399                 case "$yyy" in
9400                 123.456)
9401                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9402                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9403                         echo "We will use %llf."
9404                         ;;
9405                 esac
9406         fi
9407 fi
9408
9409 if $test X"$sPRIfldbl" = X; then
9410         $cat >try.c <<'EOCP'
9411 #include <sys/types.h>
9412 #include <stdio.h>
9413 int main() {
9414   long double d = 123.456;
9415   printf("%.3lf\n", d);
9416 }
9417 EOCP
9418         set try
9419         if eval $compile; then
9420                 yyy=`$run ./try`
9421                 case "$yyy" in
9422                 123.456)
9423                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9424                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9425                         echo "We will use %lf."
9426                         ;;
9427                 esac
9428         fi
9429 fi
9430
9431 if $test X"$sPRIfldbl" = X; then
9432         echo "Cannot figure out how to print long doubles." >&4
9433 else
9434         sSCNfldbl=$sPRIfldbl    # expect consistency
9435 fi
9436
9437 $rm_try
9438
9439 fi # d_longdbl
9440
9441 case "$sPRIfldbl" in
9442 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9443         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9444         d_SCNfldbl="$undef";
9445         ;;
9446 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9447         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9448         d_SCNfldbl="$define";
9449         ;;
9450 esac
9451
9452 : Check how to convert floats to strings.
9453
9454 if test "X$d_Gconvert" = X; then
9455
9456 echo " "
9457 echo "Checking for an efficient way to convert floats to strings."
9458 echo " " > try.c
9459 case "$uselongdouble" in
9460 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9461 esac
9462 case "$d_longdbl" in
9463 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9464 esac
9465 case "$d_PRIgldbl" in
9466 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9467 esac
9468 $cat >>try.c <<EOP
9469 #ifdef TRY_gconvert
9470 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9471 char *myname = "gconvert";
9472 #endif
9473 #ifdef TRY_gcvt
9474 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9475 char *myname = "gcvt";
9476 #endif
9477 #ifdef TRY_qgcvt
9478 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9479 char *myname = "qgcvt";
9480 #define DOUBLETYPE long double
9481 #endif
9482 #ifdef TRY_sprintf
9483 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9484 #ifdef HAS_PRIgldbl
9485 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9486 #else
9487 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9488 #endif
9489 #else
9490 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9491 #endif
9492 char *myname = "sprintf";
9493 #endif
9494
9495 #ifndef DOUBLETYPE
9496 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9497 #define DOUBLETYPE long double
9498 #else
9499 #define DOUBLETYPE double
9500 #endif
9501 #endif
9502
9503 #include <stdio.h>
9504
9505 #define I_STDLIB $i_stdlib
9506 #ifdef I_STDLIB
9507 #include <stdlib.h>
9508 #endif
9509
9510 int
9511 checkit(expect, got)
9512 char *expect;
9513 char *got;
9514 {
9515     if (strcmp(expect, got)) {
9516                 printf("%s oddity:  Expected %s, got %s\n",
9517                         myname, expect, got);
9518                 exit(1);
9519         }
9520 }
9521
9522 int main()
9523 {
9524         char buf[64];
9525         buf[63] = '\0';
9526
9527         /* This must be 1st test on (which?) platform */
9528         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9529         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9530         checkit("0.1", buf);
9531
9532         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9533         checkit("0.01", buf);
9534
9535         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9536         checkit("0.001", buf);
9537
9538         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9539         checkit("0.0001", buf);
9540
9541         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9542         if (strlen(buf) > 5)
9543             checkit("9e-005", buf); /* for Microsoft ?? */
9544         else
9545             checkit("9e-05", buf);
9546
9547         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9548         checkit("1", buf);
9549
9550         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9551         checkit("1.1", buf);
9552
9553         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9554         checkit("1.01", buf);
9555
9556         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9557         checkit("1.001", buf);
9558
9559         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9560         checkit("1.0001", buf);
9561
9562         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9563         checkit("1.00001", buf);
9564
9565         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9566         checkit("1.000001", buf);
9567
9568         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9569         checkit("0", buf);
9570
9571         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9572         checkit("-1", buf);
9573
9574         /* Some Linux gcvt's give 1.e+5 here. */
9575         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9576         checkit("100000", buf);
9577
9578         /* Some Linux gcvt's give -1.e+5 here. */
9579         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9580         checkit("-100000", buf);
9581
9582         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9583         checkit("123.456", buf);
9584
9585         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9586         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9587         /* 34 should be enough to scare even long double
9588          * places into using the e notation. */
9589         if (strlen(buf) > 5)
9590             checkit("1e+034", buf); /* for Microsoft */
9591         else
9592             checkit("1e+34", buf);
9593
9594         /* For Perl, if you add additional tests here, also add them to
9595          * t/base/num.t for benefit of platforms not using Configure or
9596          * overriding d_Gconvert */
9597
9598         exit(0);
9599 }
9600 EOP
9601 : first add preferred functions to our list
9602 xxx_list=""
9603 for xxx_convert in $gconvert_preference; do
9604     case $xxx_convert in
9605     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9606     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9607     esac
9608 done
9609 : then add any others
9610 for xxx_convert in gconvert gcvt sprintf; do
9611     case "$xxx_list" in
9612     *$xxx_convert*) ;;
9613     *) xxx_list="$xxx_list $xxx_convert" ;;
9614     esac
9615 done
9616
9617 case "$d_longdbl$uselongdouble" in
9618 "$define$define")
9619     : again, add prefered functions to our list first
9620     xxx_ld_list=""
9621     for xxx_convert in $gconvert_ld_preference; do
9622         case $xxx_convert in
9623         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9624         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9625         esac
9626     done
9627     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9628     for xxx_convert in qgcvt sprintf $xxx_list; do
9629         case "$xxx_ld_list" in
9630         $xxx_convert*|*" $xxx_convert"*) ;;
9631         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9632         esac
9633     done
9634     : if sprintf cannot do long doubles, move it to the end
9635     if test "$d_PRIgldbl" != "$define"; then
9636         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9637     fi
9638     : if no qgcvt, remove it
9639     if test "$d_qgcvt" != "$define"; then
9640         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9641     fi
9642     : use the ld_list
9643     xxx_list="$xxx_ld_list"
9644     ;;
9645 esac
9646
9647 for xxx_convert in $xxx_list; do
9648         echo "Trying $xxx_convert..."
9649         $rm -f try try$_o core
9650         set try -DTRY_$xxx_convert
9651         if eval $compile; then
9652                 echo "$xxx_convert() found." >&4
9653                 if $run ./try; then
9654                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9655                         break;
9656                 else
9657                         echo "...But $xxx_convert didn't work as I expected."
9658                         xxx_convert=''
9659                 fi
9660         else
9661                 echo "$xxx_convert NOT found." >&4
9662         fi
9663 done
9664
9665 if test X$xxx_convert = X; then
9666     echo "*** WHOA THERE!!! ***" >&4
9667     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9668     xxx_convert=sprintf
9669 fi
9670
9671 case "$xxx_convert" in
9672 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9673 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9674 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9675 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9676    "$define$define$define")
9677       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9678    "$define$define$undef")
9679       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9680    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9681    esac
9682    ;;
9683 esac
9684
9685 fi
9686 $rm_try
9687
9688 : see if _fwalk exists
9689 set fwalk d__fwalk
9690 eval $inlibc
9691
9692 : Initialize h_fcntl
9693 h_fcntl=false
9694
9695 : Initialize h_sysfile
9696 h_sysfile=false
9697
9698 : access call always available on UNIX
9699 set access d_access
9700 eval $inlibc
9701
9702 : locate the flags for 'access()'
9703 case "$d_access" in
9704 "$define")
9705         echo " "
9706         $cat >access.c <<EOCP
9707 #include <sys/types.h>
9708 #ifdef I_FCNTL
9709 #include <fcntl.h>
9710 #endif
9711 #ifdef I_SYS_FILE
9712 #include <sys/file.h>
9713 #endif
9714 #ifdef I_UNISTD
9715 #include <unistd.h>
9716 #endif
9717 #$i_stdlib I_STDLIB
9718 #ifdef I_STDLIB
9719 #include <stdlib.h>
9720 #endif
9721 int main() {
9722         exit(R_OK);
9723 }
9724 EOCP
9725         : check sys/file.h first, no particular reason here
9726         if $test `./findhdr sys/file.h` && \
9727                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9728                 h_sysfile=true;
9729                 echo "<sys/file.h> defines the *_OK access constants." >&4
9730         elif $test `./findhdr fcntl.h` && \
9731                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9732                 h_fcntl=true;
9733                 echo "<fcntl.h> defines the *_OK access constants." >&4
9734         elif $test `./findhdr unistd.h` && \
9735                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9736                 echo "<unistd.h> defines the *_OK access constants." >&4
9737         else
9738                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9739         fi
9740         ;;
9741 esac
9742 $rm -f access*
9743
9744 : see if accessx exists
9745 set accessx d_accessx
9746 eval $inlibc
9747
9748 : see if aintl exists
9749 set aintl d_aintl
9750 eval $inlibc
9751
9752 : see if alarm exists
9753 set alarm d_alarm
9754 eval $inlibc
9755
9756 : see if POSIX threads are available
9757 set pthread.h i_pthread
9758 eval $inhdr
9759
9760 : define a fucntion to check prototypes
9761 $cat > protochk <<EOSH
9762 $startsh
9763 cc="$cc"
9764 optimize="$optimize"
9765 ccflags="$ccflags"
9766 prototype="$prototype"
9767 define="$define"
9768 rm_try="$rm_try"
9769 usethreads=$usethreads
9770 i_pthread=$i_pthread
9771 pthread_h_first=$pthread_h_first
9772 EOSH
9773
9774 $cat >> protochk <<'EOSH'
9775
9776 $rm_try
9777 foo="$1"
9778 shift
9779 while test $# -ge 2; do
9780         case "$1" in
9781                 $define) echo "#include <$2>" >> try.c ;;
9782                 literal) echo "$2" >> try.c ;;
9783         esac
9784     # Extra magic for the benefit of systems that need pthread.h
9785     # to be included early to correctly detect threadsafe functions.
9786     # Such functions must guarantee themselves, though, that the usethreads
9787     # and i_pthread have been defined, before calling protochk.
9788     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9789         echo "#include <pthread.h>" >> try.c
9790         pthread_h_done=yes
9791     fi
9792     shift 2
9793 done
9794 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9795 cat >> try.c <<'EOCP'
9796 #ifdef CAN_PROTOTYPE
9797 #define _(args) args
9798 #else
9799 #define _(args) ()
9800 #endif
9801 EOCP
9802 echo "$foo" >> try.c
9803 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9804 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9805 status=$?
9806 $rm_try
9807 exit $status
9808 EOSH
9809 chmod +x protochk
9810 $eunicefix protochk
9811
9812 hasproto='varname=$1; func=$2; shift; shift;
9813 while $test $# -ge 2; do
9814         case "$1" in
9815         $define) echo "#include <$2>";;
9816         esac ;
9817     shift 2;
9818 done > try.c;
9819 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9820 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9821         echo "$func() prototype found.";
9822         val="$define";
9823 else
9824         echo "$func() prototype NOT found.";
9825         val="$undef";
9826 fi;
9827 set $varname;
9828 eval $setvar;
9829 $rm_try tryout.c'
9830
9831 : see if sys/types.h has to be included
9832 set sys/types.h i_systypes
9833 eval $inhdr
9834
9835 : see if sys/select.h has to be included
9836 set sys/select.h i_sysselct
9837 eval $inhdr
9838
9839 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9840 while $test $# -ge 2; do
9841         case "$1" in
9842         $define) echo "#include <$2>";;
9843         esac ;
9844     shift 2;
9845 done > try.c;
9846 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9847 set try;
9848 if eval $compile; then
9849         val="$define";
9850 else
9851         val="$undef";
9852 fi;
9853 set $varname;
9854 eval $setvar;
9855 $rm_try'
9856
9857 : see if we should include time.h, sys/time.h, or both
9858 echo " "
9859 if test "X$timeincl" = X; then
9860         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9861         $echo $n "I'm now running the test program...$c"
9862         $cat >try.c <<EOCP
9863 #include <sys/types.h>
9864 #ifdef I_TIME
9865 #include <time.h>
9866 #endif
9867 #ifdef I_SYSTIME
9868 #ifdef SYSTIMEKERNEL
9869 #define KERNEL
9870 #endif
9871 #include <sys/time.h>
9872 #endif
9873 #ifdef I_SYSSELECT
9874 #include <sys/select.h>
9875 #endif
9876 #$i_stdlib I_STDLIB
9877 #ifdef I_STDLIB
9878 #include <stdlib.h>
9879 #endif
9880 int main()
9881 {
9882         struct tm foo;
9883 #ifdef S_TIMEVAL
9884         struct timeval bar;
9885 #endif
9886 #ifdef S_TIMEZONE
9887         struct timezone tzp;
9888 #endif
9889         if (foo.tm_sec == foo.tm_sec)
9890                 exit(0);
9891 #ifdef S_TIMEVAL
9892         if (bar.tv_sec == bar.tv_sec)
9893                 exit(0);
9894 #endif
9895         exit(1);
9896 }
9897 EOCP
9898         flags=''
9899         for s_timezone in '-DS_TIMEZONE' ''; do
9900         sysselect=''
9901         for s_timeval in '-DS_TIMEVAL' ''; do
9902         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9903         for i_time in '' '-DI_TIME'; do
9904         for i_systime in '-DI_SYSTIME' ''; do
9905                 case "$flags" in
9906                 '') $echo $n ".$c"
9907                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9908                         if eval $compile; then
9909                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9910                                 shift
9911                                 flags="$*"
9912                                 echo " "
9913                                 $echo $n "Succeeded with $flags$c"
9914                         fi
9915                         ;;
9916                 esac
9917         done
9918         done
9919         done
9920         done
9921         done
9922         timeincl=''
9923         echo " "
9924         case "$flags" in
9925         *SYSTIMEKERNEL*) i_systimek="$define"
9926                 timeincl=`./findhdr sys/time.h`
9927                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9928         *) i_systimek="$undef";;
9929         esac
9930         case "$flags" in
9931         *I_TIME*) i_time="$define"
9932                 timeincl=`./findhdr time.h`" $timeincl"
9933                 echo "We'll include <time.h>." >&4;;
9934         *) i_time="$undef";;
9935         esac
9936         case "$flags" in
9937         *I_SYSTIME*) i_systime="$define"
9938                 timeincl=`./findhdr sys/time.h`" $timeincl"
9939                 echo "We'll include <sys/time.h>." >&4;;
9940         *) i_systime="$undef";;
9941         esac
9942         $rm_try
9943 fi
9944 : see if struct tm knows about tm_zone
9945 case "$i_systime$i_time" in
9946 *$define*)
9947         echo " "
9948         echo "Checking to see if your struct tm has tm_zone field..." >&4
9949         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9950         eval $hasfield
9951         ;;
9952 *)      val="$undef"
9953         set d_tm_tm_zone
9954         eval $setvar
9955         ;;
9956 esac
9957 case "$d_tm_tm_zone" in
9958 "$define")      echo "Yes, it does."   ;;
9959 *)              echo "No, it doesn't." ;;
9960 esac
9961 : see if struct tm knows about tm_gmtoff
9962 case "$i_systime$i_time" in
9963 *$define*)
9964         echo " "
9965         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9966         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9967         eval $hasfield
9968         ;;
9969 *)      val="$undef"
9970         set d_tm_tm_gmtoff
9971         eval $setvar
9972         ;;
9973 esac
9974 case "$d_tm_tm_gmtoff" in
9975 "$define")      echo "Yes, it does."   ;;
9976 *)              echo "No, it doesn't." ;;
9977 esac
9978
9979 : see if asctime_r exists
9980 set asctime_r d_asctime_r
9981 eval $inlibc
9982 case "$d_asctime_r" in
9983 "$define")
9984         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9985         case "$d_asctime_r_proto:$usethreads" in
9986         ":define")      d_asctime_r_proto=define
9987                 set d_asctime_r_proto asctime_r $hdrs
9988                 eval $hasproto ;;
9989         *)      ;;
9990         esac
9991         case "$d_asctime_r_proto" in
9992         define)
9993         case "$asctime_r_proto" in
9994         ''|0) try='char* asctime_r(const struct tm*, char*);'
9995         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9996         esac
9997         case "$asctime_r_proto" in
9998         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9999         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10000         esac
10001         case "$asctime_r_proto" in
10002         ''|0) try='int asctime_r(const struct tm*, char*);'
10003         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10004         esac
10005         case "$asctime_r_proto" in
10006         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10007         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10008         esac
10009         case "$asctime_r_proto" in
10010         ''|0)   d_asctime_r=undef
10011                 asctime_r_proto=0
10012                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10013         * )     case "$asctime_r_proto" in
10014                 REENTRANT_PROTO*) ;;
10015                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10016                 esac
10017                 echo "Prototype: $try" ;;
10018         esac
10019         ;;
10020         *)      case "$usethreads" in
10021                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10022                 esac
10023                 d_asctime_r=undef
10024                 asctime_r_proto=0
10025                 ;;
10026         esac
10027         ;;
10028 *)      asctime_r_proto=0
10029         ;;
10030 esac
10031
10032 : see if atolf exists
10033 set atolf d_atolf
10034 eval $inlibc
10035
10036 : see if atoll exists
10037 set atoll d_atoll
10038 eval $inlibc
10039
10040 : Look for GCC-style attribute format
10041 case "$d_attribute_format" in
10042 '')
10043 echo " "
10044 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10045 $cat >attrib.c <<'EOCP'
10046 #include <stdio.h>
10047 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10048 EOCP
10049 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10050         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10051                 echo "Your C compiler doesn't support __attribute__((format))."
10052                 val="$undef"
10053         else
10054                 echo "Your C compiler supports __attribute__((format))."
10055                 val="$define"
10056         fi
10057 else
10058         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10059         val="$undef"
10060 fi
10061 ;;
10062 *) val="$d_attribute_format" ;;
10063 esac
10064 set d_attribute_format
10065 eval $setvar
10066 $rm -f attrib*
10067
10068 : Look for GCC-style attribute format with null format allowed
10069 case "$d_printf_format_null" in
10070 '') case "$d_attribute_format" in
10071     $define)
10072         echo " "
10073         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10074 $cat >attrib.c <<EOCP
10075 #include <stdio.h>
10076 #$i_stdlib I_STDLIB
10077 #ifdef I_STDLIB
10078 #include <stdlib.h>
10079 #endif
10080 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10081 int null_printf (char* pat,...) { return (int)pat; }
10082 int main () { exit(null_printf(NULL)); }
10083 EOCP
10084         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10085             : run the executable in case it produces a run-time warning
10086             if $run ./attrib >>attrib.out 2>&1; then
10087                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10088                     echo "Your C compiler doesn't allow __printf__ format to be null."
10089                     val="$undef"
10090                 else
10091                     echo "Your C compiler allows __printf__ format to be null."
10092                     val="$define"
10093                 fi
10094             else
10095             echo "Your C compiler executable failed with __printf__ format null."
10096             val="$undef"
10097         fi
10098     else
10099         echo "Your C compiler fails with __printf__ format null."
10100         val="$undef"
10101     fi
10102     ;;
10103     *)  val="$undef" ;;
10104     esac
10105 ;;
10106 *)  val="$d_printf_format_null" ;;
10107 esac
10108 set d_printf_format_null
10109 eval $setvar
10110 $rm -f attrib*
10111
10112 : Look for GCC-style attribute malloc
10113 case "$d_attribute_malloc" in
10114 '')
10115 echo " "
10116 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10117 $cat >attrib.c <<'EOCP'
10118 #include <stdio.h>
10119 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10120 EOCP
10121 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10122         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10123                 echo "Your C compiler doesn't support __attribute__((malloc))."
10124                 val="$undef"
10125         else
10126                 echo "Your C compiler supports __attribute__((malloc))."
10127                 val="$define"
10128         fi
10129 else
10130         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10131         val="$undef"
10132 fi
10133 ;;
10134 *) val="$d_attribute_malloc" ;;
10135 esac
10136 set d_attribute_malloc
10137 eval $setvar
10138 $rm -f attrib*
10139
10140 : Look for GCC-style attribute nonnull
10141 case "$d_attribute_nonnull" in
10142 '')
10143 echo " "
10144 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10145 $cat >attrib.c <<'EOCP'
10146 #include <stdio.h>
10147 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10148 EOCP
10149 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10150         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10151                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10152                 val="$undef"
10153         else
10154                 echo "Your C compiler supports __attribute__((nonnull))."
10155                 val="$define"
10156         fi
10157 else
10158         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10159         val="$undef"
10160 fi
10161 ;;
10162 *) val="$d_attribute_nonnull" ;;
10163 esac
10164 set d_attribute_nonnull
10165 eval $setvar
10166 $rm -f attrib*
10167
10168 : Look for GCC-style attribute noreturn
10169 case "$d_attribute_noreturn" in
10170 '')
10171 echo " "
10172 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10173 $cat >attrib.c <<'EOCP'
10174 #include <stdio.h>
10175 void fall_over_dead( void ) __attribute__((noreturn));
10176 EOCP
10177 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10178         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10179                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10180                 val="$undef"
10181         else
10182                 echo "Your C compiler supports __attribute__((noreturn))."
10183                 val="$define"
10184         fi
10185 else
10186         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10187         val="$undef"
10188 fi
10189 ;;
10190 *) val="$d_attribute_noreturn" ;;
10191 esac
10192 set d_attribute_noreturn
10193 eval $setvar
10194 $rm -f attrib*
10195
10196 : Look for GCC-style attribute pure
10197 case "$d_attribute_pure" in
10198 '')
10199 echo " "
10200 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10201 $cat >attrib.c <<'EOCP'
10202 #include <stdio.h>
10203 int square( int n ) __attribute__((pure));
10204 EOCP
10205 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10206         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10207                 echo "Your C compiler doesn't support __attribute__((pure))."
10208                 val="$undef"
10209         else
10210                 echo "Your C compiler supports __attribute__((pure))."
10211                 val="$define"
10212         fi
10213 else
10214         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10215         val="$undef"
10216 fi
10217 ;;
10218 *) val="$d_attribute_pure" ;;
10219 esac
10220 set d_attribute_pure
10221 eval $setvar
10222 $rm -f attrib*
10223
10224 : Look for GCC-style attribute unused
10225 case "$d_attribute_unused" in
10226 '')
10227 echo " "
10228 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10229 $cat >attrib.c <<'EOCP'
10230 #include <stdio.h>
10231 int do_something( int dummy __attribute__((unused)), int n );
10232 EOCP
10233 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10234         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10235                 echo "Your C compiler doesn't support __attribute__((unused))."
10236                 val="$undef"
10237         else
10238                 echo "Your C compiler supports __attribute__((unused))."
10239                 val="$define"
10240         fi
10241 else
10242         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10243         val="$undef"
10244 fi
10245 ;;
10246 *) val="$d_attribute_unused" ;;
10247 esac
10248 set d_attribute_unused
10249 eval $setvar
10250 $rm -f attrib*
10251
10252 : Look for GCC-style attribute warn_unused_result
10253 case "$d_attribute_warn_unused_result" in
10254 '')
10255 echo " "
10256 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10257 $cat >attrib.c <<'EOCP'
10258 #include <stdio.h>
10259 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10260 EOCP
10261 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10262         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10263                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10264                 val="$undef"
10265         else
10266                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10267                 val="$define"
10268         fi
10269 else
10270         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10271         val="$undef"
10272 fi
10273 ;;
10274 *) val="$d_attribute_warn_unused_result" ;;
10275 esac
10276 set d_attribute_warn_unused_result
10277 eval $setvar
10278 $rm -f attrib*
10279
10280 : see if bcmp exists
10281 set bcmp d_bcmp
10282 eval $inlibc
10283
10284 : see if bcopy exists
10285 set bcopy d_bcopy
10286 eval $inlibc
10287
10288 : see if getpgrp exists
10289 set getpgrp d_getpgrp
10290 eval $inlibc
10291
10292 case "$d_getpgrp" in
10293 "$define")
10294         echo " "
10295         echo "Checking to see which flavor of getpgrp is in use..."
10296         $cat >try.c <<EOP
10297 #$i_unistd I_UNISTD
10298 #include <sys/types.h>
10299 #ifdef I_UNISTD
10300 #  include <unistd.h>
10301 #endif
10302 #$i_stdlib I_STDLIB
10303 #ifdef I_STDLIB
10304 #include <stdlib.h>
10305 #endif
10306 int main()
10307 {
10308         if (getuid() == 0) {
10309                 printf("(I see you are running Configure as super-user...)\n");
10310                 setuid(1);
10311         }
10312 #ifdef TRY_BSD_PGRP
10313         if (getpgrp(1) == 0)
10314                 exit(0);
10315 #else
10316         if (getpgrp() > 0)
10317                 exit(0);
10318 #endif
10319         exit(1);
10320 }
10321 EOP
10322         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10323                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10324                 val="$define"
10325         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10326                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10327                 val="$undef"
10328         else
10329                 echo "I can't seem to compile and run the test program."
10330                 if ./usg; then
10331                         xxx="a USG one, i.e. you use getpgrp()."
10332                 else
10333                         # SVR4 systems can appear rather BSD-ish.
10334                         case "$i_unistd" in
10335                         $undef)
10336                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10337                                 val="$define"
10338                                 ;;
10339                         $define)
10340                                 xxx="probably a USG one, i.e. you use getpgrp()."
10341                                 val="$undef"
10342                                 ;;
10343                         esac
10344                 fi
10345                 echo "Assuming your getpgrp is $xxx" >&4
10346         fi
10347         ;;
10348 *) val="$undef";;
10349 esac
10350 set d_bsdgetpgrp
10351 eval $setvar
10352 $rm_try
10353
10354 : see if setpgrp exists
10355 set setpgrp d_setpgrp
10356 eval $inlibc
10357
10358 case "$d_setpgrp" in
10359 "$define")
10360         echo " "
10361         echo "Checking to see which flavor of setpgrp is in use..."
10362         $cat >try.c <<EOP
10363 #$i_unistd I_UNISTD
10364 #include <sys/types.h>
10365 #ifdef I_UNISTD
10366 #  include <unistd.h>
10367 #endif
10368 #$i_stdlib I_STDLIB
10369 #ifdef I_STDLIB
10370 #include <stdlib.h>
10371 #endif
10372 int main()
10373 {
10374         if (getuid() == 0) {
10375                 printf("(I see you are running Configure as super-user...)\n");
10376                 setuid(1);
10377         }
10378 #ifdef TRY_BSD_PGRP
10379         if (-1 == setpgrp(1, 1))
10380                 exit(0);
10381 #else
10382         if (setpgrp() != -1)
10383                 exit(0);
10384 #endif
10385         exit(1);
10386 }
10387 EOP
10388         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10389                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10390                 val="$define"
10391         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10392                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10393                 val="$undef"
10394         else
10395                 echo "(I can't seem to compile and run the test program.)"
10396                 if ./usg; then
10397                         xxx="a USG one, i.e. you use setpgrp()."
10398                 else
10399                         # SVR4 systems can appear rather BSD-ish.
10400                         case "$i_unistd" in
10401                         $undef)
10402                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10403                                 val="$define"
10404                                 ;;
10405                         $define)
10406                                 xxx="probably a USG one, i.e. you use setpgrp()."
10407                                 val="$undef"
10408                                 ;;
10409                         esac
10410                 fi
10411                 echo "Assuming your setpgrp is $xxx" >&4
10412         fi
10413         ;;
10414 *) val="$undef";;
10415 esac
10416 set d_bsdsetpgrp
10417 eval $setvar
10418 $rm_try
10419
10420 : Look for GCC-style __builtin_choose_expr
10421 case "$d_builtin_choose_expr" in
10422 '')
10423     echo " "
10424     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10425     $cat >try.c <<'EOCP'
10426 #include <assert.h>
10427 #include <stdlib.h>
10428 #include <stdio.h>
10429
10430 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10431
10432 int main(void) {
10433     assert( SYRINX(1) == 2112 );
10434     assert( SYRINX(1) != 5150 );
10435     assert( SYRINX(0) == 5150 );
10436     assert( SYRINX(0) != 2112 );
10437     puts( "All good!" );
10438     exit(0);
10439 }
10440
10441 EOCP
10442     set try
10443     if eval $compile; then
10444         echo "Your C compiler supports __builtin_choose_expr."
10445         val="$define"
10446     else
10447         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10448         val="$undef"
10449     fi
10450 ;;
10451 *) val="$d_builtin_choose_expr" ;;
10452 esac
10453
10454 set d_builtin_choose_expr
10455 eval $setvar
10456 $rm_try
10457
10458 : Look for GCC-style __builtin_expect
10459 case "$d_builtin_expect" in
10460 '')
10461     echo " "
10462     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10463     $cat >builtin.c <<'EOCP'
10464 int main(void) {
10465     int n = 50;
10466     if ( __builtin_expect(n, 0) ) n = 1;
10467 }
10468 EOCP
10469     set try
10470     if eval $compile; then
10471         echo "Your C compiler supports __builtin_choose_expr."
10472         val="$define"
10473     else
10474         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10475         val="$undef"
10476     fi
10477     ;;
10478 *) val="$d_builtin_expect" ;;
10479 esac
10480
10481 set d_builtin_expect
10482 eval $setvar
10483 $rm_try
10484
10485 : see if bzero exists
10486 set bzero d_bzero
10487 eval $inlibc
10488
10489 : see if stdarg is available
10490 echo " "
10491 if $test `./findhdr stdarg.h`; then
10492         echo "<stdarg.h> found." >&4
10493         valstd="$define"
10494 else
10495         echo "<stdarg.h> NOT found." >&4
10496         valstd="$undef"
10497 fi
10498
10499 : see if varags is available
10500 echo " "
10501 if $test `./findhdr varargs.h`; then
10502         echo "<varargs.h> found." >&4
10503 else
10504         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10505 fi
10506
10507 : set up the varargs testing programs
10508 $cat > varargs.c <<EOP
10509 #ifdef I_STDARG
10510 #include <stdarg.h>
10511 #endif
10512 #ifdef I_VARARGS
10513 #include <varargs.h>
10514 #endif
10515
10516 #ifdef I_STDARG
10517 int f(char *p, ...)
10518 #else
10519 int f(va_alist)
10520 va_dcl
10521 #endif
10522 {
10523         va_list ap;
10524 #ifndef I_STDARG
10525         char *p;
10526 #endif
10527 #ifdef I_STDARG
10528         va_start(ap,p);
10529 #else
10530         va_start(ap);
10531         p = va_arg(ap, char *);
10532 #endif
10533         va_end(ap);
10534         return 0;
10535 }
10536 EOP
10537 $cat > varargs <<EOP
10538 $startsh
10539 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10540         echo "true"
10541 else
10542         echo "false"
10543 fi
10544 $rm -f varargs$_o
10545 EOP
10546 chmod +x varargs
10547
10548 : now check which varargs header should be included
10549 echo " "
10550 i_varhdr=''
10551 case "$valstd" in
10552 "$define")
10553         if `./varargs I_STDARG`; then
10554                 val='stdarg.h'
10555         elif `./varargs I_VARARGS`; then
10556                 val='varargs.h'
10557         fi
10558         ;;
10559 *)
10560         if `./varargs I_VARARGS`; then
10561                 val='varargs.h'
10562         fi
10563         ;;
10564 esac
10565 case "$val" in
10566 '')
10567 echo "I could not find the definition for va_dcl... You have problems..." >&4
10568         val="$undef"; set i_stdarg; eval $setvar
10569         val="$undef"; set i_varargs; eval $setvar
10570         ;;
10571 *) 
10572         set i_varhdr
10573         eval $setvar
10574         case "$i_varhdr" in
10575         stdarg.h)
10576                 val="$define"; set i_stdarg; eval $setvar
10577                 val="$undef"; set i_varargs; eval $setvar
10578                 ;;
10579         varargs.h)
10580                 val="$undef"; set i_stdarg; eval $setvar
10581                 val="$define"; set i_varargs; eval $setvar
10582                 ;;
10583         esac
10584         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10585 esac
10586 $rm -f varargs*
10587
10588 : see if the Compiler supports C99 variadic macros
10589 case "$i_stdarg$i_stdlib" in
10590     "$define$define")
10591     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10592     $cat >try.c <<EOCP
10593 #include <stdio.h>
10594 #include <stdarg.h>
10595
10596 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10597
10598 int main() {
10599   char buf[20];
10600   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10601   puts(buf);
10602   return 0;
10603 }
10604 EOCP
10605     set try
10606     if eval $compile && $run ./try 2>&1 >/dev/null; then
10607         case "`$run ./try`" in
10608             "123 456 789")
10609             echo "You have C99 variadic macros." >&4
10610             d_c99_variadic_macros="$define"
10611             ;;
10612             *)
10613             echo "You don't have functional C99 variadic macros." >&4
10614             d_c99_variadic_macros="$undef"
10615             ;;
10616         esac
10617     else
10618         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10619         d_c99_variadic_macros="$undef"
10620     fi
10621     $rm_try
10622     ;;
10623     *)
10624     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10625     d_c99_variadic_macros="$undef"
10626     ;;
10627 esac
10628
10629 : see if signal is declared as pointer to function returning int or void
10630 echo " "
10631 xxx=`./findhdr signal.h`
10632 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10633 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10634         echo "You have int (*signal())() instead of void." >&4
10635         val="$undef"
10636 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10637         echo "You have void (*signal())()." >&4
10638         val="$define"
10639 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10640         echo "You have int (*signal())() instead of void." >&4
10641         val="$undef"
10642 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10643         echo "You have void (*signal())()." >&4
10644         val="$define"
10645 else
10646         case "$d_voidsig" in
10647         '')
10648         echo "I can't determine whether signal handler returns void or int..." >&4
10649                 dflt=void
10650                 rp="What type does your signal handler return?"
10651                 . ./myread
10652                 case "$ans" in
10653                 v*) val="$define";;
10654                 *) val="$undef";;
10655                 esac;;
10656         "$define")
10657                 echo "As you already told me, signal handler returns void." >&4
10658                 val="$define"
10659                 ;;
10660         *)      echo "As you already told me, signal handler returns int." >&4
10661                 val="$undef"
10662                 ;;
10663         esac
10664 fi
10665 set d_voidsig
10666 eval $setvar
10667 case "$d_voidsig" in
10668 "$define") signal_t="void";;
10669 *) signal_t="int";;
10670 esac
10671 $rm -f $$.tmp
10672
10673 : check for ability to cast large floats to 32-bit ints.
10674 echo " "
10675 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10676 if $test "$intsize" -ge 4; then
10677         xxx=int
10678 else
10679         xxx=long
10680 fi
10681 $cat >try.c <<EOCP
10682 #include <stdio.h>
10683 #$i_stdlib I_STDLIB
10684 #ifdef I_STDLIB
10685 #include <stdlib.h>
10686 #endif
10687 #include <sys/types.h>
10688 #include <signal.h>
10689 $signal_t blech(int s) { exit(3); }
10690 int main()
10691 {
10692         $xxx i32;
10693         double f, g;
10694         int result = 0;
10695         char str[16];
10696         signal(SIGFPE, blech);
10697
10698         /* Don't let compiler optimize the test away.  Store the number
10699            in a writable string for gcc to pass to sscanf under HP/UX.
10700         */
10701         sprintf(str, "2147483647");
10702         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10703         g = 10 * f;
10704         i32  = ($xxx) g;
10705
10706         /* x86 processors will probably give 0x8000 0000, which is a
10707            sign change.  We don't want that.  We want to mimic SPARC
10708            behavior here, which is to preserve the sign and give
10709            back 0x7fff ffff.
10710         */
10711         if (i32 != ($xxx) f)
10712                 result |= 1;
10713         exit(result);
10714 }
10715 EOCP
10716 set try
10717 if eval $compile_ok; then
10718         $run ./try
10719         yyy=$?
10720 else
10721         echo "(I can't seem to compile the test program--assuming it can't)"
10722         yyy=1
10723 fi
10724 case "$yyy" in
10725 0)      val="$define"
10726         echo "Yup, it can."
10727         ;;
10728 *)      val="$undef"
10729         echo "Nope, it can't."
10730         ;;
10731 esac
10732 set d_casti32
10733 eval $setvar
10734 $rm_try
10735
10736 : check for ability to cast negative floats to unsigned
10737 echo " "
10738 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10739 $cat >try.c <<EOCP
10740 #include <stdio.h>
10741 #$i_stdlib I_STDLIB
10742 #ifdef I_STDLIB
10743 #include <stdlib.h>
10744 #endif
10745 #include <sys/types.h>
10746 #include <signal.h>
10747 $signal_t blech(int s) { exit(7); }
10748 $signal_t blech_in_list(int s) { exit(4); }
10749 unsigned long dummy_long(unsigned long p) { return p; }
10750 unsigned int dummy_int(unsigned int p) { return p; }
10751 unsigned short dummy_short(unsigned short p) { return p; }
10752 int main()
10753 {
10754         double f;
10755         unsigned long along;
10756         unsigned int aint;
10757         unsigned short ashort;
10758         int result = 0;
10759         char str[16];
10760
10761         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10762            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10763            optimized the whole file away
10764         */
10765         /* Store the number in a writable string for gcc to pass to
10766            sscanf under HP/UX.
10767         */
10768         sprintf(str, "-123");
10769         sscanf(str, "%lf", &f);  /* f = -123.; */
10770
10771         signal(SIGFPE, blech);
10772         along = (unsigned long)f;
10773         aint = (unsigned int)f;
10774         ashort = (unsigned short)f;
10775         if (along != (unsigned long)-123)
10776                 result |= 1;
10777         if (aint != (unsigned int)-123)
10778                 result |= 1;
10779         if (ashort != (unsigned short)-123)
10780                 result |= 1;
10781         sprintf(str, "1073741824.");
10782         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10783         f = f + f;
10784         along = 0;
10785         along = (unsigned long)f;
10786         if (along != 0x80000000)
10787                 result |= 2;
10788         f -= 1.;
10789         along = 0;
10790         along = (unsigned long)f;
10791         if (along != 0x7fffffff)
10792                 result |= 1;
10793         f += 2.;
10794         along = 0;
10795         along = (unsigned long)f;
10796         if (along != 0x80000001)
10797                 result |= 2;
10798         if (result)
10799                 exit(result);
10800         signal(SIGFPE, blech_in_list);
10801         sprintf(str, "123.");
10802         sscanf(str, "%lf", &f);  /* f = 123.; */
10803         along = dummy_long((unsigned long)f);
10804         aint = dummy_int((unsigned int)f);
10805         ashort = dummy_short((unsigned short)f);
10806         if (along != (unsigned long)123)
10807                 result |= 4;
10808         if (aint != (unsigned int)123)
10809                 result |= 4;
10810         if (ashort != (unsigned short)123)
10811                 result |= 4;
10812         exit(result);
10813
10814 }
10815 EOCP
10816 set try
10817 if eval $compile_ok; then
10818         $run ./try
10819         castflags=$?
10820 else
10821         echo "(I can't seem to compile the test program--assuming it can't)"
10822         castflags=7
10823 fi
10824 case "$castflags" in
10825 0)      val="$define"
10826         echo "Yup, it can."
10827         ;;
10828 *)      val="$undef"
10829         echo "Nope, it can't."
10830         ;;
10831 esac
10832 set d_castneg
10833 eval $setvar
10834 $rm_try
10835
10836 : see if vprintf exists
10837 echo " "
10838 if set vprintf val -f d_vprintf; eval $csym; $val; then
10839         echo 'vprintf() found.' >&4
10840         val="$define"
10841         $cat >try.c <<EOF
10842 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10843 #$i_varargs I_VARARGS
10844
10845 #$i_stdlib I_STDLIB
10846 #$i_unistd I_UNISTD
10847
10848 #ifdef I_STDARG
10849 #  include <stdarg.h>
10850 #else /* I_VARARGS */
10851 #  include <varargs.h>
10852 #endif
10853
10854 #ifdef I_UNISTD
10855 #  include <unistd.h>
10856 #endif
10857
10858 #ifdef I_STDLIB
10859 #  include <stdlib.h>
10860 #endif
10861
10862 #include <stdio.h> /* vsprintf prototype */
10863
10864 #ifdef I_STDARG
10865 void xxx(int n, ...)
10866 {
10867     va_list args;
10868     char buf[10];
10869     va_start(args, n);
10870     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10871 }
10872 int main() { xxx(1, "foo"); }
10873
10874 #else /* I_VARARGS */
10875
10876 xxx(va_alist)
10877 va_dcl
10878 {
10879     va_list args;
10880     char buf[10];
10881     va_start(args);
10882     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10883 }
10884 int main() { xxx("foo"); }
10885
10886 #endif
10887
10888 EOF
10889         set try
10890         if eval $compile_ok; then
10891                 if $run ./try; then
10892                         echo "Your vsprintf() returns (int)." >&4
10893                         val2="$undef"
10894                 else
10895                         echo "Your vsprintf() returns (char*)." >&4
10896                         val2="$define"
10897                 fi
10898         else
10899                 echo 'I am unable to compile the vsprintf() test program.' >&4
10900                 # We shouldn't get here.  If we do, assume the standard signature,
10901                 # not the old BSD one.
10902                 echo 'Guessing that vsprintf() returns (int).' >&4
10903                 val2="$undef"
10904         fi
10905 else
10906         echo 'vprintf() NOT found.' >&4
10907         val="$undef"
10908         val2="$undef"
10909 fi
10910 $rm_try
10911 set d_vprintf
10912 eval $setvar
10913 val=$val2
10914 set d_charvspr
10915 eval $setvar
10916
10917 : see if chown exists
10918 set chown d_chown
10919 eval $inlibc
10920
10921 : see if chroot exists
10922 set chroot d_chroot
10923 eval $inlibc
10924
10925 : see if chsize exists
10926 set chsize d_chsize
10927 eval $inlibc
10928
10929 : see if class exists
10930 set class d_class
10931 eval $inlibc
10932
10933 : see if clearenv exists
10934 set clearenv d_clearenv
10935 eval $inlibc
10936
10937 hasstruct='varname=$1; struct=$2; shift; shift;
10938 while $test $# -ge 2; do
10939         case "$1" in
10940         $define) echo "#include <$2>";;
10941         esac ;
10942     shift 2;
10943 done > try.c;
10944 echo "int main () { struct $struct foo; }" >> try.c;
10945 set try;
10946 if eval $compile; then
10947         val="$define";
10948 else
10949         val="$undef";
10950 fi;
10951 set $varname;
10952 eval $setvar;
10953 $rm_try'
10954
10955 socketlib=''
10956 sockethdr=''
10957 : see whether socket exists
10958 echo " "
10959 $echo $n "Hmm... $c" >&4
10960 if set socket val -f d_socket; eval $csym; $val; then
10961         echo "Looks like you have Berkeley networking support." >&4
10962         d_socket="$define"
10963         if set setsockopt val -f; eval $csym; $val; then
10964                 d_oldsock="$undef"
10965         else
10966                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10967                 d_oldsock="$define"
10968         fi
10969 else
10970         if $contains socklib libc.list >/dev/null 2>&1; then
10971                 echo "Looks like you have Berkeley networking support." >&4
10972                 d_socket="$define"
10973                 : we will have to assume that it supports the 4.2 BSD interface
10974                 d_oldsock="$undef"
10975         else
10976                 echo "You don't have Berkeley networking in libc$_a..." >&4
10977                 if test "X$d_socket" = "X$define"; then
10978                    echo "...but you seem to believe that you have sockets." >&4
10979                 else
10980                         for net in net socket
10981                         do
10982                                 if test -f /usr/lib/lib$net$_a; then
10983                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10984                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10985                                         if $contains socket libc.list >/dev/null 2>&1; then
10986                                                 d_socket="$define"
10987                                                 socketlib="-l$net"
10988                                                 case "$net" in
10989                                                 net)
10990                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10991                                                         sockethdr="-I/usr/netinclude"
10992                                                         ;;
10993                                                 esac
10994                                                 echo "Found Berkeley sockets interface in lib$net." >&4
10995                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10996                                                         d_oldsock="$undef"
10997                                                 else
10998                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10999                                                         d_oldsock="$define"
11000                                                 fi
11001                                                 break
11002                                         fi
11003                                 fi
11004                         done
11005                         if test "X$d_socket" != "X$define"; then
11006                            echo "or anywhere else I see." >&4
11007                            d_socket="$undef"
11008                            d_oldsock="$undef"
11009                         fi
11010                 fi
11011         fi
11012 fi
11013
11014 : see if socketpair exists
11015 set socketpair d_sockpair
11016 eval $inlibc
11017
11018
11019 echo " "
11020 echo "Checking the availability of certain socket constants..." >&4
11021 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11022         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11023         $cat >try.c <<EOF
11024 #include <sys/types.h>
11025 #include <sys/socket.h>
11026 int main() {
11027     int i = $ENUM;
11028 }
11029 EOF
11030         val="$undef"
11031         set try; if eval $compile; then
11032                 val="$define"
11033         fi
11034         set d_${enum}; eval $setvar
11035         $rm_try
11036 done
11037
11038 : see if this is a sys/uio.h system
11039 set sys/uio.h i_sysuio
11040 eval $inhdr
11041
11042
11043 echo " "
11044 echo "Checking to see if your system supports struct cmsghdr..." >&4
11045 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11046 eval $hasstruct
11047 case "$d_cmsghdr_s" in
11048 "$define")      echo "Yes, it does."   ;;
11049 *)              echo "No, it doesn't." ;;
11050 esac
11051
11052
11053 : check for const keyword
11054 echo " "
11055 echo 'Checking to see if your C compiler knows about "const"...' >&4
11056 $cat >const.c <<'EOCP'
11057 typedef struct spug { int drokk; } spug;
11058 int main()
11059 {
11060         const char *foo;
11061         const spug y = { 0 };
11062 }
11063 EOCP
11064 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11065         val="$define"
11066         echo "Yup, it does."
11067 else
11068         val="$undef"
11069         echo "Nope, it doesn't."
11070 fi
11071 set d_const
11072 eval $setvar
11073
11074 : see if copysignl exists
11075 set copysignl d_copysignl
11076 eval $inlibc
11077
11078 : see if crypt exists
11079 echo " "
11080 set crypt d_crypt
11081 eval $inlibc
11082 case "$d_crypt" in
11083 $define) cryptlib='' ;;
11084 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11085                 echo 'crypt() found.' >&4
11086                 val="$define"
11087                 cryptlib=''
11088         else
11089                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11090                 if $test -z "$cryptlib"; then
11091                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11092                 else
11093                         cryptlib=-lcrypt
11094                 fi
11095                 if $test -z "$cryptlib"; then
11096                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11097                 else
11098                         cryptlib=-lcrypt
11099                 fi
11100                 if $test -z "$cryptlib"; then
11101                         cryptlib=`./loc libcrypt$_a "" $libpth`
11102                 else
11103                         cryptlib=-lcrypt
11104                 fi
11105                 if $test -z "$cryptlib"; then
11106                         echo 'crypt() NOT found.' >&4
11107                         val="$undef"
11108                 else
11109                         val="$define"
11110                 fi
11111         fi
11112         set d_crypt
11113         eval $setvar
11114         ;;
11115 esac
11116
11117 : see if this is a crypt.h system
11118 set crypt.h i_crypt
11119 eval $inhdr
11120
11121 : see if crypt_r exists
11122 set crypt_r d_crypt_r
11123 eval $inlibc
11124 case "$d_crypt_r" in
11125 "$define")
11126         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11127         case "$d_crypt_r_proto:$usethreads" in
11128         ":define")      d_crypt_r_proto=define
11129                 set d_crypt_r_proto crypt_r $hdrs
11130                 eval $hasproto ;;
11131         *)      ;;
11132         esac
11133         case "$d_crypt_r_proto" in
11134         define)
11135         case "$crypt_r_proto" in
11136         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11137         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11138         esac
11139         case "$crypt_r_proto" in
11140         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11141         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11142         esac
11143         case "$crypt_r_proto" in
11144         ''|0)   d_crypt_r=undef
11145                 crypt_r_proto=0
11146                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11147         * )     case "$crypt_r_proto" in
11148                 REENTRANT_PROTO*) ;;
11149                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11150                 esac
11151                 echo "Prototype: $try" ;;
11152         esac
11153         ;;
11154         *)      case "$usethreads" in
11155                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11156                 esac
11157                 d_crypt_r=undef
11158                 crypt_r_proto=0
11159                 ;;
11160         esac
11161         ;;
11162 *)      crypt_r_proto=0
11163         ;;
11164 esac
11165
11166 : get csh whereabouts
11167 case "$csh" in
11168 'csh') val="$undef" ;;
11169 *) val="$define" ;;
11170 esac
11171 set d_csh
11172 eval $setvar
11173 : Respect a hint or command line value for full_csh.
11174 case "$full_csh" in
11175 '') full_csh=$csh ;;
11176 esac
11177
11178 : see if ctermid exists
11179 set ctermid d_ctermid
11180 eval $inlibc
11181
11182 : see if ctermid_r exists
11183 set ctermid_r d_ctermid_r
11184 eval $inlibc
11185 case "$d_ctermid_r" in
11186 "$define")
11187         hdrs="$i_systypes sys/types.h define stdio.h "
11188         case "$d_ctermid_r_proto:$usethreads" in
11189         ":define")      d_ctermid_r_proto=define
11190                 set d_ctermid_r_proto ctermid_r $hdrs
11191                 eval $hasproto ;;
11192         *)      ;;
11193         esac
11194         case "$d_ctermid_r_proto" in
11195         define)
11196         case "$ctermid_r_proto" in
11197         ''|0) try='char* ctermid_r(char*);'
11198         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11199         esac
11200         case "$ctermid_r_proto" in
11201         ''|0)   d_ctermid_r=undef
11202                 ctermid_r_proto=0
11203                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11204         * )     case "$ctermid_r_proto" in
11205                 REENTRANT_PROTO*) ;;
11206                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11207                 esac
11208                 echo "Prototype: $try" ;;
11209         esac
11210         ;;
11211         *)      case "$usethreads" in
11212                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11213                 esac
11214                 d_ctermid_r=undef
11215                 ctermid_r_proto=0
11216                 ;;
11217         esac
11218         ;;
11219 *)      ctermid_r_proto=0
11220         ;;
11221 esac
11222
11223 : see if ctime_r exists
11224 set ctime_r d_ctime_r
11225 eval $inlibc
11226 case "$d_ctime_r" in
11227 "$define")
11228         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11229         case "$d_ctime_r_proto:$usethreads" in
11230         ":define")      d_ctime_r_proto=define
11231                 set d_ctime_r_proto ctime_r $hdrs
11232                 eval $hasproto ;;
11233         *)      ;;
11234         esac
11235         case "$d_ctime_r_proto" in
11236         define)
11237         case "$ctime_r_proto" in
11238         ''|0) try='char* ctime_r(const time_t*, char*);'
11239         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11240         esac
11241         case "$ctime_r_proto" in
11242         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11243         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11244         esac
11245         case "$ctime_r_proto" in
11246         ''|0) try='int ctime_r(const time_t*, char*);'
11247         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11248         esac
11249         case "$ctime_r_proto" in
11250         ''|0) try='int ctime_r(const time_t*, char*, int);'
11251         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11252         esac
11253         case "$ctime_r_proto" in
11254         ''|0)   d_ctime_r=undef
11255                 ctime_r_proto=0
11256                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11257         * )     case "$ctime_r_proto" in
11258                 REENTRANT_PROTO*) ;;
11259                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11260                 esac
11261                 echo "Prototype: $try" ;;
11262         esac
11263         ;;
11264         *)      case "$usethreads" in
11265                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11266                 esac
11267                 d_ctime_r=undef
11268                 ctime_r_proto=0
11269                 ;;
11270         esac
11271         ;;
11272 *)      ctime_r_proto=0
11273         ;;
11274 esac
11275
11276 : see if cuserid exists
11277 set cuserid d_cuserid
11278 eval $inlibc
11279
11280 : see if this is a limits.h system
11281 set limits.h i_limits
11282 eval $inhdr
11283
11284 : see if this is a float.h system
11285 set float.h i_float
11286 eval $inhdr
11287
11288 : See if number of significant digits in a double precision number is known
11289 echo " "
11290 $cat >dbl_dig.c <<EOM
11291 #$i_limits I_LIMITS
11292 #$i_float I_FLOAT
11293 #ifdef I_LIMITS
11294 #include <limits.h>
11295 #endif
11296 #ifdef I_FLOAT
11297 #include <float.h>
11298 #endif
11299 #ifdef DBL_DIG
11300 printf("Contains DBL_DIG");
11301 #endif
11302 EOM
11303 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11304 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11305         echo "DBL_DIG found." >&4
11306         val="$define"
11307 else
11308         echo "DBL_DIG NOT found." >&4
11309         val="$undef"
11310 fi
11311 $rm -f dbl_dig.?
11312 set d_dbl_dig
11313 eval $setvar
11314
11315 : see if dbm.h is available
11316 : see if dbmclose exists
11317 set dbmclose d_dbmclose
11318 eval $inlibc
11319
11320 case "$d_dbmclose" in
11321 $define)
11322         set dbm.h i_dbm
11323         eval $inhdr
11324         case "$i_dbm" in
11325         $define)
11326                 val="$undef"
11327                 set i_rpcsvcdbm
11328                 eval $setvar
11329                 ;;
11330         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11331                 eval $inhdr
11332                 ;;
11333         esac
11334         ;;
11335 *)      echo "We won't be including <dbm.h>"
11336         val="$undef"
11337         set i_dbm
11338         eval $setvar
11339         val="$undef"
11340         set i_rpcsvcdbm
11341         eval $setvar
11342         ;;
11343 esac
11344
11345 : see if prototype for dbminit is available
11346 echo " "
11347 set d_dbminitproto dbminit $i_dbm dbm.h
11348 eval $hasproto
11349
11350 : see if difftime exists
11351 set difftime d_difftime
11352 eval $inlibc
11353
11354 : see if this is a dirent system
11355 echo " "
11356 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11357         val="$define"
11358         echo "<dirent.h> found." >&4
11359 else
11360         val="$undef"
11361         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11362                 echo "<sys/dir.h> found." >&4
11363                 echo " "
11364         else
11365                 xinc=`./findhdr sys/ndir.h`
11366         fi
11367         echo "<dirent.h> NOT found." >&4
11368 fi
11369 set i_dirent
11370 eval $setvar
11371
11372 : Look for type of directory structure.
11373 echo " "
11374 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11375
11376 case "$direntrytype" in
11377 ''|' ')
11378         case "$i_dirent" in
11379         $define) guess1='struct dirent' ;;
11380         *) guess1='struct direct'  ;;
11381         esac
11382         ;;
11383 *)      guess1="$direntrytype"
11384         ;;
11385 esac
11386
11387 case "$guess1" in
11388 'struct dirent') guess2='struct direct' ;;
11389 *) guess2='struct dirent' ;;
11390 esac
11391
11392 if $contains "$guess1" try.c >/dev/null 2>&1; then
11393         direntrytype="$guess1"
11394         echo "Your directory entries are $direntrytype." >&4
11395 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11396         direntrytype="$guess2"
11397         echo "Your directory entries seem to be $direntrytype." >&4
11398 else
11399         echo "I don't recognize your system's directory entries." >&4
11400         rp="What type is used for directory entries on this system?"
11401         dflt="$guess1"
11402         . ./myread
11403         direntrytype="$ans"
11404 fi
11405 $rm_try
11406
11407 : see if the directory entry stores field length
11408 echo " "
11409 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11410 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11411         echo "Good, your directory entry keeps length information in d_namlen." >&4
11412         val="$define"
11413 else
11414         echo "Your directory entry does not know about the d_namlen field." >&4
11415         val="$undef"
11416 fi
11417 set d_dirnamlen
11418 eval $setvar
11419 $rm_try
11420
11421 : Look for DIR.dd_fd
11422 case "$i_dirent" in
11423 "$define")
11424     echo "Checking to see if DIR has a dd_fd member variable" >&4
11425     $cat >try.c <<EOCP
11426 #$i_stdlib I_STDLIB
11427 #ifdef I_STDLIB
11428 #include <stdlib.h>
11429 #endif
11430 #include <dirent.h>
11431
11432 int main() {
11433     DIR dir;
11434     dir.dd_fd = 1;
11435     return 0;
11436 }
11437 EOCP
11438     val=$undef
11439     set try
11440     if eval $compile; then
11441         echo "Yes, it does."
11442         val="$define"
11443     else
11444         echo "No, it does not."
11445         val="$undef"
11446     fi
11447     ;;
11448 *)
11449     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11450     val="$undef"
11451     ;;
11452 esac
11453 set d_dir_dd_fd
11454 eval $setvar
11455 $rm_try
11456
11457 : see if this is an sysdir system
11458 set sys/dir.h i_sysdir
11459 eval $inhdr
11460
11461 : see if this is an sysndir system
11462 set sys/ndir.h i_sysndir
11463 eval $inhdr
11464
11465 : Look for dirfd
11466 echo " "
11467 $cat >dirfd.c <<EOM
11468 #include <stdio.h>
11469 #$i_stdlib I_STDLIB
11470 #ifdef I_STDLIB
11471 #include <stdlib.h>
11472 #endif
11473 #$i_dirent I_DIRENT             /**/
11474 #$i_sysdir I_SYS_DIR            /**/
11475 #$i_sysndir I_SYS_NDIR          /**/
11476 #$i_systypes I_SYS_TYPES        /**/
11477 #if defined(I_SYS_TYPES)
11478 #include <sys/types.h>
11479 #endif
11480 #if defined(I_DIRENT)
11481 #include <dirent.h>
11482 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11483 #include <sys/dir.h>
11484 #endif
11485 #else
11486 #ifdef I_SYS_NDIR
11487 #include <sys/ndir.h>
11488 #else
11489 #ifdef I_SYS_DIR
11490 #ifdef hp9000s500
11491 #include <ndir.h>       /* may be wrong in the future */
11492 #else
11493 #include <sys/dir.h>
11494 #endif
11495 #endif
11496 #endif
11497 #endif 
11498 int main() {
11499         DIR *dirp = opendir(".");
11500         if (dirfd(dirp) >= 0)
11501                 exit(0);
11502         else
11503                 exit(1);
11504 }
11505 EOM
11506 val=$undef
11507 set dirfd
11508 if eval $compile; then
11509         val="$define"
11510 fi
11511 case "$val" in
11512 $define)        echo "dirfd() found." >&4       ;;
11513 *)              echo "dirfd() NOT found." >&4   ;;
11514 esac
11515 set d_dirfd
11516 eval $setvar
11517 $rm -f dirfd*
11518
11519 : see if dlerror exists
11520 xxx_runnm="$runnm"
11521 runnm=false
11522 set dlerror d_dlerror
11523 eval $inlibc
11524 runnm="$xxx_runnm"
11525
11526 : see if dlfcn is available
11527 set dlfcn.h i_dlfcn
11528 eval $inhdr
11529
11530 case "$usedl" in
11531 $define|y|true)
11532         $cat << EOM
11533
11534 On a few systems, the dynamically loaded modules that perl generates and uses
11535 will need a different extension than shared libs. The default will probably
11536 be appropriate.
11537
11538 EOM
11539         case "$dlext" in
11540         '')     dflt="$so" ;;
11541         *)      dflt="$dlext" ;;
11542         esac
11543         rp='What is the extension of dynamically loaded modules'
11544         . ./myread
11545         dlext="$ans"
11546         ;;
11547 *)
11548         dlext="none"
11549         ;;
11550 esac
11551
11552 : Check if dlsym need a leading underscore
11553 echo " "
11554 val="$undef"
11555
11556 case "$dlsrc" in
11557 dl_dlopen.xs)
11558         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11559         $cat >dyna.c <<'EOM'
11560 fred () { }
11561 EOM
11562
11563 $cat >fred.c<<EOM
11564
11565 #include <stdio.h>
11566 #$i_stdlib I_STDLIB
11567 #ifdef I_STDLIB
11568 #include <stdlib.h>
11569 #endif
11570 #$i_dlfcn I_DLFCN
11571 #ifdef I_DLFCN
11572 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11573 #else
11574 #include <sys/types.h>
11575 #include <nlist.h>
11576 #include <link.h>
11577 #endif
11578
11579 extern int fred() ;
11580
11581 int main()
11582 {
11583     void * handle ;
11584     void * symbol ;
11585 #ifndef RTLD_LAZY
11586     int mode = 1 ;
11587 #else
11588     int mode = RTLD_LAZY ;
11589 #endif
11590     handle = dlopen("./dyna.$dlext", mode) ;
11591     if (handle == NULL) {
11592         printf ("1\n") ;
11593         fflush (stdout) ;
11594         exit(0);
11595     }
11596     symbol = dlsym(handle, "fred") ;
11597     if (symbol == NULL) {
11598         /* try putting a leading underscore */
11599         symbol = dlsym(handle, "_fred") ;
11600         if (symbol == NULL) {
11601             printf ("2\n") ;
11602             fflush (stdout) ;
11603             exit(0);
11604         }
11605         printf ("3\n") ;
11606     }
11607     else
11608         printf ("4\n") ;
11609     fflush (stdout) ;
11610     exit(0);
11611 }
11612 EOM
11613         : Call the object file tmp-dyna.o in case dlext=o.
11614         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11615                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11616                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11617                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11618                 xxx=`$run ./fred`
11619                 case $xxx in
11620                 1)      echo "Test program failed using dlopen." >&4
11621                         echo "Perhaps you should not use dynamic loading." >&4;;
11622                 2)      echo "Test program failed using dlsym." >&4
11623                         echo "Perhaps you should not use dynamic loading." >&4;;
11624                 3)      echo "dlsym needs a leading underscore" >&4
11625                         val="$define" ;;
11626                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11627                 esac
11628         else
11629                 echo "I can't compile and run the test program." >&4
11630                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11631         fi
11632         ;;
11633 esac
11634                 
11635 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11636
11637 set d_dlsymun
11638 eval $setvar
11639
11640 : see if drand48_r exists
11641 set drand48_r d_drand48_r
11642 eval $inlibc
11643 case "$d_drand48_r" in
11644 "$define")
11645         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11646         case "$d_drand48_r_proto:$usethreads" in
11647         ":define")      d_drand48_r_proto=define
11648                 set d_drand48_r_proto drand48_r $hdrs
11649                 eval $hasproto ;;
11650         *)      ;;
11651         esac
11652         case "$d_drand48_r_proto" in
11653         define)
11654         case "$drand48_r_proto" in
11655         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11656         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11657         esac
11658         case "$drand48_r_proto" in
11659         ''|0)   d_drand48_r=undef
11660                 drand48_r_proto=0
11661                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11662         * )     case "$drand48_r_proto" in
11663                 REENTRANT_PROTO*) ;;
11664                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11665                 esac
11666                 echo "Prototype: $try" ;;
11667         esac
11668         ;;
11669         *)      case "$usethreads" in
11670                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11671                 esac
11672                 d_drand48_r=undef
11673                 drand48_r_proto=0
11674                 ;;
11675         esac
11676         ;;
11677 *)      drand48_r_proto=0
11678         ;;
11679 esac
11680
11681 : see if prototype for drand48 is available
11682 echo " "
11683 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11684 eval $hasproto
11685
11686 : see if dup2 exists
11687 set dup2 d_dup2
11688 eval $inlibc
11689
11690 : see if eaccess exists
11691 set eaccess d_eaccess
11692 eval $inlibc
11693
11694 : see if endgrent exists
11695 set endgrent d_endgrent
11696 eval $inlibc
11697
11698 : see if this is an grp system
11699 set grp.h i_grp
11700 eval $inhdr
11701
11702 case "$i_grp" in
11703 $define)
11704         xxx=`./findhdr grp.h`
11705         $cppstdin $cppflags $cppminus < $xxx >$$.h
11706
11707         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11708                 val="$define"
11709         else
11710                 val="$undef"
11711         fi
11712         set d_grpasswd
11713         eval $setvar
11714
11715         $rm -f $$.h
11716         ;;
11717 *)
11718         val="$undef";
11719         set d_grpasswd; eval $setvar
11720         ;;
11721 esac
11722
11723 : see if endgrent_r exists
11724 set endgrent_r d_endgrent_r
11725 eval $inlibc
11726 case "$d_endgrent_r" in
11727 "$define")
11728         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11729         case "$d_endgrent_r_proto:$usethreads" in
11730         ":define")      d_endgrent_r_proto=define
11731                 set d_endgrent_r_proto endgrent_r $hdrs
11732                 eval $hasproto ;;
11733         *)      ;;
11734         esac
11735         case "$d_endgrent_r_proto" in
11736         define)
11737         case "$endgrent_r_proto" in
11738         ''|0) try='int endgrent_r(FILE**);'
11739         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11740         esac
11741         case "$endgrent_r_proto" in
11742         ''|0) try='void endgrent_r(FILE**);'
11743         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11744         esac
11745         case "$endgrent_r_proto" in
11746         ''|0)   d_endgrent_r=undef
11747                 endgrent_r_proto=0
11748                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11749         * )     case "$endgrent_r_proto" in
11750                 REENTRANT_PROTO*) ;;
11751                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11752                 esac
11753                 echo "Prototype: $try" ;;
11754         esac
11755         ;;
11756         *)      case "$usethreads" in
11757                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11758                 esac
11759                 d_endgrent_r=undef
11760                 endgrent_r_proto=0
11761                 ;;
11762         esac
11763         ;;
11764 *)      endgrent_r_proto=0
11765         ;;
11766 esac
11767
11768 : see if endhostent exists
11769 set endhostent d_endhent
11770 eval $inlibc
11771
11772 : see if this is a netdb.h system
11773 set netdb.h i_netdb
11774 eval $inhdr
11775
11776 : see if endhostent_r exists
11777 set endhostent_r d_endhostent_r
11778 eval $inlibc
11779 case "$d_endhostent_r" in
11780 "$define")
11781         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11782         case "$d_endhostent_r_proto:$usethreads" in
11783         ":define")      d_endhostent_r_proto=define
11784                 set d_endhostent_r_proto endhostent_r $hdrs
11785                 eval $hasproto ;;
11786         *)      ;;
11787         esac
11788         case "$d_endhostent_r_proto" in
11789         define)
11790         case "$endhostent_r_proto" in
11791         ''|0) try='int endhostent_r(struct hostent_data*);'
11792         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11793         esac
11794         case "$endhostent_r_proto" in
11795         ''|0) try='void endhostent_r(struct hostent_data*);'
11796         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11797         esac
11798         case "$endhostent_r_proto" in
11799         ''|0)   d_endhostent_r=undef
11800                 endhostent_r_proto=0
11801                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11802         * )     case "$endhostent_r_proto" in
11803                 REENTRANT_PROTO*) ;;
11804                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11805                 esac
11806                 echo "Prototype: $try" ;;
11807         esac
11808         ;;
11809         *)      case "$usethreads" in
11810                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11811                 esac
11812                 d_endhostent_r=undef
11813                 endhostent_r_proto=0
11814                 ;;
11815         esac
11816         ;;
11817 *)      endhostent_r_proto=0
11818         ;;
11819 esac
11820
11821 : see if endnetent exists
11822 set endnetent d_endnent
11823 eval $inlibc
11824
11825 : see if endnetent_r exists
11826 set endnetent_r d_endnetent_r
11827 eval $inlibc
11828 case "$d_endnetent_r" in
11829 "$define")
11830         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11831         case "$d_endnetent_r_proto:$usethreads" in
11832         ":define")      d_endnetent_r_proto=define
11833                 set d_endnetent_r_proto endnetent_r $hdrs
11834                 eval $hasproto ;;
11835         *)      ;;
11836         esac
11837         case "$d_endnetent_r_proto" in
11838         define)
11839         case "$endnetent_r_proto" in
11840         ''|0) try='int endnetent_r(struct netent_data*);'
11841         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11842         esac
11843         case "$endnetent_r_proto" in
11844         ''|0) try='void endnetent_r(struct netent_data*);'
11845         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11846         esac
11847         case "$endnetent_r_proto" in
11848         ''|0)   d_endnetent_r=undef
11849                 endnetent_r_proto=0
11850                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11851         * )     case "$endnetent_r_proto" in
11852                 REENTRANT_PROTO*) ;;
11853                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11854                 esac
11855                 echo "Prototype: $try" ;;
11856         esac
11857         ;;
11858         *)      case "$usethreads" in
11859                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11860                 esac
11861                 d_endnetent_r=undef
11862                 endnetent_r_proto=0
11863                 ;;
11864         esac
11865         ;;
11866 *)      endnetent_r_proto=0
11867         ;;
11868 esac
11869
11870 : see if endprotoent exists
11871 set endprotoent d_endpent
11872 eval $inlibc
11873
11874 : see if endprotoent_r exists
11875 set endprotoent_r d_endprotoent_r
11876 eval $inlibc
11877 case "$d_endprotoent_r" in
11878 "$define")
11879         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11880         case "$d_endprotoent_r_proto:$usethreads" in
11881         ":define")      d_endprotoent_r_proto=define
11882                 set d_endprotoent_r_proto endprotoent_r $hdrs
11883                 eval $hasproto ;;
11884         *)      ;;
11885         esac
11886         case "$d_endprotoent_r_proto" in
11887         define)
11888         case "$endprotoent_r_proto" in
11889         ''|0) try='int endprotoent_r(struct protoent_data*);'
11890         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11891         esac
11892         case "$endprotoent_r_proto" in
11893         ''|0) try='void endprotoent_r(struct protoent_data*);'
11894         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11895         esac
11896         case "$endprotoent_r_proto" in
11897         ''|0)   d_endprotoent_r=undef
11898                 endprotoent_r_proto=0
11899                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11900         * )     case "$endprotoent_r_proto" in
11901                 REENTRANT_PROTO*) ;;
11902                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11903                 esac
11904                 echo "Prototype: $try" ;;
11905         esac
11906         ;;
11907         *)      case "$usethreads" in
11908                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11909                 esac
11910                 d_endprotoent_r=undef
11911                 endprotoent_r_proto=0
11912                 ;;
11913         esac
11914         ;;
11915 *)      endprotoent_r_proto=0
11916         ;;
11917 esac
11918
11919 : see if endpwent exists
11920 set endpwent d_endpwent
11921 eval $inlibc
11922
11923 : see if this is a pwd.h system
11924 set pwd.h i_pwd
11925 eval $inhdr
11926
11927 case "$i_pwd" in
11928 $define)
11929         xxx=`./findhdr pwd.h`
11930         $cppstdin $cppflags $cppminus < $xxx >$$.h
11931
11932         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11933                 val="$define"
11934         else
11935                 val="$undef"
11936         fi
11937         set d_pwquota
11938         eval $setvar
11939
11940         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11941                 val="$define"
11942         else
11943                 val="$undef"
11944         fi
11945         set d_pwage
11946         eval $setvar
11947
11948         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11949                 val="$define"
11950         else
11951                 val="$undef"
11952         fi
11953         set d_pwchange
11954         eval $setvar
11955
11956         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11957                 val="$define"
11958         else
11959                 val="$undef"
11960         fi
11961         set d_pwclass
11962         eval $setvar
11963
11964         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11965                 val="$define"
11966         else
11967                 val="$undef"
11968         fi
11969         set d_pwexpire
11970         eval $setvar
11971
11972         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11973                 val="$define"
11974         else
11975                 val="$undef"
11976         fi
11977         set d_pwcomment
11978         eval $setvar
11979
11980         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11981                 val="$define"
11982         else
11983                 val="$undef"
11984         fi
11985         set d_pwgecos
11986         eval $setvar
11987
11988         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11989                 val="$define"
11990         else
11991                 val="$undef"
11992         fi
11993         set d_pwpasswd
11994         eval $setvar
11995
11996         $rm -f $$.h
11997         ;;
11998 *)
11999         val="$undef"; 
12000         set d_pwquota; eval $setvar
12001         set d_pwage; eval $setvar
12002         set d_pwchange; eval $setvar
12003         set d_pwclass; eval $setvar
12004         set d_pwexpire; eval $setvar
12005         set d_pwcomment; eval $setvar
12006         set d_pwgecos; eval $setvar
12007         set d_pwpasswd; eval $setvar
12008         ;;
12009 esac
12010
12011 : see if endpwent_r exists
12012 set endpwent_r d_endpwent_r
12013 eval $inlibc
12014 case "$d_endpwent_r" in
12015 "$define")
12016         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12017         case "$d_endpwent_r_proto:$usethreads" in
12018         ":define")      d_endpwent_r_proto=define
12019                 set d_endpwent_r_proto endpwent_r $hdrs
12020                 eval $hasproto ;;
12021         *)      ;;
12022         esac
12023         case "$d_endpwent_r_proto" in
12024         define)
12025         case "$endpwent_r_proto" in
12026         ''|0) try='int endpwent_r(FILE**);'
12027         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12028         esac
12029         case "$endpwent_r_proto" in
12030         ''|0) try='void endpwent_r(FILE**);'
12031         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12032         esac
12033         case "$endpwent_r_proto" in
12034         ''|0)   d_endpwent_r=undef
12035                 endpwent_r_proto=0
12036                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12037         * )     case "$endpwent_r_proto" in
12038                 REENTRANT_PROTO*) ;;
12039                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12040                 esac
12041                 echo "Prototype: $try" ;;
12042         esac
12043         ;;
12044         *)      case "$usethreads" in
12045                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12046                 esac
12047                 d_endpwent_r=undef
12048                 endpwent_r_proto=0
12049                 ;;
12050         esac
12051         ;;
12052 *)      endpwent_r_proto=0
12053         ;;
12054 esac
12055
12056 : see if endservent exists
12057 set endservent d_endsent
12058 eval $inlibc
12059
12060 : see if endservent_r exists
12061 set endservent_r d_endservent_r
12062 eval $inlibc
12063 case "$d_endservent_r" in
12064 "$define")
12065         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12066         case "$d_endservent_r_proto:$usethreads" in
12067         ":define")      d_endservent_r_proto=define
12068                 set d_endservent_r_proto endservent_r $hdrs
12069                 eval $hasproto ;;
12070         *)      ;;
12071         esac
12072         case "$d_endservent_r_proto" in
12073         define)
12074         case "$endservent_r_proto" in
12075         ''|0) try='int endservent_r(struct servent_data*);'
12076         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12077         esac
12078         case "$endservent_r_proto" in
12079         ''|0) try='void endservent_r(struct servent_data*);'
12080         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12081         esac
12082         case "$endservent_r_proto" in
12083         ''|0)   d_endservent_r=undef
12084                 endservent_r_proto=0
12085                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12086         * )     case "$endservent_r_proto" in
12087                 REENTRANT_PROTO*) ;;
12088                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12089                 esac
12090                 echo "Prototype: $try" ;;
12091         esac
12092         ;;
12093         *)      case "$usethreads" in
12094                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12095                 esac
12096                 d_endservent_r=undef
12097                 endservent_r_proto=0
12098                 ;;
12099         esac
12100         ;;
12101 *)      endservent_r_proto=0
12102         ;;
12103 esac
12104
12105 : Locate the flags for 'open()'
12106 echo " "
12107 $cat >try.c <<EOCP
12108 #include <sys/types.h>
12109 #ifdef I_FCNTL
12110 #include <fcntl.h>
12111 #endif
12112 #ifdef I_SYS_FILE
12113 #include <sys/file.h>
12114 #endif
12115 #$i_stdlib I_STDLIB
12116 #ifdef I_STDLIB
12117 #include <stdlib.h>
12118 #endif
12119 int main() {
12120         if(O_RDONLY);
12121 #ifdef O_TRUNC
12122         exit(0);
12123 #else
12124         exit(1);
12125 #endif
12126 }
12127 EOCP
12128 : check sys/file.h first to get FREAD on Sun
12129 if $test `./findhdr sys/file.h` && \
12130                 set try -DI_SYS_FILE && eval $compile; then
12131         h_sysfile=true;
12132         echo "<sys/file.h> defines the O_* constants..." >&4
12133         if $run ./try; then
12134                 echo "and you have the 3 argument form of open()." >&4
12135                 val="$define"
12136         else
12137                 echo "but not the 3 argument form of open().  Oh, well." >&4
12138                 val="$undef"
12139         fi
12140 elif $test `./findhdr fcntl.h` && \
12141                 set try -DI_FCNTL && eval $compile; then
12142         h_fcntl=true;
12143         echo "<fcntl.h> defines the O_* constants..." >&4
12144         if $run ./try; then
12145                 echo "and you have the 3 argument form of open()." >&4
12146                 val="$define"
12147         else
12148                 echo "but not the 3 argument form of open().  Oh, well." >&4
12149                 val="$undef"
12150         fi
12151 else
12152         val="$undef"
12153         echo "I can't find the O_* constant definitions!  You got problems." >&4
12154 fi
12155 set d_open3
12156 eval $setvar
12157 $rm_try
12158
12159 : see which of string.h or strings.h is needed
12160 echo " "
12161 strings=`./findhdr string.h`
12162 if $test "$strings" && $test -r "$strings"; then
12163         echo "Using <string.h> instead of <strings.h>." >&4
12164         val="$define"
12165 else
12166         val="$undef"
12167         strings=`./findhdr strings.h`
12168         if $test "$strings" && $test -r "$strings"; then
12169                 echo "Using <strings.h> instead of <string.h>." >&4
12170         else
12171                 echo "No string header found -- You'll surely have problems." >&4
12172         fi
12173 fi
12174 set i_string
12175 eval $setvar
12176 case "$i_string" in
12177 "$undef") strings=`./findhdr strings.h`;;
12178 *)        strings=`./findhdr string.h`;;
12179 esac
12180
12181 : see if this is a sys/file.h system
12182 val=''
12183 set sys/file.h val
12184 eval $inhdr
12185
12186 : do we need to include sys/file.h ?
12187 case "$val" in
12188 "$define")
12189         echo " "
12190         if $h_sysfile; then
12191                 val="$define"
12192                 echo "We'll be including <sys/file.h>." >&4
12193         else
12194                 val="$undef"
12195                 echo "We won't be including <sys/file.h>." >&4
12196         fi
12197         ;;
12198 *)
12199         h_sysfile=false
12200         ;;
12201 esac
12202 set i_sysfile
12203 eval $setvar
12204
12205 : see if fcntl.h is there
12206 val=''
12207 set fcntl.h val
12208 eval $inhdr
12209
12210 : see if we can include fcntl.h
12211 case "$val" in
12212 "$define")
12213         echo " "
12214         if $h_fcntl; then
12215                 val="$define"
12216                 echo "We'll be including <fcntl.h>." >&4
12217         else
12218                 val="$undef"
12219                 if $h_sysfile; then
12220         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12221                 else
12222                         echo "We won't be including <fcntl.h>." >&4
12223                 fi
12224         fi
12225         ;;
12226 *)
12227         h_fcntl=false
12228         val="$undef"
12229         ;;
12230 esac
12231 set i_fcntl
12232 eval $setvar
12233
12234 : see if fork exists
12235 set fork d_fork
12236 eval $inlibc
12237
12238 : see if pipe exists
12239 set pipe d_pipe
12240 eval $inlibc
12241
12242 : check for non-blocking I/O stuff
12243 case "$h_sysfile" in
12244 true) echo "#include <sys/file.h>" > head.c;;
12245 *)
12246        case "$h_fcntl" in
12247        true) echo "#include <fcntl.h>" > head.c;;
12248        *) echo "#include <sys/fcntl.h>" > head.c;;
12249        esac
12250        ;;
12251 esac
12252 echo " "
12253 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12254 case "$o_nonblock" in
12255 '')
12256         $cat head.c > try.c
12257         $cat >>try.c <<EOCP
12258 #include <stdio.h>
12259 #$i_stdlib I_STDLIB
12260 #ifdef I_STDLIB
12261 #include <stdlib.h>
12262 #endif
12263 #$i_fcntl I_FCNTL
12264 #ifdef I_FCNTL
12265 #include <fcntl.h>
12266 #endif
12267 int main() {
12268 #ifdef O_NONBLOCK
12269         printf("O_NONBLOCK\n");
12270         exit(0);
12271 #endif
12272 #ifdef O_NDELAY
12273         printf("O_NDELAY\n");
12274         exit(0);
12275 #endif
12276 #ifdef FNDELAY
12277         printf("FNDELAY\n");
12278         exit(0);
12279 #endif
12280         exit(0);
12281 }
12282 EOCP
12283         set try
12284         if eval $compile_ok; then
12285                 o_nonblock=`$run ./try`
12286                 case "$o_nonblock" in
12287                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12288                 *) echo "Seems like we can use $o_nonblock.";;
12289                 esac
12290         else
12291                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12292         fi
12293         ;;
12294 *) echo "Using $hint value $o_nonblock.";;
12295 esac
12296 $rm_try
12297
12298 echo " "
12299 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12300 case "$eagain" in
12301 '')
12302         case "$d_fork:$d_pipe" in
12303         define:define)
12304         $cat head.c > try.c
12305         $cat >>try.c <<EOCP
12306 #include <errno.h>
12307 #include <sys/types.h>
12308 #include <signal.h>
12309 #include <stdio.h>
12310 #$i_stdlib I_STDLIB
12311 #ifdef I_STDLIB
12312 #include <stdlib.h>
12313 #endif
12314 #$i_fcntl I_FCNTL
12315 #ifdef I_FCNTL
12316 #include <fcntl.h>
12317 #endif
12318 #define MY_O_NONBLOCK $o_nonblock
12319 #ifndef errno  /* XXX need better Configure test */
12320 extern int errno;
12321 #endif
12322 #$i_unistd I_UNISTD
12323 #ifdef I_UNISTD
12324 #include <unistd.h>
12325 #endif
12326 #$i_string I_STRING
12327 #ifdef I_STRING
12328 #include <string.h>
12329 #else
12330 #include <strings.h>
12331 #endif
12332 $signal_t blech(int x) { exit(3); }
12333 EOCP
12334         $cat >> try.c <<'EOCP'
12335 int main()
12336 {
12337         int pd[2];
12338         int pu[2];
12339         char buf[1];
12340         char string[100];
12341
12342         pipe(pd);       /* Down: child -> parent */
12343         pipe(pu);       /* Up: parent -> child */
12344         if (0 != fork()) {
12345                 int ret;
12346                 close(pd[1]);   /* Parent reads from pd[0] */
12347                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12348 #ifdef F_SETFL
12349                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12350                         exit(1);
12351 #else
12352                 exit(4);
12353 #endif
12354                 signal(SIGALRM, blech);
12355                 alarm(5);
12356                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12357                         exit(2);
12358                 sprintf(string, "%d\n", ret);
12359                 write(2, string, strlen(string));
12360                 alarm(0);
12361 #ifdef EAGAIN
12362                 if (errno == EAGAIN) {
12363                         printf("EAGAIN\n");
12364                         goto ok;
12365                 }
12366 #endif
12367 #ifdef EWOULDBLOCK
12368                 if (errno == EWOULDBLOCK)
12369                         printf("EWOULDBLOCK\n");
12370 #endif
12371         ok:
12372                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12373                 sleep(2);                               /* Give it time to close our pipe */
12374                 alarm(5);
12375                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12376                 alarm(0);
12377                 sprintf(string, "%d\n", ret);
12378                 write(4, string, strlen(string));
12379                 exit(0);
12380         }
12381
12382         close(pd[0]);                   /* We write to pd[1] */
12383         close(pu[1]);                   /* We read from pu[0] */
12384         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12385         close(pd[1]);                   /* Pipe pd is now fully closed! */
12386         exit(0);                                /* Bye bye, thank you for playing! */
12387 }
12388 EOCP
12389         set try
12390         if eval $compile_ok; then
12391                 echo "$startsh" >mtry
12392                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12393                 chmod +x mtry
12394                 ./mtry >/dev/null 2>&1
12395                 case $? in
12396                 0) eagain=`$cat try.out`;;
12397                 1) echo "Could not perform non-blocking setting!";;
12398                 2) echo "I did a successful read() for something that was not there!";;
12399                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12400                 4) echo "Could not find F_SETFL!";;
12401                 *) echo "Something terribly wrong happened during testing.";;
12402                 esac
12403                 rd_nodata=`$cat try.ret`
12404                 echo "A read() system call with no data present returns $rd_nodata."
12405                 case "$rd_nodata" in
12406                 0|-1) ;;
12407                 *)
12408                         echo "(That's peculiar, fixing that to be -1.)"
12409                         rd_nodata=-1
12410                         ;;
12411                 esac
12412                 case "$eagain" in
12413                 '')
12414                         echo "Forcing errno EAGAIN on read() with no data available."
12415                         eagain=EAGAIN
12416                         ;;
12417                 *)
12418                         echo "Your read() sets errno to $eagain when no data is available."
12419                         ;;
12420                 esac
12421                 status=`$cat try.err`
12422                 case "$status" in
12423                 0) echo "And it correctly returns 0 to signal EOF.";;
12424                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12425                 *) echo "However, your read() returns '$status' on EOF??";;
12426                 esac
12427                 val="$define"
12428                 if test "$status" = "$rd_nodata"; then
12429                         echo "WARNING: you can't distinguish between EOF and no data!"
12430                         val="$undef"
12431                 fi
12432         else
12433                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12434                 eagain=EAGAIN
12435         fi
12436         ;;
12437         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12438                 eagain=EAGAIN
12439                 val="$define"
12440                 ;;
12441         esac
12442         set d_eofnblk
12443         eval $setvar
12444         ;;
12445 *)
12446         echo "Using $hint value $eagain."
12447         echo "Your read() returns $rd_nodata when no data is present."
12448         case "$d_eofnblk" in
12449         "$define") echo "And you can see EOF because read() returns 0.";;
12450         "$undef") echo "But you can't see EOF status from read() returned value.";;
12451         *)
12452                 echo "(Assuming you can't see EOF status from read anyway.)"
12453                 d_eofnblk=$undef
12454                 ;;
12455         esac
12456         ;;
12457 esac
12458 $rm_try head.c mtry
12459
12460 : see if _ptr and _cnt from stdio act std
12461 echo " "
12462
12463 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12464         echo "(Looks like you have stdio.h from BSD.)"
12465         case "$stdio_ptr" in
12466         '') stdio_ptr='((fp)->_p)'
12467                 ptr_lval=$define
12468                 ;;
12469         *)      ptr_lval=$d_stdio_ptr_lval;;
12470         esac
12471         case "$stdio_cnt" in
12472         '') stdio_cnt='((fp)->_r)'
12473                 cnt_lval=$define
12474                 ;;
12475         *)      cnt_lval=$d_stdio_cnt_lval;;
12476         esac
12477         case "$stdio_base" in
12478         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12479         esac
12480         case "$stdio_bufsiz" in
12481         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12482         esac
12483 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12484         echo "(Looks like you have stdio.h from Linux.)"
12485         case "$stdio_ptr" in
12486         '') stdio_ptr='((fp)->_IO_read_ptr)'
12487                 ptr_lval=$define
12488                 ;;
12489         *)      ptr_lval=$d_stdio_ptr_lval;;
12490         esac
12491         case "$stdio_cnt" in
12492         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12493                 cnt_lval=$undef
12494                 ;;
12495         *)      cnt_lval=$d_stdio_cnt_lval;;
12496         esac
12497         case "$stdio_base" in
12498         '') stdio_base='((fp)->_IO_read_base)';;
12499         esac
12500         case "$stdio_bufsiz" in
12501         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12502         esac
12503 else
12504         case "$stdio_ptr" in
12505         '') stdio_ptr='((fp)->_ptr)'
12506                 ptr_lval=$define
12507                 ;;
12508         *)      ptr_lval=$d_stdio_ptr_lval;;
12509         esac
12510         case "$stdio_cnt" in
12511         '') stdio_cnt='((fp)->_cnt)'
12512                 cnt_lval=$define
12513                 ;;
12514         *)      cnt_lval=$d_stdio_cnt_lval;;
12515         esac
12516         case "$stdio_base" in
12517         '') stdio_base='((fp)->_base)';;
12518         esac
12519         case "$stdio_bufsiz" in
12520         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12521         esac
12522 fi
12523
12524 : test whether _ptr and _cnt really work
12525 echo "Checking how std your stdio is..." >&4
12526 $cat >try.c <<EOP
12527 #include <stdio.h>
12528 #$i_stdlib I_STDLIB
12529 #ifdef I_STDLIB
12530 #include <stdlib.h>
12531 #endif
12532 #define FILE_ptr(fp)    $stdio_ptr
12533 #define FILE_cnt(fp)    $stdio_cnt
12534 int main() {
12535         FILE *fp = fopen("try.c", "r");
12536         char c = getc(fp);
12537         if (
12538                 18 <= FILE_cnt(fp) &&
12539                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12540         )
12541                 exit(0);
12542         exit(1);
12543 }
12544 EOP
12545 val="$undef"
12546 set try
12547 if eval $compile && $to try.c; then
12548         if $run ./try; then
12549                 echo "Your stdio acts pretty std."
12550                 val="$define"
12551         else
12552                 echo "Your stdio isn't very std."
12553         fi
12554 else
12555         echo "Your stdio doesn't appear very std."
12556 fi
12557 $rm_try
12558
12559 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12560 # direct buffer manipulation no longer works.  The Configure tests
12561 # should be changed to correctly detect this, but until then,
12562 # the following check should at least let perl compile and run.
12563 # (This quick fix should be updated before 5.8.1.)
12564 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12565 # A. Dougherty, June 3, 2002.
12566 case "$d_gnulibc" in
12567 $define)
12568         case "$gnulibc_version" in
12569         2.[01]*)  ;;
12570         2.2) ;;
12571         2.2.[0-9]) ;;
12572         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12573                 val="$undef"
12574                 ;;
12575         esac
12576         ;;
12577 esac
12578 set d_stdstdio
12579 eval $setvar
12580
12581 : Can _ptr be used as an lvalue?
12582 case "$d_stdstdio$ptr_lval" in
12583 $define$define) val=$define ;;
12584 *) val=$undef ;;
12585 esac
12586 set d_stdio_ptr_lval
12587 eval $setvar
12588
12589 : Can _cnt be used as an lvalue?
12590 case "$d_stdstdio$cnt_lval" in
12591 $define$define) val=$define ;;
12592 *) val=$undef ;;
12593 esac
12594 set d_stdio_cnt_lval
12595 eval $setvar
12596
12597
12598 : test whether setting _ptr sets _cnt as a side effect
12599 d_stdio_ptr_lval_sets_cnt="$undef"
12600 d_stdio_ptr_lval_nochange_cnt="$undef"
12601 case "$d_stdio_ptr_lval$d_stdstdio" in
12602 $define$define)
12603         echo "Checking to see what happens if we set the stdio ptr..." >&4
12604 $cat >try.c <<EOP
12605 #include <stdio.h>
12606 /* Can we scream? */
12607 /* Eat dust sed :-) */
12608 /* In the buffer space, no one can hear you scream. */
12609 #$i_stdlib I_STDLIB
12610 #ifdef I_STDLIB
12611 #include <stdlib.h>
12612 #endif
12613 #define FILE_ptr(fp)    $stdio_ptr
12614 #define FILE_cnt(fp)    $stdio_cnt
12615 #include <sys/types.h>
12616 int main() {
12617         FILE *fp = fopen("try.c", "r");
12618         int c;
12619         char *ptr;
12620         size_t cnt;
12621         if (!fp) {
12622             puts("Fail even to read");
12623             exit(1);
12624         }
12625         c = getc(fp); /* Read away the first # */
12626         if (c == EOF) {
12627             puts("Fail even to read");
12628             exit(1);
12629         }
12630         if (!(
12631                 18 <= FILE_cnt(fp) &&
12632                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12633         )) {
12634                 puts("Fail even to read");
12635                 exit (1);
12636         }
12637         ptr = (char*) FILE_ptr(fp);
12638         cnt = (size_t)FILE_cnt(fp);
12639
12640         FILE_ptr(fp) += 42;
12641
12642         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12643                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12644                 exit (1);
12645         }
12646         if (FILE_cnt(fp) <= 20) {
12647                 printf ("Fail (<20 chars to test)");
12648                 exit (1);
12649         }
12650         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12651                 puts("Fail compare");
12652                 exit (1);
12653         }
12654         if (cnt == FILE_cnt(fp)) {
12655                 puts("Pass_unchanged");
12656                 exit (0);
12657         }
12658         if (FILE_cnt(fp) == (cnt - 42)) {
12659                 puts("Pass_changed");
12660                 exit (0);
12661         }
12662         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12663         return 1;
12664
12665 }
12666 EOP
12667         set try
12668         if eval $compile && $to try.c; then
12669                 case `$run ./try` in
12670                 Pass_changed)
12671                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12672                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12673                 Pass_unchanged)
12674                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12675                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12676                 Fail*)
12677                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12678                 *)
12679                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12680         esac
12681         else
12682                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12683         fi
12684         $rm_try
12685         ;;
12686 esac
12687
12688 : see if _base is also standard
12689 val="$undef"
12690 case "$d_stdstdio" in
12691 $define)
12692         $cat >try.c <<EOP
12693 #include <stdio.h>
12694 #$i_stdlib I_STDLIB
12695 #ifdef I_STDLIB
12696 #include <stdlib.h>
12697 #endif
12698 #define FILE_base(fp)   $stdio_base
12699 #define FILE_bufsiz(fp) $stdio_bufsiz
12700 int main() {
12701         FILE *fp = fopen("try.c", "r");
12702         char c = getc(fp);
12703         if (
12704                 19 <= FILE_bufsiz(fp) &&
12705                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12706         )
12707                 exit(0);
12708         exit(1);
12709 }
12710 EOP
12711         set try
12712         if eval $compile && $to try.c; then
12713                 if $run ./try; then
12714                         echo "And its _base field acts std."
12715                         val="$define"
12716                 else
12717                         echo "But its _base field isn't std."
12718                 fi
12719         else
12720                 echo "However, it seems to be lacking the _base field."
12721         fi
12722         $rm_try
12723         ;;
12724 esac
12725 set d_stdiobase
12726 eval $setvar
12727
12728 : see if fast_stdio exists
12729 val="$undef"
12730 case "$d_stdstdio:$d_stdio_ptr_lval" in
12731 "$define:$define")
12732         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12733         *$define*)
12734                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12735                 val="$define"
12736                 ;;
12737         esac
12738         ;;
12739 esac
12740 set d_faststdio
12741 eval $setvar
12742
12743
12744
12745 : see if fchdir exists
12746 set fchdir d_fchdir
12747 eval $inlibc
12748
12749 : see if fchmod exists
12750 set fchmod d_fchmod
12751 eval $inlibc
12752
12753 : see if fchown exists
12754 set fchown d_fchown
12755 eval $inlibc
12756
12757 : see if this is an fcntl system
12758 set fcntl d_fcntl
12759 eval $inlibc
12760
12761 echo " "
12762 : See if fcntl-based locking works.
12763 $cat >try.c <<EOCP
12764 #$i_stdlib I_STDLIB
12765 #ifdef I_STDLIB
12766 #include <stdlib.h>
12767 #endif
12768 #include <unistd.h>
12769 #include <fcntl.h>
12770 #include <signal.h>
12771 $signal_t blech(int x) { exit(3); }
12772 int main() {
12773 #if defined(F_SETLK) && defined(F_SETLKW)
12774      struct flock flock;
12775      int retval, fd;
12776      fd = open("try.c", O_RDONLY);
12777      flock.l_type = F_RDLCK;
12778      flock.l_whence = SEEK_SET;
12779      flock.l_start = flock.l_len = 0;
12780      signal(SIGALRM, blech);
12781      alarm(10);
12782      retval = fcntl(fd, F_SETLK, &flock);
12783      close(fd);
12784      (retval < 0 ? exit(2) : exit(0));
12785 #else
12786      exit(2);
12787 #endif
12788 }
12789 EOCP
12790 echo "Checking if fcntl-based file locking works... "
12791 case "$d_fcntl" in
12792 "$define")
12793         set try
12794         if eval $compile_ok; then
12795                 if $run ./try; then
12796                         echo "Yes, it seems to work."
12797                         val="$define"
12798                 else
12799                         echo "Nope, it didn't work."
12800                         val="$undef"
12801                         case "$?" in
12802                         3) $cat >&4 <<EOM
12803 ***
12804 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12805 *** This is (almost) impossible.
12806 *** If your NFS lock daemons are not feeling well, something like
12807 *** this may happen, please investigate.  Cannot continue, aborting.
12808 ***
12809 EOM
12810                                 exit 1
12811                                 ;;
12812                         esac
12813                 fi
12814         else
12815                 echo "I'm unable to compile the test program, so I'll assume not."
12816                 val="$undef"
12817         fi
12818         ;;
12819 *) val="$undef";
12820         echo "Nope, since you don't even have fcntl()."
12821         ;;
12822 esac
12823 set d_fcntl_can_lock
12824 eval $setvar
12825 $rm_try
12826
12827 : check for fd_set items
12828 $cat <<EOM
12829
12830 Checking to see how well your C compiler handles fd_set and friends ...
12831 EOM
12832 $cat >try.c <<EOCP
12833 #$i_stdlib I_STDLIB
12834 #ifdef I_STDLIB
12835 #include <stdlib.h>
12836 #endif
12837 #$i_systime I_SYS_TIME
12838 #$i_sysselct I_SYS_SELECT
12839 #$d_socket HAS_SOCKET
12840 #include <sys/types.h>
12841 #ifdef HAS_SOCKET
12842 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12843 #endif
12844 #ifdef I_SYS_TIME
12845 #include <sys/time.h>
12846 #endif
12847 #ifdef I_SYS_SELECT
12848 #include <sys/select.h>
12849 #endif
12850 int main() {
12851         fd_set fds;
12852
12853 #ifdef TRYBITS
12854         if(fds.fds_bits);
12855 #endif
12856
12857 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12858         exit(0);
12859 #else
12860         exit(1);
12861 #endif
12862 }
12863 EOCP
12864 set try -DTRYBITS
12865 if eval $compile; then
12866         d_fds_bits="$define"
12867         d_fd_set="$define"
12868         echo "Well, your system knows about the normal fd_set typedef..." >&4
12869         if $run ./try; then
12870                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12871                 d_fd_macros="$define"
12872         else
12873                 $cat >&4 <<'EOM'
12874 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12875 EOM
12876                 d_fd_macros="$undef"
12877         fi
12878 else
12879         $cat <<'EOM'
12880 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12881 EOM
12882         set try
12883         if eval $compile; then
12884                 d_fds_bits="$undef"
12885                 d_fd_set="$define"
12886                 echo "Well, your system has some sort of fd_set available..." >&4
12887                 if $run ./try; then
12888                         echo "and you have the normal fd_set macros." >&4
12889                         d_fd_macros="$define"
12890                 else
12891                         $cat <<'EOM'
12892 but not the normal fd_set macros!  Gross!  More work for me...
12893 EOM
12894                         d_fd_macros="$undef"
12895                 fi
12896         else
12897         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12898                 d_fd_set="$undef"
12899                 d_fds_bits="$undef"
12900                 d_fd_macros="$undef"
12901         fi
12902 fi
12903 $rm_try
12904
12905 : see if fgetpos exists
12906 set fgetpos d_fgetpos
12907 eval $inlibc
12908
12909 : see if finite exists
12910 set finite d_finite
12911 eval $inlibc
12912
12913 : see if finitel exists
12914 set finitel d_finitel
12915 eval $inlibc
12916
12917 : see if flock exists
12918 set flock d_flock
12919 eval $inlibc
12920
12921 : see if prototype for flock is available
12922 echo " "
12923 set d_flockproto flock $i_sysfile sys/file.h
12924 eval $hasproto
12925
12926 : see if fp_class exists
12927 set fp_class d_fp_class
12928 eval $inlibc
12929
12930 : see if pathconf exists
12931 set pathconf d_pathconf
12932 eval $inlibc
12933
12934 : see if fpathconf exists
12935 set fpathconf d_fpathconf
12936 eval $inlibc
12937
12938 : see if fpclass exists
12939 set fpclass d_fpclass
12940 eval $inlibc
12941
12942 : see if fpclassify exists
12943 set fpclassify d_fpclassify
12944 eval $inlibc
12945
12946 : see if fpclassl exists
12947 set fpclassl d_fpclassl
12948 eval $inlibc
12949
12950
12951 : check for fpos64_t
12952 echo " "
12953 echo "Checking to see if you have fpos64_t..." >&4
12954 $cat >try.c <<EOCP
12955 #include <stdio.h>
12956 int main() { fpos64_t x = 7; }
12957 EOCP
12958 set try
12959 if eval $compile; then
12960         val="$define"
12961         echo "You have fpos64_t."
12962 else
12963         val="$undef"
12964         echo "You do not have fpos64_t."
12965         case "$fpossize" in
12966         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12967         esac
12968 fi
12969 $rm_try
12970 set d_fpos64_t
12971 eval $setvar
12972
12973 : see if frexpl exists
12974 set frexpl d_frexpl
12975 eval $inlibc
12976
12977 : see if this is a sys/param system
12978 set sys/param.h i_sysparam
12979 eval $inhdr
12980
12981 : see if this is a sys/mount.h system
12982 set sys/mount.h i_sysmount
12983 eval $inhdr
12984
12985
12986 echo " "
12987 echo "Checking to see if your system supports struct fs_data..." >&4
12988 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12989 eval $hasstruct
12990 case "$d_fs_data_s" in
12991 "$define")      echo "Yes, it does."   ;;
12992 *)              echo "No, it doesn't." ;;
12993 esac
12994
12995 : see if fseeko exists
12996 set fseeko d_fseeko
12997 eval $inlibc
12998 case "$longsize" in
12999 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13000 esac
13001
13002 : see if fsetpos exists
13003 set fsetpos d_fsetpos
13004 eval $inlibc
13005
13006
13007 : see if fstatfs exists
13008 set fstatfs d_fstatfs
13009 eval $inlibc
13010
13011
13012 : see if statvfs exists
13013 set statvfs d_statvfs
13014 eval $inlibc
13015
13016 : see if fstatvfs exists
13017 set fstatvfs d_fstatvfs
13018 eval $inlibc
13019
13020
13021 : see if fsync exists
13022 set fsync d_fsync
13023 eval $inlibc
13024
13025 : see if ftello exists
13026 set ftello d_ftello
13027 eval $inlibc
13028 case "$longsize" in
13029 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13030 esac
13031
13032 d_futimes="$undef"
13033 : check for a working futimes
13034 echo " "
13035 echo "Checking if you have a working futimes()" >&4
13036 $cat >try.c <<EOCP
13037 #include <stdio.h>
13038 #include <sys/time.h>
13039 #include <errno.h>
13040 #include <fcntl.h>
13041
13042 int main ()
13043 {
13044     int fd, rv;
13045     fd = open ("try.c", O_RDWR);
13046     if (-1 == fd) exit (1);
13047     rv = futimes (fd, NULL);
13048     exit (rv == -1 ? errno : 0);
13049 }
13050 EOCP
13051 set try
13052 if eval $compile; then
13053     `$run ./try`
13054     rc=$?
13055     case "$rc" in
13056         0)  echo "Yes, you have" >&4
13057             d_futimes="$define"
13058             ;;
13059         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13060             ;;
13061     esac
13062 else
13063     echo "No, it does not (probably harmless)" >&4
13064 fi
13065 $rm_try
13066
13067 : see if getcwd exists
13068 set getcwd d_getcwd
13069 eval $inlibc
13070
13071 : see if getespwnam exists
13072 set getespwnam d_getespwnam
13073 eval $inlibc
13074
13075
13076 : see if getfsstat exists
13077 set getfsstat d_getfsstat
13078 eval $inlibc
13079
13080 : see if getgrent exists
13081 set getgrent d_getgrent
13082 eval $inlibc
13083
13084 : see if getgrent_r exists
13085 set getgrent_r d_getgrent_r
13086 eval $inlibc
13087 case "$d_getgrent_r" in
13088 "$define")
13089         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13090         case "$d_getgrent_r_proto:$usethreads" in
13091         ":define")      d_getgrent_r_proto=define
13092                 set d_getgrent_r_proto getgrent_r $hdrs
13093                 eval $hasproto ;;
13094         *)      ;;
13095         esac
13096         case "$d_getgrent_r_proto" in
13097         define)
13098         case "$getgrent_r_proto" in
13099         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13100         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13101         esac
13102         case "$getgrent_r_proto" in
13103         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13104         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13105         esac
13106         case "$getgrent_r_proto" in
13107         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13108         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13109         esac
13110         case "$getgrent_r_proto" in
13111         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13112         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13113         esac
13114         case "$getgrent_r_proto" in
13115         ''|0) try='int getgrent_r(struct group*, char*, int);'
13116         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13117         esac
13118         case "$getgrent_r_proto" in
13119         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13120         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13121         esac
13122         case "$getgrent_r_proto" in
13123         ''|0)   d_getgrent_r=undef
13124                 getgrent_r_proto=0
13125                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13126         * )     case "$getgrent_r_proto" in
13127                 REENTRANT_PROTO*) ;;
13128                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13129                 esac
13130                 echo "Prototype: $try" ;;
13131         esac
13132         ;;
13133         *)      case "$usethreads" in
13134                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13135                 esac
13136                 d_getgrent_r=undef
13137                 getgrent_r_proto=0
13138                 ;;
13139         esac
13140         ;;
13141 *)      getgrent_r_proto=0
13142         ;;
13143 esac
13144
13145 : see if getgrgid_r exists
13146 set getgrgid_r d_getgrgid_r
13147 eval $inlibc
13148 case "$d_getgrgid_r" in
13149 "$define")
13150         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13151         case "$d_getgrgid_r_proto:$usethreads" in
13152         ":define")      d_getgrgid_r_proto=define
13153                 set d_getgrgid_r_proto getgrgid_r $hdrs
13154                 eval $hasproto ;;
13155         *)      ;;
13156         esac
13157         case "$d_getgrgid_r_proto" in
13158         define)
13159         case "$getgrgid_r_proto" in
13160         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13161         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13162         esac
13163         case "$getgrgid_r_proto" in
13164         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13165         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13166         esac
13167         case "$getgrgid_r_proto" in
13168         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13169         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13170         esac
13171         case "$getgrgid_r_proto" in
13172         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13173         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13174         esac
13175         case "$getgrgid_r_proto" in
13176         ''|0)   d_getgrgid_r=undef
13177                 getgrgid_r_proto=0
13178                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13179         * )     case "$getgrgid_r_proto" in
13180                 REENTRANT_PROTO*) ;;
13181                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13182                 esac
13183                 echo "Prototype: $try" ;;
13184         esac
13185         ;;
13186         *)      case "$usethreads" in
13187                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13188                 esac
13189                 d_getgrgid_r=undef
13190                 getgrgid_r_proto=0
13191                 ;;
13192         esac
13193         ;;
13194 *)      getgrgid_r_proto=0
13195         ;;
13196 esac
13197
13198 : see if getgrnam_r exists
13199 set getgrnam_r d_getgrnam_r
13200 eval $inlibc
13201 case "$d_getgrnam_r" in
13202 "$define")
13203         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13204         case "$d_getgrnam_r_proto:$usethreads" in
13205         ":define")      d_getgrnam_r_proto=define
13206                 set d_getgrnam_r_proto getgrnam_r $hdrs
13207                 eval $hasproto ;;
13208         *)      ;;
13209         esac
13210         case "$d_getgrnam_r_proto" in
13211         define)
13212         case "$getgrnam_r_proto" in
13213         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13214         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13215         esac
13216         case "$getgrnam_r_proto" in
13217         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13218         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13219         esac
13220         case "$getgrnam_r_proto" in
13221         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13222         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13223         esac
13224         case "$getgrnam_r_proto" in
13225         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13226         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13227         esac
13228         case "$getgrnam_r_proto" in
13229         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13230         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13231         esac
13232         case "$getgrnam_r_proto" in
13233         ''|0)   d_getgrnam_r=undef
13234                 getgrnam_r_proto=0
13235                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13236         * )     case "$getgrnam_r_proto" in
13237                 REENTRANT_PROTO*) ;;
13238                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13239                 esac
13240                 echo "Prototype: $try" ;;
13241         esac
13242         ;;
13243         *)      case "$usethreads" in
13244                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13245                 esac
13246                 d_getgrnam_r=undef
13247                 getgrnam_r_proto=0
13248                 ;;
13249         esac
13250         ;;
13251 *)      getgrnam_r_proto=0
13252         ;;
13253 esac
13254
13255 : see if gethostbyaddr exists
13256 set gethostbyaddr d_gethbyaddr
13257 eval $inlibc
13258
13259 : see if gethostbyname exists
13260 set gethostbyname d_gethbyname
13261 eval $inlibc
13262
13263 : see if gethostent exists
13264 set gethostent d_gethent
13265 eval $inlibc
13266
13267 : see how we will look up host name
13268 echo " "
13269 call=''
13270 if set gethostname val -f d_gethname; eval $csym; $val; then
13271         echo 'gethostname() found.' >&4
13272         d_gethname="$define"
13273         call=gethostname
13274 fi
13275 if set uname val -f d_uname; eval $csym; $val; then
13276         if ./xenix; then
13277                 $cat <<'EOM'
13278 uname() was found, but you're running xenix, and older versions of xenix
13279 have a broken uname(). If you don't really know whether your xenix is old
13280 enough to have a broken system call, use the default answer.
13281
13282 EOM
13283                 dflt=y
13284                 case "$d_uname" in
13285                 "$define") dflt=n;;
13286                 esac
13287                 rp='Is your uname() broken?'
13288                 . ./myread
13289                 case "$ans" in
13290                 n*) d_uname="$define"; call=uname;;
13291                 esac
13292         else
13293                 echo 'uname() found.' >&4
13294                 d_uname="$define"
13295                 case "$call" in
13296                 '') call=uname ;;
13297                 esac
13298         fi
13299 fi
13300 case "$d_gethname" in
13301 '') d_gethname="$undef";;
13302 esac
13303 case "$d_uname" in
13304 '') d_uname="$undef";;
13305 esac
13306 case "$d_uname$d_gethname" in
13307 *define*)
13308         dflt=n
13309         cat <<EOM
13310  
13311 Every now and then someone has a $call() that lies about the hostname
13312 but can't be fixed for political or economic reasons.  If you wish, I can
13313 pretend $call() isn't there and maybe compute hostname at run-time
13314 thanks to the '$phostname' command.
13315
13316 EOM
13317         rp="Shall I ignore $call() from now on?"
13318         . ./myread
13319         case "$ans" in
13320         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13321         esac;;
13322 esac
13323 case "$phostname" in
13324 '') aphostname='';;
13325 *) case "$aphostname" in
13326         /*) ;;
13327         *) set X $phostname
13328                 shift
13329                 file=$1
13330                 shift
13331                 file=`./loc $file $file $pth`
13332                 aphostname=`echo $file $*`
13333                 ;;
13334         esac
13335         ;;
13336 esac
13337 case "$d_uname$d_gethname" in
13338 *define*) ;;
13339 *)
13340         case "$phostname" in
13341         '')
13342                 echo "There will be no way for $package to get your hostname." >&4;;
13343         *)
13344         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13345                 ;;
13346         esac;;
13347 esac
13348 case "$d_phostname" in
13349 '') d_phostname="$undef";;
13350 esac
13351
13352 : see if gethostbyaddr_r exists
13353 set gethostbyaddr_r d_gethostbyaddr_r
13354 eval $inlibc
13355 case "$d_gethostbyaddr_r" in
13356 "$define")
13357         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13358         case "$d_gethostbyaddr_r_proto:$usethreads" in
13359         ":define")      d_gethostbyaddr_r_proto=define
13360                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13361                 eval $hasproto ;;
13362         *)      ;;
13363         esac
13364         case "$d_gethostbyaddr_r_proto" in
13365         define)
13366         case "$gethostbyaddr_r_proto" in
13367         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13368         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13369         esac
13370         case "$gethostbyaddr_r_proto" in
13371         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13372         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13373         esac
13374         case "$gethostbyaddr_r_proto" in
13375         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13376         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13377         esac
13378         case "$gethostbyaddr_r_proto" in
13379         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13380         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13381         esac
13382         case "$gethostbyaddr_r_proto" in
13383         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13384         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13385         esac
13386         case "$gethostbyaddr_r_proto" in
13387         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13388         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13389         esac
13390         case "$gethostbyaddr_r_proto" in
13391         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13392         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13393         esac
13394         case "$gethostbyaddr_r_proto" in
13395         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13396         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13397         esac
13398         case "$gethostbyaddr_r_proto" in
13399         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13400         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13401         esac
13402         case "$gethostbyaddr_r_proto" in
13403         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13404         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13405         esac
13406         case "$gethostbyaddr_r_proto" in
13407         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13408         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13409         esac
13410         case "$gethostbyaddr_r_proto" in
13411         ''|0)   d_gethostbyaddr_r=undef
13412                 gethostbyaddr_r_proto=0
13413                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13414         * )     case "$gethostbyaddr_r_proto" in
13415                 REENTRANT_PROTO*) ;;
13416                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13417                 esac
13418                 echo "Prototype: $try" ;;
13419         esac
13420         ;;
13421         *)      case "$usethreads" in
13422                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13423                 esac
13424                 d_gethostbyaddr_r=undef
13425                 gethostbyaddr_r_proto=0
13426                 ;;
13427         esac
13428         ;;
13429 *)      gethostbyaddr_r_proto=0
13430         ;;
13431 esac
13432
13433 : see if gethostbyname_r exists
13434 set gethostbyname_r d_gethostbyname_r
13435 eval $inlibc
13436 case "$d_gethostbyname_r" in
13437 "$define")
13438         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13439         case "$d_gethostbyname_r_proto:$usethreads" in
13440         ":define")      d_gethostbyname_r_proto=define
13441                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13442                 eval $hasproto ;;
13443         *)      ;;
13444         esac
13445         case "$d_gethostbyname_r_proto" in
13446         define)
13447         case "$gethostbyname_r_proto" in
13448         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13449         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13450         esac
13451         case "$gethostbyname_r_proto" in
13452         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13453         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13454         esac
13455         case "$gethostbyname_r_proto" in
13456         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13457         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13458         esac
13459         case "$gethostbyname_r_proto" in
13460         ''|0)   d_gethostbyname_r=undef
13461                 gethostbyname_r_proto=0
13462                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13463         * )     case "$gethostbyname_r_proto" in
13464                 REENTRANT_PROTO*) ;;
13465                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13466                 esac
13467                 echo "Prototype: $try" ;;
13468         esac
13469         ;;
13470         *)      case "$usethreads" in
13471                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13472                 esac
13473                 d_gethostbyname_r=undef
13474                 gethostbyname_r_proto=0
13475                 ;;
13476         esac
13477         ;;
13478 *)      gethostbyname_r_proto=0
13479         ;;
13480 esac
13481
13482 : see if gethostent_r exists
13483 set gethostent_r d_gethostent_r
13484 eval $inlibc
13485 case "$d_gethostent_r" in
13486 "$define")
13487         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13488         case "$d_gethostent_r_proto:$usethreads" in
13489         ":define")      d_gethostent_r_proto=define
13490                 set d_gethostent_r_proto gethostent_r $hdrs
13491                 eval $hasproto ;;
13492         *)      ;;
13493         esac
13494         case "$d_gethostent_r_proto" in
13495         define)
13496         case "$gethostent_r_proto" in
13497         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13498         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13499         esac
13500         case "$gethostent_r_proto" in
13501         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13502         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13503         esac
13504         case "$gethostent_r_proto" in
13505         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13506         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13507         esac
13508         case "$gethostent_r_proto" in
13509         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13510         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13511         esac
13512         case "$gethostent_r_proto" in
13513         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13514         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13515         esac
13516         case "$gethostent_r_proto" in
13517         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13518         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13519         esac
13520         case "$gethostent_r_proto" in
13521         ''|0)   d_gethostent_r=undef
13522                 gethostent_r_proto=0
13523                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13524         * )     case "$gethostent_r_proto" in
13525                 REENTRANT_PROTO*) ;;
13526                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13527                 esac
13528                 echo "Prototype: $try" ;;
13529         esac
13530         ;;
13531         *)      case "$usethreads" in
13532                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13533                 esac
13534                 d_gethostent_r=undef
13535                 gethostent_r_proto=0
13536                 ;;
13537         esac
13538         ;;
13539 *)      gethostent_r_proto=0
13540         ;;
13541 esac
13542
13543 : see if prototypes for various gethostxxx netdb.h functions are available
13544 echo " "
13545 set d_gethostprotos gethostent $i_netdb netdb.h
13546 eval $hasproto
13547
13548 : see if getitimer exists
13549 set getitimer d_getitimer
13550 eval $inlibc
13551
13552 : see if getlogin exists
13553 set getlogin d_getlogin
13554 eval $inlibc
13555
13556 : see if getlogin_r exists
13557 set getlogin_r d_getlogin_r
13558 eval $inlibc
13559 case "$d_getlogin_r" in
13560 "$define")
13561         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13562         case "$d_getlogin_r_proto:$usethreads" in
13563         ":define")      d_getlogin_r_proto=define
13564                 set d_getlogin_r_proto getlogin_r $hdrs
13565                 eval $hasproto ;;
13566         *)      ;;
13567         esac
13568         case "$d_getlogin_r_proto" in
13569         define)
13570         case "$getlogin_r_proto" in
13571         ''|0) try='int getlogin_r(char*, size_t);'
13572         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13573         esac
13574         case "$getlogin_r_proto" in
13575         ''|0) try='int getlogin_r(char*, int);'
13576         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13577         esac
13578         case "$getlogin_r_proto" in
13579         ''|0) try='char* getlogin_r(char*, size_t);'
13580         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13581         esac
13582         case "$getlogin_r_proto" in
13583         ''|0) try='char* getlogin_r(char*, int);'
13584         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13585         esac
13586         case "$getlogin_r_proto" in
13587         ''|0)   d_getlogin_r=undef
13588                 getlogin_r_proto=0
13589                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13590         * )     case "$getlogin_r_proto" in
13591                 REENTRANT_PROTO*) ;;
13592                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13593                 esac
13594                 echo "Prototype: $try" ;;
13595         esac
13596         ;;
13597         *)      case "$usethreads" in
13598                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13599                 esac
13600                 d_getlogin_r=undef
13601                 getlogin_r_proto=0
13602                 ;;
13603         esac
13604         ;;
13605 *)      getlogin_r_proto=0
13606         ;;
13607 esac
13608
13609 : see if getmnt exists
13610 set getmnt d_getmnt
13611 eval $inlibc
13612
13613 : see if getmntent exists
13614 set getmntent d_getmntent
13615 eval $inlibc
13616
13617 : see if getnetbyaddr exists
13618 set getnetbyaddr d_getnbyaddr
13619 eval $inlibc
13620
13621 : see if getnetbyname exists
13622 set getnetbyname d_getnbyname
13623 eval $inlibc
13624
13625 : see if getnetent exists
13626 set getnetent d_getnent
13627 eval $inlibc
13628
13629 : see if getnetbyaddr_r exists
13630 set getnetbyaddr_r d_getnetbyaddr_r
13631 eval $inlibc
13632 case "$d_getnetbyaddr_r" in
13633 "$define")
13634         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13635         case "$d_getnetbyaddr_r_proto:$usethreads" in
13636         ":define")      d_getnetbyaddr_r_proto=define
13637                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13638                 eval $hasproto ;;
13639         *)      ;;
13640         esac
13641         case "$d_getnetbyaddr_r_proto" in
13642         define)
13643         case "$getnetbyaddr_r_proto" in
13644         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13645         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13646         esac
13647         case "$getnetbyaddr_r_proto" in
13648         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13649         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13650         esac
13651         case "$getnetbyaddr_r_proto" in
13652         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13653         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13654         esac
13655         case "$getnetbyaddr_r_proto" in
13656         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13657         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13658         esac
13659         case "$getnetbyaddr_r_proto" in
13660         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13661         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13662         esac
13663         case "$getnetbyaddr_r_proto" in
13664         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13665         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13666         esac
13667         case "$getnetbyaddr_r_proto" in
13668         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13669         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13670         esac
13671         case "$getnetbyaddr_r_proto" in
13672         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13673         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13674         esac
13675         case "$getnetbyaddr_r_proto" in
13676         ''|0)   d_getnetbyaddr_r=undef
13677                 getnetbyaddr_r_proto=0
13678                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13679         * )     case "$getnetbyaddr_r_proto" in
13680                 REENTRANT_PROTO*) ;;
13681                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13682                 esac
13683                 echo "Prototype: $try" ;;
13684         esac
13685         ;;
13686         *)      case "$usethreads" in
13687                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13688                 esac
13689                 d_getnetbyaddr_r=undef
13690                 getnetbyaddr_r_proto=0
13691                 ;;
13692         esac
13693         ;;
13694 *)      getnetbyaddr_r_proto=0
13695         ;;
13696 esac
13697
13698 : see if getnetbyname_r exists
13699 set getnetbyname_r d_getnetbyname_r
13700 eval $inlibc
13701 case "$d_getnetbyname_r" in
13702 "$define")
13703         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13704         case "$d_getnetbyname_r_proto:$usethreads" in
13705         ":define")      d_getnetbyname_r_proto=define
13706                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13707                 eval $hasproto ;;
13708         *)      ;;
13709         esac
13710         case "$d_getnetbyname_r_proto" in
13711         define)
13712         case "$getnetbyname_r_proto" in
13713         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13714         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13715         esac
13716         case "$getnetbyname_r_proto" in
13717         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13718         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13719         esac
13720         case "$getnetbyname_r_proto" in
13721         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13722         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13723         esac
13724         case "$getnetbyname_r_proto" in
13725         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13726         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13727         esac
13728         case "$getnetbyname_r_proto" in
13729         ''|0)   d_getnetbyname_r=undef
13730                 getnetbyname_r_proto=0
13731                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13732         * )     case "$getnetbyname_r_proto" in
13733                 REENTRANT_PROTO*) ;;
13734                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13735                 esac
13736                 echo "Prototype: $try" ;;
13737         esac
13738         ;;
13739         *)      case "$usethreads" in
13740                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13741                 esac
13742                 d_getnetbyname_r=undef
13743                 getnetbyname_r_proto=0
13744                 ;;
13745         esac
13746         ;;
13747 *)      getnetbyname_r_proto=0
13748         ;;
13749 esac
13750
13751 : see if getnetent_r exists
13752 set getnetent_r d_getnetent_r
13753 eval $inlibc
13754 case "$d_getnetent_r" in
13755 "$define")
13756         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13757         case "$d_getnetent_r_proto:$usethreads" in
13758         ":define")      d_getnetent_r_proto=define
13759                 set d_getnetent_r_proto getnetent_r $hdrs
13760                 eval $hasproto ;;
13761         *)      ;;
13762         esac
13763         case "$d_getnetent_r_proto" in
13764         define)
13765         case "$getnetent_r_proto" in
13766         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13767         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13768         esac
13769         case "$getnetent_r_proto" in
13770         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13771         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13772         esac
13773         case "$getnetent_r_proto" in
13774         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13775         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13776         esac
13777         case "$getnetent_r_proto" in
13778         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13779         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13780         esac
13781         case "$getnetent_r_proto" in
13782         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13783         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13784         esac
13785         case "$getnetent_r_proto" in
13786         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13787         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13788         esac
13789         case "$getnetent_r_proto" in
13790         ''|0)   d_getnetent_r=undef
13791                 getnetent_r_proto=0
13792                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13793         * )     case "$getnetent_r_proto" in
13794                 REENTRANT_PROTO*) ;;
13795                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13796                 esac
13797                 echo "Prototype: $try" ;;
13798         esac
13799         ;;
13800         *)      case "$usethreads" in
13801                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13802                 esac
13803                 d_getnetent_r=undef
13804                 getnetent_r_proto=0
13805                 ;;
13806         esac
13807         ;;
13808 *)      getnetent_r_proto=0
13809         ;;
13810 esac
13811
13812 : see if prototypes for various getnetxxx netdb.h functions are available
13813 echo " "
13814 set d_getnetprotos getnetent $i_netdb netdb.h
13815 eval $hasproto
13816
13817 : see if getpagesize exists
13818 set getpagesize d_getpagsz
13819 eval $inlibc
13820
13821
13822 : see if getprotobyname exists
13823 set getprotobyname d_getpbyname
13824 eval $inlibc
13825
13826 : see if getprotobynumber exists
13827 set getprotobynumber d_getpbynumber
13828 eval $inlibc
13829
13830 : see if getprotoent exists
13831 set getprotoent d_getpent
13832 eval $inlibc
13833
13834 : see if getpgid exists
13835 set getpgid d_getpgid
13836 eval $inlibc
13837
13838 : see if getpgrp2 exists
13839 set getpgrp2 d_getpgrp2
13840 eval $inlibc
13841
13842 : see if getppid exists
13843 set getppid d_getppid
13844 eval $inlibc
13845
13846 : see if getpriority exists
13847 set getpriority d_getprior
13848 eval $inlibc
13849
13850 : see if getprotobyname_r exists
13851 set getprotobyname_r d_getprotobyname_r
13852 eval $inlibc
13853 case "$d_getprotobyname_r" in
13854 "$define")
13855         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13856         case "$d_getprotobyname_r_proto:$usethreads" in
13857         ":define")      d_getprotobyname_r_proto=define
13858                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13859                 eval $hasproto ;;
13860         *)      ;;
13861         esac
13862         case "$d_getprotobyname_r_proto" in
13863         define)
13864         case "$getprotobyname_r_proto" in
13865         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13866         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13867         esac
13868         case "$getprotobyname_r_proto" in
13869         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13870         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13871         esac
13872         case "$getprotobyname_r_proto" in
13873         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13874         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13875         esac
13876         case "$getprotobyname_r_proto" in
13877         ''|0)   d_getprotobyname_r=undef
13878                 getprotobyname_r_proto=0
13879                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13880         * )     case "$getprotobyname_r_proto" in
13881                 REENTRANT_PROTO*) ;;
13882                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13883                 esac
13884                 echo "Prototype: $try" ;;
13885         esac
13886         ;;
13887         *)      case "$usethreads" in
13888                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13889                 esac
13890                 d_getprotobyname_r=undef
13891                 getprotobyname_r_proto=0
13892                 ;;
13893         esac
13894         ;;
13895 *)      getprotobyname_r_proto=0
13896         ;;
13897 esac
13898
13899 : see if getprotobynumber_r exists
13900 set getprotobynumber_r d_getprotobynumber_r
13901 eval $inlibc
13902 case "$d_getprotobynumber_r" in
13903 "$define")
13904         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13905         case "$d_getprotobynumber_r_proto:$usethreads" in
13906         ":define")      d_getprotobynumber_r_proto=define
13907                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13908                 eval $hasproto ;;
13909         *)      ;;
13910         esac
13911         case "$d_getprotobynumber_r_proto" in
13912         define)
13913         case "$getprotobynumber_r_proto" in
13914         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13915         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13916         esac
13917         case "$getprotobynumber_r_proto" in
13918         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13919         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13920         esac
13921         case "$getprotobynumber_r_proto" in
13922         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13923         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13924         esac
13925         case "$getprotobynumber_r_proto" in
13926         ''|0)   d_getprotobynumber_r=undef
13927                 getprotobynumber_r_proto=0
13928                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13929         * )     case "$getprotobynumber_r_proto" in
13930                 REENTRANT_PROTO*) ;;
13931                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13932                 esac
13933                 echo "Prototype: $try" ;;
13934         esac
13935         ;;
13936         *)      case "$usethreads" in
13937                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13938                 esac
13939                 d_getprotobynumber_r=undef
13940                 getprotobynumber_r_proto=0
13941                 ;;
13942         esac
13943         ;;
13944 *)      getprotobynumber_r_proto=0
13945         ;;
13946 esac
13947
13948 : see if getprotoent_r exists
13949 set getprotoent_r d_getprotoent_r
13950 eval $inlibc
13951 case "$d_getprotoent_r" in
13952 "$define")
13953         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13954         case "$d_getprotoent_r_proto:$usethreads" in
13955         ":define")      d_getprotoent_r_proto=define
13956                 set d_getprotoent_r_proto getprotoent_r $hdrs
13957                 eval $hasproto ;;
13958         *)      ;;
13959         esac
13960         case "$d_getprotoent_r_proto" in
13961         define)
13962         case "$getprotoent_r_proto" in
13963         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13964         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13965         esac
13966         case "$getprotoent_r_proto" in
13967         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13968         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13969         esac
13970         case "$getprotoent_r_proto" in
13971         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13972         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13973         esac
13974         case "$getprotoent_r_proto" in
13975         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13976         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13977         esac
13978         case "$getprotoent_r_proto" in
13979         ''|0)   d_getprotoent_r=undef
13980                 getprotoent_r_proto=0
13981                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13982         * )     case "$getprotoent_r_proto" in
13983                 REENTRANT_PROTO*) ;;
13984                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13985                 esac
13986                 echo "Prototype: $try" ;;
13987         esac
13988         ;;
13989         *)      case "$usethreads" in
13990                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13991                 esac
13992                 d_getprotoent_r=undef
13993                 getprotoent_r_proto=0
13994                 ;;
13995         esac
13996         ;;
13997 *)      getprotoent_r_proto=0
13998         ;;
13999 esac
14000
14001 : see if prototypes for various getprotoxxx netdb.h functions are available
14002 echo " "
14003 set d_getprotoprotos getprotoent $i_netdb netdb.h
14004 eval $hasproto
14005
14006 : see if getprpwnam exists
14007 set getprpwnam d_getprpwnam
14008 eval $inlibc
14009
14010 : see if getpwent exists
14011 set getpwent d_getpwent
14012 eval $inlibc
14013
14014 : see if getpwent_r exists
14015 set getpwent_r d_getpwent_r
14016 eval $inlibc
14017 case "$d_getpwent_r" in
14018 "$define")
14019         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14020         case "$d_getpwent_r_proto:$usethreads" in
14021         ":define")      d_getpwent_r_proto=define
14022                 set d_getpwent_r_proto getpwent_r $hdrs
14023                 eval $hasproto ;;
14024         *)      ;;
14025         esac
14026         case "$d_getpwent_r_proto" in
14027         define)
14028         case "$getpwent_r_proto" in
14029         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14030         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14031         esac
14032         case "$getpwent_r_proto" in
14033         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14034         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14035         esac
14036         case "$getpwent_r_proto" in
14037         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14038         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14039         esac
14040         case "$getpwent_r_proto" in
14041         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14042         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14043         esac
14044         case "$getpwent_r_proto" in
14045         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14046         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14047         esac
14048         case "$getpwent_r_proto" in
14049         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14050         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14051         esac
14052         case "$getpwent_r_proto" in
14053         ''|0)   d_getpwent_r=undef
14054                 getpwent_r_proto=0
14055                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14056         * )     case "$getpwent_r_proto" in
14057                 REENTRANT_PROTO*) ;;
14058                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14059                 esac
14060                 echo "Prototype: $try" ;;
14061         esac
14062         ;;
14063         *)      case "$usethreads" in
14064                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14065                 esac
14066                 d_getpwent_r=undef
14067                 getpwent_r_proto=0
14068                 ;;
14069         esac
14070         ;;
14071 *)      getpwent_r_proto=0
14072         ;;
14073 esac
14074
14075 : see if getpwnam_r exists
14076 set getpwnam_r d_getpwnam_r
14077 eval $inlibc
14078 case "$d_getpwnam_r" in
14079 "$define")
14080         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14081         case "$d_getpwnam_r_proto:$usethreads" in
14082         ":define")      d_getpwnam_r_proto=define
14083                 set d_getpwnam_r_proto getpwnam_r $hdrs
14084                 eval $hasproto ;;
14085         *)      ;;
14086         esac
14087         case "$d_getpwnam_r_proto" in
14088         define)
14089         case "$getpwnam_r_proto" in
14090         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14091         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14092         esac
14093         case "$getpwnam_r_proto" in
14094         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14095         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14096         esac
14097         case "$getpwnam_r_proto" in
14098         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14099         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14100         esac
14101         case "$getpwnam_r_proto" in
14102         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14103         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14104         esac
14105         case "$getpwnam_r_proto" in
14106         ''|0)   d_getpwnam_r=undef
14107                 getpwnam_r_proto=0
14108                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14109         * )     case "$getpwnam_r_proto" in
14110                 REENTRANT_PROTO*) ;;
14111                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14112                 esac
14113                 echo "Prototype: $try" ;;
14114         esac
14115         ;;
14116         *)      case "$usethreads" in
14117                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14118                 esac
14119                 d_getpwnam_r=undef
14120                 getpwnam_r_proto=0
14121                 ;;
14122         esac
14123         ;;
14124 *)      getpwnam_r_proto=0
14125         ;;
14126 esac
14127
14128 : see if getpwuid_r exists
14129 set getpwuid_r d_getpwuid_r
14130 eval $inlibc
14131 case "$d_getpwuid_r" in
14132 "$define")
14133         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14134         case "$d_getpwuid_r_proto:$usethreads" in
14135         ":define")      d_getpwuid_r_proto=define
14136                 set d_getpwuid_r_proto getpwuid_r $hdrs
14137                 eval $hasproto ;;
14138         *)      ;;
14139         esac
14140         case "$d_getpwuid_r_proto" in
14141         define)
14142         case "$getpwuid_r_proto" in
14143         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14144         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14145         esac
14146         case "$getpwuid_r_proto" in
14147         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14148         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14149         esac
14150         case "$getpwuid_r_proto" in
14151         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14152         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14153         esac
14154         case "$getpwuid_r_proto" in
14155         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14156         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14157         esac
14158         case "$getpwuid_r_proto" in
14159         ''|0)   d_getpwuid_r=undef
14160                 getpwuid_r_proto=0
14161                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14162         * )     case "$getpwuid_r_proto" in
14163                 REENTRANT_PROTO*) ;;
14164                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14165                 esac
14166                 echo "Prototype: $try" ;;
14167         esac
14168         ;;
14169         *)      case "$usethreads" in
14170                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14171                 esac
14172                 d_getpwuid_r=undef
14173                 getpwuid_r_proto=0
14174                 ;;
14175         esac
14176         ;;
14177 *)      getpwuid_r_proto=0
14178         ;;
14179 esac
14180
14181
14182 : see if getservbyname exists
14183 set getservbyname d_getsbyname
14184 eval $inlibc
14185
14186 : see if getservbyport exists
14187 set getservbyport d_getsbyport
14188 eval $inlibc
14189
14190 : see if getservent exists
14191 set getservent d_getsent
14192 eval $inlibc
14193
14194 : see if getservbyname_r exists
14195 set getservbyname_r d_getservbyname_r
14196 eval $inlibc
14197 case "$d_getservbyname_r" in
14198 "$define")
14199         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14200         case "$d_getservbyname_r_proto:$usethreads" in
14201         ":define")      d_getservbyname_r_proto=define
14202                 set d_getservbyname_r_proto getservbyname_r $hdrs
14203                 eval $hasproto ;;
14204         *)      ;;
14205         esac
14206         case "$d_getservbyname_r_proto" in
14207         define)
14208         case "$getservbyname_r_proto" in
14209         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14210         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14211         esac
14212         case "$getservbyname_r_proto" in
14213         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14214         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14215         esac
14216         case "$getservbyname_r_proto" in
14217         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14218         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14219         esac
14220         case "$getservbyname_r_proto" in
14221         ''|0)   d_getservbyname_r=undef
14222                 getservbyname_r_proto=0
14223                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14224         * )     case "$getservbyname_r_proto" in
14225                 REENTRANT_PROTO*) ;;
14226                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14227                 esac
14228                 echo "Prototype: $try" ;;
14229         esac
14230         ;;
14231         *)      case "$usethreads" in
14232                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14233                 esac
14234                 d_getservbyname_r=undef
14235                 getservbyname_r_proto=0
14236                 ;;
14237         esac
14238         ;;
14239 *)      getservbyname_r_proto=0
14240         ;;
14241 esac
14242
14243 : see if getservbyport_r exists
14244 set getservbyport_r d_getservbyport_r
14245 eval $inlibc
14246 case "$d_getservbyport_r" in
14247 "$define")
14248         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14249         case "$d_getservbyport_r_proto:$usethreads" in
14250         ":define")      d_getservbyport_r_proto=define
14251                 set d_getservbyport_r_proto getservbyport_r $hdrs
14252                 eval $hasproto ;;
14253         *)      ;;
14254         esac
14255         case "$d_getservbyport_r_proto" in
14256         define)
14257         case "$getservbyport_r_proto" in
14258         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14259         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14260         esac
14261         case "$getservbyport_r_proto" in
14262         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14263         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14264         esac
14265         case "$getservbyport_r_proto" in
14266         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14267         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14268         esac
14269         case "$getservbyport_r_proto" in
14270         ''|0)   d_getservbyport_r=undef
14271                 getservbyport_r_proto=0
14272                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14273         * )     case "$getservbyport_r_proto" in
14274                 REENTRANT_PROTO*) ;;
14275                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14276                 esac
14277                 echo "Prototype: $try" ;;
14278         esac
14279         ;;
14280         *)      case "$usethreads" in
14281                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14282                 esac
14283                 d_getservbyport_r=undef
14284                 getservbyport_r_proto=0
14285                 ;;
14286         esac
14287         ;;
14288 *)      getservbyport_r_proto=0
14289         ;;
14290 esac
14291
14292 : see if getservent_r exists
14293 set getservent_r d_getservent_r
14294 eval $inlibc
14295 case "$d_getservent_r" in
14296 "$define")
14297         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14298         case "$d_getservent_r_proto:$usethreads" in
14299         ":define")      d_getservent_r_proto=define
14300                 set d_getservent_r_proto getservent_r $hdrs
14301                 eval $hasproto ;;
14302         *)      ;;
14303         esac
14304         case "$d_getservent_r_proto" in
14305         define)
14306         case "$getservent_r_proto" in
14307         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14308         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14309         esac
14310         case "$getservent_r_proto" in
14311         ''|0) try='int getservent_r(struct servent*, char*, int);'
14312         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14313         esac
14314         case "$getservent_r_proto" in
14315         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14316         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14317         esac
14318         case "$getservent_r_proto" in
14319         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14320         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14321         esac
14322         case "$getservent_r_proto" in
14323         ''|0)   d_getservent_r=undef
14324                 getservent_r_proto=0
14325                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14326         * )     case "$getservent_r_proto" in
14327                 REENTRANT_PROTO*) ;;
14328                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14329                 esac
14330                 echo "Prototype: $try" ;;
14331         esac
14332         ;;
14333         *)      case "$usethreads" in
14334                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14335                 esac
14336                 d_getservent_r=undef
14337                 getservent_r_proto=0
14338                 ;;
14339         esac
14340         ;;
14341 *)      getservent_r_proto=0
14342         ;;
14343 esac
14344
14345 : see if prototypes for various getservxxx netdb.h functions are available
14346 echo " "
14347 set d_getservprotos getservent $i_netdb netdb.h
14348 eval $hasproto
14349
14350 : see if getspnam exists
14351 set getspnam d_getspnam
14352 eval $inlibc
14353
14354 : see if this is a shadow.h system
14355 set shadow.h i_shadow
14356 eval $inhdr
14357
14358 : see if getspnam_r exists
14359 set getspnam_r d_getspnam_r
14360 eval $inlibc
14361 case "$d_getspnam_r" in
14362 "$define")
14363         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14364         case "$d_getspnam_r_proto:$usethreads" in
14365         ":define")      d_getspnam_r_proto=define
14366                 set d_getspnam_r_proto getspnam_r $hdrs
14367                 eval $hasproto ;;
14368         *)      ;;
14369         esac
14370         case "$d_getspnam_r_proto" in
14371         define)
14372         case "$getspnam_r_proto" in
14373         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14374         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14375         esac
14376         case "$getspnam_r_proto" in
14377         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14378         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14379         esac
14380         case "$getspnam_r_proto" in
14381         ''|0)   d_getspnam_r=undef
14382                 getspnam_r_proto=0
14383                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14384         * )     case "$getspnam_r_proto" in
14385                 REENTRANT_PROTO*) ;;
14386                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14387                 esac
14388                 echo "Prototype: $try" ;;
14389         esac
14390         ;;
14391         *)      case "$usethreads" in
14392                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14393                 esac
14394                 d_getspnam_r=undef
14395                 getspnam_r_proto=0
14396                 ;;
14397         esac
14398         ;;
14399 *)      getspnam_r_proto=0
14400         ;;
14401 esac
14402
14403 : see if gettimeofday or ftime exists
14404 set gettimeofday d_gettimeod
14405 eval $inlibc
14406 case "$d_gettimeod" in
14407 "$undef")
14408         set ftime d_ftime 
14409         eval $inlibc
14410         ;;
14411 *)
14412         val="$undef"; set d_ftime; eval $setvar
14413         ;;
14414 esac
14415 case "$d_gettimeod$d_ftime" in
14416 "$undef$undef")
14417         echo " "
14418         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14419         ;;
14420 esac
14421
14422 : see if gmtime_r exists
14423 set gmtime_r d_gmtime_r
14424 eval $inlibc
14425 case "$d_gmtime_r" in
14426 "$define")
14427         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14428         case "$d_gmtime_r_proto:$usethreads" in
14429         ":define")      d_gmtime_r_proto=define
14430                 set d_gmtime_r_proto gmtime_r $hdrs
14431                 eval $hasproto ;;
14432         *)      ;;
14433         esac
14434         case "$d_gmtime_r_proto" in
14435         define)
14436         case "$gmtime_r_proto" in
14437         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14438         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14439         esac
14440         case "$gmtime_r_proto" in
14441         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14442         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14443         esac
14444         case "$gmtime_r_proto" in
14445         ''|0)   d_gmtime_r=undef
14446                 gmtime_r_proto=0
14447                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14448         * )     case "$gmtime_r_proto" in
14449                 REENTRANT_PROTO*) ;;
14450                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14451                 esac
14452                 echo "Prototype: $try" ;;
14453         esac
14454         ;;
14455         *)      case "$usethreads" in
14456                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14457                 esac
14458                 d_gmtime_r=undef
14459                 gmtime_r_proto=0
14460                 ;;
14461         esac
14462         ;;
14463 *)      gmtime_r_proto=0
14464         ;;
14465 esac
14466
14467 : see if hasmntopt exists
14468 set hasmntopt d_hasmntopt
14469 eval $inlibc
14470
14471 : see if this is a netinet/in.h or sys/in.h system
14472 set netinet/in.h i_niin sys/in.h i_sysin
14473 eval $inhdr
14474
14475 : see if arpa/inet.h has to be included
14476 set arpa/inet.h i_arpainet
14477 eval $inhdr
14478
14479 : see if htonl --and friends-- exists
14480 val=''
14481 set htonl val
14482 eval $inlibc
14483
14484 : Maybe they are macros.
14485 case "$val" in
14486 $undef)
14487         $cat >htonl.c <<EOM
14488 #include <stdio.h>
14489 #include <sys/types.h>
14490 #$i_niin I_NETINET_IN
14491 #$i_sysin I_SYS_IN
14492 #$i_arpainet I_ARPA_INET
14493 #ifdef I_NETINET_IN
14494 #include <netinet/in.h>
14495 #endif
14496 #ifdef I_SYS_IN
14497 #include <sys/in.h>
14498 #endif
14499 #ifdef I_ARPA_INET
14500 #include <arpa/inet.h>
14501 #endif
14502 #ifdef htonl
14503 printf("Defined as a macro.");
14504 #endif
14505 EOM
14506         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14507         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14508                 val="$define"
14509                 echo "But it seems to be defined as a macro." >&4
14510         fi
14511         $rm -f htonl.?
14512         ;;
14513 esac
14514 set d_htonl
14515 eval $setvar
14516
14517 : see if ilogbl exists
14518 set ilogbl d_ilogbl
14519 eval $inlibc
14520
14521 : index or strchr
14522 echo " "
14523 if set index val -f; eval $csym; $val; then
14524         if set strchr val -f d_strchr; eval $csym; $val; then
14525                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14526                         val="$define"
14527                         vali="$undef"
14528                         echo "strchr() found." >&4
14529                 else
14530                         val="$undef"
14531                         vali="$define"
14532                         echo "index() found." >&4
14533                 fi
14534         else
14535                 val="$undef"
14536                 vali="$define"
14537                 echo "index() found." >&4
14538         fi
14539 else
14540         if set strchr val -f d_strchr; eval $csym; $val; then
14541                 val="$define"
14542                 vali="$undef"
14543                 echo "strchr() found." >&4
14544         else
14545                 echo "No index() or strchr() found!" >&4
14546                 val="$undef"
14547                 vali="$undef"
14548         fi
14549 fi
14550 set d_strchr; eval $setvar
14551 val="$vali"
14552 set d_index; eval $setvar
14553
14554 : check whether inet_aton exists
14555 set inet_aton d_inetaton
14556 eval $inlibc
14557
14558 : Look for isascii
14559 echo " "
14560 $cat >isascii.c <<EOCP
14561 #include <stdio.h>
14562 #include <ctype.h>
14563 #$i_stdlib I_STDLIB
14564 #ifdef I_STDLIB
14565 #include <stdlib.h>
14566 #endif
14567 int main() {
14568         int c = 'A';
14569         if (isascii(c))
14570                 exit(0);
14571         else
14572                 exit(1);
14573 }
14574 EOCP
14575 set isascii
14576 if eval $compile; then
14577         echo "isascii() found." >&4
14578         val="$define"
14579 else
14580         echo "isascii() NOT found." >&4
14581         val="$undef"
14582 fi
14583 set d_isascii
14584 eval $setvar
14585 $rm -f isascii*
14586
14587 : see if isfinite exists
14588 set isfinite d_isfinite
14589 eval $inlibc
14590
14591 : see if isinf exists
14592 set isinf d_isinf
14593 eval $inlibc
14594
14595 : see if isnan exists
14596 set isnan d_isnan
14597 eval $inlibc
14598
14599 : see if isnanl exists
14600 set isnanl d_isnanl
14601 eval $inlibc
14602
14603 : see if killpg exists
14604 set killpg d_killpg
14605 eval $inlibc
14606
14607 : see if lchown exists
14608 echo " "
14609 $cat > try.c <<'EOCP'
14610 /* System header to define __stub macros and hopefully few prototypes,
14611     which can conflict with char lchown(); below.  */
14612 #include <assert.h>
14613 /* Override any gcc2 internal prototype to avoid an error.  */
14614 /* We use char because int might match the return type of a gcc2
14615    builtin and then its argument prototype would still apply.  */
14616 char lchown();
14617 int main() {
14618     /*  The GNU C library defines this for functions which it implements
14619         to always fail with ENOSYS.  Some functions are actually named
14620         something starting with __ and the normal name is an alias.  */
14621 #if defined (__stub_lchown) || defined (__stub___lchown)
14622 choke me
14623 #else
14624 lchown();
14625 #endif
14626 ; return 0; }
14627 EOCP
14628 set try
14629 if eval $compile; then
14630     $echo "lchown() found." >&4
14631     val="$define"
14632 else
14633     $echo "lchown() NOT found." >&4
14634     val="$undef"
14635 fi
14636 set d_lchown
14637 eval $setvar
14638
14639 : See if number of significant digits in a double precision number is known
14640 echo " "
14641 $cat >ldbl_dig.c <<EOM
14642 #$i_limits I_LIMITS
14643 #$i_float I_FLOAT
14644 #ifdef I_LIMITS
14645 #include <limits.h>
14646 #endif
14647 #ifdef I_FLOAT
14648 #include <float.h>
14649 #endif
14650 #ifdef LDBL_DIG
14651 printf("Contains LDBL_DIG");
14652 #endif
14653 EOM
14654 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14655 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14656         echo "LDBL_DIG found." >&4
14657         val="$define"
14658 else
14659         echo "LDBL_DIG NOT found." >&4
14660         val="$undef"
14661 fi
14662 $rm -f ldbl_dig.?
14663 set d_ldbl_dig
14664 eval $setvar
14665
14666 : see if this is a math.h system
14667 set math.h i_math
14668 eval $inhdr
14669
14670 d_libm_lib_version="$undef"
14671 case $i_math in
14672     $define)
14673         : check to see if math.h defines _LIB_VERSION
14674         echo " "
14675         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14676         $cat >try.c <<EOCP
14677 #include <unistd.h>
14678 #include <math.h>
14679 int main (int argc, char *argv[])
14680 {
14681     printf ("%d\n", _LIB_VERSION);
14682     return (0);
14683     } /* main */
14684 EOCP
14685         set try
14686         if eval $compile; then
14687             foo=`$run ./try`
14688             echo "Yes, it does ($foo)" >&4
14689             d_libm_lib_version="$define"
14690         else
14691             echo "No, it does not (probably harmless)" >&4
14692             fi
14693         $rm_try
14694         ;;
14695
14696     esac
14697
14698 : see if link exists
14699 set link d_link
14700 eval $inlibc
14701
14702 : see if localtime_r exists
14703 set localtime_r d_localtime_r
14704 eval $inlibc
14705 case "$d_localtime_r" in
14706 "$define")
14707         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14708         case "$d_localtime_r_proto:$usethreads" in
14709         ":define")      d_localtime_r_proto=define
14710                 set d_localtime_r_proto localtime_r $hdrs
14711                 eval $hasproto ;;
14712         *)      ;;
14713         esac
14714         case "$d_localtime_r_proto" in
14715         define)
14716         case "$localtime_r_proto" in
14717         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14718         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14719         esac
14720         case "$localtime_r_proto" in
14721         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14722         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14723         esac
14724         case "$localtime_r_proto" in
14725         ''|0)   d_localtime_r=undef
14726                 localtime_r_proto=0
14727                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14728         * )     case "$localtime_r_proto" in
14729                 REENTRANT_PROTO*) ;;
14730                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14731                 esac
14732                 echo "Prototype: $try" ;;
14733         esac
14734         ;;
14735         *)      case "$usethreads" in
14736                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14737                 esac
14738                 d_localtime_r=undef
14739                 localtime_r_proto=0
14740                 ;;
14741         esac
14742         ;;
14743 *)      localtime_r_proto=0
14744         ;;
14745 esac
14746
14747 : see if localtime_r calls tzset
14748 case "$localtime_r_proto" in
14749 REENTRANT_PROTO*)
14750         $cat >try.c <<EOCP
14751 /*  Does our libc's localtime_r call tzset ?
14752  *  return 0 if so, 1 otherwise.
14753  */
14754 #include <sys/types.h>
14755 #include <unistd.h>
14756 #include <time.h>
14757 #include <string.h>
14758 #include <malloc.h>
14759 int main()
14760 {
14761     time_t t = time(0L);
14762     char w_tz[]="TZ" "=GMT+5",
14763          e_tz[]="TZ" "=GMT-5",
14764         *tz_e = (char*)malloc(16),
14765         *tz_w = (char*)malloc(16);
14766     struct tm tm_e, tm_w;
14767     memset(&tm_e,'\0',sizeof(struct tm));
14768     memset(&tm_w,'\0',sizeof(struct tm));
14769     strcpy(tz_e,e_tz);
14770     strcpy(tz_w,w_tz);
14771
14772     putenv(tz_e);
14773     localtime_r(&t, &tm_e);
14774
14775     putenv(tz_w);
14776     localtime_r(&t, &tm_w);
14777
14778     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14779         return 1;
14780     return 0;
14781 }
14782 EOCP
14783         set try
14784         if eval $compile; then
14785             if $run ./try; then
14786                 d_localtime_r_needs_tzset=undef;
14787             else
14788                 d_localtime_r_needs_tzset=define;
14789             fi;
14790         else
14791             d_localtime_r_needs_tzset=undef;
14792         fi;
14793      ;;
14794   *)
14795      d_localtime_r_needs_tzset=undef;
14796      ;;
14797 esac
14798 $rm_try
14799
14800 : see if localeconv exists
14801 set localeconv d_locconv
14802 eval $inlibc
14803
14804 : see if lockf exists
14805 set lockf d_lockf
14806 eval $inlibc
14807
14808 : see if prototype for lseek is available
14809 echo " "
14810 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14811 eval $hasproto
14812
14813 : see if lstat exists
14814 set lstat d_lstat
14815 eval $inlibc
14816
14817 : see if madvise exists
14818 set madvise d_madvise
14819 eval $inlibc
14820
14821 : see if malloc_size exists
14822 set malloc_size d_malloc_size
14823 eval $inlibc
14824
14825 : see if malloc_size_good exists
14826 set malloc_good_size d_malloc_good_size
14827 eval $inlibc
14828
14829 : see if mblen exists
14830 set mblen d_mblen
14831 eval $inlibc
14832
14833 : see if mbstowcs exists
14834 set mbstowcs d_mbstowcs
14835 eval $inlibc
14836
14837 : see if mbtowc exists
14838 set mbtowc d_mbtowc
14839 eval $inlibc
14840
14841 : see if memchr exists
14842 set memchr d_memchr
14843 eval $inlibc
14844
14845 : see if memcmp exists
14846 set memcmp d_memcmp
14847 eval $inlibc
14848
14849 : see if memcpy exists
14850 set memcpy d_memcpy
14851 eval $inlibc
14852
14853 : see if memmove exists
14854 set memmove d_memmove
14855 eval $inlibc
14856
14857 : see if memset exists
14858 set memset d_memset
14859 eval $inlibc
14860
14861 : see if mkdir exists
14862 set mkdir d_mkdir
14863 eval $inlibc
14864
14865 : see if mkdtemp exists
14866 set mkdtemp d_mkdtemp
14867 eval $inlibc
14868
14869 : see if mkfifo exists
14870 set mkfifo d_mkfifo
14871 eval $inlibc
14872
14873 : see if mkstemp exists
14874 set mkstemp d_mkstemp
14875 eval $inlibc
14876
14877 : see if mkstemps exists
14878 set mkstemps d_mkstemps
14879 eval $inlibc
14880
14881 : see if mktime exists
14882 set mktime d_mktime
14883 eval $inlibc
14884
14885 : see if this is a sys/mman.h system
14886 set sys/mman.h i_sysmman
14887 eval $inhdr
14888
14889 : see if mmap exists
14890 set mmap d_mmap
14891 eval $inlibc
14892 : see what shmat returns
14893 : default to something harmless
14894 mmaptype='void *'
14895 case "$i_sysmman$d_mmap" in
14896 "$define$define")
14897         $cat >mmap.c <<'END'
14898 #include <sys/mman.h>
14899 void *mmap();
14900 END
14901         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14902                 mmaptype='void *'
14903         else
14904                 mmaptype='caddr_t'
14905         fi
14906         echo "and it returns ($mmaptype)." >&4
14907         ;;
14908 esac
14909
14910
14911
14912 : see if sqrtl exists
14913 set sqrtl d_sqrtl
14914 eval $inlibc
14915
14916 : see if scalbnl exists
14917 set scalbnl d_scalbnl
14918 eval $inlibc
14919
14920 : see if modfl exists
14921 set modfl d_modfl
14922 eval $inlibc
14923
14924 : see if prototype for modfl is available
14925 echo " "
14926 set d_modflproto modfl $i_math math.h
14927 eval $hasproto
14928
14929 d_modfl_pow32_bug="$undef"
14930
14931 case "$d_longdbl$d_modfl" in
14932 $define$define)
14933         $cat <<EOM
14934 Checking to see whether your modfl() is okay for large values...
14935 EOM
14936 $cat >try.c <<EOCP
14937 #include <math.h>
14938 #include <stdio.h>
14939 EOCP
14940 if $test "X$d_modflproto" != "X$define"; then
14941         $cat >>try.c <<EOCP
14942 /* Sigh. many current glibcs provide the function, but do not prototype it. */
14943 long double modfl (long double, long double *);
14944 EOCP
14945 fi
14946 $cat >>try.c <<EOCP
14947 int main() {
14948     long double nv = 4294967303.15;
14949     long double v, w;
14950     v = modfl(nv, &w);
14951 #ifdef __GLIBC__
14952     printf("glibc");
14953 #endif
14954     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14955     return 0;
14956 }
14957 EOCP
14958         case "$osname:$gccversion" in
14959         aix:)   saveccflags="$ccflags"
14960                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14961         esac
14962         set try
14963         if eval $compile; then
14964                 foo=`$run ./try`
14965                 case "$foo" in
14966                 *" 4294967303.150000 1.150000 4294967302.000000")
14967                         echo >&4 "Your modfl() is broken for large values."
14968                         d_modfl_pow32_bug="$define"
14969                         case "$foo" in
14970                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14971                         ;;
14972                         esac
14973                         ;;
14974                 *" 4294967303.150000 0.150000 4294967303.000000")
14975                         echo >&4 "Your modfl() seems okay for large values."
14976                         ;;
14977                 *)      echo >&4 "I don't understand your modfl() at all."
14978                         d_modfl="$undef"
14979                         ;;
14980                 esac
14981                 $rm_try
14982         else
14983                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14984                 d_modfl="$undef"
14985         fi
14986         case "$osname:$gccversion" in
14987         aix:)   ccflags="$saveccflags" ;; # restore
14988         esac
14989         ;;
14990 esac
14991
14992 if $test "$uselongdouble" = "$define"; then
14993     message=""
14994     if $test "$d_sqrtl" != "$define"; then
14995         message="$message sqrtl"
14996     fi
14997     if $test "$d_modfl" != "$define"; then
14998         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14999             echo "You have both aintl and copysignl, so I can emulate modfl."
15000         else
15001             message="$message modfl"
15002         fi
15003     fi
15004     if $test "$d_frexpl" != "$define"; then
15005         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15006             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15007         else
15008             message="$message frexpl"
15009         fi
15010     fi
15011
15012     if $test "$message" != ""; then
15013         $cat <<EOM >&4
15014
15015 *** You requested the use of long doubles but you do not seem to have
15016 *** the following mathematical functions needed for long double support:
15017 ***    $message
15018 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15019 *** Cannot continue, aborting.
15020
15021 EOM
15022
15023         exit 1
15024     fi
15025 fi
15026
15027 : see if mprotect exists
15028 set mprotect d_mprotect
15029 eval $inlibc
15030
15031 : see if msgctl exists
15032 set msgctl d_msgctl
15033 eval $inlibc
15034
15035 : see if msgget exists
15036 set msgget d_msgget
15037 eval $inlibc
15038
15039 : see if msgsnd exists
15040 set msgsnd d_msgsnd
15041 eval $inlibc
15042
15043 : see if msgrcv exists
15044 set msgrcv d_msgrcv
15045 eval $inlibc
15046
15047 : see how much of the 'msg*(2)' library is present.
15048 h_msg=true
15049 echo " "
15050 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15051 *"$undef"*) h_msg=false;;
15052 esac
15053 case "$osname" in
15054 freebsd)
15055     case "`ipcs 2>&1`" in
15056     "SVID messages"*"not configured"*)
15057         echo "Your $osname does not have the msg*(2) configured." >&4
15058         h_msg=false
15059         val="$undef"
15060         set msgctl d_msgctl
15061         eval $setvar
15062         set msgget d_msgget
15063         eval $setvar
15064         set msgsnd d_msgsnd
15065         eval $setvar
15066         set msgrcv d_msgrcv
15067         eval $setvar
15068         ;;
15069     esac
15070     ;;
15071 esac
15072 : we could also check for sys/ipc.h ...
15073 if $h_msg && $test `./findhdr sys/msg.h`; then
15074         echo "You have the full msg*(2) library." >&4
15075         val="$define"
15076 else
15077         echo "You don't have the full msg*(2) library." >&4
15078         val="$undef"
15079 fi
15080 set d_msg
15081 eval $setvar
15082
15083
15084 echo " "
15085 echo "Checking to see if your system supports struct msghdr..." >&4
15086 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15087 eval $hasstruct
15088 case "$d_msghdr_s" in
15089 "$define")      echo "Yes, it does."   ;;
15090 *)              echo "No, it doesn't." ;;
15091 esac
15092
15093
15094 : see if msync exists
15095 set msync d_msync
15096 eval $inlibc
15097
15098 : see if munmap exists
15099 set munmap d_munmap
15100 eval $inlibc
15101
15102 : see if nice exists
15103 set nice d_nice
15104 eval $inlibc
15105
15106 : see if this is a langinfo.h system
15107 set langinfo.h i_langinfo
15108 eval $inhdr
15109
15110 : see if nl_langinfo exists
15111 set nl_langinfo d_nl_langinfo
15112 eval $inlibc
15113
15114 : check for volatile keyword
15115 echo " "
15116 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15117 $cat >try.c <<'EOCP'
15118 int main()
15119 {
15120         typedef struct _goo_struct goo_struct;
15121         goo_struct * volatile goo = ((goo_struct *)0);
15122         struct _goo_struct {
15123                 long long_int;
15124                 int reg_int;
15125                 char char_var;
15126         };
15127         typedef unsigned short foo_t;
15128         char *volatile foo;
15129         volatile int bar;
15130         volatile foo_t blech;
15131         foo = foo;
15132 }
15133 EOCP
15134 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15135         val="$define"
15136         echo "Yup, it does."
15137 else
15138         val="$undef"
15139         echo "Nope, it doesn't."
15140 fi
15141 set d_volatile
15142 eval $setvar
15143 $rm_try
15144
15145
15146 echo " "
15147 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15148
15149 case "$use64bitint:$d_quad:$quadtype" in
15150 define:define:?*)
15151         ivtype="$quadtype"
15152         uvtype="$uquadtype"
15153         ivsize=8
15154         uvsize=8
15155         ;;
15156 *)      ivtype="long"
15157         uvtype="unsigned long"
15158         ivsize=$longsize
15159         uvsize=$longsize
15160         ;;
15161 esac
15162
15163 case "$uselongdouble:$d_longdbl" in
15164 define:define)
15165         nvtype="long double"
15166         nvsize=$longdblsize
15167         ;;
15168 *)      nvtype=double
15169         nvsize=$doublesize
15170         ;;
15171 esac
15172
15173 $echo "(IV will be "$ivtype", $ivsize bytes)"
15174 $echo "(UV will be "$uvtype", $uvsize bytes)"
15175 $echo "(NV will be "$nvtype", $nvsize bytes)"
15176
15177 $cat >try.c <<EOCP
15178 #$i_inttypes I_INTTYPES
15179 #ifdef I_INTTYPES
15180 #include <inttypes.h>
15181 #endif
15182 #include <stdio.h>
15183 int main() {
15184 #ifdef INT8
15185    int8_t i =  INT8_MAX;
15186   uint8_t u = UINT8_MAX;
15187   printf("int8_t\n");
15188 #endif
15189 #ifdef INT16
15190    int16_t i =  INT16_MAX;
15191   uint16_t i = UINT16_MAX;
15192   printf("int16_t\n");
15193 #endif
15194 #ifdef INT32
15195    int32_t i =  INT32_MAX;
15196   uint32_t u = UINT32_MAX;
15197   printf("int32_t\n");
15198 #endif
15199 }
15200 EOCP
15201
15202 i8type="signed char"
15203 u8type="unsigned char"
15204 i8size=1
15205 u8size=1
15206
15207 case "$i16type" in
15208 '')     case "$shortsize" in
15209         2)      i16type=short
15210                 u16type="unsigned short"
15211                 i16size=$shortsize
15212                 u16size=$shortsize
15213                 ;;
15214         esac
15215         ;;
15216 esac
15217 case "$i16type" in
15218 '')     set try -DINT16
15219         if eval $compile; then
15220                 case "`$run ./try`" in
15221                 int16_t)
15222                         i16type=int16_t
15223                         u16type=uint16_t
15224                         i16size=2
15225                         u16size=2
15226                         ;;
15227                 esac
15228         fi
15229         ;;
15230 esac
15231 case "$i16type" in
15232 '')     if $test $shortsize -ge 2; then
15233                 i16type=short
15234                 u16type="unsigned short"
15235                 i16size=$shortsize
15236                 u16size=$shortsize
15237         fi
15238         ;;
15239 esac
15240
15241 case "$i32type" in
15242 '')     case "$longsize" in
15243         4)      i32type=long
15244                 u32type="unsigned long"
15245                 i32size=$longsize
15246                 u32size=$longsize
15247                 ;;
15248         *)      case "$intsize" in
15249                 4)      i32type=int
15250                         u32type="unsigned int"
15251                         i32size=$intsize
15252                         u32size=$intsize
15253                         ;;
15254                 esac
15255                 ;;
15256         esac
15257         ;;
15258 esac
15259 case "$i32type" in
15260 '')     set try -DINT32
15261         if eval $compile; then
15262                 case "`$run ./try`" in
15263                 int32_t)
15264                         i32type=int32_t
15265                         u32type=uint32_t
15266                         i32size=4
15267                         u32size=4
15268                         ;;
15269                 esac
15270         fi
15271         ;;
15272 esac
15273 case "$i32type" in
15274 '')     if $test $intsize -ge 4; then
15275                 i32type=int
15276                 u32type="unsigned int"
15277                 i32size=$intsize
15278                 u32size=$intsize
15279         fi
15280         ;;
15281 esac
15282
15283 case "$i64type" in
15284 '')     case "$d_quad:$quadtype" in
15285         define:?*)
15286                 i64type="$quadtype"
15287                 u64type="$uquadtype"
15288                 i64size=8
15289                 u64size=8
15290                 ;;
15291         esac
15292         ;;
15293 esac
15294
15295 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15296 : volatile so that the compiler has to store it out to memory.
15297 if test X"$d_volatile" = X"$define"; then
15298         volatile=volatile
15299 fi
15300 $cat <<EOP >try.c
15301 #include <stdio.h>
15302 #$i_stdlib I_STDLIB
15303 #ifdef I_STDLIB
15304 #include <stdlib.h>
15305 #endif
15306 #include <sys/types.h>
15307 #include <signal.h>
15308 #ifdef SIGFPE
15309 $volatile int bletched = 0;
15310 $signal_t blech(int s) { bletched = 1; }
15311 #endif
15312 int main() {
15313     $uvtype u = 0;
15314     $nvtype d;
15315     int     n = 8 * $uvsize;
15316     int     i;
15317 #ifdef SIGFPE
15318     signal(SIGFPE, blech);
15319 #endif
15320
15321     for (i = 0; i < n; i++) {
15322       u = u << 1 | ($uvtype)1;
15323       d = ($nvtype)u;
15324       if (($uvtype)d != u)
15325         break;
15326       if (d <= 0)
15327         break;
15328       d = ($nvtype)(u - 1);
15329       if (($uvtype)d != (u - 1))
15330         break;
15331 #ifdef SIGFPE
15332       if (bletched)
15333         break;
15334 #endif
15335     }
15336     printf("%d\n", ((i == n) ? -n : i));
15337     exit(0);
15338 }
15339 EOP
15340 set try
15341
15342 d_nv_preserves_uv="$undef"
15343 if eval $compile; then
15344         nv_preserves_uv_bits="`$run ./try`"
15345 fi
15346 case "$nv_preserves_uv_bits" in
15347 \-[1-9]*)
15348         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15349         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15350         d_nv_preserves_uv="$define"
15351         ;;
15352 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15353         d_nv_preserves_uv="$undef" ;;
15354 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15355         nv_preserves_uv_bits="0" ;;
15356 esac
15357 $rm_try
15358
15359 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15360 : volatile so that the compiler has to store it out to memory.
15361 if test X"$d_volatile" = X"$define"; then
15362         volatile=volatile
15363 fi
15364 $cat <<EOP >try.c
15365 #include <stdio.h>
15366 #$i_stdlib I_STDLIB
15367 #ifdef I_STDLIB
15368 #include <stdlib.h>
15369 #endif
15370 #$i_string I_STRING
15371 #ifdef I_STRING
15372 #  include <string.h>
15373 #else
15374 #  include <strings.h>
15375 #endif
15376 #include <sys/types.h>
15377 #include <signal.h>
15378 #ifdef SIGFPE
15379 $volatile int bletched = 0;
15380 $signal_t blech(int s) { bletched = 1; }
15381 #endif
15382
15383 int checkit($nvtype d, char *where) {
15384     unsigned char *p = (char *)&d;
15385     unsigned char *end = p + sizeof(d);
15386     int fail = 0;
15387
15388     while (p < end)
15389         fail += *p++;
15390
15391     if (!fail)
15392         return 0;
15393
15394     p = (char *)&d;
15395     printf("No - %s: 0x", where);
15396     while (p < end)
15397         printf ("%02X", *p++);
15398     printf("\n");
15399     return 1;
15400 }
15401
15402 int main(int argc, char **argv) {
15403     $nvtype d = 0.0;
15404     int fail = 0;
15405     fail += checkit(d, "0.0");
15406
15407     /* The compiler shouldn't be assuming that bletched is 0  */
15408     d = bletched;
15409
15410     fail += checkit(d, "bleched");
15411
15412 #ifdef SIGFPE
15413     signal(SIGFPE, blech);
15414 #endif
15415
15416     /* Paranoia - the compiler should have no way of knowing that ANSI says
15417        that argv[argc] will always be NULL.  Actually, if it did assume this it
15418        would be buggy, as this is C and main() can be called from elsewhere in
15419        the program.  */
15420     d = argv[argc] ? 1 : 0;
15421
15422     if (d) {
15423         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15424     }
15425
15426     fail += checkit(d, "ternary");
15427
15428     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15429
15430     if (d != 0.0) {
15431         printf("No - memset doesn't give 0.0\n");
15432         /* This might just blow up:  */
15433         printf("(gives %g)\n", d);
15434         return 1;
15435     }
15436
15437 #ifdef SIGFPE
15438     if (bletched) {
15439         printf("No - something bleched\n");
15440         return 1;
15441     }
15442 #endif
15443     if (fail) {
15444       printf("No - %d fail(s)\n", fail);
15445       return 1;
15446     }
15447     printf("Yes\n");
15448     return 0;
15449 }
15450 EOP
15451 set try
15452
15453 d_nv_zero_is_allbits_zero="$undef"
15454 if eval $compile; then
15455     xxx="`$run ./try`"
15456     case "$?" in
15457         0)
15458             case "$xxx" in
15459                 Yes)  cat >&4 <<EOM
15460 0.0 is represented as all bits zero in memory
15461 EOM
15462                     d_nv_zero_is_allbits_zero="$define"
15463                     ;;
15464                 *)  cat >&4 <<EOM
15465 0.0 is not represented as all bits zero in memory
15466 EOM
15467                     d_nv_zero_is_allbits_zero="$undef"
15468                     ;;
15469             esac
15470             ;;
15471         *)  cat >&4 <<EOM
15472 0.0 is not represented as all bits zero in memory
15473 EOM
15474             d_nv_zero_is_allbits_zero="$undef"
15475             ;;
15476     esac
15477 fi
15478 $rm_try
15479
15480 : check for off64_t
15481 echo " "
15482 echo "Checking to see if you have off64_t..." >&4
15483 $cat >try.c <<EOCP
15484 #include <sys/types.h>
15485 #include <unistd.h>
15486 int main() { off64_t x = 7; }
15487 EOCP
15488 set try
15489 if eval $compile; then
15490         val="$define"
15491         echo "You have off64_t."
15492 else
15493         val="$undef"
15494         echo "You do not have off64_t."
15495         case "$lseeksize" in
15496         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15497         esac
15498 fi
15499 $rm_try
15500 set d_off64_t
15501 eval $setvar
15502
15503 : how to create joinable pthreads
15504 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15505         echo " "
15506         echo "Checking what constant to use for creating joinable pthreads..." >&4
15507         $cat >try.c <<'EOCP'
15508 #include <pthread.h>
15509 int main() {
15510     int detachstate = JOINABLE;
15511 }
15512 EOCP
15513         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15514         if eval $compile; then
15515                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15516                 val="$undef" # Yes, undef.
15517                 set d_old_pthread_create_joinable
15518                 eval $setvar
15519                 val=""
15520                 set old_pthread_create_joinable
15521                 eval $setvar
15522         else
15523                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15524                 if eval $compile; then
15525                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15526                         val="$define"
15527                         set d_old_pthread_create_joinable
15528                         eval $setvar
15529                         val=PTHREAD_CREATE_UNDETACHED
15530                         set old_pthread_create_joinable
15531                         eval $setvar
15532                 else
15533                         set try -DJOINABLE=__UNDETACHED
15534                         if eval $compile; then
15535                                 echo "You seem to use __UNDETACHED." >&4
15536                                 val="$define"
15537                                 set d_old_pthread_create_joinable
15538                                 eval $setvar
15539                                 val=__UNDETACHED
15540                                 set old_pthread_create_joinable
15541                                 eval $setvar
15542                         else
15543                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15544                                 val="$define"
15545                                 set d_old_pthread_create_joinable
15546                                 eval $setvar
15547                                 val=0
15548                                 set old_pthread_create_joinable
15549                                 eval $setvar
15550                         fi
15551                 fi
15552         fi
15553         $rm_try
15554 else
15555     d_old_pthread_create_joinable="$undef"
15556     old_pthread_create_joinable=""
15557 fi
15558
15559 : see if pause exists
15560 set pause d_pause
15561 eval $inlibc
15562
15563 : see if poll exists
15564 set poll d_poll
15565 eval $inlibc
15566
15567 : see if readlink exists
15568 set readlink d_readlink
15569 eval $inlibc
15570
15571 echo " "
15572 procselfexe=''
15573 val="$undef"
15574 case "$d_readlink" in
15575 "$define")
15576         if $issymlink /proc/self/exe ; then
15577                 $ls -l /proc/self/exe > reflect
15578                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15579                         echo "You have Linux-like /proc/self/exe."
15580                         procselfexe='"/proc/self/exe"'
15581                         val="$define"
15582                 fi
15583         fi
15584         if $issymlink /proc/curproc/file ; then
15585                 $ls -l /proc/curproc/file > reflect
15586                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15587                         echo "You have BSD-like /proc/curproc/file."
15588                         procselfexe='"/proc/curproc/file"'
15589                         val="$define"
15590                 fi
15591         fi
15592         ;;
15593 esac
15594 $rm -f reflect
15595 set d_procselfexe
15596 eval $setvar
15597
15598 : backward compatibility for d_hvfork
15599 if test X$d_hvfork != X; then
15600         d_vfork="$d_hvfork"
15601         d_hvfork=''
15602 fi
15603 : see if there is a vfork
15604 val=''
15605 set vfork val
15606 eval $inlibc
15607
15608 d_pseudofork=$undef
15609
15610 : Ok, but do we want to use it. vfork is reportedly unreliable in
15611 : perl on Solaris 2.x, and probably elsewhere.
15612 case "$val" in
15613 $define)
15614         echo " "
15615         case "$usevfork" in
15616         false) dflt='n';;
15617         *) dflt='y';;
15618         esac
15619         cat <<'EOM'
15620
15621 Perl can only use a vfork() that doesn't suffer from strict
15622 restrictions on calling functions or modifying global data in
15623 the child.  For example, glibc-2.1 contains such a vfork()
15624 that is unsuitable.  If your system provides a proper fork()
15625 call, chances are that you do NOT want perl to use vfork().
15626
15627 EOM
15628         rp="Do you still want to use vfork()?"
15629         . ./myread
15630         case "$ans" in
15631         y|Y) ;;
15632         *)
15633                 echo "Ok, we won't use vfork()."
15634                 val="$undef"
15635                 ;;
15636         esac
15637         ;;
15638 esac
15639 set d_vfork
15640 eval $setvar
15641 case "$d_vfork" in
15642 $define) usevfork='true';;
15643 *) usevfork='false';;
15644 esac
15645
15646 : see whether the pthread_atfork exists
15647 $cat >try.c <<EOP
15648 #include <pthread.h>
15649 #include <stdio.h>
15650 int main() {
15651 #ifdef  PTHREAD_ATFORK
15652         pthread_atfork(NULL,NULL,NULL);
15653 #endif
15654 }
15655 EOP
15656
15657 : see if pthread_atfork exists
15658 set try -DPTHREAD_ATFORK
15659 if eval $compile; then
15660     val="$define"
15661 else
15662     val="$undef"
15663 fi
15664 case "$usethreads" in
15665 $define)
15666         case "$val" in
15667         $define) echo 'pthread_atfork found.' >&4        ;;
15668         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15669         esac
15670 esac
15671 set d_pthread_atfork
15672 eval $setvar
15673
15674 : see if pthread_attr_setscope exists
15675 set pthread_attr_setscope d_pthread_attr_setscope
15676 eval $inlibc
15677
15678
15679 : see whether the various POSIXish _yields exist
15680 $cat >try.c <<EOP
15681 #include <pthread.h>
15682 #include <stdio.h>
15683 int main() {
15684 #ifdef SCHED_YIELD
15685         sched_yield();
15686 #else
15687 #ifdef PTHREAD_YIELD
15688         pthread_yield();
15689 #else
15690 #ifdef PTHREAD_YIELD_NULL
15691         pthread_yield(NULL);
15692 #endif
15693 #endif
15694 #endif
15695 }
15696 EOP
15697 : see if sched_yield exists
15698 set try -DSCHED_YIELD
15699 if eval $compile; then
15700     val="$define"
15701     sched_yield='sched_yield()'
15702 else
15703     val="$undef"
15704 fi
15705 case "$usethreads" in
15706 $define)
15707         case "$val" in
15708         $define) echo 'sched_yield() found.' >&4        ;;
15709         *)       echo 'sched_yield() NOT found.' >&4    ;;
15710         esac
15711 esac
15712 set d_sched_yield
15713 eval $setvar
15714
15715 : see if pthread_yield exists
15716 set try -DPTHREAD_YIELD
15717 if eval $compile; then
15718     val="$define"
15719     case "$sched_yield" in
15720     '') sched_yield='pthread_yield()' ;;
15721     esac
15722 else
15723     set try -DPTHREAD_YIELD_NULL
15724     if eval $compile; then
15725         val="$define"
15726         case "$sched_yield" in
15727         '') sched_yield='pthread_yield(NULL)' ;;
15728         esac
15729     else
15730         val="$undef"
15731     fi
15732 fi
15733 case "$usethreads" in
15734 $define)
15735         case "$val" in
15736         $define) echo 'pthread_yield() found.' >&4      ;;
15737         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15738         esac
15739         ;;
15740 esac
15741 set d_pthread_yield
15742 eval $setvar
15743 case "$sched_yield" in
15744 '') sched_yield=undef ;;
15745 esac
15746 $rm_try
15747
15748 : see if random_r exists
15749 set random_r d_random_r
15750 eval $inlibc
15751 case "$d_random_r" in
15752 "$define")
15753         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15754         case "$d_random_r_proto:$usethreads" in
15755         ":define")      d_random_r_proto=define
15756                 set d_random_r_proto random_r $hdrs
15757                 eval $hasproto ;;
15758         *)      ;;
15759         esac
15760         case "$d_random_r_proto" in
15761         define)
15762         case "$random_r_proto" in
15763         ''|0) try='int random_r(int*, struct random_data*);'
15764         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15765         esac
15766         case "$random_r_proto" in
15767         ''|0) try='int random_r(long*, struct random_data*);'
15768         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15769         esac
15770         case "$random_r_proto" in
15771         ''|0) try='int random_r(struct random_data*, int32_t*);'
15772         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15773         esac
15774         case "$random_r_proto" in
15775         ''|0)   d_random_r=undef
15776                 random_r_proto=0
15777                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15778         * )     case "$random_r_proto" in
15779                 REENTRANT_PROTO*) ;;
15780                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15781                 esac
15782                 echo "Prototype: $try" ;;
15783         esac
15784         ;;
15785         *)      case "$usethreads" in
15786                 define) echo "random_r has no prototype, not using it." >&4 ;;
15787                 esac
15788                 d_random_r=undef
15789                 random_r_proto=0
15790                 ;;
15791         esac
15792         ;;
15793 *)      random_r_proto=0
15794         ;;
15795 esac
15796
15797 : see if readdir and friends exist
15798 set readdir d_readdir
15799 eval $inlibc
15800 set seekdir d_seekdir
15801 eval $inlibc
15802 set telldir d_telldir
15803 eval $inlibc
15804 set rewinddir d_rewinddir
15805 eval $inlibc
15806
15807 : see if readdir64_r exists
15808 set readdir64_r d_readdir64_r
15809 eval $inlibc
15810 case "$d_readdir64_r" in
15811 "$define")
15812         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15813         case "$d_readdir64_r_proto:$usethreads" in
15814         ":define")      d_readdir64_r_proto=define
15815                 set d_readdir64_r_proto readdir64_r $hdrs
15816                 eval $hasproto ;;
15817         *)      ;;
15818         esac
15819         case "$d_readdir64_r_proto" in
15820         define)
15821         case "$readdir64_r_proto" in
15822         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15823         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15824         esac
15825         case "$readdir64_r_proto" in
15826         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15827         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15828         esac
15829         case "$readdir64_r_proto" in
15830         ''|0)   d_readdir64_r=undef
15831                 readdir64_r_proto=0
15832                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15833         * )     case "$readdir64_r_proto" in
15834                 REENTRANT_PROTO*) ;;
15835                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15836                 esac
15837                 echo "Prototype: $try" ;;
15838         esac
15839         ;;
15840         *)      case "$usethreads" in
15841                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15842                 esac
15843                 d_readdir64_r=undef
15844                 readdir64_r_proto=0
15845                 ;;
15846         esac
15847         ;;
15848 *)      readdir64_r_proto=0
15849         ;;
15850 esac
15851
15852 : see if readdir_r exists
15853 set readdir_r d_readdir_r
15854 eval $inlibc
15855 case "$d_readdir_r" in
15856 "$define")
15857         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15858         case "$d_readdir_r_proto:$usethreads" in
15859         ":define")      d_readdir_r_proto=define
15860                 set d_readdir_r_proto readdir_r $hdrs
15861                 eval $hasproto ;;
15862         *)      ;;
15863         esac
15864         case "$d_readdir_r_proto" in
15865         define)
15866         case "$readdir_r_proto" in
15867         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15868         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15869         esac
15870         case "$readdir_r_proto" in
15871         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15872         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15873         esac
15874         case "$readdir_r_proto" in
15875         ''|0)   d_readdir_r=undef
15876                 readdir_r_proto=0
15877                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15878         * )     case "$readdir_r_proto" in
15879                 REENTRANT_PROTO*) ;;
15880                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15881                 esac
15882                 echo "Prototype: $try" ;;
15883         esac
15884         ;;
15885         *)      case "$usethreads" in
15886                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15887                 esac
15888                 d_readdir_r=undef
15889                 readdir_r_proto=0
15890                 ;;
15891         esac
15892         ;;
15893 *)      readdir_r_proto=0
15894         ;;
15895 esac
15896
15897 : see if readv exists
15898 set readv d_readv
15899 eval $inlibc
15900
15901 : see if recvmsg exists
15902 set recvmsg d_recvmsg
15903 eval $inlibc
15904
15905 : see if rename exists
15906 set rename d_rename
15907 eval $inlibc
15908
15909 : see if rmdir exists
15910 set rmdir d_rmdir
15911 eval $inlibc
15912
15913 : see if memory.h is available.
15914 val=''
15915 set memory.h val
15916 eval $inhdr
15917
15918 : See if it conflicts with string.h
15919 case "$val" in
15920 $define)
15921         case "$strings" in
15922         '') ;;
15923         *)
15924                 $cppstdin $cppflags $cppminus < $strings > mem.h
15925                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15926                         echo " "
15927                         echo "We won't be including <memory.h>."
15928                         val="$undef"
15929                 fi
15930                 $rm -f mem.h
15931                 ;;
15932         esac
15933 esac
15934 set i_memory
15935 eval $setvar
15936
15937 : can bcopy handle overlapping blocks?
15938 echo " "
15939 val="$undef"
15940 case "$d_memmove" in
15941 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15942 *)      case "$d_bcopy" in
15943         "$define")
15944                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15945                 $cat >try.c <<EOCP
15946 #$i_memory I_MEMORY
15947 #$i_stdlib I_STDLIB
15948 #$i_string I_STRING
15949 #$i_unistd I_UNISTD
15950 EOCP
15951         $cat >>try.c <<'EOCP'
15952 #include <stdio.h>
15953 #ifdef I_MEMORY
15954 #  include <memory.h>
15955 #endif
15956 #ifdef I_STDLIB
15957 #  include <stdlib.h>
15958 #endif
15959 #ifdef I_STRING
15960 #  include <string.h>
15961 #else
15962 #  include <strings.h>
15963 #endif
15964 #ifdef I_UNISTD
15965 #  include <unistd.h>  /* Needed for NetBSD */
15966 #endif
15967 int main()
15968 {
15969 char buf[128], abc[128];
15970 char *b;
15971 int len;
15972 int off;
15973 int align;
15974
15975 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15976    try to store the string in read-only memory. */
15977 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15978
15979 for (align = 7; align >= 0; align--) {
15980         for (len = 36; len; len--) {
15981                 b = buf+align;
15982                 bcopy(abc, b, len);
15983                 for (off = 1; off <= len; off++) {
15984                         bcopy(b, b+off, len);
15985                         bcopy(b+off, b, len);
15986                         if (bcmp(b, abc, len))
15987                                 exit(1);
15988                 }
15989         }
15990 }
15991 exit(0);
15992 }
15993 EOCP
15994                 set try
15995                 if eval $compile_ok; then
15996                         if $run ./try 2>/dev/null; then
15997                                 echo "Yes, it can."
15998                                 val="$define"
15999                         else
16000                                 echo "It can't, sorry."
16001                         fi
16002                 else
16003                         echo "(I can't compile the test program, so we'll assume not...)"
16004                 fi
16005                 ;;
16006         esac
16007         $rm_try
16008         ;;
16009 esac
16010 set d_safebcpy
16011 eval $setvar
16012
16013 : can memcpy handle overlapping blocks?
16014 echo " "
16015 val="$undef"
16016 case "$d_memmove" in
16017 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16018 *)      case "$d_memcpy" in
16019         "$define")
16020                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16021                 $cat >try.c <<EOCP
16022 #$i_memory I_MEMORY
16023 #$i_stdlib I_STDLIB
16024 #$i_string I_STRING
16025 #$i_unistd I_UNISTD
16026 EOCP
16027         $cat >>try.c <<'EOCP'
16028 #include <stdio.h>
16029 #ifdef I_MEMORY
16030 #  include <memory.h>
16031 #endif
16032 #ifdef I_STDLIB
16033 #  include <stdlib.h>
16034 #endif
16035 #ifdef I_STRING
16036 #  include <string.h>
16037 #else
16038 #  include <strings.h>
16039 #endif
16040 #ifdef I_UNISTD
16041 #  include <unistd.h>  /* Needed for NetBSD */
16042 #endif
16043 int main()
16044 {
16045 char buf[128], abc[128];
16046 char *b;
16047 int len;
16048 int off;
16049 int align;
16050
16051 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16052    try to store the string in read-only memory. */
16053 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16054
16055 for (align = 7; align >= 0; align--) {
16056         for (len = 36; len; len--) {
16057                 b = buf+align;
16058                 memcpy(b, abc, len);
16059                 for (off = 1; off <= len; off++) {
16060                         memcpy(b+off, b, len);
16061                         memcpy(b, b+off, len);
16062                         if (memcmp(b, abc, len))
16063                                 exit(1);
16064                 }
16065         }
16066 }
16067 exit(0);
16068 }
16069 EOCP
16070                 set try
16071                 if eval $compile_ok; then
16072                         if $run ./try 2>/dev/null; then
16073                                 echo "Yes, it can."
16074                                 val="$define"
16075                         else
16076                                 echo "It can't, sorry."
16077                         fi
16078                 else
16079                         echo "(I can't compile the test program, so we'll assume not...)"
16080                 fi
16081                 ;;
16082         esac
16083         $rm_try
16084         ;;
16085 esac
16086 set d_safemcpy
16087 eval $setvar
16088
16089 : can memcmp be trusted to compare relative magnitude?
16090 val="$undef"
16091 case "$d_memcmp" in
16092 "$define")
16093         echo " "
16094         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16095         $cat >try.c <<EOCP
16096 #$i_memory I_MEMORY
16097 #$i_stdlib I_STDLIB
16098 #$i_string I_STRING
16099 #$i_unistd I_UNISTD
16100 EOCP
16101         $cat >>try.c <<'EOCP'
16102 #include <stdio.h>
16103 #ifdef I_MEMORY
16104 #  include <memory.h>
16105 #endif
16106 #ifdef I_STDLIB
16107 #  include <stdlib.h>
16108 #endif
16109 #ifdef I_STRING
16110 #  include <string.h>
16111 #else
16112 #  include <strings.h>
16113 #endif
16114 #ifdef I_UNISTD
16115 #  include <unistd.h>  /* Needed for NetBSD */
16116 #endif
16117 int main()
16118 {
16119 char a = -1;
16120 char b = 0;
16121 if ((a < b) && memcmp(&a, &b, 1) < 0)
16122         exit(1);
16123 exit(0);
16124 }
16125 EOCP
16126         set try
16127         if eval $compile_ok; then
16128                 if $run ./try 2>/dev/null; then
16129                         echo "Yes, it can."
16130                         val="$define"
16131                 else
16132                         echo "No, it can't (it uses signed chars)."
16133                 fi
16134         else
16135                 echo "(I can't compile the test program, so we'll assume not...)"
16136         fi
16137         ;;
16138 esac
16139 $rm_try
16140 set d_sanemcmp
16141 eval $setvar
16142
16143 : see if prototype for sbrk is available
16144 echo " "
16145 set d_sbrkproto sbrk $i_unistd unistd.h
16146 eval $hasproto
16147
16148 : see if select exists
16149 set select d_select
16150 eval $inlibc
16151
16152 : see if semctl exists
16153 set semctl d_semctl
16154 eval $inlibc
16155
16156 : see if semget exists
16157 set semget d_semget
16158 eval $inlibc
16159
16160 : see if semop exists
16161 set semop d_semop
16162 eval $inlibc
16163
16164 : see how much of the 'sem*(2)' library is present.
16165 h_sem=true
16166 echo " "
16167 case "$d_semctl$d_semget$d_semop" in
16168 *"$undef"*) h_sem=false;;
16169 esac
16170 case "$osname" in
16171 freebsd)
16172     case "`ipcs 2>&1`" in
16173     "SVID messages"*"not configured"*)
16174         echo "Your $osname does not have the sem*(2) configured." >&4
16175         h_sem=false
16176         val="$undef"
16177         set semctl d_semctl
16178         eval $setvar
16179         set semget d_semget
16180         eval $setvar
16181         set semop d_semop
16182         eval $setvar
16183         ;;
16184     esac
16185     ;;
16186 esac
16187 : we could also check for sys/ipc.h ...
16188 if $h_sem && $test `./findhdr sys/sem.h`; then
16189         echo "You have the full sem*(2) library." >&4
16190         val="$define"
16191 else
16192         echo "You don't have the full sem*(2) library." >&4
16193         val="$undef"
16194 fi
16195 set d_sem
16196 eval $setvar
16197
16198 : see whether sys/sem.h defines union semun
16199 echo " "
16200 $cat > try.c <<'END'
16201 #include <sys/types.h>
16202 #include <sys/ipc.h>
16203 #include <sys/sem.h>
16204 int main () { union semun semun; semun.buf = 0; }
16205 END
16206 set try
16207 if eval $compile; then
16208     echo "You have union semun in <sys/sem.h>." >&4
16209     val="$define"
16210 else
16211     echo "You do not have union semun in <sys/sem.h>." >&4
16212     val="$undef"
16213 fi
16214 $rm_try
16215 set d_union_semun
16216 eval $setvar
16217
16218 : see how to do semctl IPC_STAT
16219 case "$d_sem" in
16220 $define)
16221     echo " "
16222     $cat > tryh.h <<END
16223 #ifndef S_IRUSR
16224 #   ifdef S_IREAD
16225 #       define S_IRUSR S_IREAD
16226 #       define S_IWUSR S_IWRITE
16227 #       define S_IXUSR S_IEXEC
16228 #   else
16229 #       define S_IRUSR 0400
16230 #       define S_IWUSR 0200
16231 #       define S_IXUSR 0100
16232 #   endif
16233 #   define S_IRGRP (S_IRUSR>>3)
16234 #   define S_IWGRP (S_IWUSR>>3)
16235 #   define S_IXGRP (S_IXUSR>>3)
16236 #   define S_IROTH (S_IRUSR>>6)
16237 #   define S_IWOTH (S_IWUSR>>6)
16238 #   define S_IXOTH (S_IXUSR>>6)
16239 #endif
16240 #ifndef S_IRWXU
16241 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16242 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16243 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16244 #endif
16245 END
16246     : see whether semctl IPC_STAT can use union semun
16247     case "$d_semctl_semun" in
16248     '')
16249       val="$undef"
16250       $cat > try.c <<END
16251 #include <sys/types.h>
16252 #include <sys/ipc.h>
16253 #include <sys/sem.h>
16254 #include <sys/stat.h>
16255 #include <stdio.h>
16256 #include <errno.h>
16257 #include "tryh.h"
16258 #ifndef errno
16259 extern int errno;
16260 #endif
16261 #$d_union_semun HAS_UNION_SEMUN
16262 int main() {
16263     union semun
16264 #ifndef HAS_UNION_SEMUN
16265     {
16266         int val;
16267         struct semid_ds *buf;
16268         unsigned short *array;
16269     }
16270 #endif
16271     arg;
16272     int sem, st;
16273
16274 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16275     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16276     if (sem > -1) {
16277         struct semid_ds argbuf;
16278         arg.buf = &argbuf;
16279 #       ifdef IPC_STAT
16280         st = semctl(sem, 0, IPC_STAT, arg);
16281         if (st == 0)
16282             printf("semun\n");
16283         else
16284 #       endif /* IPC_STAT */
16285             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16286 #       ifdef IPC_RMID
16287         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16288 #       endif /* IPC_RMID */
16289             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16290     } else
16291 #endif /* IPC_PRIVATE && ... */
16292         printf("semget failed: errno = %d\n", errno);
16293   return 0;
16294 }
16295 END
16296       set try
16297       if eval $compile; then
16298           xxx=`$run ./try`
16299           case "$xxx" in
16300           semun) val="$define" ;;
16301           esac
16302       fi
16303       $rm_try
16304       set d_semctl_semun
16305       eval $setvar
16306       ;;
16307     esac
16308     case "$d_semctl_semun" in
16309     $define)
16310         echo "You can use union semun for semctl IPC_STAT." >&4
16311         also='also'
16312         ;;
16313     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16314         also=''
16315         ;;
16316     esac
16317
16318     : see whether semctl IPC_STAT can use struct semid_ds pointer
16319     case "$d_semctl_semid_ds" in
16320     '')
16321       val="$undef"
16322       $cat > try.c <<'END'
16323 #include <sys/types.h>
16324 #include <sys/ipc.h>
16325 #include <sys/sem.h>
16326 #include <sys/stat.h>
16327 #include "tryh.h"
16328 #include <stdio.h>
16329 #include <errno.h>
16330 #ifndef errno
16331 extern int errno;
16332 #endif
16333 int main() {
16334     struct semid_ds arg;
16335     int sem, st;
16336
16337 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16338     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16339     if (sem > -1) {
16340 #       ifdef IPC_STAT
16341         st = semctl(sem, 0, IPC_STAT, &arg);
16342         if (st == 0)
16343             printf("semid_ds\n");
16344         else
16345 #       endif /* IPC_STAT */
16346             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16347 #       ifdef IPC_RMID
16348         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16349 #       endif /* IPC_RMID */
16350             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16351     } else
16352 #endif /* IPC_PRIVATE && ... */
16353         printf("semget failed: errno = %d\n", errno);
16354
16355     return 0;
16356 }
16357 END
16358       set try
16359       if eval $compile; then
16360           xxx=`$run ./try`
16361           case "$xxx" in
16362           semid_ds) val="$define" ;;
16363           esac
16364       fi
16365       $rm_try
16366       set d_semctl_semid_ds
16367       eval $setvar
16368       ;;
16369     esac
16370     case "$d_semctl_semid_ds" in
16371     $define)
16372         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16373         ;;
16374     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16375         ;;
16376     esac
16377     ;;
16378 *)  val="$undef"
16379
16380     # We do not have the full sem*(2) library, so assume we can not
16381     # use either.
16382
16383     set d_semctl_semun
16384     eval $setvar
16385
16386     set d_semctl_semid_ds
16387     eval $setvar
16388     ;;
16389 esac
16390 $rm_try tryh.h
16391
16392 : see if sendmsg exists
16393 set sendmsg d_sendmsg
16394 eval $inlibc
16395
16396 : see if setegid exists
16397 set setegid d_setegid
16398 eval $inlibc
16399
16400 : see if seteuid exists
16401 set seteuid d_seteuid
16402 eval $inlibc
16403
16404 : see if setgrent exists
16405 set setgrent d_setgrent
16406 eval $inlibc
16407
16408 : see if setgrent_r exists
16409 set setgrent_r d_setgrent_r
16410 eval $inlibc
16411 case "$d_setgrent_r" in
16412 "$define")
16413         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16414         case "$d_setgrent_r_proto:$usethreads" in
16415         ":define")      d_setgrent_r_proto=define
16416                 set d_setgrent_r_proto setgrent_r $hdrs
16417                 eval $hasproto ;;
16418         *)      ;;
16419         esac
16420         case "$d_setgrent_r_proto" in
16421         define)
16422         case "$setgrent_r_proto" in
16423         ''|0) try='int setgrent_r(FILE**);'
16424         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16425         esac
16426         case "$setgrent_r_proto" in
16427         ''|0) try='void setgrent_r(FILE**);'
16428         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16429         esac
16430         case "$setgrent_r_proto" in
16431         ''|0)   d_setgrent_r=undef
16432                 setgrent_r_proto=0
16433                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16434         * )     case "$setgrent_r_proto" in
16435                 REENTRANT_PROTO*) ;;
16436                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16437                 esac
16438                 echo "Prototype: $try" ;;
16439         esac
16440         ;;
16441         *)      case "$usethreads" in
16442                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16443                 esac
16444                 d_setgrent_r=undef
16445                 setgrent_r_proto=0
16446                 ;;
16447         esac
16448         ;;
16449 *)      setgrent_r_proto=0
16450         ;;
16451 esac
16452
16453 : see if sethostent exists
16454 set sethostent d_sethent
16455 eval $inlibc
16456
16457 : see if sethostent_r exists
16458 set sethostent_r d_sethostent_r
16459 eval $inlibc
16460 case "$d_sethostent_r" in
16461 "$define")
16462         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16463         case "$d_sethostent_r_proto:$usethreads" in
16464         ":define")      d_sethostent_r_proto=define
16465                 set d_sethostent_r_proto sethostent_r $hdrs
16466                 eval $hasproto ;;
16467         *)      ;;
16468         esac
16469         case "$d_sethostent_r_proto" in
16470         define)
16471         case "$sethostent_r_proto" in
16472         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16473         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16474         esac
16475         case "$sethostent_r_proto" in
16476         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16477         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16478         esac
16479         case "$sethostent_r_proto" in
16480         ''|0)   d_sethostent_r=undef
16481                 sethostent_r_proto=0
16482                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16483         * )     case "$sethostent_r_proto" in
16484                 REENTRANT_PROTO*) ;;
16485                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16486                 esac
16487                 echo "Prototype: $try" ;;
16488         esac
16489         ;;
16490         *)      case "$usethreads" in
16491                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16492                 esac
16493                 d_sethostent_r=undef
16494                 sethostent_r_proto=0
16495                 ;;
16496         esac
16497         ;;
16498 *)      sethostent_r_proto=0
16499         ;;
16500 esac
16501
16502 : see if setitimer exists
16503 set setitimer d_setitimer
16504 eval $inlibc
16505
16506 : see if setlinebuf exists
16507 set setlinebuf d_setlinebuf
16508 eval $inlibc
16509
16510 : see if setlocale exists
16511 set setlocale d_setlocale
16512 eval $inlibc
16513
16514 : see if locale.h is available
16515 set locale.h i_locale
16516 eval $inhdr
16517
16518 : see if setlocale_r exists
16519 set setlocale_r d_setlocale_r
16520 eval $inlibc
16521 case "$d_setlocale_r" in
16522 "$define")
16523         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16524         case "$d_setlocale_r_proto:$usethreads" in
16525         ":define")      d_setlocale_r_proto=define
16526                 set d_setlocale_r_proto setlocale_r $hdrs
16527                 eval $hasproto ;;
16528         *)      ;;
16529         esac
16530         case "$d_setlocale_r_proto" in
16531         define)
16532         case "$setlocale_r_proto" in
16533         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16534         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16535         esac
16536         case "$setlocale_r_proto" in
16537         ''|0)   d_setlocale_r=undef
16538                 setlocale_r_proto=0
16539                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16540         * )     case "$setlocale_r_proto" in
16541                 REENTRANT_PROTO*) ;;
16542                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16543                 esac
16544                 echo "Prototype: $try" ;;
16545         esac
16546         ;;
16547         *)      case "$usethreads" in
16548                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16549                 esac
16550                 d_setlocale_r=undef
16551                 setlocale_r_proto=0
16552                 ;;
16553         esac
16554         ;;
16555 *)      setlocale_r_proto=0
16556         ;;
16557 esac
16558
16559 : see if setnetent exists
16560 set setnetent d_setnent
16561 eval $inlibc
16562
16563 : see if setnetent_r exists
16564 set setnetent_r d_setnetent_r
16565 eval $inlibc
16566 case "$d_setnetent_r" in
16567 "$define")
16568         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16569         case "$d_setnetent_r_proto:$usethreads" in
16570         ":define")      d_setnetent_r_proto=define
16571                 set d_setnetent_r_proto setnetent_r $hdrs
16572                 eval $hasproto ;;
16573         *)      ;;
16574         esac
16575         case "$d_setnetent_r_proto" in
16576         define)
16577         case "$setnetent_r_proto" in
16578         ''|0) try='int setnetent_r(int, struct netent_data*);'
16579         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16580         esac
16581         case "$setnetent_r_proto" in
16582         ''|0) try='void setnetent_r(int, struct netent_data*);'
16583         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16584         esac
16585         case "$setnetent_r_proto" in
16586         ''|0)   d_setnetent_r=undef
16587                 setnetent_r_proto=0
16588                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16589         * )     case "$setnetent_r_proto" in
16590                 REENTRANT_PROTO*) ;;
16591                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16592                 esac
16593                 echo "Prototype: $try" ;;
16594         esac
16595         ;;
16596         *)      case "$usethreads" in
16597                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16598                 esac
16599                 d_setnetent_r=undef
16600                 setnetent_r_proto=0
16601                 ;;
16602         esac
16603         ;;
16604 *)      setnetent_r_proto=0
16605         ;;
16606 esac
16607
16608 : see if setprotoent exists
16609 set setprotoent d_setpent
16610 eval $inlibc
16611
16612 : see if setpgid exists
16613 set setpgid d_setpgid
16614 eval $inlibc
16615
16616 : see if setpgrp2 exists
16617 set setpgrp2 d_setpgrp2
16618 eval $inlibc
16619
16620 : see if setpriority exists
16621 set setpriority d_setprior
16622 eval $inlibc
16623
16624 : see if setproctitle exists
16625 set setproctitle d_setproctitle
16626 eval $inlibc
16627
16628 : see if setprotoent_r exists
16629 set setprotoent_r d_setprotoent_r
16630 eval $inlibc
16631 case "$d_setprotoent_r" in
16632 "$define")
16633         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16634         case "$d_setprotoent_r_proto:$usethreads" in
16635         ":define")      d_setprotoent_r_proto=define
16636                 set d_setprotoent_r_proto setprotoent_r $hdrs
16637                 eval $hasproto ;;
16638         *)      ;;
16639         esac
16640         case "$d_setprotoent_r_proto" in
16641         define)
16642         case "$setprotoent_r_proto" in
16643         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16644         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16645         esac
16646         case "$setprotoent_r_proto" in
16647         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16648         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16649         esac
16650         case "$setprotoent_r_proto" in
16651         ''|0)   d_setprotoent_r=undef
16652                 setprotoent_r_proto=0
16653                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16654         * )     case "$setprotoent_r_proto" in
16655                 REENTRANT_PROTO*) ;;
16656                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16657                 esac
16658                 echo "Prototype: $try" ;;
16659         esac
16660         ;;
16661         *)      case "$usethreads" in
16662                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16663                 esac
16664                 d_setprotoent_r=undef
16665                 setprotoent_r_proto=0
16666                 ;;
16667         esac
16668         ;;
16669 *)      setprotoent_r_proto=0
16670         ;;
16671 esac
16672
16673 : see if setpwent exists
16674 set setpwent d_setpwent
16675 eval $inlibc
16676
16677 : see if setpwent_r exists
16678 set setpwent_r d_setpwent_r
16679 eval $inlibc
16680 case "$d_setpwent_r" in
16681 "$define")
16682         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16683         case "$d_setpwent_r_proto:$usethreads" in
16684         ":define")      d_setpwent_r_proto=define
16685                 set d_setpwent_r_proto setpwent_r $hdrs
16686                 eval $hasproto ;;
16687         *)      ;;
16688         esac
16689         case "$d_setpwent_r_proto" in
16690         define)
16691         case "$setpwent_r_proto" in
16692         ''|0) try='int setpwent_r(FILE**);'
16693         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16694         esac
16695         case "$setpwent_r_proto" in
16696         ''|0) try='void setpwent_r(FILE**);'
16697         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16698         esac
16699         case "$setpwent_r_proto" in
16700         ''|0)   d_setpwent_r=undef
16701                 setpwent_r_proto=0
16702                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16703         * )     case "$setpwent_r_proto" in
16704                 REENTRANT_PROTO*) ;;
16705                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16706                 esac
16707                 echo "Prototype: $try" ;;
16708         esac
16709         ;;
16710         *)      case "$usethreads" in
16711                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16712                 esac
16713                 d_setpwent_r=undef
16714                 setpwent_r_proto=0
16715                 ;;
16716         esac
16717         ;;
16718 *)      setpwent_r_proto=0
16719         ;;
16720 esac
16721
16722 : see if setregid exists
16723 set setregid d_setregid
16724 eval $inlibc
16725 set setresgid d_setresgid
16726 eval $inlibc
16727
16728 : see if setreuid exists
16729 set setreuid d_setreuid
16730 eval $inlibc
16731 set setresuid d_setresuid
16732 eval $inlibc
16733
16734 : see if setrgid exists
16735 set setrgid d_setrgid
16736 eval $inlibc
16737
16738 : see if setruid exists
16739 set setruid d_setruid
16740 eval $inlibc
16741
16742 : see if setservent exists
16743 set setservent d_setsent
16744 eval $inlibc
16745
16746 : see if setservent_r exists
16747 set setservent_r d_setservent_r
16748 eval $inlibc
16749 case "$d_setservent_r" in
16750 "$define")
16751         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16752         case "$d_setservent_r_proto:$usethreads" in
16753         ":define")      d_setservent_r_proto=define
16754                 set d_setservent_r_proto setservent_r $hdrs
16755                 eval $hasproto ;;
16756         *)      ;;
16757         esac
16758         case "$d_setservent_r_proto" in
16759         define)
16760         case "$setservent_r_proto" in
16761         ''|0) try='int setservent_r(int, struct servent_data*);'
16762         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16763         esac
16764         case "$setservent_r_proto" in
16765         ''|0) try='void setservent_r(int, struct servent_data*);'
16766         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16767         esac
16768         case "$setservent_r_proto" in
16769         ''|0)   d_setservent_r=undef
16770                 setservent_r_proto=0
16771                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16772         * )     case "$setservent_r_proto" in
16773                 REENTRANT_PROTO*) ;;
16774                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16775                 esac
16776                 echo "Prototype: $try" ;;
16777         esac
16778         ;;
16779         *)      case "$usethreads" in
16780                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16781                 esac
16782                 d_setservent_r=undef
16783                 setservent_r_proto=0
16784                 ;;
16785         esac
16786         ;;
16787 *)      setservent_r_proto=0
16788         ;;
16789 esac
16790
16791 : see if setsid exists
16792 set setsid d_setsid
16793 eval $inlibc
16794
16795 : see if setvbuf exists
16796 set setvbuf d_setvbuf
16797 eval $inlibc
16798
16799 : see if sfio.h is available
16800 set sfio.h i_sfio
16801 eval $inhdr
16802
16803
16804 : see if sfio library is available
16805 case "$i_sfio" in
16806 $define)
16807         val=''
16808         set sfreserve val
16809         eval $inlibc
16810         ;;
16811 *)
16812         val="$undef"
16813         ;;
16814 esac
16815 : Ok, but do we want to use it.
16816 case "$val" in
16817 $define)
16818         case "$usesfio" in
16819         true|$define|[yY]*) dflt='y';;
16820         *) dflt='n';;
16821         esac
16822         echo "$package can use the sfio library, but it is experimental."
16823         case "$useperlio" in
16824         "$undef")
16825             echo "For sfio also the PerlIO abstraction layer is needed."
16826             echo "Earlier you said you wouldn't want that."
16827             ;;
16828         esac
16829         rp="You seem to have sfio available, do you want to try using it?"
16830         . ./myread
16831         case "$ans" in
16832         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16833                 useperlio="$define"
16834                 val="$define"
16835                 ;;
16836         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16837                 val="$undef"
16838                 ;;
16839         esac
16840         ;;
16841 *)      case "$usesfio" in
16842         true|$define|[yY]*)
16843                 echo "Sorry, cannot find sfio on this machine." >&4
16844                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16845                 val="$undef"
16846                 ;;
16847         esac
16848         ;;
16849 esac
16850 set d_sfio
16851 eval $setvar
16852 case "$d_sfio" in
16853 $define) usesfio='true';;
16854 *) usesfio='false';;
16855 esac
16856 case "$d_sfio" in
16857 $define) ;;
16858 *)      : Remove sfio from list of libraries to use
16859         case "$libs" in
16860         *-lsfio*)
16861                 echo "Removing unneeded -lsfio from library list" >&4
16862                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16863                 shift
16864                 libs="$*"
16865                 echo "libs = $libs" >&4
16866                 ;;
16867         esac
16868 ;;
16869 esac
16870
16871
16872 : see if shmctl exists
16873 set shmctl d_shmctl
16874 eval $inlibc
16875
16876 : see if shmget exists
16877 set shmget d_shmget
16878 eval $inlibc
16879
16880 : see if shmat exists
16881 set shmat d_shmat
16882 eval $inlibc
16883 : see what shmat returns
16884 case "$d_shmat" in
16885 "$define")
16886         $cat >shmat.c <<'END'
16887 #include <sys/shm.h>
16888 void *shmat();
16889 END
16890         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16891                 shmattype='void *'
16892         else
16893                 shmattype='char *'
16894         fi
16895         echo "and it returns ($shmattype)." >&4
16896         : see if a prototype for shmat is available
16897         xxx=`./findhdr sys/shm.h`
16898         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16899         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16900                 val="$define"
16901         else
16902                 val="$undef"
16903         fi
16904         $rm -f shmat.[co]
16905         ;;
16906 *)
16907         val="$undef"
16908         ;;
16909 esac
16910 set d_shmatprototype
16911 eval $setvar
16912
16913 : see if shmdt exists
16914 set shmdt d_shmdt
16915 eval $inlibc
16916
16917 : see how much of the 'shm*(2)' library is present.
16918 h_shm=true
16919 echo " "
16920 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16921 *"$undef"*) h_shm=false;;
16922 esac
16923 case "$osname" in
16924 freebsd)
16925     case "`ipcs 2>&1`" in
16926     "SVID shared memory"*"not configured"*)
16927         echo "Your $osname does not have the shm*(2) configured." >&4
16928         h_shm=false
16929         val="$undef"
16930         set shmctl d_shmctl
16931         evat $setvar
16932         set shmget d_shmget
16933         evat $setvar
16934         set shmat d_shmat
16935         evat $setvar
16936         set shmdt d_shmdt
16937         evat $setvar
16938         ;;
16939     esac
16940     ;;
16941 esac
16942 : we could also check for sys/ipc.h ...
16943 if $h_shm && $test `./findhdr sys/shm.h`; then
16944         echo "You have the full shm*(2) library." >&4
16945         val="$define"
16946 else
16947         echo "You don't have the full shm*(2) library." >&4
16948         val="$undef"
16949 fi
16950 set d_shm
16951 eval $setvar
16952
16953 echo " "
16954 : see if we have sigaction
16955 if set sigaction val -f d_sigaction; eval $csym; $val; then
16956         echo 'sigaction() found.' >&4
16957         $cat > try.c <<EOP
16958 #include <stdio.h>
16959 #include <sys/types.h>
16960 #include <signal.h>
16961 #$i_stdlib I_STDLIB
16962 #ifdef I_STDLIB
16963 #include <stdlib.h>
16964 #endif
16965 int main()
16966 {
16967     struct sigaction act, oact;
16968     act.sa_flags = 0;
16969     oact.sa_handler = 0;
16970     /* so that act and oact are used */
16971     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16972 }
16973 EOP
16974         set try
16975         if eval $compile_ok; then
16976                 val="$define"
16977         else
16978                 echo "But you don't seem to have a useable struct sigaction." >&4
16979                 val="$undef"
16980         fi
16981 else
16982         echo 'sigaction NOT found.' >&4
16983         val="$undef"
16984 fi
16985 set d_sigaction; eval $setvar
16986 $rm_try
16987
16988 : see if this is a sunmath.h system
16989 set sunmath.h i_sunmath
16990 eval $inhdr
16991
16992 : see if signbit exists
16993 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
16994 $cat >try.c <<EOCP
16995 #$i_math I_MATH
16996 #$i_sunmath I_SUNMATH
16997 #ifdef I_MATH
16998 #  include <math.h>
16999 #endif
17000 #ifdef I_SUNMATH  /* Solaris special math library */
17001 #  include <sunmath.h>
17002 #endif
17003 #define NV $nvtype
17004 int main(int argc, char **argv)
17005 {
17006     NV x = 0.0;
17007     NV y = -0.0;
17008     if ((signbit(x) == 0) && (signbit(y) != 0))
17009         return 0;
17010     else
17011         return 1;
17012 }
17013 EOCP
17014 val="$undef"
17015 set try
17016 if eval $compile; then
17017     if $run ./try; then
17018         $echo "Yes." >&4
17019         val="$define"
17020     else
17021         $echo "Signbit seems to be available, but doesn't work as I expected."
17022         $echo "I won't use it." >&4
17023         val="$undef"
17024     fi
17025 else
17026     $echo "Nope." >&4
17027     dflt="$undef"
17028 fi
17029 set d_signbit
17030 eval $setvar
17031 $rm_try
17032
17033 : see if sigprocmask exists
17034 set sigprocmask d_sigprocmask
17035 eval $inlibc
17036
17037 : see if sigsetjmp exists
17038 echo " "
17039 case "$d_sigsetjmp" in
17040 '')
17041         $cat >try.c <<EOP
17042 #include <setjmp.h>
17043 #$i_stdlib I_STDLIB
17044 #ifdef I_STDLIB
17045 #include <stdlib.h>
17046 #endif
17047 sigjmp_buf env;
17048 int set = 1;
17049 int main()
17050 {
17051         if (sigsetjmp(env,1))
17052                 exit(set);
17053         set = 0;
17054         siglongjmp(env, 1);
17055         exit(1);
17056 }
17057 EOP
17058         set try
17059         if eval $compile; then
17060                 if $run ./try >/dev/null 2>&1; then
17061                         echo "POSIX sigsetjmp found." >&4
17062                         val="$define"
17063                 else
17064                         $cat >&4 <<EOM
17065 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17066 I'll ignore them.
17067 EOM
17068                         val="$undef"
17069                 fi
17070         else
17071                 echo "sigsetjmp not found." >&4
17072                 val="$undef"
17073         fi
17074         ;;
17075 *) val="$d_sigsetjmp"
17076         case "$d_sigsetjmp" in
17077         $define) echo "POSIX sigsetjmp found." >&4;;
17078         $undef) echo "sigsetjmp not found." >&4;;
17079         esac
17080         ;;
17081 esac
17082 set d_sigsetjmp
17083 eval $setvar
17084 $rm_try
17085
17086 : see if snprintf exists
17087 set snprintf d_snprintf
17088 eval $inlibc
17089
17090 : see if vsnprintf exists
17091 set vsnprintf d_vsnprintf
17092 eval $inlibc
17093
17094 case "$d_snprintf-$d_vsnprintf" in
17095 "$define-$define")
17096     $cat <<EOM
17097 Checking whether your snprintf() and vsnprintf() work okay...
17098 EOM
17099     $cat >try.c <<'EOCP'
17100 /* v?snprintf testing logic courtesy of Russ Allbery.
17101  * According to C99:
17102  * - if the buffer is too short it still must be \0-terminated
17103  * - if the buffer is too short the potentially required length
17104  *   must be returned and not -1
17105  * - if the buffer is NULL the potentially required length
17106  *   must be returned and not -1 or core dump
17107  */
17108 #include <stdio.h>
17109 #include <stdarg.h>
17110
17111 char buf[2];
17112
17113 int test (char *format, ...)
17114 {
17115     va_list args;
17116     int count;
17117
17118     va_start (args, format);
17119     count = vsnprintf (buf, sizeof buf, format, args);
17120     va_end (args);
17121     return count;
17122 }
17123
17124 int main ()
17125 {
17126     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17127              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17128 }
17129 EOCP
17130     set try
17131     if eval $compile; then
17132         `$run ./try`
17133         case "$?" in
17134         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17135         *) cat <<EOM >&4
17136 Your snprintf() and snprintf() don't seem to be working okay.
17137 EOM
17138            d_snprintf="$undef"
17139            d_vsnprintf="$undef"
17140            ;;
17141         esac
17142     else
17143         echo "(I can't seem to compile the test program--assuming they don't)"
17144         d_snprintf="$undef"
17145         d_vsnprintf="$undef"
17146     fi
17147     $rm_try
17148     ;;
17149 esac
17150
17151 : see if sockatmark exists
17152 set sockatmark d_sockatmark
17153 eval $inlibc
17154
17155 : see if prototype for sockatmark is available
17156 echo " "
17157 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17158 eval $hasproto
17159
17160 : see if socks5_init exists
17161 set socks5_init d_socks5_init
17162 eval $inlibc
17163
17164 : see if sprintf returns the length of the string in the buffer as per ANSI
17165 $echo "Checking whether sprintf returns the length of the string..." >&4
17166 $cat <<EOP >try.c
17167 #include <stdio.h>
17168 #$i_stdlib I_STDLIB
17169 #ifdef I_STDLIB
17170 #include <stdlib.h>
17171 #endif
17172 #$i_string I_STRING
17173 #ifdef I_STRING
17174 #  include <string.h>
17175 #else
17176 #  include <strings.h>
17177 #endif
17178 #$i_math I_MATH
17179 #ifdef I_MATH
17180 #include <math.h>
17181 #endif
17182
17183 char buffer[256];
17184
17185 int check (size_t expect, int test) {
17186   size_t got = strlen(buffer);
17187   if (expect == got)
17188     return 0;
17189
17190   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17191        test, buffer);
17192   exit (test);
17193 }
17194
17195 int main(int argc, char **argv) {
17196   int test = 0;
17197
17198   check(sprintf(buffer, ""), ++test);
17199   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17200   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17201
17202   return 0;
17203 }
17204 EOP
17205 set try
17206
17207 d_sprintf_returns_strlen="$undef"
17208 if eval $compile; then
17209     xxx="`$run ./try`"
17210     case "$?" in
17211         0) cat >&4 <<EOM
17212 sprintf returns the length of the string (as ANSI says it should)
17213 EOM
17214         d_sprintf_returns_strlen="$define"
17215         ;;
17216         *) cat >&4 <<EOM
17217 sprintf does not return the length of the string (how old is this system?)
17218 EOM
17219         d_sprintf_returns_strlen="$undef"
17220         ;;
17221     esac
17222 fi
17223 $rm_try
17224
17225 : see if srand48_r exists
17226 set srand48_r d_srand48_r
17227 eval $inlibc
17228 case "$d_srand48_r" in
17229 "$define")
17230         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17231         case "$d_srand48_r_proto:$usethreads" in
17232         ":define")      d_srand48_r_proto=define
17233                 set d_srand48_r_proto srand48_r $hdrs
17234                 eval $hasproto ;;
17235         *)      ;;
17236         esac
17237         case "$d_srand48_r_proto" in
17238         define)
17239         case "$srand48_r_proto" in
17240         ''|0) try='int srand48_r(long, struct drand48_data*);'
17241         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17242         esac
17243         case "$srand48_r_proto" in
17244         ''|0)   d_srand48_r=undef
17245                 srand48_r_proto=0
17246                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17247         * )     case "$srand48_r_proto" in
17248                 REENTRANT_PROTO*) ;;
17249                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17250                 esac
17251                 echo "Prototype: $try" ;;
17252         esac
17253         ;;
17254         *)      case "$usethreads" in
17255                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17256                 esac
17257                 d_srand48_r=undef
17258                 srand48_r_proto=0
17259                 ;;
17260         esac
17261         ;;
17262 *)      srand48_r_proto=0
17263         ;;
17264 esac
17265
17266 : see if srandom_r exists
17267 set srandom_r d_srandom_r
17268 eval $inlibc
17269 case "$d_srandom_r" in
17270 "$define")
17271         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17272         case "$d_srandom_r_proto:$usethreads" in
17273         ":define")      d_srandom_r_proto=define
17274                 set d_srandom_r_proto srandom_r $hdrs
17275                 eval $hasproto ;;
17276         *)      ;;
17277         esac
17278         case "$d_srandom_r_proto" in
17279         define)
17280         case "$srandom_r_proto" in
17281         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17282         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17283         esac
17284         case "$srandom_r_proto" in
17285         ''|0)   d_srandom_r=undef
17286                 srandom_r_proto=0
17287                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17288         * )     case "$srandom_r_proto" in
17289                 REENTRANT_PROTO*) ;;
17290                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17291                 esac
17292                 echo "Prototype: $try" ;;
17293         esac
17294         ;;
17295         *)      case "$usethreads" in
17296                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17297                 esac
17298                 d_srandom_r=undef
17299                 srandom_r_proto=0
17300                 ;;
17301         esac
17302         ;;
17303 *)      srandom_r_proto=0
17304         ;;
17305 esac
17306
17307 : see if prototype for setresgid is available
17308 echo " "
17309 set d_sresgproto setresgid $i_unistd unistd.h
17310 eval $hasproto
17311
17312 : see if prototype for setresuid is available
17313 echo " "
17314 set d_sresuproto setresuid $i_unistd unistd.h
17315 eval $hasproto
17316
17317 : see if sys/stat.h is available
17318 set sys/stat.h i_sysstat
17319 eval $inhdr
17320
17321
17322 : see if stat knows about block sizes
17323 echo " "
17324 echo "Checking to see if your struct stat has st_blocks field..." >&4
17325 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17326 eval $hasfield
17327
17328
17329 : see if this is a sys/vfs.h system
17330 set sys/vfs.h i_sysvfs
17331 eval $inhdr
17332
17333
17334 : see if this is a sys/statfs.h system
17335 set sys/statfs.h i_sysstatfs
17336 eval $inhdr
17337
17338
17339 echo " "
17340 echo "Checking to see if your system supports struct statfs..." >&4
17341 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
17342 eval $hasstruct
17343 case "$d_statfs_s" in
17344 "$define")      echo "Yes, it does."   ;;
17345 *)              echo "No, it doesn't." ;;
17346 esac
17347
17348
17349
17350 : see if struct statfs knows about f_flags
17351 case "$d_statfs_s" in
17352 define) 
17353         echo " "
17354         echo "Checking to see if your struct statfs has f_flags field..." >&4
17355         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
17356         eval $hasfield
17357         ;;
17358 *)      val="$undef"
17359         set d_statfs_f_flags
17360         eval $setvar
17361         ;;
17362 esac
17363 case "$d_statfs_f_flags" in
17364 "$define")      echo "Yes, it does."   ;;
17365 *)              echo "No, it doesn't." ;;
17366 esac
17367
17368 $cat >&4 <<EOM
17369 Checking how to access stdio streams by file descriptor number...
17370 EOM
17371 case "$stdio_stream_array" in
17372 '')     $cat >try.c <<EOCP
17373 #include <stdio.h>
17374 int main() {
17375   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17376     printf("yes\n");
17377 }
17378 EOCP
17379         for s in _iob __iob __sF
17380         do
17381                 set try -DSTDIO_STREAM_ARRAY=$s
17382                 if eval $compile; then
17383                         case "`$run ./try`" in
17384                         yes)    stdio_stream_array=$s; break ;;
17385                         esac
17386                 fi
17387         done
17388         $rm_try
17389 esac
17390 case "$stdio_stream_array" in
17391 '')     $cat >&4 <<EOM
17392 I can't figure out how to access stdio streams by file descriptor number.
17393 EOM
17394         d_stdio_stream_array="$undef"
17395         ;;
17396 *)      $cat >&4 <<EOM
17397 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17398 EOM
17399         d_stdio_stream_array="$define"
17400         ;;
17401 esac
17402
17403 : see if strcoll exists
17404 set strcoll d_strcoll
17405 eval $inlibc
17406
17407 : check for structure copying
17408 echo " "
17409 echo "Checking to see if your C compiler can copy structs..." >&4
17410 $cat >try.c <<'EOCP'
17411 int main()
17412 {
17413         struct blurfl {
17414                 int dyick;
17415         } foo, bar;
17416
17417         foo = bar;
17418 }
17419 EOCP
17420 if $cc -c try.c >/dev/null 2>&1 ; then
17421         val="$define"
17422         echo "Yup, it can."
17423 else
17424         val="$undef"
17425         echo "Nope, it can't."
17426 fi
17427 set d_strctcpy
17428 eval $setvar
17429 $rm_try
17430
17431 : see if strerror and/or sys_errlist[] exist
17432 echo " "
17433 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17434     if set strerror val -f d_strerror; eval $csym; $val; then
17435                 echo 'strerror() found.' >&4
17436                 d_strerror="$define"
17437                 d_strerrm='strerror(e)'
17438                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17439                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17440                         d_syserrlst="$define"
17441                 else
17442                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17443                         d_syserrlst="$undef"
17444                 fi
17445     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17446                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17447                 echo 'strerror() found in string header.' >&4
17448                 d_strerror="$define"
17449                 d_strerrm='strerror(e)'
17450                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17451                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17452                                 d_syserrlst="$define"
17453                 else
17454                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17455                         d_syserrlst="$undef"
17456                 fi
17457     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17458                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17459                 d_strerror="$undef"
17460                 d_syserrlst="$define"
17461                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17462     else
17463                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17464                 d_strerror="$undef"
17465                 d_syserrlst="$undef"
17466                 d_strerrm='"unknown"'
17467     fi
17468 fi
17469
17470 : see if strerror_r exists
17471 set strerror_r d_strerror_r
17472 eval $inlibc
17473 case "$d_strerror_r" in
17474 "$define")
17475         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17476         case "$d_strerror_r_proto:$usethreads" in
17477         ":define")      d_strerror_r_proto=define
17478                 set d_strerror_r_proto strerror_r $hdrs
17479                 eval $hasproto ;;
17480         *)      ;;
17481         esac
17482         case "$d_strerror_r_proto" in
17483         define)
17484         case "$strerror_r_proto" in
17485         ''|0) try='int strerror_r(int, char*, size_t);'
17486         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17487         esac
17488         case "$strerror_r_proto" in
17489         ''|0) try='int strerror_r(int, char*, int);'
17490         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17491         esac
17492         case "$strerror_r_proto" in
17493         ''|0) try='char* strerror_r(int, char*, size_t);'
17494         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17495         esac
17496         case "$strerror_r_proto" in
17497         ''|0)   d_strerror_r=undef
17498                 strerror_r_proto=0
17499                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17500         * )     case "$strerror_r_proto" in
17501                 REENTRANT_PROTO*) ;;
17502                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17503                 esac
17504                 echo "Prototype: $try" ;;
17505         esac
17506         ;;
17507         *)      case "$usethreads" in
17508                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17509                 esac
17510                 d_strerror_r=undef
17511                 strerror_r_proto=0
17512                 ;;
17513         esac
17514         ;;
17515 *)      strerror_r_proto=0
17516         ;;
17517 esac
17518
17519 : see if strftime exists
17520 set strftime d_strftime
17521 eval $inlibc
17522
17523 : see if strlcat exists
17524 set strlcat d_strlcat
17525 eval $inlibc
17526
17527 : see if strlcpy exists
17528 set strlcpy d_strlcpy
17529 eval $inlibc
17530
17531 : see if strtod exists
17532 set strtod d_strtod
17533 eval $inlibc
17534
17535 : see if strtol exists
17536 set strtol d_strtol
17537 eval $inlibc
17538
17539 : see if strtold exists
17540 set strtold d_strtold
17541 eval $inlibc
17542
17543 : see if strtoll exists
17544 set strtoll d_strtoll
17545 eval $inlibc
17546
17547 case "$d_longlong-$d_strtoll" in
17548 "$define-$define")
17549         $cat <<EOM
17550 Checking whether your strtoll() works okay...
17551 EOM
17552         $cat >try.c <<'EOCP'
17553 #include <errno.h>
17554 #ifdef __hpux
17555 #define strtoll __strtoll
17556 #endif
17557 #ifdef __EMX__
17558 #define strtoll _strtoll
17559 #endif
17560 #include <stdio.h>
17561 extern long long int strtoll(char *s, char **, int); 
17562 static int bad = 0;
17563 int check(char *s, long long ell, int een) {
17564         long long gll;
17565         errno = 0;
17566         gll = strtoll(s, 0, 10);
17567         if (!((gll == ell) && (errno == een)))
17568                 bad++;
17569 }
17570 int main() {
17571         check(" 1",                                      1LL, 0);
17572         check(" 0",                                      0LL, 0);
17573         check("-1",                                     -1LL, 0);
17574         check("-9223372036854775808", -9223372036854775808LL, 0);
17575         check("-9223372036854775808", -9223372036854775808LL, 0);
17576         check(" 9223372036854775807",  9223372036854775807LL, 0);
17577         check("-9223372036854775808", -9223372036854775808LL, 0);
17578         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17579         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17580         if (!bad)
17581                 printf("ok\n");
17582 }
17583 EOCP
17584         set try
17585         if eval $compile; then
17586                 yyy=`$run ./try`
17587                 case "$yyy" in
17588                 ok) echo "Your strtoll() seems to be working okay." ;;
17589                 *) cat <<EOM >&4
17590 Your strtoll() doesn't seem to be working okay.
17591 EOM
17592                    d_strtoll="$undef"
17593                    ;;
17594                 esac
17595         else
17596                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17597                 d_strtoll="$undef"
17598         fi
17599         ;;
17600 esac
17601
17602 : see if strtoq exists
17603 set strtoq d_strtoq
17604 eval $inlibc
17605
17606 : see if strtoul exists
17607 set strtoul d_strtoul
17608 eval $inlibc
17609
17610 case "$d_strtoul" in
17611 "$define")
17612         $cat <<EOM
17613 Checking whether your strtoul() works okay...
17614 EOM
17615         $cat >try.c <<'EOCP'
17616 #include <errno.h>
17617 #include <stdio.h>
17618 extern unsigned long int strtoul(char *s, char **, int); 
17619 static int bad = 0;
17620 void check(char *s, unsigned long eul, int een) {
17621         unsigned long gul;
17622         errno = 0;
17623         gul = strtoul(s, 0, 10);
17624         if (!((gul == eul) && (errno == een)))
17625                 bad++;
17626 }
17627 int main() {
17628         check(" 1", 1L, 0);
17629         check(" 0", 0L, 0);
17630 EOCP
17631         case "$longsize" in
17632         8)
17633             $cat >>try.c <<'EOCP'
17634         check("18446744073709551615", 18446744073709551615UL, 0);
17635         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17636 #if 0 /* strtoul() for /^-/ strings is undefined. */
17637         check("-1", 18446744073709551615UL, 0);
17638         check("-18446744073709551614", 2, 0);
17639         check("-18446744073709551615", 1, 0);
17640         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17641         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17642 #endif
17643 EOCP
17644                 ;;
17645         4)
17646                     $cat >>try.c <<'EOCP'
17647         check("4294967295", 4294967295UL, 0);
17648         check("4294967296", 4294967295UL, ERANGE);
17649 #if 0 /* strtoul() for /^-/ strings is undefined. */
17650         check("-1", 4294967295UL, 0);
17651         check("-4294967294", 2, 0);
17652         check("-4294967295", 1, 0);
17653         check("-4294967296", 4294967295UL, ERANGE);
17654         check("-4294967297", 4294967295UL, ERANGE);
17655 #endif
17656 EOCP
17657                 ;;
17658         *)
17659 : Should we write these tests to be more portable by sprintf-ing
17660 : ~0 and then manipulating that char string as input for strtol?
17661                 ;;
17662         esac
17663         $cat >>try.c <<'EOCP'
17664         if (!bad)
17665                 printf("ok\n");
17666         return 0;
17667 }
17668 EOCP
17669         set try
17670         if eval $compile; then
17671                 case "`$run ./try`" in
17672                 ok) echo "Your strtoul() seems to be working okay." ;;
17673                 *) cat <<EOM >&4
17674 Your strtoul() doesn't seem to be working okay.
17675 EOM
17676                    d_strtoul="$undef"
17677                    ;;
17678                 esac
17679         else
17680                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17681                 d_strtoul="$undef"
17682         fi
17683         ;;
17684 esac
17685
17686 : see if strtoull exists
17687 set strtoull d_strtoull
17688 eval $inlibc
17689
17690 case "$d_longlong-$d_strtoull" in
17691 "$define-$define")
17692         $cat <<EOM
17693 Checking whether your strtoull() works okay...
17694 EOM
17695         $cat >try.c <<'EOCP'
17696 #include <errno.h>
17697 #ifdef __hpux
17698 #define strtoull __strtoull
17699 #endif
17700 #include <stdio.h>
17701 extern unsigned long long int strtoull(char *s, char **, int); 
17702 static int bad = 0;
17703 int check(char *s, long long eull, int een) {
17704         long long gull;
17705         errno = 0;
17706         gull = strtoull(s, 0, 10);
17707         if (!((gull == eull) && (errno == een)))
17708                 bad++;
17709 }
17710 int main() {
17711         check(" 1",                                        1LL, 0);
17712         check(" 0",                                        0LL, 0);
17713         check("18446744073709551615",  18446744073709551615ULL, 0);
17714         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17715 #if 0 /* strtoull() for /^-/ strings is undefined. */
17716         check("-1",                    18446744073709551615ULL, 0);
17717         check("-18446744073709551614",                     2LL, 0);
17718         check("-18446744073709551615",                     1LL, 0);
17719         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17720         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17721 #endif
17722         if (!bad)
17723                 printf("ok\n");
17724 }
17725 EOCP
17726         set try
17727         if eval $compile; then
17728                 case "`$run ./try`" in
17729                 ok) echo "Your strtoull() seems to be working okay." ;;
17730                 *) cat <<EOM >&4
17731 Your strtoull() doesn't seem to be working okay.
17732 EOM
17733                    d_strtoull="$undef"
17734                    ;;
17735                 esac
17736         else
17737                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17738                 d_strtoull="$undef"
17739         fi
17740         ;;
17741 esac
17742
17743 : see if strtouq exists
17744 set strtouq d_strtouq
17745 eval $inlibc
17746
17747 case "$d_strtouq" in
17748 "$define")
17749         $cat <<EOM
17750 Checking whether your strtouq() works okay...
17751 EOM
17752         $cat >try.c <<'EOCP'
17753 #include <errno.h>
17754 #include <stdio.h>
17755 extern unsigned long long int strtouq(char *s, char **, int); 
17756 static int bad = 0;
17757 void check(char *s, unsigned long long eull, int een) {
17758         unsigned long long gull;
17759         errno = 0;
17760         gull = strtouq(s, 0, 10);
17761         if (!((gull == eull) && (errno == een)))
17762                 bad++;
17763 }
17764 int main() {
17765         check(" 1",                                        1LL, 0);
17766         check(" 0",                                        0LL, 0);
17767         check("18446744073709551615",  18446744073709551615ULL, 0);
17768         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17769 #if 0 /* strtouq() for /^-/ strings is undefined. */
17770         check("-1",                    18446744073709551615ULL, 0);
17771         check("-18446744073709551614",                     2LL, 0);
17772         check("-18446744073709551615",                     1LL, 0);
17773         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17774         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17775 #endif
17776         if (!bad)
17777                 printf("ok\n");
17778         return 0;
17779 }
17780 EOCP
17781         set try
17782         if eval $compile; then
17783                 case "`$run ./try`" in
17784                 ok) echo "Your strtouq() seems to be working okay." ;;
17785                 *) cat <<EOM >&4
17786 Your strtouq() doesn't seem to be working okay.
17787 EOM
17788                    d_strtouq="$undef"
17789                    ;;
17790                 esac
17791         else
17792                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17793                 d_strtouq="$undef"
17794         fi
17795         ;;
17796 esac
17797
17798 : see if strxfrm exists
17799 set strxfrm d_strxfrm
17800 eval $inlibc
17801
17802 : see if symlink exists
17803 set symlink d_symlink
17804 eval $inlibc
17805
17806 : see if syscall exists
17807 set syscall d_syscall
17808 eval $inlibc
17809
17810 : see if prototype for syscall is available
17811 echo " "
17812 set d_syscallproto syscall $i_unistd unistd.h
17813 eval $hasproto
17814
17815 : see if sysconf exists
17816 set sysconf d_sysconf
17817 eval $inlibc
17818
17819 : see if system exists
17820 set system d_system
17821 eval $inlibc
17822
17823 : see if tcgetpgrp exists
17824 set tcgetpgrp d_tcgetpgrp
17825 eval $inlibc
17826
17827 : see if tcsetpgrp exists
17828 set tcsetpgrp d_tcsetpgrp
17829 eval $inlibc
17830
17831 : see if prototype for telldir is available
17832 echo " "
17833 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17834 eval $hasproto
17835
17836 : see if time exists
17837 echo " "
17838 if test "X$d_time" = X -o X"$timetype" = X; then
17839     if set time val -f d_time; eval $csym; $val; then
17840                 echo 'time() found.' >&4
17841                 val="$define"
17842                 rp="What is the type returned by time() on this system?"
17843                 set time_t timetype long stdio.h sys/types.h
17844                 eval $typedef_ask
17845     else
17846                 echo 'time() not found, hope that will do.' >&4
17847                 val="$undef"
17848                 timetype='int';
17849     fi
17850     set d_time
17851     eval $setvar
17852 fi
17853
17854 : see if this is a sys/times.h system
17855 set sys/times.h i_systimes
17856 eval $inhdr
17857
17858 : see if times exists
17859 echo " "
17860 if set times val -f d_times; eval $csym; $val; then
17861         echo 'times() found.' >&4
17862         d_times="$define"
17863         inc=''
17864         case "$i_systimes" in
17865         "$define") inc='sys/times.h';;
17866         esac
17867         rp="What is the type returned by times() on this system?"
17868         set clock_t clocktype long stdio.h sys/types.h $inc
17869         eval $typedef_ask
17870 else
17871         echo 'times() NOT found, hope that will do.' >&4
17872         d_times="$undef"
17873         clocktype='int'
17874 fi
17875
17876 : see if tmpnam_r exists
17877 set tmpnam_r d_tmpnam_r
17878 eval $inlibc
17879 case "$d_tmpnam_r" in
17880 "$define")
17881         hdrs="$i_systypes sys/types.h define stdio.h "
17882         case "$d_tmpnam_r_proto:$usethreads" in
17883         ":define")      d_tmpnam_r_proto=define
17884                 set d_tmpnam_r_proto tmpnam_r $hdrs
17885                 eval $hasproto ;;
17886         *)      ;;
17887         esac
17888         case "$d_tmpnam_r_proto" in
17889         define)
17890         case "$tmpnam_r_proto" in
17891         ''|0) try='char* tmpnam_r(char*);'
17892         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17893         esac
17894         case "$tmpnam_r_proto" in
17895         ''|0)   d_tmpnam_r=undef
17896                 tmpnam_r_proto=0
17897                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17898         * )     case "$tmpnam_r_proto" in
17899                 REENTRANT_PROTO*) ;;
17900                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17901                 esac
17902                 echo "Prototype: $try" ;;
17903         esac
17904         ;;
17905         *)      case "$usethreads" in
17906                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17907                 esac
17908                 d_tmpnam_r=undef
17909                 tmpnam_r_proto=0
17910                 ;;
17911         esac
17912         ;;
17913 *)      tmpnam_r_proto=0
17914         ;;
17915 esac
17916
17917 : see if truncate exists
17918 set truncate d_truncate
17919 eval $inlibc
17920
17921 : see if ttyname_r exists
17922 set ttyname_r d_ttyname_r
17923 eval $inlibc
17924 case "$d_ttyname_r" in
17925 "$define")
17926         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17927         case "$d_ttyname_r_proto:$usethreads" in
17928         ":define")      d_ttyname_r_proto=define
17929                 set d_ttyname_r_proto ttyname_r $hdrs
17930                 eval $hasproto ;;
17931         *)      ;;
17932         esac
17933         case "$d_ttyname_r_proto" in
17934         define)
17935         case "$ttyname_r_proto" in
17936         ''|0) try='int ttyname_r(int, char*, size_t);'
17937         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17938         esac
17939         case "$ttyname_r_proto" in
17940         ''|0) try='int ttyname_r(int, char*, int);'
17941         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17942         esac
17943         case "$ttyname_r_proto" in
17944         ''|0) try='char* ttyname_r(int, char*, int);'
17945         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17946         esac
17947         case "$ttyname_r_proto" in
17948         ''|0)   d_ttyname_r=undef
17949                 ttyname_r_proto=0
17950                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17951         * )     case "$ttyname_r_proto" in
17952                 REENTRANT_PROTO*) ;;
17953                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17954                 esac
17955                 echo "Prototype: $try" ;;
17956         esac
17957         ;;
17958         *)      case "$usethreads" in
17959                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17960                 esac
17961                 d_ttyname_r=undef
17962                 ttyname_r_proto=0
17963                 ;;
17964         esac
17965         ;;
17966 *)      ttyname_r_proto=0
17967         ;;
17968 esac
17969
17970 : see if tzname[] exists
17971 echo " "
17972 if set tzname val -a d_tzname; eval $csym; $val; then
17973         val="$define"
17974         echo 'tzname[] found.' >&4
17975 else
17976         val="$undef"
17977         echo 'tzname[] NOT found.' >&4
17978 fi
17979 set d_tzname
17980 eval $setvar
17981
17982 case "$osname" in
17983 next|rhapsody|darwin) multiarch="$define" ;;
17984 esac
17985 case "$multiarch" in
17986 ''|[nN]*) multiarch="$undef" ;;
17987 esac
17988
17989 : check for ordering of bytes in a UV
17990 echo " "
17991 case "$usecrosscompile$multiarch" in
17992 *$define*)
17993         $cat <<EOM
17994 You seem to be either cross-compiling or doing a multiarchitecture build,
17995 skipping the byteorder check.
17996
17997 EOM
17998         byteorder='ffff'
17999         ;;
18000 *)
18001         case "$byteorder" in
18002         '')
18003                 $cat <<'EOM'
18004 In the following, larger digits indicate more significance.  A big-endian
18005 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18006 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18007 machines may have weird orders like 3412.  A Cray will report 87654321,
18008 an Alpha will report 12345678. If the test program works the default is
18009 probably right.
18010 I'm now running the test program...
18011 EOM
18012                 $cat >try.c <<EOCP
18013 #include <stdio.h>
18014 #$i_stdlib I_STDLIB
18015 #ifdef I_STDLIB
18016 #include <stdlib.h>
18017 #endif
18018 #include <sys/types.h>
18019 typedef $uvtype UV;
18020 int main()
18021 {
18022         int i;
18023         union {
18024                 UV l;
18025                 char c[$uvsize];
18026         } u;
18027
18028         if ($uvsize > 4)
18029                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18030         else
18031                 u.l = (UV)0x04030201;
18032         for (i = 0; i < $uvsize; i++)
18033                 printf("%c", u.c[i]+'0');
18034         printf("\n");
18035         exit(0);
18036 }
18037 EOCP
18038                 xxx_prompt=y
18039                 set try
18040                 if eval $compile && $run ./try > /dev/null; then
18041                         dflt=`$run ./try`
18042                         case "$dflt" in
18043                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18044                                 echo "(The test program ran ok.)"
18045                                 echo "byteorder=$dflt"
18046                                 xxx_prompt=n
18047                         ;;
18048                         ????|????????) echo "(The test program ran ok.)" ;;
18049                         *) echo "(The test program didn't run right for some reason.)" ;;
18050                         esac
18051                 else
18052                         dflt='4321'
18053                         cat <<'EOM'
18054 (I can't seem to compile the test program.  Guessing big-endian...)
18055 EOM
18056                 fi
18057                 case "$xxx_prompt" in
18058                 y)
18059                         rp="What is the order of bytes in $uvtype?"
18060                         . ./myread
18061                         byteorder="$ans"
18062                         ;;
18063                 *)      byteorder=$dflt
18064                         ;;
18065                 esac
18066                 ;;
18067         esac
18068         $rm_try
18069         ;;
18070 esac
18071
18072 $cat <<EOM
18073
18074 Checking to see whether you can access character data unalignedly...
18075 EOM
18076 case "$d_u32align" in
18077 '')   $cat >try.c <<EOCP
18078 #include <stdio.h>
18079 #$i_stdlib I_STDLIB
18080 #ifdef I_STDLIB
18081 #include <stdlib.h>
18082 #endif
18083 #define U32 $u32type
18084 #define BYTEORDER 0x$byteorder
18085 #define U8 $u8type
18086 #include <signal.h>
18087 #ifdef SIGBUS
18088 $signal_t bletch(int s) { exit(4); }
18089 #endif
18090 int main() {
18091 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18092     U8 buf[8];
18093     U32 *up;
18094     int i;
18095
18096     if (sizeof(U32) != 4) {
18097         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18098         exit(1);
18099     }
18100
18101     fflush(stdout);
18102
18103 #ifdef SIGBUS
18104     signal(SIGBUS, bletch);
18105 #endif
18106
18107     buf[0] = 0;
18108     buf[1] = 0;
18109     buf[2] = 0;
18110     buf[3] = 1;
18111     buf[4] = 0;
18112     buf[5] = 0;
18113     buf[6] = 0;
18114     buf[7] = 1;
18115
18116     for (i = 0; i < 4; i++) {
18117         up = (U32*)(buf + i);
18118         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18119                (*up == 1 << (8*(3-i)))  /* little-endian */
18120               )
18121            )
18122         {
18123             printf("read failed (%x)\n", *up);
18124             exit(2);
18125         }
18126     }
18127
18128     /* write test */
18129     for (i = 0; i < 4; i++) {
18130         up = (U32*)(buf + i);
18131         *up = 0xBeef;
18132         if (*up != 0xBeef) {
18133             printf("write failed (%x)\n", *up);
18134             exit(3);
18135         }
18136     }
18137
18138     exit(0);
18139 #else
18140     printf("1\n");
18141     exit(1);
18142 #endif
18143     return 0;
18144 }
18145 EOCP
18146 set try
18147 if eval $compile_ok; then
18148         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18149         $run ./try 2>&1 >/dev/null
18150         case "$?" in
18151         0)      cat >&4 <<EOM
18152 You can access character data pretty unalignedly.
18153 EOM
18154                 d_u32align="$undef"
18155                 ;;
18156         *)      cat >&4 <<EOM
18157 It seems that you must access character data in an aligned manner.
18158 EOM
18159                 d_u32align="$define"
18160                 ;;
18161         esac
18162 else
18163         rp='Can you access character data at unaligned addresses?'
18164         dflt='n'
18165         . ./myread
18166         case "$ans" in
18167         [yY]*)  d_u32align="$undef"  ;;
18168         *)      d_u32align="$define" ;;
18169         esac
18170 fi
18171 $rm_try
18172 ;;
18173 esac
18174
18175 : see if ualarm exists
18176 set ualarm d_ualarm
18177 eval $inlibc
18178
18179 : see if umask exists
18180 set umask d_umask
18181 eval $inlibc
18182
18183 : see if unordered exists
18184 set unordered d_unordered
18185 eval $inlibc
18186
18187 : see if unsetenv exists
18188 set unsetenv d_unsetenv
18189 eval $inlibc
18190
18191 : see if usleep exists
18192 set usleep d_usleep
18193 eval $inlibc
18194
18195 : see if prototype for usleep is available
18196 echo " "
18197 set d_usleepproto usleep $i_unistd unistd.h
18198 eval $hasproto
18199
18200 : see if ustat exists
18201 set ustat d_ustat
18202 eval $inlibc
18203
18204 : see if closedir exists
18205 set closedir d_closedir
18206 eval $inlibc
18207
18208 case "$d_closedir" in
18209 "$define")
18210         echo " "
18211         echo "Checking whether closedir() returns a status..." >&4
18212         cat > try.c <<EOM
18213 #$i_dirent I_DIRENT             /**/
18214 #$i_sysdir I_SYS_DIR            /**/
18215 #$i_sysndir I_SYS_NDIR          /**/
18216 #$i_systypes I_SYS_TYPES        /**/
18217
18218 #if defined(I_SYS_TYPES)
18219 #include <sys/types.h>
18220 #endif
18221 #if defined(I_DIRENT)
18222 #include <dirent.h>
18223 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18224 #include <sys/dir.h>
18225 #endif
18226 #else
18227 #ifdef I_SYS_NDIR
18228 #include <sys/ndir.h>
18229 #else
18230 #ifdef I_SYS_DIR
18231 #ifdef hp9000s500
18232 #include <ndir.h>       /* may be wrong in the future */
18233 #else
18234 #include <sys/dir.h>
18235 #endif
18236 #endif
18237 #endif
18238 #endif
18239 int main() { return closedir(opendir(".")); }
18240 EOM
18241         set try
18242         if eval $compile_ok; then
18243                 if $run ./try > /dev/null 2>&1 ; then
18244                         echo "Yes, it does."
18245                         val="$undef"
18246                 else
18247                         echo "No, it doesn't."
18248                         val="$define"
18249                 fi
18250         else
18251                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18252                 val="$define"
18253         fi
18254         ;;
18255 *)
18256         val="$undef";
18257         ;;
18258 esac
18259 set d_void_closedir
18260 eval $setvar
18261 $rm_try
18262
18263 : see if there is a wait4
18264 set wait4 d_wait4
18265 eval $inlibc
18266
18267 : see if waitpid exists
18268 set waitpid d_waitpid
18269 eval $inlibc
18270
18271 : see if wcstombs exists
18272 set wcstombs d_wcstombs
18273 eval $inlibc
18274
18275 : see if wctomb exists
18276 set wctomb d_wctomb
18277 eval $inlibc
18278
18279 : see if writev exists
18280 set writev d_writev
18281 eval $inlibc
18282
18283 : preserve RCS keywords in files with variable substitution, grrr
18284 Date='$Date'
18285 Id='$Id'
18286 Log='$Log'
18287 RCSfile='$RCSfile'
18288 Revision='$Revision'
18289
18290 : check for alignment requirements
18291 echo " "
18292 case "$usecrosscompile$multiarch" in
18293 *$define*)
18294         $cat <<EOM
18295 You seem to be either cross-compiling or doing a multiarchitecture build,
18296 skipping the memory alignment check.
18297
18298 EOM
18299         case "$alignbytes" in
18300         '') alignbytes=8 ;;
18301         esac
18302         ;;
18303 *)
18304         case "$alignbytes" in
18305         '') echo "Checking alignment constraints..." >&4
18306                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18307                         $cat >try.c <<'EOCP'
18308 typedef long double NV;
18309 EOCP
18310                 else
18311                         $cat >try.c <<'EOCP'
18312 typedef double NV;
18313 EOCP
18314                 fi
18315                 $cat >>try.c <<'EOCP'
18316 #include <stdio.h>
18317 struct foobar {
18318         char foo;
18319         NV bar;
18320 } try_algn;
18321 int main()
18322 {
18323     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18324     return(0);
18325 }
18326 EOCP
18327                 set try
18328                 if eval $compile_ok; then
18329                         dflt=`$run ./try`
18330                 else
18331                         dflt='8'
18332                         echo "(I can't seem to compile the test program...)"
18333                 fi
18334                 ;;
18335         *) dflt="$alignbytes"
18336                 ;;
18337         esac
18338         rp="Doubles must be aligned on a how-many-byte boundary?"
18339         . ./myread
18340         alignbytes="$ans"
18341         $rm_try
18342         ;;
18343 esac
18344
18345
18346 : set the base revision
18347 baserev=5.0
18348
18349 : how do we concatenate cpp tokens here?
18350 echo " "
18351 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18352 $cat >cpp_stuff.c <<'EOCP'
18353 #define RCAT(a,b)a/**/b
18354 #define ACAT(a,b)a ## b
18355 RCAT(Rei,ser)
18356 ACAT(Cir,cus)
18357 EOCP
18358 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18359 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18360         echo "Oh!  Smells like ANSI's been here." >&4
18361         echo "We can catify or stringify, separately or together!"
18362         cpp_stuff=42
18363 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18364         echo "Ah, yes!  The good old days!" >&4
18365         echo "However, in the good old days we don't know how to stringify and"
18366         echo "catify at the same time."
18367         cpp_stuff=1
18368 else
18369         $cat >&4 <<EOM
18370 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18371 You're going to have to edit the values of CAT[2-5] in config.h...
18372 EOM
18373         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18374 fi
18375 $rm -f cpp_stuff.*
18376
18377 : see if this is a db.h system
18378 set db.h i_db
18379 eval $inhdr
18380
18381 case "$i_db" in
18382 $define)
18383         : Check db version.
18384         echo " "
18385         echo "Checking Berkeley DB version ..." >&4
18386         $cat >try.c <<EOCP
18387 #$d_const HASCONST
18388 #ifndef HASCONST
18389 #define const
18390 #endif
18391 #include <sys/types.h>
18392 #include <stdio.h>
18393 #$i_stdlib I_STDLIB
18394 #ifdef I_STDLIB
18395 #include <stdlib.h>
18396 #endif
18397 #include <db.h>
18398 int main(int argc, char *argv[])
18399 {
18400 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18401     int Major, Minor, Patch ;
18402     unsigned long Version ;
18403     (void)db_version(&Major, &Minor, &Patch) ;
18404     if (argc == 2) {
18405         printf("%d %d %d %d %d %d\n",
18406                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18407                Major, Minor, Patch);
18408         exit(0);
18409     }
18410     printf("You have Berkeley DB Version 2 or greater.\n");
18411
18412     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18413                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18414     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18415                 Major, Minor, Patch) ;
18416
18417     /* check that db.h & libdb are compatible */
18418     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18419         printf("db.h and libdb are incompatible.\n") ;
18420         exit(3);
18421     }
18422
18423     printf("db.h and libdb are compatible.\n") ;
18424
18425     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18426                 + DB_VERSION_PATCH ;
18427
18428     /* needs to be >= 2.3.4 */
18429     if (Version < 2003004) {
18430     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18431         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18432         exit(2);
18433     }
18434
18435     exit(0);
18436 #else
18437 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18438     if (argc == 2) {
18439         printf("1 0 0\n");
18440         exit(0);
18441     }
18442     printf("You have Berkeley DB Version 1.\n");
18443     exit(0);    /* DB version < 2: the coast is clear. */
18444 #else
18445     exit(1);    /* <db.h> not Berkeley DB? */
18446 #endif
18447 #endif
18448 }
18449 EOCP
18450         set try
18451         if eval $compile_ok && $run ./try; then
18452                 echo 'Looks OK.' >&4
18453                 set `$run ./try 1`
18454                 db_version_major=$1
18455                 db_version_minor=$2
18456                 db_version_patch=$3
18457         else
18458                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18459                 i_db=$undef
18460                 case " $libs " in
18461                 *"-ldb "*)
18462                         : Remove db from list of libraries to use
18463                         echo "Removing unusable -ldb from library list" >&4
18464                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18465                         shift
18466                         libs="$*"
18467                         echo "libs = $libs" >&4
18468                         ;;
18469                 esac
18470         fi
18471         $rm_try
18472         ;;
18473 esac
18474
18475 case "$i_db" in
18476 define)
18477         : Check the return type needed for hash
18478         echo " "
18479         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18480         $cat >try.c <<EOCP
18481 #$d_const HASCONST
18482 #ifndef HASCONST
18483 #define const
18484 #endif
18485 #include <sys/types.h>
18486 #include <db.h>
18487
18488 #ifndef DB_VERSION_MAJOR
18489 u_int32_t hash_cb (ptr, size)
18490 const void *ptr;
18491 size_t size;
18492 {
18493 }
18494 HASHINFO info;
18495 int main()
18496 {
18497         info.hash = hash_cb;
18498 }
18499 #endif
18500 EOCP
18501         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18502                 if $contains warning try.out >>/dev/null 2>&1 ; then
18503                         db_hashtype='int'
18504                 else
18505                         db_hashtype='u_int32_t'
18506                 fi
18507         else
18508                 : XXX Maybe we should just give up here.
18509                 db_hashtype=u_int32_t
18510                 $cat try.out >&4
18511                 echo "Help:  I can't seem to compile the db test program." >&4
18512                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18513         fi
18514         $rm_try
18515         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18516         ;;
18517 *)      db_hashtype=u_int32_t
18518         ;;
18519 esac
18520 case "$i_db" in
18521 define)
18522         : Check the return type needed for prefix
18523         echo " "
18524         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18525         cat >try.c <<EOCP
18526 #$d_const HASCONST
18527 #ifndef HASCONST
18528 #define const
18529 #endif
18530 #include <sys/types.h>
18531 #include <db.h>
18532
18533 #ifndef DB_VERSION_MAJOR
18534 size_t prefix_cb (key1, key2)
18535 const DBT *key1;
18536 const DBT *key2;
18537 {
18538 }
18539 BTREEINFO info;
18540 int main()
18541 {
18542         info.prefix = prefix_cb;
18543 }
18544 #endif
18545 EOCP
18546         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18547                 if $contains warning try.out >>/dev/null 2>&1 ; then
18548                         db_prefixtype='int'
18549                 else
18550                         db_prefixtype='size_t'
18551                 fi
18552         else
18553                 db_prefixtype='size_t'
18554                 : XXX Maybe we should just give up here.
18555                 $cat try.out >&4
18556                 echo "Help:  I can't seem to compile the db test program." >&4
18557                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18558         fi
18559         $rm_try
18560         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18561         ;;
18562 *)      db_prefixtype='size_t'
18563         ;;
18564 esac
18565
18566 : How can we generate normalized random numbers ?
18567 echo " "
18568 echo "Looking for a random number function..." >&4
18569 case "$randfunc" in
18570 '')
18571         if set drand48 val -f; eval $csym; $val; then
18572                 dflt="drand48"
18573                 echo "Good, found drand48()." >&4
18574         elif set random val -f; eval $csym; $val; then
18575                 dflt="random"
18576                 echo "OK, found random()." >&4
18577         else
18578                 dflt="rand"
18579                 echo "Yick, looks like I have to use rand()." >&4
18580         fi
18581         echo " "
18582         ;;
18583 *)
18584         dflt="$randfunc"
18585         ;;
18586 esac
18587 cont=true
18588
18589 case "$ccflags" in
18590 *-Dmy_rand=*|*-Dmy_srand=*)
18591         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18592         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18593         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18594         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18595         ;;
18596 esac
18597
18598 while $test "$cont"; do
18599         rp="Use which function to generate random numbers?"
18600         . ./myread
18601         if $test "$ans" = "$dflt"; then
18602                 : null
18603         else
18604                 randbits=''
18605         fi
18606         randfunc="$ans"
18607         if set $ans val -f; eval $csym; $val; then
18608                 cont=''
18609         else
18610                 dflt=y
18611                 rp="I cannot find function $ans. Use that name anyway?"
18612                 . ./myread
18613                 dflt=rand
18614                 case "$ans" in
18615                         [yY]*) cont='';;
18616                 esac
18617         fi
18618         case "$cont" in
18619         '')
18620                 case "$randfunc" in
18621                 drand48)
18622                         drand01="drand48()"
18623                         seedfunc="srand48"
18624                         randbits=48
18625                         randseedtype=long
18626                         ;;
18627                 rand|random)
18628                         case "$randbits" in
18629                         '')
18630 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18631                                 $cat >try.c <<EOCP
18632 #$i_unistd I_UNISTD
18633 #$i_stdlib I_STDLIB
18634 #include <stdio.h>
18635 #ifdef I_UNISTD
18636 #  include <unistd.h>
18637 #endif
18638 #ifdef I_STDLIB
18639 #  include <stdlib.h>
18640 #endif
18641 int main()
18642 {
18643         register int i;
18644         register unsigned long tmp;
18645         register unsigned long max = 0L;
18646
18647         for (i = 1000; i; i--) {
18648                 tmp = (unsigned long) $randfunc();
18649                 if (tmp > max) max = tmp;
18650         }
18651         for (i = 0; max; i++)
18652                 max /= 2;
18653         printf("%d\n",i);
18654 }
18655 EOCP
18656                                 set try
18657                                 if eval $compile_ok; then
18658                                         dflt=`try`
18659                                 else
18660                                         dflt='?'
18661                                         echo "(I can't seem to compile the test program...)"
18662                                 fi
18663                                 ;;
18664                         *)
18665                                 dflt="$randbits"
18666                                 ;;
18667                         esac
18668                         rp="How many bits does your $randfunc() function produce?"
18669                         . ./myread
18670                         randbits="$ans"
18671                         $rm_try
18672                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18673                         seedfunc="s$randfunc"
18674                         randseedtype=unsigned
18675                         ;;
18676                 *)
18677                         dflt="31"
18678                         rp="How many bits does your $randfunc() function produce?"
18679                         . ./myread
18680                         randbits="$ans"
18681                         seedfunc="s$randfunc"
18682                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18683                         if set $seedfunc val -f; eval $csym; $val; then
18684                                 echo "(Using $seedfunc() to seed random generator)"
18685                         else
18686                                 echo "(Warning: no $seedfunc() to seed random generator)"
18687                                 seedfunc=rand
18688                         fi
18689                         randseedtype=unsigned
18690                         ;;
18691                 esac
18692                 ;;
18693         esac
18694 done
18695
18696 echo " "
18697 echo "Determining whether or not we are on an EBCDIC system..." >&4
18698 $cat >try.c <<'EOM'
18699 int main()
18700 {
18701   if ('M'==0xd4) return 0;
18702   return 1;
18703 }
18704 EOM
18705
18706 val=$undef
18707 set try
18708 if eval $compile_ok; then
18709         if $run ./try; then
18710                 echo "You seem to speak EBCDIC." >&4
18711                 val="$define"
18712         else
18713                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18714         fi
18715 else
18716         echo "I'm unable to compile the test program." >&4
18717         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18718 fi
18719 $rm_try
18720 set ebcdic
18721 eval $setvar
18722
18723 echo " "
18724 $cat >&4 <<EOM
18725 Checking how to flush all pending stdio output...
18726 EOM
18727 # I only know how to find the first 32 possibly open files on SunOS.
18728 # See also hints/sunos_4_1.sh and util.c  --AD
18729 case "$osname" in
18730 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18731 esac
18732 $cat >>try.c <<EOCP
18733 #include <stdio.h>
18734 #$i_stdlib I_STDLIB
18735 #ifdef I_STDLIB
18736 #include <stdlib.h>
18737 #endif
18738 #$i_unistd I_UNISTD
18739 #ifdef I_UNISTD
18740 # include <unistd.h>
18741 #endif
18742 #$d_sysconf HAS_SYSCONF
18743 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18744 #ifdef HAS_STDIO_STREAM_ARRAY
18745 # define STDIO_STREAM_ARRAY $stdio_stream_array
18746 #endif
18747 int main() {
18748   FILE* p;
18749   unlink("try.out");
18750   p = fopen("try.out", "w");
18751 #ifdef TRY_FPUTC
18752   fputc('x', p);
18753 #else
18754 # ifdef TRY_FPRINTF
18755   fprintf(p, "x");
18756 # endif
18757 #endif
18758 #ifdef TRY_FFLUSH_NULL
18759   fflush(NULL);
18760 #endif
18761 #ifdef TRY_FFLUSH_ALL
18762   {
18763     long open_max = -1;
18764 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18765     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18766 # else
18767 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18768     open_max = sysconf(_SC_OPEN_MAX);
18769 #  else
18770 #   ifdef FOPEN_MAX
18771     open_max = FOPEN_MAX;
18772 #   else
18773 #    ifdef OPEN_MAX
18774     open_max = OPEN_MAX;
18775 #    else
18776 #     ifdef _NFILE
18777     open_max = _NFILE;
18778 #     endif
18779 #    endif
18780 #   endif
18781 #  endif
18782 # endif
18783 # ifdef HAS_STDIO_STREAM_ARRAY
18784     if (open_max > 0) {
18785       long i;
18786       for (i = 0; i < open_max; i++)
18787             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18788                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18789                 STDIO_STREAM_ARRAY[i]._flag)
18790                 fflush(&STDIO_STREAM_ARRAY[i]);
18791     }
18792   }
18793 # endif
18794 #endif
18795   _exit(42);
18796 }
18797 EOCP
18798 : first we have to find out how _not_ to flush
18799 $to try.c
18800 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18801     output=''
18802     set try -DTRY_FPUTC
18803     if eval $compile; then
18804             $run ./try 2>/dev/null
18805             code="$?"
18806             $from try.out
18807             if $test ! -s try.out -a "X$code" = X42; then
18808                 output=-DTRY_FPUTC
18809             fi
18810     fi
18811     case "$output" in
18812     '')
18813             set try -DTRY_FPRINTF
18814             if eval $compile; then
18815                     $run ./try 2>/dev/null
18816                     code="$?"
18817                     $from try.out
18818                     if $test ! -s try.out -a "X$code" = X42; then
18819                         output=-DTRY_FPRINTF
18820                     fi
18821             fi
18822         ;;
18823     esac
18824 fi
18825 : check for fflush NULL behaviour
18826 case "$fflushNULL" in
18827 '')     set try -DTRY_FFLUSH_NULL $output
18828         if eval $compile; then
18829                 $run ./try 2>/dev/null
18830                 code="$?"
18831                 $from try.out
18832                 if $test -s try.out -a "X$code" = X42; then
18833                         fflushNULL="`$cat try.out`"
18834                 else
18835                         if $test "X$code" != X42; then
18836                                 $cat >&4 <<EOM
18837 (If this test failed, don't worry, we'll try another method shortly.)
18838 EOM
18839                         fi
18840                 fi
18841         fi
18842         $rm_try
18843         case "$fflushNULL" in
18844         x)      $cat >&4 <<EOM
18845 Your fflush(NULL) works okay for output streams.
18846 Let's see if it clobbers input pipes...
18847 EOM
18848 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18849 # bug that improperly flushes the input end of pipes.  So we avoid the
18850 # autoflush on fork/system/exec support for now. :-(
18851 $cat >tryp.c <<EOCP
18852 #include <stdio.h>
18853 int
18854 main(int argc, char **argv)
18855 {
18856     char buf[1024];
18857     int i;
18858     char *bp = buf;
18859     while (1) {
18860         while ((i = getc(stdin)) != -1
18861                && (*bp++ = i) != '\n'
18862                && bp < &buf[1024])
18863         /* DO NOTHING */ ;
18864         *bp = '\0';
18865         fprintf(stdout, "%s", buf);
18866         fflush(NULL);
18867         if (i == -1)
18868             return 0;
18869         bp = buf;
18870     }
18871 }
18872 EOCP
18873                 fflushNULL="$define"
18874                 set tryp
18875                 if eval $compile; then
18876                     $rm -f tryp.out
18877                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18878                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18879                        $cat >&4 <<EOM
18880 fflush(NULL) seems to behave okay with input streams.
18881 EOM
18882                         fflushNULL="$define"
18883                     else
18884                         $cat >&4 <<EOM
18885 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18886 EOM
18887                         fflushNULL="$undef"
18888                     fi
18889                 fi
18890                 $rm -f core tryp.c tryp.core core.tryp.*
18891                 ;;
18892         '')     $cat >&4 <<EOM
18893 Your fflush(NULL) isn't working (contrary to ANSI C).
18894 EOM
18895                 fflushNULL="$undef"
18896                 ;;
18897         *)      $cat >&4 <<EOM
18898 Cannot figure out whether your fflush(NULL) works or not.
18899 I'm assuming it doesn't (contrary to ANSI C).
18900 EOM
18901                 fflushNULL="$undef"
18902                 ;;
18903         esac
18904         ;;
18905 $define|true|[yY]*)
18906         fflushNULL="$define"
18907         ;;
18908 *)
18909         fflushNULL="$undef"
18910         ;;
18911 esac
18912 : check explicit looping only if NULL did not work, and if the pipe
18913 : bug does not show up on an explicit flush too
18914 case "$fflushNULL" in
18915 "$undef")
18916         $cat >tryp.c <<EOCP
18917 #include <stdio.h>
18918 int
18919 main(int argc, char **argv)
18920 {
18921     char buf[1024];
18922     int i;
18923     char *bp = buf;
18924     while (1) {
18925         while ((i = getc(stdin)) != -1
18926                && (*bp++ = i) != '\n'
18927                && bp < &buf[1024])
18928         /* DO NOTHING */ ;
18929         *bp = '\0';
18930         fprintf(stdout, "%s", buf);
18931         fflush(stdin);
18932         if (i == -1)
18933             return 0;
18934         bp = buf;
18935     }
18936 }
18937 EOCP
18938         set tryp
18939         if eval $compile; then
18940             $rm -f tryp.out
18941             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18942             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18943                $cat >&4 <<EOM
18944 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18945 EOM
18946                 : now check for fflushall behaviour
18947                 case "$fflushall" in
18948                 '')     set try -DTRY_FFLUSH_ALL $output
18949                         if eval $compile; then
18950                                 $cat >&4 <<EOM
18951 (Now testing the other method--but note that this also may fail.)
18952 EOM
18953                                 $run ./try 2>/dev/null
18954                                 code=$?
18955                                 $from try.out
18956                                 if $test -s try.out -a "X$code" = X42; then
18957                                         fflushall="`$cat try.out`"
18958                                 fi
18959                         fi
18960                         $rm_try
18961                         case "$fflushall" in
18962                         x)      $cat >&4 <<EOM
18963 Whew. Flushing explicitly all the stdio streams works.
18964 EOM
18965                                 fflushall="$define"
18966                                 ;;
18967                         '')     $cat >&4 <<EOM
18968 Sigh. Flushing explicitly all the stdio streams doesn't work.
18969 EOM
18970                                 fflushall="$undef"
18971                                 ;;
18972                         *)      $cat >&4 <<EOM
18973 Cannot figure out whether flushing stdio streams explicitly works or not.
18974 I'm assuming it doesn't.
18975 EOM
18976                                 fflushall="$undef"
18977                                 ;;
18978                         esac
18979                         ;;
18980                 "$define"|true|[yY]*)
18981                         fflushall="$define"
18982                         ;;
18983                 *)
18984                         fflushall="$undef"
18985                         ;;
18986                 esac
18987             else
18988                 $cat >&4 <<EOM
18989 All is futile.  Even fflush(stdin) clobbers input pipes!
18990 EOM
18991                 fflushall="$undef"
18992             fi
18993         else
18994             fflushall="$undef"
18995         fi
18996         $rm -f core tryp.c tryp.core core.tryp.*
18997         ;;
18998 *)      fflushall="$undef"
18999         ;;
19000 esac
19001
19002 case "$fflushNULL$fflushall" in
19003 undefundef)
19004         $cat <<EOM
19005 OK, I give up.  I cannot figure out how to flush pending stdio output.
19006 We won't be flushing handles at all before fork/exec/popen.
19007 EOM
19008         ;;
19009 esac
19010 $rm_try
19011
19012 : Store the full pathname to the ar program for use in the C program
19013 : Respect a hint or command line value for full_ar.
19014 case "$full_ar" in
19015 '') full_ar=$ar ;;
19016 esac
19017
19018 : Store the full pathname to the sed program for use in the C program
19019 full_sed=$sed
19020
19021 : see what type gids are declared as in the kernel
19022 echo " "
19023 echo "Looking for the type for group ids returned by getgid()."
19024 set gid_t gidtype xxx stdio.h sys/types.h
19025 eval $typedef
19026 case "$gidtype" in
19027 xxx)
19028         xxx=`./findhdr sys/user.h`
19029         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19030         case $1 in
19031         unsigned) dflt="$1 $2" ;;
19032         *) dflt="$1" ;;
19033         esac
19034         ;;
19035 *) dflt="$gidtype";;
19036 esac
19037 case "$gidtype" in
19038 gid_t) echo "gid_t found." ;;
19039 *)      rp="What is the type for group ids returned by getgid()?"
19040         . ./myread
19041         gidtype="$ans"
19042         ;;
19043 esac
19044
19045 echo " "
19046 case "$gidtype" in
19047 *_t) zzz="$gidtype"     ;;
19048 *)   zzz="gid"          ;;
19049 esac
19050 echo "Checking the size of $zzz..." >&4 
19051 cat > try.c <<EOCP
19052 #include <sys/types.h>
19053 #include <stdio.h>
19054 #$i_stdlib I_STDLIB
19055 #ifdef I_STDLIB
19056 #include <stdlib.h>
19057 #endif
19058 int main() {
19059     printf("%d\n", (int)sizeof($gidtype));
19060     exit(0);
19061 }
19062 EOCP
19063 set try
19064 if eval $compile_ok; then
19065         yyy=`$run ./try`
19066         case "$yyy" in
19067         '')     gidsize=4
19068                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19069                 ;;
19070         *)      gidsize=$yyy
19071                 echo "Your $zzz is $gidsize bytes long."
19072                 ;;
19073         esac
19074 else
19075         gidsize=4
19076         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19077 fi
19078
19079
19080 echo " "
19081 case "$gidtype" in
19082 *_t) zzz="$gidtype"     ;;
19083 *)   zzz="gid"          ;;
19084 esac
19085 echo "Checking the sign of $zzz..." >&4 
19086 cat > try.c <<EOCP
19087 #include <sys/types.h>
19088 #include <stdio.h>
19089 int main() {
19090         $gidtype foo = -1;
19091         if (foo < 0)
19092                 printf("-1\n");
19093         else
19094                 printf("1\n");
19095 }
19096 EOCP
19097 set try
19098 if eval $compile; then
19099         yyy=`$run ./try`
19100         case "$yyy" in
19101         '')     gidsign=1
19102                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19103                 ;;
19104         *)      gidsign=$yyy
19105                 case "$gidsign" in
19106                  1) echo "Your $zzz is unsigned." ;;
19107                 -1) echo "Your $zzz is signed."   ;;
19108                 esac
19109                 ;;
19110         esac
19111 else
19112         gidsign=1
19113         echo "(I can't compile the test program--guessing unsigned.)" >&4
19114 fi
19115
19116
19117 echo " "
19118
19119 if $test X"$quadtype" != X; then
19120
19121 echo "Checking how to print 64-bit integers..." >&4
19122
19123 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19124         $cat >try.c <<'EOCP'
19125 #include <sys/types.h>
19126 #include <stdio.h>
19127 int main() {
19128   int q = 12345678901;
19129   printf("%ld\n", q);
19130 }
19131 EOCP
19132         set try
19133         if eval $compile; then
19134                 yyy=`$run ./try`
19135                 case "$yyy" in
19136                 12345678901)
19137                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19138                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19139                         echo "We will use %d."
19140                         ;;
19141                 esac
19142         fi
19143 fi
19144
19145 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19146         $cat >try.c <<'EOCP'
19147 #include <sys/types.h>
19148 #include <stdio.h>
19149 int main() {
19150   long q = 12345678901;
19151   printf("%ld\n", q);
19152 }
19153 EOCP
19154         set try
19155         if eval $compile; then
19156                 yyy=`$run ./try`
19157                 case "$yyy" in
19158                 12345678901)
19159                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19160                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19161                         echo "We will use %ld."
19162                         ;;
19163                 esac
19164         fi
19165 fi
19166
19167 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19168         $cat >try.c <<'EOCP'
19169 #include <sys/types.h>
19170 #include <inttypes.h>
19171 #include <stdio.h>
19172 int main() {
19173   int64_t q = 12345678901;
19174   printf("%" PRId64 "\n", q);
19175 }
19176 EOCP
19177         set try
19178         if eval $compile; then
19179                 yyy=`$run ./try`
19180                 case "$yyy" in
19181                 12345678901)
19182                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19183                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19184                         echo "We will use the C9X style."
19185                         ;;
19186                 esac
19187         fi
19188 fi
19189
19190 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19191         $cat >try.c <<EOCP
19192 #include <sys/types.h>
19193 #include <stdio.h>
19194 int main() {
19195   $quadtype q = 12345678901;
19196   printf("%Ld\n", q);
19197 }
19198 EOCP
19199         set try
19200         if eval $compile; then
19201                 yyy=`$run ./try`
19202                 case "$yyy" in
19203                 12345678901)
19204                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19205                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19206                         echo "We will use %Ld."
19207                         ;;
19208                 esac
19209         fi
19210 fi
19211
19212 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19213         $cat >try.c <<'EOCP'
19214 #include <sys/types.h>
19215 #include <stdio.h>
19216 int main() {
19217   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19218   printf("%lld\n", q);
19219 }
19220 EOCP
19221         set try
19222         if eval $compile; then
19223                 yyy=`$run ./try`
19224                 case "$yyy" in
19225                 12345678901)
19226                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19227                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19228                         echo "We will use the %lld style."
19229                         ;;
19230                 esac
19231         fi
19232 fi
19233
19234 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19235         $cat >try.c <<EOCP
19236 #include <sys/types.h>
19237 #include <stdio.h>
19238 int main() {
19239   $quadtype q = 12345678901;
19240   printf("%qd\n", q);
19241 }
19242 EOCP
19243         set try
19244         if eval $compile; then
19245                 yyy=`$run ./try`
19246                 case "$yyy" in
19247                 12345678901)
19248                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19249                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19250                         echo "We will use %qd."
19251                         ;;
19252                 esac
19253         fi
19254 fi
19255
19256 if $test X"$sPRId64" = X; then
19257         echo "Cannot figure out how to print 64-bit integers." >&4
19258 fi
19259 $rm_try
19260
19261 fi
19262
19263 case "$sPRId64" in
19264 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19265         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19266         ;;
19267 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19268         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19269         ;;
19270 esac
19271
19272
19273 echo " "
19274 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19275
19276 if $test X"$ivsize" = X8; then
19277         ivdformat="$sPRId64"
19278         uvuformat="$sPRIu64"
19279         uvoformat="$sPRIo64"
19280         uvxformat="$sPRIx64"
19281         uvXUformat="$sPRIXU64"
19282 else
19283         if $test X"$ivsize" = X"$longsize"; then
19284                 ivdformat='"ld"'
19285                 uvuformat='"lu"'
19286                 uvoformat='"lo"'
19287                 uvxformat='"lx"'
19288                 uvXUformat='"lX"'
19289         else
19290                 if $test X"$ivsize" = X"$intsize"; then
19291                         ivdformat='"d"'
19292                         uvuformat='"u"'
19293                         uvoformat='"o"'
19294                         uvxformat='"x"'
19295                         uvXUformat='"X"'
19296                 else
19297                         : far out
19298                         if $test X"$ivsize" = X"$shortsize"; then
19299                                 ivdformat='"hd"'
19300                                 uvuformat='"hu"'
19301                                 uvoformat='"ho"'
19302                                 uvxformat='"hx"'
19303                                 uvXUformat='"hX"'
19304                         fi
19305                 fi
19306         fi
19307 fi
19308
19309 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19310         nveformat="$sPRIeldbl"
19311         nvfformat="$sPRIfldbl"
19312         nvgformat="$sPRIgldbl"
19313         nvEUformat="$sPRIEUldbl"
19314         nvFUformat="$sPRIFUldbl"
19315         nvGUformat="$sPRIGUldbl"
19316 else
19317         nveformat='"e"'
19318         nvfformat='"f"'
19319         nvgformat='"g"'
19320         nvEUformat='"E"'
19321         nvFUformat='"F"'
19322         nvGUformat='"G"'
19323 fi
19324
19325 case "$ivdformat" in
19326 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19327     exit 1
19328     ;;
19329 esac
19330
19331
19332 echo " "
19333 $echo "Checking the format string to be used for gids..." >&4
19334
19335 case "$gidsign" in
19336 -1)     if $test X"$gidsize" = X"$ivsize"; then
19337                 gidformat="$ivdformat"
19338         else
19339                 if $test X"$gidsize" = X"$longsize"; then
19340                         gidformat='"ld"'
19341                 else
19342                         if $test X"$gidsize" = X"$intsize"; then
19343                                 gidformat='"d"'
19344                         else
19345                                 if $test X"$gidsize" = X"$shortsize"; then
19346                                         gidformat='"hd"'
19347                                 fi
19348                         fi
19349                 fi
19350         fi
19351         ;;
19352 *)      if $test X"$gidsize" = X"$uvsize"; then
19353                 gidformat="$uvuformat"
19354         else
19355                 if $test X"$gidsize" = X"$longsize"; then
19356                         gidformat='"lu"'
19357                 else
19358                         if $test X"$gidsize" = X"$intsize"; then
19359                                 gidformat='"u"'
19360                         else
19361                                 if $test X"$gidsize" = X"$shortsize"; then
19362                                         gidformat='"hu"'
19363                                 fi
19364                         fi
19365                 fi
19366         fi
19367         ;;
19368 esac
19369
19370 : see if getgroups exists
19371 set getgroups d_getgrps
19372 eval $inlibc
19373
19374 : see if setgroups exists
19375 set setgroups d_setgrps
19376 eval $inlibc
19377
19378
19379 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19380 echo " "
19381 case "$d_getgrps$d_setgrps" in
19382 *define*)
19383         case "$groupstype" in
19384         '') dflt="$gidtype" ;;
19385         *)  dflt="$groupstype" ;;
19386         esac
19387         $cat <<EOM
19388 What type of pointer is the second argument to getgroups() and setgroups()?
19389 Usually this is the same as group ids, $gidtype, but not always.
19390
19391 EOM
19392         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19393         . ./myread
19394         groupstype="$ans"
19395         ;;
19396 *)  groupstype="$gidtype";;
19397 esac
19398
19399
19400 if $test $patchlevel -lt 9; then
19401 : MAD is not available in 5.8.x or earlier.
19402     ans=n;
19403 else
19404     case "$mad" in
19405     $define|true|[yY]*) dflt='y' ;;
19406     *)                  dflt='n' ;;
19407     esac
19408     cat <<EOM
19409
19410 Would you like to build with Misc Attribute Decoration? This is development
19411 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19412 overhead on the interpreter.
19413
19414 If this doesn't make any sense to you, just accept the default '$dflt'.
19415 EOM
19416     rp='Build Perl with MAD?'
19417     . ./myread
19418 fi
19419 case "$ans" in
19420 y|Y)    val="$define"
19421         madlyh='madly.h madly.act madly.tab'
19422         madlysrc='madly.c'
19423         madlyobj="madly$_o" ;;
19424 *)      val="$undef"
19425         madlyh=''
19426         madlysrc=''
19427         madlyobj='' ;;
19428 esac
19429 set mad
19430 eval $setvar
19431
19432 echo " "
19433 echo "Checking if your $make program sets \$(MAKE)..." >&4
19434 case "$make_set_make" in
19435 '')
19436         $sed 's/^X //' > testmake.mak << 'EOF'
19437 Xall:
19438 X       @echo 'maketemp="$(MAKE)"'
19439 EOF
19440         case "`$make -f testmake.mak 2>/dev/null`" in
19441         *maketemp=*) make_set_make='#' ;;
19442         *)      make_set_make="MAKE=$make" ;;
19443         esac
19444         $rm -f testmake.mak
19445         ;;
19446 esac
19447 case "$make_set_make" in
19448 '#') echo "Yup, it does.";;
19449 *) echo "Nope, it doesn't.";;
19450 esac
19451
19452 : see what type is used for mode_t
19453 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19454 set mode_t modetype int stdio.h sys/types.h
19455 eval $typedef_ask
19456
19457 : see if we need va_copy
19458 echo " "
19459 case "$i_stdarg" in
19460 "$define")
19461         $cat >try.c <<EOCP
19462 #include <stdarg.h>
19463 #include <stdio.h>
19464 #$i_stdlib I_STDLIB
19465 #ifdef I_STDLIB
19466 #include <stdlib.h>
19467 #endif
19468 #include <signal.h>
19469
19470 int
19471 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19472 {
19473   return vfprintf(f, fmt, *valp);
19474 }
19475
19476 int
19477 myvfprintf(FILE *f, const  char *fmt, va_list val)
19478 {
19479   return ivfprintf(f, fmt, &val);
19480 }
19481
19482 int
19483 myprintf(char *fmt, ...)
19484 {
19485   va_list val;
19486   va_start(val, fmt);
19487   return myvfprintf(stdout, fmt, val);
19488 }
19489
19490 int
19491 main(int ac, char **av)
19492 {
19493   signal(SIGSEGV, exit);
19494
19495   myprintf("%s%cs all right, then\n", "that", '\'');
19496   exit(0);
19497 }
19498 EOCP
19499         set try
19500         if eval $compile && $run ./try 2>&1 >/dev/null; then
19501                 case "`$run ./try`" in
19502                 "that's all right, then")
19503                         okay=yes
19504                         ;;
19505                 esac
19506         fi
19507         case "$okay" in
19508         yes)    echo "It seems that you don't need va_copy()." >&4
19509                 need_va_copy="$undef"
19510                 ;;
19511         *)      echo "It seems that va_copy() or similar will be needed." >&4
19512                 need_va_copy="$define"
19513                 ;;
19514         esac
19515         $rm_try
19516         ;;
19517 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19518         ;;
19519 esac
19520
19521 : see what type is used for size_t
19522 rp="What is the type used for the length parameter for string functions?"
19523 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19524 eval $typedef_ask
19525
19526 : check for type of arguments to gethostbyaddr. 
19527 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19528         case "$d_gethbyaddr" in
19529         $define)
19530                 $cat <<EOM
19531
19532 Checking to see what type of arguments are accepted by gethostbyaddr().
19533 EOM
19534                 hdrs="$define sys/types.h
19535                         $d_socket sys/socket.h 
19536                         $i_niin netinet/in.h 
19537                         $i_netdb netdb.h
19538                         $i_unistd unistd.h"
19539                 : The first arg can 'char *' or 'void *'
19540                 : The second arg is some of integral type
19541                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19542                         for yyy in size_t long int; do
19543                                 case "$netdb_host_type" in
19544                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19545                                         if ./protochk "$try" $hdrs; then
19546                                                 echo "Your system accepts $xxx for the first arg."
19547                                                 echo "...and $yyy for the second arg."
19548                                                 netdb_host_type="$xxx"
19549                                                 netdb_hlen_type="$yyy"
19550                                         fi
19551                                         ;;
19552                                 esac
19553                         done
19554                 done
19555                 : In case none of those worked, prompt the user.
19556                 case "$netdb_host_type" in
19557                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19558                         dflt='char *'
19559                         . ./myread
19560                         netdb_host_type=$ans
19561                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19562                         dflt="$sizetype"
19563                         . ./myread
19564                         netdb_hlen_type=$ans
19565                         ;;
19566                 esac
19567                 ;;
19568         *)      : no gethostbyaddr, so pick harmless defaults
19569                 netdb_host_type='char *'
19570                 netdb_hlen_type="$sizetype"
19571                 ;;
19572         esac
19573         # Remove the "const" if needed. -- but then we'll have a 
19574         # prototype clash!
19575         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19576 fi
19577
19578 : check for type of argument to gethostbyname. 
19579 if test "X$netdb_name_type" = X ; then
19580         case "$d_gethbyname" in
19581         $define)
19582                 $cat <<EOM
19583
19584 Checking to see what type of argument is accepted by gethostbyname().
19585 EOM
19586                 hdrs="$define sys/types.h
19587                         $d_socket sys/socket.h 
19588                         $i_niin netinet/in.h 
19589                         $i_netdb netdb.h
19590                         $i_unistd unistd.h"
19591                 for xxx in "const char *" "char *"; do
19592                         case "$netdb_name_type" in
19593                         '')     try="extern struct hostent *gethostbyname($xxx);"
19594                                 if ./protochk "$try" $hdrs; then
19595                                         echo "Your system accepts $xxx."
19596                                         netdb_name_type="$xxx"
19597                                 fi
19598                                 ;;
19599                         esac
19600                 done
19601                 : In case none of those worked, prompt the user.
19602                 case "$netdb_name_type" in
19603                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19604                         dflt='char *'
19605                         . ./myread
19606                         netdb_name_type=$ans
19607                         ;;
19608                 esac
19609                 ;;
19610         *)      : no gethostbyname, so pick harmless default
19611                 netdb_name_type='char *'
19612                 ;;
19613         esac
19614 fi
19615
19616 : check for type of 1st argument to getnetbyaddr. 
19617 if test "X$netdb_net_type" = X ; then
19618         case "$d_getnbyaddr" in
19619         $define)
19620                 $cat <<EOM
19621
19622 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19623 EOM
19624                 hdrs="$define sys/types.h
19625                         $d_socket sys/socket.h 
19626                         $i_niin netinet/in.h 
19627                         $i_netdb netdb.h
19628                         $i_unistd unistd.h"
19629                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19630                         case "$netdb_net_type" in
19631                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19632                                 if ./protochk "$try" $hdrs; then
19633                                         echo "Your system accepts $xxx."
19634                                         netdb_net_type="$xxx"
19635                                 fi
19636                                 ;;
19637                         esac
19638                 done
19639                 : In case none of those worked, prompt the user.
19640                 case "$netdb_net_type" in
19641                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19642                         dflt='long'
19643                         . ./myread
19644                         netdb_net_type=$ans
19645                         ;;
19646                 esac
19647                 ;;
19648         *)      : no getnetbyaddr, so pick harmless default
19649                 netdb_net_type='long'
19650                 ;;
19651         esac
19652 fi
19653 : locate the preferred pager for this system
19654 fn=f/
19655 case "$pager" in
19656 '')
19657         dflt=''
19658         case "$pg" in
19659         /*) dflt=$pg;;
19660         [a-zA-Z]:/*) dflt=$pg;;
19661         esac
19662         case "$more" in
19663         /*) dflt=$more;;
19664         [a-zA-Z]:/*) dflt=$more;;
19665         esac
19666         case "$less" in
19667         /*) dflt=$less;;
19668         [a-zA-Z]:/*) dflt=$less;;
19669         esac
19670         case "$dflt" in
19671         '') dflt=/usr/ucb/more;;
19672         esac
19673         ;;
19674 *)      dflt="$pager"
19675         : Instruct ./getfile to trust the hinted or previous pager value,
19676         : even if it does not begin with a slash.  For example, on os2,
19677         : pager might be cmd /c more.  See comments in UU/getfile.
19678         fn="f/($pager)"
19679         ;;
19680 esac
19681 echo " "
19682 rp='What pager is used on your system?'
19683 . ./getfile
19684 pager="$ans"
19685
19686 : see what type pids are declared as in the kernel
19687 rp="What is the type of process ids on this system?"
19688 set pid_t pidtype int stdio.h sys/types.h
19689 eval $typedef_ask
19690
19691 : see if ar generates random libraries by itself
19692 echo " "
19693 echo "Checking how to generate random libraries on your machine..." >&4
19694 echo 'int bar1() { return bar2(); }' > bar1.c
19695 echo 'int bar2() { return 2; }' > bar2.c
19696 $cat > foo.c <<EOP
19697 #$i_stdlib I_STDLIB
19698 #ifdef I_STDLIB
19699 #include <stdlib.h>
19700 #endif
19701 int main() { printf("%d\n", bar1()); exit(0); }
19702 EOP
19703 $cc $ccflags -c bar1.c >/dev/null 2>&1
19704 $cc $ccflags -c bar2.c >/dev/null 2>&1
19705 $cc $ccflags -c foo.c >/dev/null 2>&1
19706 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19707 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19708         $run ./foobar >/dev/null 2>&1; then
19709         echo "$ar appears to generate random libraries itself."
19710         orderlib=false
19711         if [ "X$ranlib" = "X" ]; then
19712             ranlib=":"
19713         fi
19714 elif $ar s bar$_a >/dev/null 2>&1 &&
19715         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19716         $run ./foobar >/dev/null 2>&1; then
19717                 echo "a table of contents needs to be added with '$ar s'."
19718                 orderlib=false
19719                 ranlib="$ar s"
19720 elif $ar ts bar$_a >/dev/null 2>&1 &&
19721         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19722         $run ./foobar >/dev/null 2>&1; then
19723                 echo "a table of contents needs to be added with '$ar ts'."
19724                 orderlib=false
19725                 ranlib="$ar ts"
19726 else
19727         case "$ranlib" in
19728         :) ranlib='';;
19729         '')
19730                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19731                 $test -f $ranlib || ranlib=''
19732                 ;;
19733         esac
19734         if $test -n "$ranlib"; then
19735                 echo "your system has '$ranlib'; we'll use that."
19736                 orderlib=false
19737         else
19738                 echo "your system doesn't seem to support random libraries"
19739                 echo "so we'll use lorder and tsort to order the libraries."
19740                 orderlib=true
19741                 ranlib=":"
19742         fi
19743 fi
19744 $rm -f foo* bar*
19745
19746 : check for type of arguments to select. 
19747 case "$selecttype" in
19748 '') case "$d_select" in
19749         $define)
19750                 echo " "
19751                 $cat <<EOM
19752 Checking to see what type of arguments are accepted by select().
19753 EOM
19754                 hdrs="$define sys/types.h
19755                         $i_systime sys/time.h 
19756                         $i_sysselct sys/select.h
19757                         $d_socket sys/socket.h"
19758                 : The first arg can be int, unsigned, or size_t
19759                 : The last arg may or may not be 'const'
19760                 val=''
19761                 : void pointer has been seen but using that
19762                 : breaks the selectminbits test
19763                 for xxx in 'fd_set *' 'int *'; do
19764                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19765                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19766                                         case "$val" in
19767                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19768                                                 if ./protochk "$try" $hdrs; then
19769                                                         echo "Your system accepts $xxx."
19770                                                         val="$xxx"
19771                                                 fi
19772                                                 ;;
19773                                         esac
19774                                 done
19775                         done
19776                 done
19777                 case "$val" in
19778                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19779                         case "$d_fd_set" in
19780                                 $define) dflt="fd_set *" ;;
19781                                 *)              dflt="int *" ;;
19782                         esac
19783                         . ./myread
19784                         val=$ans
19785                         ;;
19786                 esac
19787                 selecttype="$val"
19788                 ;;
19789         *)      : no select, so pick a harmless default
19790                 selecttype='int *'
19791                 ;;
19792         esac
19793         ;;
19794 esac
19795
19796 : check for the select 'width'
19797 case "$selectminbits" in
19798 '') safebits=`expr $ptrsize \* 8`
19799     case "$d_select" in
19800         $define)
19801                 $cat <<EOM
19802
19803 Checking to see on how many bits at a time your select() operates...
19804 EOM
19805                 $cat >try.c <<EOCP
19806 #include <sys/types.h>
19807 #$i_time I_TIME
19808 #$i_systime I_SYS_TIME
19809 #$i_systimek I_SYS_TIME_KERNEL
19810 #ifdef I_TIME
19811 #   include <time.h>
19812 #endif
19813 #ifdef I_SYS_TIME
19814 #   ifdef I_SYS_TIME_KERNEL
19815 #       define KERNEL
19816 #   endif
19817 #   include <sys/time.h>
19818 #   ifdef I_SYS_TIME_KERNEL
19819 #       undef KERNEL
19820 #   endif
19821 #endif
19822 #$i_sysselct I_SYS_SELECT
19823 #ifdef I_SYS_SELECT
19824 #include <sys/select.h>
19825 #endif
19826 #$d_socket HAS_SOCKET
19827 #ifdef HAS_SOCKET
19828 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19829 #endif
19830 #include <stdio.h>
19831 #$i_stdlib I_STDLIB
19832 #ifdef I_STDLIB
19833 #include <stdlib.h>
19834 #endif
19835 $selecttype b;
19836 #define S sizeof(*(b))
19837 #define MINBITS 64
19838 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19839 #define NBITS  (NBYTES * 8)
19840 int main() {
19841     char *s = (char *)malloc(NBYTES);
19842     struct timeval t;
19843     int i;
19844     FILE* fp;
19845     int fd;
19846
19847     if (!s)
19848         exit(1);
19849     fclose(stdin);
19850     fp = fopen("try.c", "r");
19851     if (fp == 0)
19852       exit(2);
19853     fd = fileno(fp);
19854     if (fd < 0)
19855       exit(3);
19856     b = ($selecttype)s;
19857     for (i = 0; i < NBITS; i++)
19858         FD_SET(i, b);
19859     t.tv_sec  = 0;
19860     t.tv_usec = 0;
19861     select(fd + 1, b, 0, 0, &t);
19862     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19863     free(s);
19864     printf("%d\n", i + 1);
19865     return 0;
19866 }
19867 EOCP
19868                 set try
19869                 if eval $compile_ok; then
19870                         selectminbits=`$run ./try`
19871                         case "$selectminbits" in
19872                         '')     cat >&4 <<EOM
19873 Cannot figure out on how many bits at a time your select() operates.
19874 I'll play safe and guess it is $safebits bits.
19875 EOM
19876                                 selectminbits=$safebits
19877                                 bits="$safebits bits"
19878                                 ;;
19879                         1)      bits="1 bit" ;;
19880                         *)      bits="$selectminbits bits" ;;
19881                         esac
19882                         echo "Your select() operates on $bits at a time." >&4
19883                 else
19884                         rp='What is the minimum number of bits your select() operates on?'
19885                         case "$byteorder" in
19886                         12345678)       dflt=64 ;;
19887                         1234)           dflt=32 ;;
19888                         *)              dflt=1  ;;
19889                         esac
19890                         . ./myread
19891                         val=$ans
19892                         selectminbits="$val"
19893                 fi
19894                 $rm_try
19895                 ;;
19896         *)      : no select, so pick a harmless default
19897                 selectminbits=$safebits
19898                 ;;
19899         esac
19900         ;;
19901 esac
19902
19903 : Trace out the files included by signal.h, then look for SIGxxx names.
19904 : Remove SIGARRAYSIZE used by HPUX.
19905 : Remove SIGSTKSIZE used by Linux.
19906 : Remove SIGSTKSZ used by Posix.
19907 : Remove SIGTYP void lines used by OS2.
19908 : Some cpps, like os390, dont give the file name anywhere
19909 if [ "X$fieldn" = X ]; then
19910         : Just make some guesses.  We check them later.
19911         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19912 else
19913         xxx=`echo '#include <signal.h>' |
19914         $cppstdin $cppminus $cppflags 2>/dev/null |
19915         $grep '^[       ]*#.*include' | 
19916         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19917 fi
19918 : Check this list of files to be sure we have parsed the cpp output ok.
19919 : This will also avoid potentially non-existent files, such 
19920 : as ../foo/bar.h
19921 xxxfiles=''
19922 for xx in $xxx /dev/null ; do
19923         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19924 done
19925 : If we have found no files, at least try signal.h
19926 case "$xxxfiles" in
19927 '')     xxxfiles=`./findhdr signal.h` ;;
19928 esac
19929 xxx=`awk '
19930 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19931         print substr($2, 4, 20)
19932 }
19933 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19934         print substr($3, 4, 20)
19935 }' $xxxfiles`
19936 : Append some common names just in case the awk scan failed.
19937 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19938 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19939 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19940 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19941 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19942
19943 : generate a few handy files for later
19944 $cat > signal.c <<EOCP
19945 #include <sys/types.h>
19946 #include <signal.h>
19947 #$i_stdlib I_STDLIB
19948 #ifdef I_STDLIB
19949 #include <stdlib.h>
19950 #endif
19951 #include <stdio.h>
19952 int main() {
19953
19954 /* Strange style to avoid deeply-nested #if/#else/#endif */
19955 #ifndef NSIG
19956 #  ifdef _NSIG
19957 #    define NSIG (_NSIG)
19958 #  endif
19959 #endif
19960
19961 #ifndef NSIG
19962 #  ifdef SIGMAX
19963 #    define NSIG (SIGMAX+1)
19964 #  endif
19965 #endif
19966
19967 #ifndef NSIG
19968 #  ifdef SIG_MAX
19969 #    define NSIG (SIG_MAX+1)
19970 #  endif
19971 #endif
19972
19973 #ifndef NSIG
19974 #  ifdef _SIG_MAX
19975 #    define NSIG (_SIG_MAX+1)
19976 #  endif
19977 #endif
19978
19979 #ifndef NSIG
19980 #  ifdef MAXSIG
19981 #    define NSIG (MAXSIG+1)
19982 #  endif
19983 #endif
19984
19985 #ifndef NSIG
19986 #  ifdef MAX_SIG
19987 #    define NSIG (MAX_SIG+1)
19988 #  endif
19989 #endif
19990
19991 #ifndef NSIG
19992 #  ifdef SIGARRAYSIZE
19993 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19994 #  endif
19995 #endif
19996
19997 #ifndef NSIG
19998 #  ifdef _sys_nsig
19999 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20000 #  endif
20001 #endif
20002
20003 /* Default to some arbitrary number that's big enough to get most
20004    of the common signals.
20005 */
20006 #ifndef NSIG
20007 #    define NSIG 50
20008 #endif
20009
20010 printf("NSIG %d\n", NSIG);
20011
20012 #ifndef JUST_NSIG
20013
20014 EOCP
20015
20016 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20017 {
20018         printf "#ifdef SIG"; printf $1; printf "\n"
20019         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20020         printf $1; printf ");\n"
20021         printf "#endif\n"
20022 }
20023 END {
20024         printf "#endif /* JUST_NSIG */\n";
20025         printf "exit(0);\n}\n";
20026 }
20027 ' >>signal.c
20028 $cat >signal.awk <<'EOP'
20029 BEGIN { ndups = 0 }
20030 $1 ~ /^NSIG$/ { nsig = $2 }
20031 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20032     if ($2 > maxsig) { maxsig = $2 }
20033     if (sig_name[$2]) {
20034         dup_name[ndups] = $1
20035         dup_num[ndups] = $2
20036         ndups++ 
20037     }
20038     else {
20039         sig_name[$2] = $1
20040         sig_num[$2] = $2
20041     }
20042 }
20043 END { 
20044     if (nsig == 0) {
20045         nsig = maxsig + 1
20046     }
20047     printf("NSIG %d\n", nsig);
20048     for (n = 1; n < nsig; n++) {
20049         if (sig_name[n]) {
20050             printf("%s %d\n", sig_name[n], sig_num[n])
20051         }
20052         else {
20053             printf("NUM%d %d\n", n, n) 
20054         }
20055     }
20056     for (n = 0; n < ndups; n++) {
20057         printf("%s %d\n", dup_name[n], dup_num[n])
20058     }
20059 }
20060 EOP
20061 $cat >signal_cmd <<EOS
20062 $startsh
20063 if $test -s signal.lst; then
20064     echo "Using your existing signal.lst file"
20065         exit 0
20066 fi
20067 xxx="$xxx"
20068 EOS
20069 $cat >>signal_cmd <<'EOS'
20070
20071 set signal
20072 if eval $compile_ok; then
20073         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
20074 else
20075         echo "(I can't seem be able to compile the whole test program)" >&4
20076         echo "(I'll try it in little pieces.)" >&4
20077         set signal -DJUST_NSIG
20078         if eval $compile_ok; then
20079                 $run ./signal$_exe > signal.nsg
20080                 $cat signal.nsg
20081         else
20082                 echo "I can't seem to figure out how many signals you have." >&4
20083                 echo "Guessing 50." >&4
20084                 echo 'NSIG 50' > signal.nsg
20085         fi
20086         : Now look at all the signal names, one at a time.
20087         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20088                 $cat > signal.c <<EOCP
20089 #include <sys/types.h>
20090 #include <signal.h>
20091 #include <stdio.h>
20092 int main() {
20093 printf("$xx %d\n", SIG${xx});
20094 return 0;
20095 }
20096 EOCP
20097                 set signal
20098                 if eval $compile; then
20099                         echo "SIG${xx} found."
20100                         $run ./signal$_exe  >> signal.ls1
20101                 else
20102                         echo "SIG${xx} NOT found."
20103                 fi
20104         done
20105         if $test -s signal.ls1; then
20106                 $cat signal.nsg signal.ls1 |
20107                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20108         fi
20109
20110 fi
20111 if $test -s signal.lst; then
20112         :
20113 else
20114         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20115         echo 'kill -l' >signal
20116         set X `csh -f <signal`
20117         $rm -f signal
20118         shift
20119         case $# in
20120         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20121         esac
20122         echo $@ | $tr ' ' $trnl | \
20123             $awk '{ printf "%s %d\n", $1, ++s; }
20124                   END { printf "NSIG %d\n", ++s }' >signal.lst
20125 fi
20126 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20127 EOS
20128 chmod a+x signal_cmd
20129 $eunicefix signal_cmd
20130
20131 : generate list of signal names
20132 echo " "
20133 case "$sig_name_init" in
20134 '') doinit=yes ;;
20135 *)  case "$sig_num_init" in
20136     ''|*,*) doinit=yes ;;
20137     esac ;;
20138 esac
20139 case "$doinit" in
20140 yes)
20141         echo "Generating a list of signal names and numbers..." >&4
20142         . ./signal_cmd
20143         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20144         sig_name=`$awk 'BEGIN { printf "ZERO " }
20145                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20146         sig_num=`$awk  'BEGIN { printf "0 " }
20147                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20148         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20149                              !/^NSIG/   { printf "\"%s\", ", $1 }
20150                              END        { printf "0\n" }' signal.lst`
20151         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20152                              !/^NSIG/   { printf "%d, ", $2}
20153                              END        { printf "0\n"}' signal.lst`
20154         ;;
20155 esac
20156 echo "The following $sig_count signals are available:"
20157 echo " "
20158 echo $sig_name | $awk \
20159 'BEGIN { linelen = 0 }
20160 {
20161         for (i = 1; i <= NF; i++) {
20162                 name = "SIG" $i " "
20163                 linelen = linelen + length(name)
20164                 if (linelen > 70) {
20165                         printf "\n"
20166                         linelen = length(name)
20167                 }
20168                 printf "%s", name
20169         }
20170         printf "\n"
20171 }'
20172 sig_size=`echo $sig_name | awk '{print NF}'`
20173 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
20174
20175 echo " "
20176 case "$sizetype" in
20177 *_t) zzz="$sizetype"    ;;
20178 *)   zzz="filesize"     ;;
20179 esac
20180 echo "Checking the size of $zzz..." >&4 
20181 cat > try.c <<EOCP
20182 #include <sys/types.h>
20183 #include <stdio.h>
20184 #$i_stdlib I_STDLIB
20185 #ifdef I_STDLIB
20186 #include <stdlib.h>
20187 #endif
20188 int main() {
20189     printf("%d\n", (int)sizeof($sizetype));
20190     exit(0);
20191 }
20192 EOCP
20193 set try
20194 if eval $compile_ok; then
20195         yyy=`$run ./try`
20196         case "$yyy" in
20197         '')     sizesize=4
20198                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20199                 ;;
20200         *)      sizesize=$yyy
20201                 echo "Your $zzz size is $sizesize bytes."
20202                 ;;
20203         esac
20204 else
20205         sizesize=4
20206         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20207 fi
20208
20209
20210 : check for socklen_t
20211 echo " "
20212 echo "Checking to see if you have socklen_t..." >&4
20213 $cat >try.c <<EOCP
20214 #include <sys/types.h>
20215 #$d_socket HAS_SOCKET
20216 #ifdef HAS_SOCKET
20217 #include <sys/socket.h>
20218 #endif
20219 int main() { socklen_t x = 16; }
20220 EOCP
20221 set try
20222 if eval $compile; then
20223         val="$define"
20224         echo "You have socklen_t."
20225 else
20226         val="$undef"
20227         echo "You do not have socklen_t."
20228         case "$sizetype" in
20229         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20230         esac
20231 fi
20232 $rm_try
20233 set d_socklen_t
20234 eval $setvar
20235
20236 : see if this is a socks.h system
20237 set socks.h i_socks
20238 eval $inhdr
20239
20240 : check for type of the size argument to socket calls
20241 case "$d_socket" in
20242 "$define")
20243         $cat <<EOM
20244
20245 Checking to see what type is the last argument of accept().
20246 EOM
20247         yyy=''
20248         case "$d_socklen_t" in
20249         "$define") yyy="$yyy socklen_t"
20250         esac
20251         yyy="$yyy $sizetype int long unsigned"
20252         for xxx in $yyy; do
20253                 case "$socksizetype" in
20254                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20255                         case "$usesocks" in
20256                         "$define")
20257                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20258                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20259                                         socksizetype="$xxx"
20260                                 fi
20261                                 ;;
20262                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20263                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20264                                         socksizetype="$xxx"
20265                                 fi
20266                                 ;;
20267                         esac
20268                         ;;
20269                 esac
20270         done
20271 : In case none of those worked, prompt the user.
20272         case "$socksizetype" in
20273         '')     rp='What is the type for socket address structure sizes?'
20274                 dflt='int'
20275                 . ./myread
20276                 socksizetype=$ans
20277                 ;;
20278         esac
20279         ;;
20280 *)      : no sockets, so pick relatively harmless default
20281         socksizetype='int'
20282         ;;
20283 esac
20284
20285 : see what type is used for signed size_t
20286 set ssize_t ssizetype int stdio.h sys/types.h
20287 eval $typedef
20288 dflt="$ssizetype"
20289 $cat > try.c <<EOM
20290 #include <stdio.h>
20291 #$i_stdlib I_STDLIB
20292 #ifdef I_STDLIB
20293 #include <stdlib.h>
20294 #endif
20295 #include <sys/types.h>
20296 #define Size_t $sizetype
20297 #define SSize_t $dflt
20298 int main()
20299 {
20300         if (sizeof(Size_t) == sizeof(SSize_t))
20301                 printf("$dflt\n");
20302         else if (sizeof(Size_t) == sizeof(int))
20303                 printf("int\n");
20304         else
20305                 printf("long\n");
20306         exit(0);
20307 }
20308 EOM
20309 echo " "
20310 set try
20311 if eval $compile_ok && $run ./try > /dev/null; then
20312         ssizetype=`$run ./try`
20313         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20314 else
20315         $cat >&4 <<EOM
20316 Help! I can't compile and run the ssize_t test program: please enlighten me!
20317 (This is probably a misconfiguration in your system or libraries, and
20318 you really ought to fix it.  Still, I'll try anyway.)
20319
20320 I need a type that is the same size as $sizetype, but is guaranteed to
20321 be signed.  Common values are ssize_t, int and long.
20322
20323 EOM
20324         rp="What signed type is the same size as $sizetype?"
20325         . ./myread
20326         ssizetype="$ans"
20327 fi
20328 $rm_try
20329
20330 : see what type of char stdio uses.
20331 echo " "
20332 echo '#include <stdio.h>' > stdio.c
20333 $cppstdin $cppminus < stdio.c > stdioh
20334 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20335         echo "Your stdio uses unsigned chars." >&4
20336         stdchar="unsigned char"
20337 else
20338         echo "Your stdio uses signed chars." >&4
20339         stdchar="char"
20340 fi
20341 $rm -f stdio.* stdioh
20342
20343 : see what type uids are declared as in the kernel
20344 echo " "
20345 echo "Looking for the type for user ids returned by getuid()."
20346 set uid_t uidtype xxx stdio.h sys/types.h
20347 eval $typedef
20348 case "$uidtype" in
20349 xxx)
20350         xxx=`./findhdr sys/user.h`
20351         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20352         case $1 in
20353         unsigned) dflt="$1 $2" ;;
20354         *) dflt="$1" ;;
20355         esac
20356         ;;
20357 *) dflt="$uidtype";;
20358 esac
20359 case "$uidtype" in
20360 uid_t)  echo "uid_t found." ;;
20361 *)      rp="What is the type for user ids returned by getuid()?"
20362         . ./myread
20363         uidtype="$ans"
20364         ;;
20365 esac
20366
20367 echo " "
20368 case "$uidtype" in
20369 *_t) zzz="$uidtype"     ;;
20370 *)   zzz="uid"          ;;
20371 esac
20372 echo "Checking the size of $zzz..." >&4 
20373 cat > try.c <<EOCP
20374 #include <sys/types.h>
20375 #include <stdio.h>
20376 #$i_stdlib I_STDLIB
20377 #ifdef I_STDLIB
20378 #include <stdlib.h>
20379 #endif
20380 int main() {
20381     printf("%d\n", (int)sizeof($uidtype));
20382     exit(0);
20383 }
20384 EOCP
20385 set try
20386 if eval $compile_ok; then
20387         yyy=`$run ./try`
20388         case "$yyy" in
20389         '')     uidsize=4
20390                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20391                 ;;
20392         *)      uidsize=$yyy
20393                 echo "Your $zzz is $uidsize bytes long."
20394                 ;;
20395         esac
20396 else
20397         uidsize=4
20398         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20399 fi
20400
20401 echo " "
20402 case "$uidtype" in
20403 *_t) zzz="$uidtype"     ;;
20404 *)   zzz="uid"          ;;
20405 esac
20406 echo "Checking the sign of $zzz..." >&4
20407 cat > try.c <<EOCP
20408 #include <sys/types.h>
20409 #include <stdio.h>
20410 int main() {
20411         $uidtype foo = -1;
20412         if (foo < 0)
20413                 printf("-1\n");
20414         else
20415                 printf("1\n");
20416 }
20417 EOCP
20418 set try
20419 if eval $compile; then
20420         yyy=`$run ./try`
20421         case "$yyy" in
20422         '')     uidsign=1
20423                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20424                 ;;
20425         *)      uidsign=$yyy
20426                 case "$uidsign" in
20427                  1) echo "Your $zzz is unsigned." ;;
20428                 -1) echo "Your $zzz is signed."   ;;
20429                 esac
20430                 ;;
20431         esac
20432 else
20433         uidsign=1
20434         echo "(I can't compile the test program--guessing unsigned.)" >&4
20435 fi
20436
20437
20438
20439 echo " "
20440 $echo "Checking the format string to be used for uids..." >&4
20441
20442 case "$uidsign" in
20443 -1)     if $test X"$uidsize" = X"$ivsize"; then
20444                 uidformat="$ivdformat"
20445         else
20446                 if $test X"$uidsize" = X"$longsize"; then
20447                         uidformat='"ld"'
20448                 else
20449                         if $test X"$uidsize" = X"$intsize"; then
20450                                 uidformat='"d"'
20451                         else
20452                                 if $test X"$uidsize" = X"$shortsize"; then
20453                                         uidformat='"hd"'
20454                                 fi
20455                         fi
20456                 fi
20457         fi
20458         ;;
20459 *)      if $test X"$uidsize" = X"$uvsize"; then
20460                 uidformat="$uvuformat"
20461         else
20462                 if $test X"$uidsize" = X"$longsize"; then
20463                         uidformat='"lu"'
20464                 else
20465                         if $test X"$uidsize" = X"$intsize"; then
20466                                 uidformat='"u"'
20467                         else
20468                                 if $test X"$uidsize" = X"$shortsize"; then
20469                                         uidformat='"hu"'
20470                                 fi
20471                         fi
20472                 fi
20473         fi
20474         ;;
20475 esac
20476
20477
20478 case "$usesitecustomize" in
20479     $define|true|[Yy]*)
20480         usesitecustomize="$define"
20481         ;;
20482     *)
20483         usesitecustomize="$undef"
20484         ;;
20485     esac
20486
20487 : determine compiler compiler
20488 case "$yacc" in
20489 '')
20490         dflt=yacc;;
20491 *)
20492         dflt="$yacc";;
20493 esac
20494 echo " "
20495 comp='yacc'
20496 if $test -f "$byacc$_exe"; then
20497         dflt="$byacc"
20498         comp="byacc or $comp"
20499 fi
20500 if $test -f "$bison$_exe"; then
20501         comp="$comp or bison -y"
20502 fi
20503 rp="Which compiler compiler ($comp) shall I use?"
20504 . ./myread
20505 yacc="$ans"
20506 case "$yacc" in
20507 *bis*)
20508         case "$yacc" in
20509         *-y*) ;;
20510         *)
20511                 yacc="$yacc -y"
20512                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20513                 ;;
20514         esac
20515         ;;
20516 esac
20517
20518 : see if this is a fp.h system
20519 set fp.h i_fp
20520 eval $inhdr
20521
20522 : see if this is a fp_class.h system
20523 set fp_class.h i_fp_class
20524 eval $inhdr
20525
20526 : see if gdbm.h is available
20527 set gdbm.h t_gdbm
20528 eval $inhdr
20529 case "$t_gdbm" in
20530 $define)
20531         : see if gdbm_open exists
20532         set gdbm_open d_gdbm_open
20533         eval $inlibc
20534         case "$d_gdbm_open" in
20535         $undef)
20536                 t_gdbm="$undef"
20537                 echo "We won't be including <gdbm.h>"
20538                 ;;
20539         esac
20540         ;;
20541 esac
20542 val="$t_gdbm"
20543 set i_gdbm
20544 eval $setvar
20545
20546 : see if this is a ieeefp.h system
20547 case "$i_ieeefp" in
20548 '' ) set ieeefp.h i_ieeefp
20549      eval $inhdr
20550      ;;
20551 esac
20552
20553 : see if this is a libutil.h system
20554 set libutil.h i_libutil
20555 eval $inhdr
20556
20557 : see if mach cthreads are available
20558 if test "X$usethreads" = "X$define"; then
20559         set mach/cthreads.h i_machcthr
20560         eval $inhdr
20561 else
20562         i_machcthr="$undef"
20563 fi
20564
20565
20566
20567 : see if this is a mntent.h system
20568 set mntent.h i_mntent
20569 eval $inhdr
20570
20571 : see if ndbm.h is available
20572 set ndbm.h t_ndbm
20573 eval $inhdr
20574
20575 case "$t_ndbm" in
20576 $undef)
20577     # Some Linux distributions such as RedHat 7.1 put the
20578     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20579     if $test -f /usr/include/gdbm/ndbm.h; then
20580         echo '<gdbm/ndbm.h> found.'
20581         ccflags="$ccflags -I/usr/include/gdbm"
20582         cppflags="$cppflags -I/usr/include/gdbm"
20583         t_ndbm=$define
20584     fi
20585     ;;
20586 esac
20587
20588 case "$t_ndbm" in
20589 $define)
20590         : see if dbm_open exists
20591         set dbm_open d_dbm_open
20592         eval $inlibc
20593         case "$d_dbm_open" in
20594         $undef)
20595                 t_ndbm="$undef"
20596                 echo "We won't be including <ndbm.h>"
20597                 ;;
20598         esac
20599         ;;
20600 esac
20601 val="$t_ndbm"
20602 set i_ndbm
20603 eval $setvar
20604
20605 : see if net/errno.h is available
20606 val=''
20607 set net/errno.h val
20608 eval $inhdr
20609
20610 : Unfortunately, it causes problems on some systems.  Arrgh.
20611 case "$val" in
20612 $define)
20613         cat > try.c <<'EOM'
20614 #include <stdio.h>
20615 #include <errno.h>
20616 #include <net/errno.h>
20617 int func()
20618 {
20619         return ENOTSOCK;
20620 }
20621 EOM
20622         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20623                 echo "We'll be including <net/errno.h>." >&4
20624         else
20625                 echo "We won't be including <net/errno.h>." >&4
20626                 val="$undef"
20627         fi
20628         $rm_try
20629         ;;
20630 esac
20631 set i_neterrno
20632 eval $setvar
20633
20634 : see if netinet/tcp.h is available
20635 set netinet/tcp.h i_netinettcp
20636 eval $inhdr
20637
20638 : see if this is a poll.h system
20639 set poll.h i_poll
20640 eval $inhdr
20641
20642 : see if this is a prot.h system
20643 set prot.h i_prot
20644 eval $inhdr
20645
20646 echo " "
20647 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20648 $cat <<'EOSH' > Cppsym.know
20649 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20650 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20651 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20652 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20653 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20654 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20655 bull c cadmus clipper CMU COFF COMPILER_VERSION
20656 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20657 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20658 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20659 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20660 GLIBC GLIBC_MINOR
20661 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20662 H3050R H3050RX hbullx20 hcx host_mips
20663 hp200 hp300 hp700 HP700 hp800 hp9000
20664 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20665 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20666 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20667 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20668 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20669 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20670 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20671 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20672 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20673 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20674 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20675 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20676 MATH_HAS_NO_SIDE_EFFECTS
20677 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20678 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20679 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20680 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20681 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20682 NetBSD news1500 news1700 news1800 news1900 news3700
20683 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20684 ns32016 ns32332 ns32k nsc32000
20685 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20686 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20687 pc532 pdp11 PGC PIC plexus PORTAR posix
20688 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20689 POSIX_C_SOURCE POSIX_SOURCE POWER
20690 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
20691 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20692 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20693 sony sony_news sonyrisc sparc sparclite spectrum
20694 stardent stdc STDC_EXT stratos sun sun3 sun386
20695 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20696 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20697 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20698 sysV68 sysV88 Tek4132 Tek4300 titan
20699 TM3200 TM5400 TM5600
20700 tower tower32 tower32_200 tower32_600 tower32_700
20701 tower32_800 tower32_850 tss
20702 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20703 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20704 unix UNIX95 UNIX99 unixpc unos
20705 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20706 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20707 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20708 USGr4 USGr4_2
20709 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20710 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20711 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20712 z8000
20713 EOSH
20714 # Maybe put other stuff here too.
20715 cat <<EOSH >>Cppsym.know
20716 $osname
20717 EOSH
20718 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20719 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20720 $cat Cppsym.know > Cppsym.c
20721 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20722 $rm -f Cppsym.a Cppsym.b Cppsym.c
20723 cat <<EOSH > Cppsym
20724 $startsh
20725 if $test \$# -gt 0; then
20726     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20727     if $test -s Cppsym.got; then
20728         $rm -f Cppsym.got
20729         exit 0
20730     fi
20731     $rm -f Cppsym.got
20732     exit 1
20733 else
20734     $tr " " "$trnl" | ./Cppsym.try
20735     exit 0
20736 fi
20737 EOSH
20738 chmod +x Cppsym
20739 $eunicefix Cppsym
20740 cat <<EOSH > Cppsym.try
20741 $startsh
20742 cat <<'EOCP' > try.c
20743 #include <stdio.h>
20744 #if cpp_stuff == 1
20745 #define STRINGIFY(a)    "a"
20746 #endif
20747 #if cpp_stuff == 42
20748 #define StGiFy(a)  #a
20749 #define STRINGIFY(a)    StGiFy(a)
20750 #endif
20751 #if $cpp_stuff != 1 && $cpp_stuff != 42
20752 #   include "Bletch: How does this C preprocessor stringify macros?"
20753 #endif
20754 int main() {
20755 EOCP
20756 $awk \\
20757 EOSH
20758 cat <<'EOSH' >> Cppsym.try
20759 'length($1) > 0 {
20760     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20761     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20762     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20763     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20764 }'       >> try.c
20765 echo 'return 0;}' >> try.c
20766 EOSH
20767 cat <<EOSH >> Cppsym.try
20768 ccflags="$ccflags"
20769 case "$osname-$gccversion" in
20770 irix-) ccflags="\$ccflags -woff 1178" ;;
20771 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20772 esac
20773 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20774 EOSH
20775 chmod +x Cppsym.try
20776 $eunicefix Cppsym.try
20777 ./Cppsym < Cppsym.know > Cppsym.true
20778 : Add in any linux cpp "predefined macros":
20779 case "$osname::$gccversion" in
20780   *linux*::*.*)
20781     tHdrH=_tmpHdr
20782     rm -f $tHdrH'.h' $tHdrH
20783     touch $tHdrH'.h'
20784     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20785        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20786        if [ -s $tHdrH'_cppsym.real' ]; then
20787           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20788        fi
20789     fi
20790     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20791   ;;
20792 esac
20793 : now check the C compiler for additional symbols
20794 postprocess_cc_v=''
20795 case "$osname" in
20796 aix) postprocess_cc_v="|$tr , ' '" ;;
20797 esac
20798 $cat >ccsym <<EOS
20799 $startsh
20800 $cat >tmp.c <<EOF
20801 extern int foo;
20802 EOF
20803 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20804 do
20805         case "\$i" in
20806         -D*) echo "\$i" | $sed 's/^-D//';;
20807         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20808         esac
20809 done
20810 $rm_try
20811 EOS
20812 postprocess_cc_v=''
20813 chmod +x ccsym
20814 $eunicefix ccsym
20815 ./ccsym > ccsym1.raw
20816 if $test -s ccsym1.raw; then
20817        $sort ccsym1.raw | $uniq >ccsym.raw
20818 else
20819        mv ccsym1.raw ccsym.raw
20820 fi
20821
20822 $awk '/\=/ { print $0; next }
20823         { print $0"=1" }' ccsym.raw >ccsym.list
20824 $comm -13 Cppsym.true ccsym.list >ccsym.own
20825 $comm -12 Cppsym.true ccsym.list >ccsym.com
20826 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20827 also=''
20828 if $test -z ccsym.raw; then
20829         echo "Your C compiler doesn't seem to define any symbols!" >&4
20830         echo " "
20831         echo "However, your C preprocessor defines the following symbols:"
20832         $cat Cppsym.true
20833         ccsymbols=''
20834         cppsymbols=`$cat Cppsym.true`
20835         cppsymbols=`echo $cppsymbols`
20836         cppccsymbols="$cppsymbols"
20837 else
20838         if $test -s ccsym.com; then
20839                 echo "Your C compiler and pre-processor define these symbols:"
20840                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20841                 also='also '
20842                 symbols='ones'
20843                 cppccsymbols=`$cat ccsym.com`
20844                 cppccsymbols=`echo $cppccsymbols`
20845                 $test "$silent" || sleep 1
20846         fi
20847         if $test -s ccsym.cpp; then
20848                 $test "$also" && echo " "
20849                 echo "Your C pre-processor ${also}defines the following symbols:"
20850                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20851                 also='further '
20852                 cppsymbols=`$cat ccsym.cpp`
20853                 cppsymbols=`echo $cppsymbols`
20854                 $test "$silent" || sleep 1
20855         fi
20856         if $test -s ccsym.own; then
20857                 $test "$also" && echo " "
20858                 echo "Your C compiler ${also}defines the following cpp symbols:"
20859                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20860                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20861                 ccsymbols=`$cat ccsym.own`
20862                 ccsymbols=`echo $ccsymbols`
20863                 $test "$silent" || sleep 1
20864         fi
20865 fi
20866
20867 : see if this is a termio system
20868 val="$undef"
20869 val2="$undef"
20870 val3="$undef"
20871 if $test `./findhdr termios.h`; then
20872         set tcsetattr i_termios
20873         eval $inlibc
20874         val3="$i_termios"
20875 fi
20876 echo " "
20877 case "$val3" in
20878 "$define") echo "You have POSIX termios.h... good!" >&4;;
20879 *) if ./Cppsym pyr; then
20880                 case "`/bin/universe`" in
20881                 ucb) if $test `./findhdr sgtty.h`; then
20882                                 val2="$define"
20883                                 echo "<sgtty.h> found." >&4
20884                         else
20885                                 echo "System is pyramid with BSD universe."
20886                                 echo "<sgtty.h> not found--you could have problems." >&4
20887                         fi;;
20888                 *) if $test `./findhdr termio.h`; then
20889                                 val="$define"
20890                                 echo "<termio.h> found." >&4
20891                         else
20892                                 echo "System is pyramid with USG universe."
20893                                 echo "<termio.h> not found--you could have problems." >&4
20894                         fi;;
20895                 esac
20896         elif ./usg; then
20897                 if $test `./findhdr termio.h`; then
20898                         echo "<termio.h> found." >&4
20899                         val="$define"
20900                 elif $test `./findhdr sgtty.h`; then
20901                         echo "<sgtty.h> found." >&4
20902                         val2="$define"
20903                 else
20904 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20905                 fi
20906         else
20907                 if $test `./findhdr sgtty.h`; then
20908                         echo "<sgtty.h> found." >&4
20909                         val2="$define"
20910                 elif $test `./findhdr termio.h`; then
20911                         echo "<termio.h> found." >&4
20912                         val="$define"
20913                 else
20914 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20915                 fi
20916         fi;;
20917 esac
20918 set i_termio; eval $setvar
20919 val=$val2; set i_sgtty; eval $setvar
20920 val=$val3; set i_termios; eval $setvar
20921
20922 : see if stddef is available
20923 set stddef.h i_stddef
20924 eval $inhdr
20925
20926 : see if sys/access.h is available
20927 set sys/access.h i_sysaccess
20928 eval $inhdr
20929
20930 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20931 set sys/filio.h i_sysfilio
20932 eval $inhdr
20933 echo " "
20934 if $test `./findhdr sys/ioctl.h`; then
20935         val="$define"
20936         echo '<sys/ioctl.h> found.' >&4
20937 else
20938         val="$undef"
20939         if $test $i_sysfilio = "$define"; then
20940             echo '<sys/ioctl.h> NOT found.' >&4
20941         else
20942                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20943                 $test $i_termio = "$define" && xxx="termio.h"
20944                 $test $i_termios = "$define" && xxx="termios.h"
20945 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20946         fi
20947 fi
20948 set i_sysioctl
20949 eval $setvar
20950
20951 : see if socket ioctl defs are in sys/sockio.h
20952 echo " "
20953 xxx=`./findhdr sys/sockio.h`
20954 if $test "$xxx"; then
20955         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20956                 val="$define"
20957                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20958         else
20959                 val="$undef"
20960                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20961         fi
20962 else
20963         val="$undef"
20964         $cat <<EOM
20965 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20966 EOM
20967 fi
20968 set i_syssockio
20969 eval $setvar
20970
20971
20972 : see if this is a syslog.h system
20973 set syslog.h i_syslog
20974 eval $inhdr
20975
20976
20977 : see if this is a sys/mode.h system
20978 set sys/mode.h i_sysmode
20979 eval $inhdr
20980
20981 : see if sys/resource.h has to be included
20982 set sys/resource.h i_sysresrc
20983 eval $inhdr
20984
20985 : see if sys/security.h is available
20986 set sys/security.h i_syssecrt
20987 eval $inhdr
20988
20989 : see if this is a sys/statvfs.h system
20990 set sys/statvfs.h i_sysstatvfs
20991 eval $inhdr
20992
20993 : see if this is a sys/un.h system
20994 set sys/un.h i_sysun
20995 eval $inhdr
20996
20997
20998 : see if this is a sys/utsname.h system
20999 set sys/utsname.h i_sysutsname
21000 eval $inhdr
21001
21002 : see if this is a syswait system
21003 set sys/wait.h i_syswait
21004 eval $inhdr
21005
21006 : see if this is a ustat.h system
21007 set ustat.h i_ustat
21008 eval $inhdr
21009
21010 : see if this is an utime system
21011 set utime.h i_utime
21012 eval $inhdr
21013
21014 : see if this is a values.h system
21015 set values.h i_values
21016 eval $inhdr
21017
21018 : see if this is a vfork system
21019 case "$d_vfork" in
21020 "$define")
21021         set vfork.h i_vfork
21022         eval $inhdr
21023         ;;
21024 *)
21025         i_vfork="$undef"
21026         ;;
21027 esac
21028
21029 echo " "
21030 echo "Looking for extensions..." >&4
21031 : If we are using the old config.sh, known_extensions may contain
21032 : old or inaccurate or duplicate values.
21033 known_extensions=''
21034 nonxs_extensions=''
21035 : We do not use find because it might not be available.
21036 : We do not just use MANIFEST because the user may have dropped
21037 : some additional extensions into the source tree and expect them
21038 : to be built.
21039
21040 : Function to recursively find available extensions, ignoring DynaLoader
21041 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21042 find_extensions='
21043     for xxx in *; do
21044         case "$xxx" in
21045             DynaLoader|dynaload) ;;
21046             *)
21047             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21048                 known_extensions="$known_extensions $1$xxx";
21049             elif $test -f $xxx/Makefile.PL; then
21050                 nonxs_extensions="$nonxs_extensions $1$xxx";
21051             else
21052                 if $test -d $xxx -a $# -lt 10; then
21053                     set $1$xxx/ $*;
21054                     cd "$xxx";
21055                     eval $find_extensions;
21056                     cd ..;
21057                     shift;
21058                 fi;
21059             fi
21060             ;;
21061         esac;
21062     done'
21063 tdir=`pwd`
21064 cd "$rsrc/ext"
21065 set X
21066 shift
21067 eval $find_extensions
21068 # Special case:  Add in modules that nest beyond the first level.
21069 # Currently threads/shared and Hash/Util/FieldHash, since they are
21070 # not picked up by the recursive find above (and adding in general
21071 # recursive finding breaks SDBM_File/sdbm).
21072 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21073 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21074 set X $known_extensions
21075 shift
21076 known_extensions="$*"
21077 set X $nonxs_extensions
21078 shift
21079 nonxs_extensions="$*"
21080 cd "$tdir"
21081
21082 : Now see which are supported on this system.
21083 avail_ext=''
21084 for xxx in $known_extensions ; do
21085         case "$xxx" in
21086         DB_File|db_file)
21087                 case "$i_db" in
21088                 $define) avail_ext="$avail_ext $xxx" ;;
21089                 esac
21090                 ;;
21091         GDBM_File|gdbm_fil)
21092                 case "$i_gdbm" in
21093                 $define) avail_ext="$avail_ext $xxx" ;;
21094                 esac
21095                 ;;
21096         I18N/Langinfo|i18n_lan)
21097                 case "$i_langinfo$d_nl_langinfo" in
21098                 $define$define) avail_ext="$avail_ext $xxx" ;;
21099                 esac
21100                 ;;
21101         IPC/SysV|ipc/sysv)
21102                 : XXX Do we need a useipcsysv variable here
21103                 case "${d_msg}${d_sem}${d_shm}" in
21104                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21105                 esac
21106                 ;;
21107         NDBM_File|ndbm_fil)
21108                 case "$i_ndbm" in
21109                 $define)
21110                     case "$osname-$use64bitint" in
21111                     hpux-define)
21112                         case "$libs" in
21113                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21114                         esac
21115                         ;;
21116                     *) avail_ext="$avail_ext $xxx" ;;
21117                     esac
21118                     ;;
21119                 esac
21120                 ;;
21121         ODBM_File|odbm_fil)
21122                 case "${i_dbm}${i_rpcsvcdbm}" in
21123                 *"${define}"*)
21124                     case "$d_cplusplus" in
21125                     define) ;; # delete as a function name will not work
21126                     *)  case "$osname-$use64bitint" in
21127                         hpux-define)
21128                             case "$libs" in
21129                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21130                             esac
21131                             ;;
21132                         *) avail_ext="$avail_ext $xxx" ;;
21133                         esac
21134                         ;;
21135                     esac
21136                     ;;
21137                 esac
21138                 ;;
21139         Opcode|opcode)
21140                 case "$useopcode" in
21141                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21142                 esac
21143                 ;;
21144         POSIX|posix)
21145                 case "$useposix" in
21146                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21147                 esac
21148                 ;;
21149         Socket|socket)
21150                 case "$d_socket" in
21151                 true|$define|y)
21152                     case "$osname" in
21153                     beos) ;; # not unless BONE
21154                     *) avail_ext="$avail_ext $xxx" ;;
21155                     esac
21156                     ;;
21157                 esac
21158                 ;;
21159         Sys/Syslog|sys/syslog)
21160                 : XXX syslog requires socket
21161                 case "$d_socket" in
21162                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21163                 esac
21164                 ;;
21165         Thread|thread)
21166                 case "$usethreads" in
21167                 true|$define|y)
21168                         case "$use5005threads" in
21169                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21170                         esac
21171                 esac
21172                 ;;
21173         threads|threads/shared)
21174                 # threads and threads::shared are special cases.
21175                 # To stop people from asking "Perl 5.8.0 was supposed
21176                 # to have this new fancy threads implementation but my
21177                 # perl doesn't have it" and from people trying to
21178                 # (re)install the threads module using CPAN.pm and
21179                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21180                 # the threads.pm and threads/shared.pm will always be
21181                 # there, croaking informatively ("you need to rebuild
21182                 # all of Perl with threads, sorry") when threads haven't
21183                 # been compiled in.
21184                 # --jhi
21185                 avail_ext="$avail_ext $xxx"
21186                 ;;
21187         Win32*)
21188                 case "$osname" in
21189                 cygwin) avail_ext="$avail_ext $xxx" ;;
21190                 esac
21191                 ;;
21192         XS/APItest|xs/apitest)
21193                 # This is just for testing.  Skip it unless we have dynamic loading.
21194
21195                 case "$usedl" in
21196                 $define) avail_ext="$avail_ext $xxx" ;;
21197                 esac
21198                 ;;
21199         XS/Typemap|xs/typemap)
21200                 # This is just for testing.  Skip it unless we have dynamic loading.
21201                 case "$usedl" in
21202                 $define) avail_ext="$avail_ext $xxx" ;;
21203                 esac
21204                 ;;
21205         *)      avail_ext="$avail_ext $xxx"
21206                 ;;
21207         esac
21208 done
21209
21210 set X $avail_ext
21211 shift
21212 avail_ext="$*"
21213
21214 case "$onlyextensions" in
21215 '') ;;
21216 *)  keepextensions=''
21217     echo "You have requested that only certains extensions be included..." >&4
21218     for i in $onlyextensions; do
21219         case " $avail_ext " in
21220         *" $i "*)
21221             echo "Keeping extension $i."
21222             keepextensions="$keepextensions $i"
21223             ;;
21224         *) echo "Ignoring extension $i." ;;
21225         esac
21226     done
21227     avail_ext="$keepextensions"
21228     ;;
21229 esac
21230
21231 case "$noextensions" in
21232 '') ;;
21233 *)  keepextensions=''
21234     echo "You have requested that certain extensions be ignored..." >&4
21235     for i in $avail_ext; do
21236         case " $noextensions " in
21237         *" $i "*) echo "Ignoring extension $i." ;;
21238         *) echo "Keeping extension $i.";
21239            keepextensions="$keepextensions $i"
21240            ;;
21241         esac
21242     done
21243     avail_ext="$keepextensions"
21244     ;;
21245 esac
21246
21247 : Now see which nonxs extensions are supported on this system.
21248 : For now assume all are.
21249 nonxs_ext=''
21250 for xxx in $nonxs_extensions ; do
21251         case "$xxx" in
21252         *)      nonxs_ext="$nonxs_ext $xxx"
21253                 ;;
21254         esac
21255 done
21256
21257 set X $nonxs_ext
21258 shift
21259 nonxs_ext="$*"
21260
21261 case $usedl in
21262 $define)
21263         $cat <<EOM
21264 A number of extensions are supplied with $package.  You may choose to
21265 compile these extensions for dynamic loading (the default), compile
21266 them into the $package executable (static loading), or not include
21267 them at all.  Answer "none" to include no extensions.
21268 Note that DynaLoader is always built and need not be mentioned here.
21269
21270 EOM
21271         case "$dynamic_ext" in
21272         '')
21273                 : Exclude those listed in static_ext
21274                 dflt=''
21275                 for xxx in $avail_ext; do
21276                         case " $static_ext " in
21277                         *" $xxx "*) ;;
21278                         *) dflt="$dflt $xxx" ;;
21279                         esac
21280                 done
21281                 set X $dflt
21282                 shift
21283                 dflt="$*"
21284                 ;;
21285         *)      dflt="$dynamic_ext"
21286                 # Perhaps we are reusing an old out-of-date config.sh.
21287                 case "$hint" in
21288                 previous)
21289                         if test X"$dynamic_ext" != X"$avail_ext"; then
21290                                 $cat <<EOM
21291 NOTICE:  Your previous config.sh list may be incorrect.
21292 The extensions now available to you are
21293         ${avail_ext}
21294 but the default list from your previous config.sh is
21295         ${dynamic_ext}
21296
21297 EOM
21298                         fi
21299                         ;;
21300                 esac
21301                 ;;
21302         esac
21303         case "$dflt" in
21304         '')     dflt=none;;
21305         esac
21306         rp="What extensions do you wish to load dynamically?"
21307         . ./myread
21308         case "$ans" in
21309         none) dynamic_ext=' ' ;;
21310         *) dynamic_ext="$ans" ;;
21311         esac
21312
21313         case "$static_ext" in
21314         '')
21315                 : Exclude those already listed in dynamic linking
21316                 dflt=''
21317                 for xxx in $avail_ext; do
21318                         case " $dynamic_ext " in
21319                         *" $xxx "*) ;;
21320                         *) dflt="$dflt $xxx" ;;
21321                         esac
21322                 done
21323                 set X $dflt
21324                 shift
21325                 dflt="$*"
21326                 ;;
21327         *)  dflt="$static_ext"
21328                 ;;
21329         esac
21330
21331         case "$dflt" in
21332         '')     dflt=none;;
21333         esac
21334         rp="What extensions do you wish to load statically?"
21335         . ./myread
21336         case "$ans" in
21337         none) static_ext=' ' ;;
21338         *) static_ext="$ans" ;;
21339         esac
21340         ;;
21341 *)
21342         $cat <<EOM
21343 A number of extensions are supplied with $package.  Answer "none"
21344 to include no extensions.
21345 Note that DynaLoader is always built and need not be mentioned here.
21346
21347 EOM
21348         case "$static_ext" in
21349         '') dflt="$avail_ext" ;;
21350         *)      dflt="$static_ext"
21351                 # Perhaps we are reusing an old out-of-date config.sh.
21352                 case "$hint" in
21353                 previous)
21354                         if test X"$static_ext" != X"$avail_ext"; then
21355                                 $cat <<EOM
21356 NOTICE:  Your previous config.sh list may be incorrect.
21357 The extensions now available to you are
21358         ${avail_ext}
21359 but the default list from your previous config.sh is
21360         ${static_ext}
21361
21362 EOM
21363                         fi
21364                         ;;
21365                 esac
21366                 ;;
21367         esac
21368         : Exclude those that are not xs extensions
21369         case "$dflt" in
21370         '')     dflt=none;;
21371         esac
21372         rp="What extensions do you wish to include?"
21373         . ./myread
21374         case "$ans" in
21375         none) static_ext=' ' ;;
21376         *) static_ext="$ans" ;;
21377         esac
21378         ;;
21379 esac
21380 #
21381 # Encode is a special case.  If we are building Encode as a static
21382 # extension, we need to explicitly list its subextensions as well.
21383 # For other nested extensions, this is handled automatically by
21384 # the appropriate Makefile.PL.
21385 case " $static_ext " in
21386         *" Encode "*) # Add the subextensions of Encode
21387         cd "$rsrc/ext"
21388         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21389                 static_ext="$static_ext Encode/$xxx"
21390         done
21391         cd "$tdir"
21392         ;;
21393 esac
21394
21395 set X $dynamic_ext $static_ext $nonxs_ext
21396 shift
21397 extensions="$*"
21398
21399 # Sanity check:  We require an extension suitable for use with
21400 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21401 # should show up as failures in the test suite, but it's helpful to
21402 # catch them now.) The 'extensions' list is normally sorted
21403 # alphabetically, so we need to accept either
21404 #    DB_File ... Fcntl ... IO  ....
21405 # or something like
21406 #    Fcntl ... NDBM_File ... IO  ....
21407 case " $extensions"  in
21408 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21409 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21410 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21411 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21412    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21413    ;;
21414 esac
21415
21416 : Remove libraries needed only for extensions
21417 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21418 : The exception is SunOS 4.x, which needs them.
21419 case "${osname}X${osvers}" in
21420 sunos*X4*)
21421     perllibs="$libs"
21422     ;;
21423 *) case "$usedl" in
21424     $define|true|[yY]*)
21425             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21426             shift
21427             perllibs="$*"
21428             ;;
21429     *)  perllibs="$libs"
21430             ;;
21431     esac
21432     ;;
21433 esac
21434
21435 : Remove build directory name from cppstdin so it can be used from
21436 : either the present location or the final installed location.
21437 echo " "
21438 : Get out of the UU directory to get correct path name.
21439 cd ..
21440 case "$cppstdin" in
21441 `pwd`/cppstdin)
21442         echo "Stripping down cppstdin path name"
21443         cppstdin=cppstdin
21444         ;;
21445 esac
21446 cd UU
21447
21448 : end of configuration questions
21449 echo " "
21450 echo "End of configuration questions."
21451 echo " "
21452
21453 : back to where it started
21454 if test -d ../UU; then
21455         cd ..
21456 fi
21457
21458 : configuration may be patched via a 'config.arch' file
21459 if $test -f config.arch; then
21460         echo "I see a config.arch file, loading it."
21461         . ./config.arch
21462 fi
21463
21464 : configuration may be patched via a 'config.over' file
21465 if $test -f config.over; then
21466         echo " "
21467         dflt=y
21468         rp='I see a config.over file.  Do you wish to load it?'
21469         . UU/myread
21470         case "$ans" in
21471         n*) echo "OK, I'll ignore it.";;
21472         *)      . ./config.over
21473                 echo "Configuration override changes have been loaded."
21474                 ;;
21475         esac
21476 fi
21477
21478 : in case they want portability, strip down executable paths
21479 case "$d_portable" in
21480 "$define")
21481         echo " "
21482         echo "Stripping down executable paths..." >&4
21483         for file in $loclist $trylist; do
21484                 eval temp=\$$file
21485                 eval $file=`basename $temp`
21486         done
21487         ;;
21488 esac
21489
21490 : create config.sh file
21491 echo " "
21492 echo "Creating config.sh..." >&4
21493 $spitshell <<EOT >config.sh
21494 $startsh
21495 #
21496 # This file was produced by running the Configure script. It holds all the
21497 # definitions figured out by Configure. Should you modify one of these values,
21498 # do not forget to propagate your changes by running "Configure -der". You may
21499 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21500 #
21501
21502 # Package name      : $package
21503 # Source directory  : $src
21504 # Configuration time: $cf_time
21505 # Configured by     : $cf_by
21506 # Target system     : $myuname
21507
21508 Author='$Author'
21509 Date='$Date'
21510 Header='$Header'
21511 Id='$Id'
21512 Locker='$Locker'
21513 Log='$Log'
21514 Mcc='$Mcc'
21515 RCSfile='$RCSfile'
21516 Revision='$Revision'
21517 Source='$Source'
21518 State='$State'
21519 _a='$_a'
21520 _exe='$_exe'
21521 _o='$_o'
21522 afs='$afs'
21523 afsroot='$afsroot'
21524 alignbytes='$alignbytes'
21525 ansi2knr='$ansi2knr'
21526 aphostname='$aphostname'
21527 api_revision='$api_revision'
21528 api_subversion='$api_subversion'
21529 api_version='$api_version'
21530 api_versionstring='$api_versionstring'
21531 ar='$ar'
21532 archlib='$archlib'
21533 archlibexp='$archlibexp'
21534 archname64='$archname64'
21535 archname='$archname'
21536 archobjs='$archobjs'
21537 asctime_r_proto='$asctime_r_proto'
21538 awk='$awk'
21539 baserev='$baserev'
21540 bash='$bash'
21541 bin='$bin'
21542 binexp='$binexp'
21543 bison='$bison'
21544 byacc='$byacc'
21545 byteorder='$byteorder'
21546 c='$c'
21547 castflags='$castflags'
21548 cat='$cat'
21549 cc='$cc'
21550 cccdlflags='$cccdlflags'
21551 ccdlflags='$ccdlflags'
21552 ccflags='$ccflags'
21553 ccflags_uselargefiles='$ccflags_uselargefiles'
21554 ccname='$ccname'
21555 ccsymbols='$ccsymbols'
21556 ccversion='$ccversion'
21557 cf_by='$cf_by'
21558 cf_email='$cf_email'
21559 cf_time='$cf_time'
21560 chgrp='$chgrp'
21561 chmod='$chmod'
21562 chown='$chown'
21563 clocktype='$clocktype'
21564 comm='$comm'
21565 compress='$compress'
21566 contains='$contains'
21567 cp='$cp'
21568 cpio='$cpio'
21569 cpp='$cpp'
21570 cpp_stuff='$cpp_stuff'
21571 cppccsymbols='$cppccsymbols'
21572 cppflags='$cppflags'
21573 cpplast='$cpplast'
21574 cppminus='$cppminus'
21575 cpprun='$cpprun'
21576 cppstdin='$cppstdin'
21577 cppsymbols='$cppsymbols'
21578 crypt_r_proto='$crypt_r_proto'
21579 cryptlib='$cryptlib'
21580 csh='$csh'
21581 ctermid_r_proto='$ctermid_r_proto'
21582 ctime_r_proto='$ctime_r_proto'
21583 d_Gconvert='$d_Gconvert'
21584 d_PRIEUldbl='$d_PRIEUldbl'
21585 d_PRIFUldbl='$d_PRIFUldbl'
21586 d_PRIGUldbl='$d_PRIGUldbl'
21587 d_PRIXU64='$d_PRIXU64'
21588 d_PRId64='$d_PRId64'
21589 d_PRIeldbl='$d_PRIeldbl'
21590 d_PRIfldbl='$d_PRIfldbl'
21591 d_PRIgldbl='$d_PRIgldbl'
21592 d_PRIi64='$d_PRIi64'
21593 d_PRIo64='$d_PRIo64'
21594 d_PRIu64='$d_PRIu64'
21595 d_PRIx64='$d_PRIx64'
21596 d_SCNfldbl='$d_SCNfldbl'
21597 d__fwalk='$d__fwalk'
21598 d_access='$d_access'
21599 d_accessx='$d_accessx'
21600 d_aintl='$d_aintl'
21601 d_alarm='$d_alarm'
21602 d_archlib='$d_archlib'
21603 d_asctime_r='$d_asctime_r'
21604 d_atolf='$d_atolf'
21605 d_atoll='$d_atoll'
21606 d_attribute_format='$d_attribute_format'
21607 d_attribute_malloc='$d_attribute_malloc'
21608 d_attribute_nonnull='$d_attribute_nonnull'
21609 d_attribute_noreturn='$d_attribute_noreturn'
21610 d_attribute_pure='$d_attribute_pure'
21611 d_attribute_unused='$d_attribute_unused'
21612 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21613 d_bcmp='$d_bcmp'
21614 d_bcopy='$d_bcopy'
21615 d_bsd='$d_bsd'
21616 d_bsdgetpgrp='$d_bsdgetpgrp'
21617 d_bsdsetpgrp='$d_bsdsetpgrp'
21618 d_builtin_choose_expr='$d_builtin_choose_expr'
21619 d_builtin_expect='$d_builtin_expect'
21620 d_bzero='$d_bzero'
21621 d_c99_variadic_macros='$d_c99_variadic_macros'
21622 d_casti32='$d_casti32'
21623 d_castneg='$d_castneg'
21624 d_charvspr='$d_charvspr'
21625 d_chown='$d_chown'
21626 d_chroot='$d_chroot'
21627 d_chsize='$d_chsize'
21628 d_class='$d_class'
21629 d_clearenv='$d_clearenv'
21630 d_closedir='$d_closedir'
21631 d_cmsghdr_s='$d_cmsghdr_s'
21632 d_const='$d_const'
21633 d_copysignl='$d_copysignl'
21634 d_cplusplus='$d_cplusplus'
21635 d_crypt='$d_crypt'
21636 d_crypt_r='$d_crypt_r'
21637 d_csh='$d_csh'
21638 d_ctermid='$d_ctermid'
21639 d_ctermid_r='$d_ctermid_r'
21640 d_ctime_r='$d_ctime_r'
21641 d_cuserid='$d_cuserid'
21642 d_dbl_dig='$d_dbl_dig'
21643 d_dbminitproto='$d_dbminitproto'
21644 d_difftime='$d_difftime'
21645 d_dir_dd_fd='$d_dir_dd_fd'
21646 d_dirfd='$d_dirfd'
21647 d_dirnamlen='$d_dirnamlen'
21648 d_dlerror='$d_dlerror'
21649 d_dlopen='$d_dlopen'
21650 d_dlsymun='$d_dlsymun'
21651 d_dosuid='$d_dosuid'
21652 d_drand48_r='$d_drand48_r'
21653 d_drand48proto='$d_drand48proto'
21654 d_dup2='$d_dup2'
21655 d_eaccess='$d_eaccess'
21656 d_endgrent='$d_endgrent'
21657 d_endgrent_r='$d_endgrent_r'
21658 d_endhent='$d_endhent'
21659 d_endhostent_r='$d_endhostent_r'
21660 d_endnent='$d_endnent'
21661 d_endnetent_r='$d_endnetent_r'
21662 d_endpent='$d_endpent'
21663 d_endprotoent_r='$d_endprotoent_r'
21664 d_endpwent='$d_endpwent'
21665 d_endpwent_r='$d_endpwent_r'
21666 d_endsent='$d_endsent'
21667 d_endservent_r='$d_endservent_r'
21668 d_eofnblk='$d_eofnblk'
21669 d_eunice='$d_eunice'
21670 d_faststdio='$d_faststdio'
21671 d_fchdir='$d_fchdir'
21672 d_fchmod='$d_fchmod'
21673 d_fchown='$d_fchown'
21674 d_fcntl='$d_fcntl'
21675 d_fcntl_can_lock='$d_fcntl_can_lock'
21676 d_fd_macros='$d_fd_macros'
21677 d_fd_set='$d_fd_set'
21678 d_fds_bits='$d_fds_bits'
21679 d_fgetpos='$d_fgetpos'
21680 d_finite='$d_finite'
21681 d_finitel='$d_finitel'
21682 d_flexfnam='$d_flexfnam'
21683 d_flock='$d_flock'
21684 d_flockproto='$d_flockproto'
21685 d_fork='$d_fork'
21686 d_fp_class='$d_fp_class'
21687 d_fpathconf='$d_fpathconf'
21688 d_fpclass='$d_fpclass'
21689 d_fpclassify='$d_fpclassify'
21690 d_fpclassl='$d_fpclassl'
21691 d_fpos64_t='$d_fpos64_t'
21692 d_frexpl='$d_frexpl'
21693 d_fs_data_s='$d_fs_data_s'
21694 d_fseeko='$d_fseeko'
21695 d_fsetpos='$d_fsetpos'
21696 d_fstatfs='$d_fstatfs'
21697 d_fstatvfs='$d_fstatvfs'
21698 d_fsync='$d_fsync'
21699 d_ftello='$d_ftello'
21700 d_ftime='$d_ftime'
21701 d_futimes='$d_futimes'
21702 d_getcwd='$d_getcwd'
21703 d_getespwnam='$d_getespwnam'
21704 d_getfsstat='$d_getfsstat'
21705 d_getgrent='$d_getgrent'
21706 d_getgrent_r='$d_getgrent_r'
21707 d_getgrgid_r='$d_getgrgid_r'
21708 d_getgrnam_r='$d_getgrnam_r'
21709 d_getgrps='$d_getgrps'
21710 d_gethbyaddr='$d_gethbyaddr'
21711 d_gethbyname='$d_gethbyname'
21712 d_gethent='$d_gethent'
21713 d_gethname='$d_gethname'
21714 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21715 d_gethostbyname_r='$d_gethostbyname_r'
21716 d_gethostent_r='$d_gethostent_r'
21717 d_gethostprotos='$d_gethostprotos'
21718 d_getitimer='$d_getitimer'
21719 d_getlogin='$d_getlogin'
21720 d_getlogin_r='$d_getlogin_r'
21721 d_getmnt='$d_getmnt'
21722 d_getmntent='$d_getmntent'
21723 d_getnbyaddr='$d_getnbyaddr'
21724 d_getnbyname='$d_getnbyname'
21725 d_getnent='$d_getnent'
21726 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21727 d_getnetbyname_r='$d_getnetbyname_r'
21728 d_getnetent_r='$d_getnetent_r'
21729 d_getnetprotos='$d_getnetprotos'
21730 d_getpagsz='$d_getpagsz'
21731 d_getpbyname='$d_getpbyname'
21732 d_getpbynumber='$d_getpbynumber'
21733 d_getpent='$d_getpent'
21734 d_getpgid='$d_getpgid'
21735 d_getpgrp2='$d_getpgrp2'
21736 d_getpgrp='$d_getpgrp'
21737 d_getppid='$d_getppid'
21738 d_getprior='$d_getprior'
21739 d_getprotobyname_r='$d_getprotobyname_r'
21740 d_getprotobynumber_r='$d_getprotobynumber_r'
21741 d_getprotoent_r='$d_getprotoent_r'
21742 d_getprotoprotos='$d_getprotoprotos'
21743 d_getprpwnam='$d_getprpwnam'
21744 d_getpwent='$d_getpwent'
21745 d_getpwent_r='$d_getpwent_r'
21746 d_getpwnam_r='$d_getpwnam_r'
21747 d_getpwuid_r='$d_getpwuid_r'
21748 d_getsbyname='$d_getsbyname'
21749 d_getsbyport='$d_getsbyport'
21750 d_getsent='$d_getsent'
21751 d_getservbyname_r='$d_getservbyname_r'
21752 d_getservbyport_r='$d_getservbyport_r'
21753 d_getservent_r='$d_getservent_r'
21754 d_getservprotos='$d_getservprotos'
21755 d_getspnam='$d_getspnam'
21756 d_getspnam_r='$d_getspnam_r'
21757 d_gettimeod='$d_gettimeod'
21758 d_gmtime_r='$d_gmtime_r'
21759 d_gnulibc='$d_gnulibc'
21760 d_grpasswd='$d_grpasswd'
21761 d_hasmntopt='$d_hasmntopt'
21762 d_htonl='$d_htonl'
21763 d_ilogbl='$d_ilogbl'
21764 d_inc_version_list='$d_inc_version_list'
21765 d_index='$d_index'
21766 d_inetaton='$d_inetaton'
21767 d_int64_t='$d_int64_t'
21768 d_isascii='$d_isascii'
21769 d_isfinite='$d_isfinite'
21770 d_isinf='$d_isinf'
21771 d_isnan='$d_isnan'
21772 d_isnanl='$d_isnanl'
21773 d_killpg='$d_killpg'
21774 d_lchown='$d_lchown'
21775 d_ldbl_dig='$d_ldbl_dig'
21776 d_libm_lib_version='$d_libm_lib_version'
21777 d_link='$d_link'
21778 d_localtime_r='$d_localtime_r'
21779 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21780 d_locconv='$d_locconv'
21781 d_lockf='$d_lockf'
21782 d_longdbl='$d_longdbl'
21783 d_longlong='$d_longlong'
21784 d_lseekproto='$d_lseekproto'
21785 d_lstat='$d_lstat'
21786 d_madvise='$d_madvise'
21787 d_malloc_good_size='$d_malloc_good_size'
21788 d_malloc_size='$d_malloc_size'
21789 d_mblen='$d_mblen'
21790 d_mbstowcs='$d_mbstowcs'
21791 d_mbtowc='$d_mbtowc'
21792 d_memchr='$d_memchr'
21793 d_memcmp='$d_memcmp'
21794 d_memcpy='$d_memcpy'
21795 d_memmove='$d_memmove'
21796 d_memset='$d_memset'
21797 d_mkdir='$d_mkdir'
21798 d_mkdtemp='$d_mkdtemp'
21799 d_mkfifo='$d_mkfifo'
21800 d_mkstemp='$d_mkstemp'
21801 d_mkstemps='$d_mkstemps'
21802 d_mktime='$d_mktime'
21803 d_mmap='$d_mmap'
21804 d_modfl='$d_modfl'
21805 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21806 d_modflproto='$d_modflproto'
21807 d_mprotect='$d_mprotect'
21808 d_msg='$d_msg'
21809 d_msg_ctrunc='$d_msg_ctrunc'
21810 d_msg_dontroute='$d_msg_dontroute'
21811 d_msg_oob='$d_msg_oob'
21812 d_msg_peek='$d_msg_peek'
21813 d_msg_proxy='$d_msg_proxy'
21814 d_msgctl='$d_msgctl'
21815 d_msgget='$d_msgget'
21816 d_msghdr_s='$d_msghdr_s'
21817 d_msgrcv='$d_msgrcv'
21818 d_msgsnd='$d_msgsnd'
21819 d_msync='$d_msync'
21820 d_munmap='$d_munmap'
21821 d_mymalloc='$d_mymalloc'
21822 d_nice='$d_nice'
21823 d_nl_langinfo='$d_nl_langinfo'
21824 d_nv_preserves_uv='$d_nv_preserves_uv'
21825 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21826 d_off64_t='$d_off64_t'
21827 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21828 d_oldpthreads='$d_oldpthreads'
21829 d_oldsock='$d_oldsock'
21830 d_open3='$d_open3'
21831 d_pathconf='$d_pathconf'
21832 d_pause='$d_pause'
21833 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21834 d_phostname='$d_phostname'
21835 d_pipe='$d_pipe'
21836 d_poll='$d_poll'
21837 d_portable='$d_portable'
21838 d_printf_format_null='$d_printf_format_null'
21839 d_procselfexe='$d_procselfexe'
21840 d_pseudofork='$d_pseudofork'
21841 d_pthread_atfork='$d_pthread_atfork'
21842 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21843 d_pthread_yield='$d_pthread_yield'
21844 d_pwage='$d_pwage'
21845 d_pwchange='$d_pwchange'
21846 d_pwclass='$d_pwclass'
21847 d_pwcomment='$d_pwcomment'
21848 d_pwexpire='$d_pwexpire'
21849 d_pwgecos='$d_pwgecos'
21850 d_pwpasswd='$d_pwpasswd'
21851 d_pwquota='$d_pwquota'
21852 d_qgcvt='$d_qgcvt'
21853 d_quad='$d_quad'
21854 d_random_r='$d_random_r'
21855 d_readdir64_r='$d_readdir64_r'
21856 d_readdir='$d_readdir'
21857 d_readdir_r='$d_readdir_r'
21858 d_readlink='$d_readlink'
21859 d_readv='$d_readv'
21860 d_recvmsg='$d_recvmsg'
21861 d_rename='$d_rename'
21862 d_rewinddir='$d_rewinddir'
21863 d_rmdir='$d_rmdir'
21864 d_safebcpy='$d_safebcpy'
21865 d_safemcpy='$d_safemcpy'
21866 d_sanemcmp='$d_sanemcmp'
21867 d_sbrkproto='$d_sbrkproto'
21868 d_scalbnl='$d_scalbnl'
21869 d_sched_yield='$d_sched_yield'
21870 d_scm_rights='$d_scm_rights'
21871 d_seekdir='$d_seekdir'
21872 d_select='$d_select'
21873 d_sem='$d_sem'
21874 d_semctl='$d_semctl'
21875 d_semctl_semid_ds='$d_semctl_semid_ds'
21876 d_semctl_semun='$d_semctl_semun'
21877 d_semget='$d_semget'
21878 d_semop='$d_semop'
21879 d_sendmsg='$d_sendmsg'
21880 d_setegid='$d_setegid'
21881 d_seteuid='$d_seteuid'
21882 d_setgrent='$d_setgrent'
21883 d_setgrent_r='$d_setgrent_r'
21884 d_setgrps='$d_setgrps'
21885 d_sethent='$d_sethent'
21886 d_sethostent_r='$d_sethostent_r'
21887 d_setitimer='$d_setitimer'
21888 d_setlinebuf='$d_setlinebuf'
21889 d_setlocale='$d_setlocale'
21890 d_setlocale_r='$d_setlocale_r'
21891 d_setnent='$d_setnent'
21892 d_setnetent_r='$d_setnetent_r'
21893 d_setpent='$d_setpent'
21894 d_setpgid='$d_setpgid'
21895 d_setpgrp2='$d_setpgrp2'
21896 d_setpgrp='$d_setpgrp'
21897 d_setprior='$d_setprior'
21898 d_setproctitle='$d_setproctitle'
21899 d_setprotoent_r='$d_setprotoent_r'
21900 d_setpwent='$d_setpwent'
21901 d_setpwent_r='$d_setpwent_r'
21902 d_setregid='$d_setregid'
21903 d_setresgid='$d_setresgid'
21904 d_setresuid='$d_setresuid'
21905 d_setreuid='$d_setreuid'
21906 d_setrgid='$d_setrgid'
21907 d_setruid='$d_setruid'
21908 d_setsent='$d_setsent'
21909 d_setservent_r='$d_setservent_r'
21910 d_setsid='$d_setsid'
21911 d_setvbuf='$d_setvbuf'
21912 d_sfio='$d_sfio'
21913 d_shm='$d_shm'
21914 d_shmat='$d_shmat'
21915 d_shmatprototype='$d_shmatprototype'
21916 d_shmctl='$d_shmctl'
21917 d_shmdt='$d_shmdt'
21918 d_shmget='$d_shmget'
21919 d_sigaction='$d_sigaction'
21920 d_signbit='$d_signbit'
21921 d_sigprocmask='$d_sigprocmask'
21922 d_sigsetjmp='$d_sigsetjmp'
21923 d_sitearch='$d_sitearch'
21924 d_snprintf='$d_snprintf'
21925 d_sockatmark='$d_sockatmark'
21926 d_sockatmarkproto='$d_sockatmarkproto'
21927 d_socket='$d_socket'
21928 d_socklen_t='$d_socklen_t'
21929 d_sockpair='$d_sockpair'
21930 d_socks5_init='$d_socks5_init'
21931 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21932 d_sqrtl='$d_sqrtl'
21933 d_srand48_r='$d_srand48_r'
21934 d_srandom_r='$d_srandom_r'
21935 d_sresgproto='$d_sresgproto'
21936 d_sresuproto='$d_sresuproto'
21937 d_statblks='$d_statblks'
21938 d_statfs_f_flags='$d_statfs_f_flags'
21939 d_statfs_s='$d_statfs_s'
21940 d_statvfs='$d_statvfs'
21941 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21942 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21943 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21944 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21945 d_stdio_stream_array='$d_stdio_stream_array'
21946 d_stdiobase='$d_stdiobase'
21947 d_stdstdio='$d_stdstdio'
21948 d_strchr='$d_strchr'
21949 d_strcoll='$d_strcoll'
21950 d_strctcpy='$d_strctcpy'
21951 d_strerrm='$d_strerrm'
21952 d_strerror='$d_strerror'
21953 d_strerror_r='$d_strerror_r'
21954 d_strftime='$d_strftime'
21955 d_strlcat='$d_strlcat'
21956 d_strlcpy='$d_strlcpy'
21957 d_strtod='$d_strtod'
21958 d_strtol='$d_strtol'
21959 d_strtold='$d_strtold'
21960 d_strtoll='$d_strtoll'
21961 d_strtoq='$d_strtoq'
21962 d_strtoul='$d_strtoul'
21963 d_strtoull='$d_strtoull'
21964 d_strtouq='$d_strtouq'
21965 d_strxfrm='$d_strxfrm'
21966 d_suidsafe='$d_suidsafe'
21967 d_symlink='$d_symlink'
21968 d_syscall='$d_syscall'
21969 d_syscallproto='$d_syscallproto'
21970 d_sysconf='$d_sysconf'
21971 d_sysernlst='$d_sysernlst'
21972 d_syserrlst='$d_syserrlst'
21973 d_system='$d_system'
21974 d_tcgetpgrp='$d_tcgetpgrp'
21975 d_tcsetpgrp='$d_tcsetpgrp'
21976 d_telldir='$d_telldir'
21977 d_telldirproto='$d_telldirproto'
21978 d_time='$d_time'
21979 d_times='$d_times'
21980 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21981 d_tm_tm_zone='$d_tm_tm_zone'
21982 d_tmpnam_r='$d_tmpnam_r'
21983 d_truncate='$d_truncate'
21984 d_ttyname_r='$d_ttyname_r'
21985 d_tzname='$d_tzname'
21986 d_u32align='$d_u32align'
21987 d_ualarm='$d_ualarm'
21988 d_umask='$d_umask'
21989 d_uname='$d_uname'
21990 d_union_semun='$d_union_semun'
21991 d_unordered='$d_unordered'
21992 d_unsetenv='$d_unsetenv'
21993 d_usleep='$d_usleep'
21994 d_usleepproto='$d_usleepproto'
21995 d_ustat='$d_ustat'
21996 d_vendorarch='$d_vendorarch'
21997 d_vendorbin='$d_vendorbin'
21998 d_vendorlib='$d_vendorlib'
21999 d_vendorscript='$d_vendorscript'
22000 d_vfork='$d_vfork'
22001 d_void_closedir='$d_void_closedir'
22002 d_voidsig='$d_voidsig'
22003 d_voidtty='$d_voidtty'
22004 d_volatile='$d_volatile'
22005 d_vprintf='$d_vprintf'
22006 d_vsnprintf='$d_vsnprintf'
22007 d_wait4='$d_wait4'
22008 d_waitpid='$d_waitpid'
22009 d_wcstombs='$d_wcstombs'
22010 d_wctomb='$d_wctomb'
22011 d_writev='$d_writev'
22012 d_xenix='$d_xenix'
22013 date='$date'
22014 db_hashtype='$db_hashtype'
22015 db_prefixtype='$db_prefixtype'
22016 db_version_major='$db_version_major'
22017 db_version_minor='$db_version_minor'
22018 db_version_patch='$db_version_patch'
22019 defvoidused='$defvoidused'
22020 direntrytype='$direntrytype'
22021 dlext='$dlext'
22022 dlsrc='$dlsrc'
22023 doublesize='$doublesize'
22024 drand01='$drand01'
22025 drand48_r_proto='$drand48_r_proto'
22026 dynamic_ext='$dynamic_ext'
22027 eagain='$eagain'
22028 ebcdic='$ebcdic'
22029 echo='$echo'
22030 egrep='$egrep'
22031 emacs='$emacs'
22032 endgrent_r_proto='$endgrent_r_proto'
22033 endhostent_r_proto='$endhostent_r_proto'
22034 endnetent_r_proto='$endnetent_r_proto'
22035 endprotoent_r_proto='$endprotoent_r_proto'
22036 endpwent_r_proto='$endpwent_r_proto'
22037 endservent_r_proto='$endservent_r_proto'
22038 eunicefix='$eunicefix'
22039 exe_ext='$exe_ext'
22040 expr='$expr'
22041 extensions='$extensions'
22042 extras='$extras'
22043 fflushNULL='$fflushNULL'
22044 fflushall='$fflushall'
22045 find='$find'
22046 firstmakefile='$firstmakefile'
22047 flex='$flex'
22048 fpossize='$fpossize'
22049 fpostype='$fpostype'
22050 freetype='$freetype'
22051 from='$from'
22052 full_ar='$full_ar'
22053 full_csh='$full_csh'
22054 full_sed='$full_sed'
22055 gccansipedantic='$gccansipedantic'
22056 gccosandvers='$gccosandvers'
22057 gccversion='$gccversion'
22058 getgrent_r_proto='$getgrent_r_proto'
22059 getgrgid_r_proto='$getgrgid_r_proto'
22060 getgrnam_r_proto='$getgrnam_r_proto'
22061 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22062 gethostbyname_r_proto='$gethostbyname_r_proto'
22063 gethostent_r_proto='$gethostent_r_proto'
22064 getlogin_r_proto='$getlogin_r_proto'
22065 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22066 getnetbyname_r_proto='$getnetbyname_r_proto'
22067 getnetent_r_proto='$getnetent_r_proto'
22068 getprotobyname_r_proto='$getprotobyname_r_proto'
22069 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22070 getprotoent_r_proto='$getprotoent_r_proto'
22071 getpwent_r_proto='$getpwent_r_proto'
22072 getpwnam_r_proto='$getpwnam_r_proto'
22073 getpwuid_r_proto='$getpwuid_r_proto'
22074 getservbyname_r_proto='$getservbyname_r_proto'
22075 getservbyport_r_proto='$getservbyport_r_proto'
22076 getservent_r_proto='$getservent_r_proto'
22077 getspnam_r_proto='$getspnam_r_proto'
22078 gidformat='$gidformat'
22079 gidsign='$gidsign'
22080 gidsize='$gidsize'
22081 gidtype='$gidtype'
22082 glibpth='$glibpth'
22083 gmake='$gmake'
22084 gmtime_r_proto='$gmtime_r_proto'
22085 gnulibc_version='$gnulibc_version'
22086 grep='$grep'
22087 groupcat='$groupcat'
22088 groupstype='$groupstype'
22089 gzip='$gzip'
22090 h_fcntl='$h_fcntl'
22091 h_sysfile='$h_sysfile'
22092 hint='$hint'
22093 hostcat='$hostcat'
22094 html1dir='$html1dir'
22095 html1direxp='$html1direxp'
22096 html3dir='$html3dir'
22097 html3direxp='$html3direxp'
22098 i16size='$i16size'
22099 i16type='$i16type'
22100 i32size='$i32size'
22101 i32type='$i32type'
22102 i64size='$i64size'
22103 i64type='$i64type'
22104 i8size='$i8size'
22105 i8type='$i8type'
22106 i_arpainet='$i_arpainet'
22107 i_bsdioctl='$i_bsdioctl'
22108 i_crypt='$i_crypt'
22109 i_db='$i_db'
22110 i_dbm='$i_dbm'
22111 i_dirent='$i_dirent'
22112 i_dld='$i_dld'
22113 i_dlfcn='$i_dlfcn'
22114 i_fcntl='$i_fcntl'
22115 i_float='$i_float'
22116 i_fp='$i_fp'
22117 i_fp_class='$i_fp_class'
22118 i_gdbm='$i_gdbm'
22119 i_grp='$i_grp'
22120 i_ieeefp='$i_ieeefp'
22121 i_inttypes='$i_inttypes'
22122 i_langinfo='$i_langinfo'
22123 i_libutil='$i_libutil'
22124 i_limits='$i_limits'
22125 i_locale='$i_locale'
22126 i_machcthr='$i_machcthr'
22127 i_malloc='$i_malloc'
22128 i_math='$i_math'
22129 i_memory='$i_memory'
22130 i_mntent='$i_mntent'
22131 i_ndbm='$i_ndbm'
22132 i_netdb='$i_netdb'
22133 i_neterrno='$i_neterrno'
22134 i_netinettcp='$i_netinettcp'
22135 i_niin='$i_niin'
22136 i_poll='$i_poll'
22137 i_prot='$i_prot'
22138 i_pthread='$i_pthread'
22139 i_pwd='$i_pwd'
22140 i_rpcsvcdbm='$i_rpcsvcdbm'
22141 i_sfio='$i_sfio'
22142 i_sgtty='$i_sgtty'
22143 i_shadow='$i_shadow'
22144 i_socks='$i_socks'
22145 i_stdarg='$i_stdarg'
22146 i_stddef='$i_stddef'
22147 i_stdlib='$i_stdlib'
22148 i_string='$i_string'
22149 i_sunmath='$i_sunmath'
22150 i_sysaccess='$i_sysaccess'
22151 i_sysdir='$i_sysdir'
22152 i_sysfile='$i_sysfile'
22153 i_sysfilio='$i_sysfilio'
22154 i_sysin='$i_sysin'
22155 i_sysioctl='$i_sysioctl'
22156 i_syslog='$i_syslog'
22157 i_sysmman='$i_sysmman'
22158 i_sysmode='$i_sysmode'
22159 i_sysmount='$i_sysmount'
22160 i_sysndir='$i_sysndir'
22161 i_sysparam='$i_sysparam'
22162 i_sysresrc='$i_sysresrc'
22163 i_syssecrt='$i_syssecrt'
22164 i_sysselct='$i_sysselct'
22165 i_syssockio='$i_syssockio'
22166 i_sysstat='$i_sysstat'
22167 i_sysstatfs='$i_sysstatfs'
22168 i_sysstatvfs='$i_sysstatvfs'
22169 i_systime='$i_systime'
22170 i_systimek='$i_systimek'
22171 i_systimes='$i_systimes'
22172 i_systypes='$i_systypes'
22173 i_sysuio='$i_sysuio'
22174 i_sysun='$i_sysun'
22175 i_sysutsname='$i_sysutsname'
22176 i_sysvfs='$i_sysvfs'
22177 i_syswait='$i_syswait'
22178 i_termio='$i_termio'
22179 i_termios='$i_termios'
22180 i_time='$i_time'
22181 i_unistd='$i_unistd'
22182 i_ustat='$i_ustat'
22183 i_utime='$i_utime'
22184 i_values='$i_values'
22185 i_varargs='$i_varargs'
22186 i_varhdr='$i_varhdr'
22187 i_vfork='$i_vfork'
22188 ignore_versioned_solibs='$ignore_versioned_solibs'
22189 inc_version_list='$inc_version_list'
22190 inc_version_list_init='$inc_version_list_init'
22191 incpath='$incpath'
22192 inews='$inews'
22193 initialinstalllocation='$initialinstalllocation'
22194 installarchlib='$installarchlib'
22195 installbin='$installbin'
22196 installhtml1dir='$installhtml1dir'
22197 installhtml3dir='$installhtml3dir'
22198 installman1dir='$installman1dir'
22199 installman3dir='$installman3dir'
22200 installprefix='$installprefix'
22201 installprefixexp='$installprefixexp'
22202 installprivlib='$installprivlib'
22203 installscript='$installscript'
22204 installsitearch='$installsitearch'
22205 installsitebin='$installsitebin'
22206 installsitehtml1dir='$installsitehtml1dir'
22207 installsitehtml3dir='$installsitehtml3dir'
22208 installsitelib='$installsitelib'
22209 installsiteman1dir='$installsiteman1dir'
22210 installsiteman3dir='$installsiteman3dir'
22211 installsitescript='$installsitescript'
22212 installstyle='$installstyle'
22213 installusrbinperl='$installusrbinperl'
22214 installvendorarch='$installvendorarch'
22215 installvendorbin='$installvendorbin'
22216 installvendorhtml1dir='$installvendorhtml1dir'
22217 installvendorhtml3dir='$installvendorhtml3dir'
22218 installvendorlib='$installvendorlib'
22219 installvendorman1dir='$installvendorman1dir'
22220 installvendorman3dir='$installvendorman3dir'
22221 installvendorscript='$installvendorscript'
22222 intsize='$intsize'
22223 issymlink='$issymlink'
22224 ivdformat='$ivdformat'
22225 ivsize='$ivsize'
22226 ivtype='$ivtype'
22227 known_extensions='$known_extensions'
22228 ksh='$ksh'
22229 ld='$ld'
22230 lddlflags='$lddlflags'
22231 ldflags='$ldflags'
22232 ldflags_uselargefiles='$ldflags_uselargefiles'
22233 ldlibpthname='$ldlibpthname'
22234 less='$less'
22235 lib_ext='$lib_ext'
22236 libc='$libc'
22237 libperl='$libperl'
22238 libpth='$libpth'
22239 libs='$libs'
22240 libsdirs='$libsdirs'
22241 libsfiles='$libsfiles'
22242 libsfound='$libsfound'
22243 libspath='$libspath'
22244 libswanted='$libswanted'
22245 libswanted_uselargefiles='$libswanted_uselargefiles'
22246 line='$line'
22247 lint='$lint'
22248 lkflags='$lkflags'
22249 ln='$ln'
22250 lns='$lns'
22251 localtime_r_proto='$localtime_r_proto'
22252 locincpth='$locincpth'
22253 loclibpth='$loclibpth'
22254 longdblsize='$longdblsize'
22255 longlongsize='$longlongsize'
22256 longsize='$longsize'
22257 lp='$lp'
22258 lpr='$lpr'
22259 ls='$ls'
22260 lseeksize='$lseeksize'
22261 lseektype='$lseektype'
22262 mad='$mad'
22263 madlyh='$madlyh'
22264 madlyobj='$madlyobj'
22265 madlysrc='$madlysrc'
22266 mail='$mail'
22267 mailx='$mailx'
22268 make='$make'
22269 make_set_make='$make_set_make'
22270 mallocobj='$mallocobj'
22271 mallocsrc='$mallocsrc'
22272 malloctype='$malloctype'
22273 man1dir='$man1dir'
22274 man1direxp='$man1direxp'
22275 man1ext='$man1ext'
22276 man3dir='$man3dir'
22277 man3direxp='$man3direxp'
22278 man3ext='$man3ext'
22279 mips_type='$mips_type'
22280 mistrustnm='$mistrustnm'
22281 mkdir='$mkdir'
22282 mmaptype='$mmaptype'
22283 modetype='$modetype'
22284 more='$more'
22285 multiarch='$multiarch'
22286 mv='$mv'
22287 myarchname='$myarchname'
22288 mydomain='$mydomain'
22289 myhostname='$myhostname'
22290 myuname='$myuname'
22291 n='$n'
22292 need_va_copy='$need_va_copy'
22293 netdb_hlen_type='$netdb_hlen_type'
22294 netdb_host_type='$netdb_host_type'
22295 netdb_name_type='$netdb_name_type'
22296 netdb_net_type='$netdb_net_type'
22297 nm='$nm'
22298 nm_opt='$nm_opt'
22299 nm_so_opt='$nm_so_opt'
22300 nonxs_ext='$nonxs_ext'
22301 nroff='$nroff'
22302 nvEUformat='$nvEUformat'
22303 nvFUformat='$nvFUformat'
22304 nvGUformat='$nvGUformat'
22305 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22306 nveformat='$nveformat'
22307 nvfformat='$nvfformat'
22308 nvgformat='$nvgformat'
22309 nvsize='$nvsize'
22310 nvtype='$nvtype'
22311 o_nonblock='$o_nonblock'
22312 obj_ext='$obj_ext'
22313 old_pthread_create_joinable='$old_pthread_create_joinable'
22314 optimize='$optimize'
22315 orderlib='$orderlib'
22316 osname='$osname'
22317 osvers='$osvers'
22318 otherlibdirs='$otherlibdirs'
22319 package='$package'
22320 pager='$pager'
22321 passcat='$passcat'
22322 patchlevel='$patchlevel'
22323 path_sep='$path_sep'
22324 perl5='$perl5'
22325 perl='$perl'
22326 perl_patchlevel='$perl_patchlevel'
22327 perladmin='$perladmin'
22328 perllibs='$perllibs'
22329 perlpath='$perlpath'
22330 pg='$pg'
22331 phostname='$phostname'
22332 pidtype='$pidtype'
22333 plibpth='$plibpth'
22334 pmake='$pmake'
22335 pr='$pr'
22336 prefix='$prefix'
22337 prefixexp='$prefixexp'
22338 privlib='$privlib'
22339 privlibexp='$privlibexp'
22340 procselfexe='$procselfexe'
22341 prototype='$prototype'
22342 ptrsize='$ptrsize'
22343 quadkind='$quadkind'
22344 quadtype='$quadtype'
22345 randbits='$randbits'
22346 randfunc='$randfunc'
22347 random_r_proto='$random_r_proto'
22348 randseedtype='$randseedtype'
22349 ranlib='$ranlib'
22350 rd_nodata='$rd_nodata'
22351 readdir64_r_proto='$readdir64_r_proto'
22352 readdir_r_proto='$readdir_r_proto'
22353 revision='$revision'
22354 rm='$rm'
22355 rm_try='$rm_try'
22356 rmail='$rmail'
22357 run='$run'
22358 runnm='$runnm'
22359 sPRIEUldbl='$sPRIEUldbl'
22360 sPRIFUldbl='$sPRIFUldbl'
22361 sPRIGUldbl='$sPRIGUldbl'
22362 sPRIXU64='$sPRIXU64'
22363 sPRId64='$sPRId64'
22364 sPRIeldbl='$sPRIeldbl'
22365 sPRIfldbl='$sPRIfldbl'
22366 sPRIgldbl='$sPRIgldbl'
22367 sPRIi64='$sPRIi64'
22368 sPRIo64='$sPRIo64'
22369 sPRIu64='$sPRIu64'
22370 sPRIx64='$sPRIx64'
22371 sSCNfldbl='$sSCNfldbl'
22372 sched_yield='$sched_yield'
22373 scriptdir='$scriptdir'
22374 scriptdirexp='$scriptdirexp'
22375 sed='$sed'
22376 seedfunc='$seedfunc'
22377 selectminbits='$selectminbits'
22378 selecttype='$selecttype'
22379 sendmail='$sendmail'
22380 setgrent_r_proto='$setgrent_r_proto'
22381 sethostent_r_proto='$sethostent_r_proto'
22382 setlocale_r_proto='$setlocale_r_proto'
22383 setnetent_r_proto='$setnetent_r_proto'
22384 setprotoent_r_proto='$setprotoent_r_proto'
22385 setpwent_r_proto='$setpwent_r_proto'
22386 setservent_r_proto='$setservent_r_proto'
22387 sh='$sh'
22388 shar='$shar'
22389 sharpbang='$sharpbang'
22390 shmattype='$shmattype'
22391 shortsize='$shortsize'
22392 shrpenv='$shrpenv'
22393 shsharp='$shsharp'
22394 sig_count='$sig_count'
22395 sig_name='$sig_name'
22396 sig_name_init='$sig_name_init'
22397 sig_num='$sig_num'
22398 sig_num_init='$sig_num_init'
22399 sig_size='$sig_size'
22400 signal_t='$signal_t'
22401 sitearch='$sitearch'
22402 sitearchexp='$sitearchexp'
22403 sitebin='$sitebin'
22404 sitebinexp='$sitebinexp'
22405 sitehtml1dir='$sitehtml1dir'
22406 sitehtml1direxp='$sitehtml1direxp'
22407 sitehtml3dir='$sitehtml3dir'
22408 sitehtml3direxp='$sitehtml3direxp'
22409 sitelib='$sitelib'
22410 sitelib_stem='$sitelib_stem'
22411 sitelibexp='$sitelibexp'
22412 siteman1dir='$siteman1dir'
22413 siteman1direxp='$siteman1direxp'
22414 siteman3dir='$siteman3dir'
22415 siteman3direxp='$siteman3direxp'
22416 siteprefix='$siteprefix'
22417 siteprefixexp='$siteprefixexp'
22418 sitescript='$sitescript'
22419 sitescriptexp='$sitescriptexp'
22420 sizesize='$sizesize'
22421 sizetype='$sizetype'
22422 sleep='$sleep'
22423 smail='$smail'
22424 so='$so'
22425 sockethdr='$sockethdr'
22426 socketlib='$socketlib'
22427 socksizetype='$socksizetype'
22428 sort='$sort'
22429 spackage='$spackage'
22430 spitshell='$spitshell'
22431 srand48_r_proto='$srand48_r_proto'
22432 srandom_r_proto='$srandom_r_proto'
22433 src='$src'
22434 ssizetype='$ssizetype'
22435 startperl='$startperl'
22436 startsh='$startsh'
22437 static_ext='$static_ext'
22438 stdchar='$stdchar'
22439 stdio_base='$stdio_base'
22440 stdio_bufsiz='$stdio_bufsiz'
22441 stdio_cnt='$stdio_cnt'
22442 stdio_filbuf='$stdio_filbuf'
22443 stdio_ptr='$stdio_ptr'
22444 stdio_stream_array='$stdio_stream_array'
22445 strerror_r_proto='$strerror_r_proto'
22446 strings='$strings'
22447 submit='$submit'
22448 subversion='$subversion'
22449 sysman='$sysman'
22450 tail='$tail'
22451 tar='$tar'
22452 targetarch='$targetarch'
22453 tbl='$tbl'
22454 tee='$tee'
22455 test='$test'
22456 timeincl='$timeincl'
22457 timetype='$timetype'
22458 tmpnam_r_proto='$tmpnam_r_proto'
22459 to='$to'
22460 touch='$touch'
22461 tr='$tr'
22462 trnl='$trnl'
22463 troff='$troff'
22464 ttyname_r_proto='$ttyname_r_proto'
22465 u16size='$u16size'
22466 u16type='$u16type'
22467 u32size='$u32size'
22468 u32type='$u32type'
22469 u64size='$u64size'
22470 u64type='$u64type'
22471 u8size='$u8size'
22472 u8type='$u8type'
22473 uidformat='$uidformat'
22474 uidsign='$uidsign'
22475 uidsize='$uidsize'
22476 uidtype='$uidtype'
22477 uname='$uname'
22478 uniq='$uniq'
22479 uquadtype='$uquadtype'
22480 use5005threads='$use5005threads'
22481 use64bitall='$use64bitall'
22482 use64bitint='$use64bitint'
22483 usecrosscompile='$usecrosscompile'
22484 usedl='$usedl'
22485 usefaststdio='$usefaststdio'
22486 useithreads='$useithreads'
22487 uselargefiles='$uselargefiles'
22488 uselongdouble='$uselongdouble'
22489 usemallocwrap='$usemallocwrap'
22490 usemorebits='$usemorebits'
22491 usemultiplicity='$usemultiplicity'
22492 usemymalloc='$usemymalloc'
22493 usenm='$usenm'
22494 useopcode='$useopcode'
22495 useperlio='$useperlio'
22496 useposix='$useposix'
22497 usereentrant='$usereentrant'
22498 userelocatableinc='$userelocatableinc'
22499 usesfio='$usesfio'
22500 useshrplib='$useshrplib'
22501 usesitecustomize='$usesitecustomize'
22502 usesocks='$usesocks'
22503 usethreads='$usethreads'
22504 usevendorprefix='$usevendorprefix'
22505 usevfork='$usevfork'
22506 usrinc='$usrinc'
22507 uuname='$uuname'
22508 uvXUformat='$uvXUformat'
22509 uvoformat='$uvoformat'
22510 uvsize='$uvsize'
22511 uvtype='$uvtype'
22512 uvuformat='$uvuformat'
22513 uvxformat='$uvxformat'
22514 vendorarch='$vendorarch'
22515 vendorarchexp='$vendorarchexp'
22516 vendorbin='$vendorbin'
22517 vendorbinexp='$vendorbinexp'
22518 vendorhtml1dir='$vendorhtml1dir'
22519 vendorhtml1direxp='$vendorhtml1direxp'
22520 vendorhtml3dir='$vendorhtml3dir'
22521 vendorhtml3direxp='$vendorhtml3direxp'
22522 vendorlib='$vendorlib'
22523 vendorlib_stem='$vendorlib_stem'
22524 vendorlibexp='$vendorlibexp'
22525 vendorman1dir='$vendorman1dir'
22526 vendorman1direxp='$vendorman1direxp'
22527 vendorman3dir='$vendorman3dir'
22528 vendorman3direxp='$vendorman3direxp'
22529 vendorprefix='$vendorprefix'
22530 vendorprefixexp='$vendorprefixexp'
22531 vendorscript='$vendorscript'
22532 vendorscriptexp='$vendorscriptexp'
22533 version='$version'
22534 version_patchlevel_string='$version_patchlevel_string'
22535 versiononly='$versiononly'
22536 vi='$vi'
22537 voidflags='$voidflags'
22538 xlibpth='$xlibpth'
22539 yacc='$yacc'
22540 yaccflags='$yaccflags'
22541 zcat='$zcat'
22542 zip='$zip'
22543 EOT
22544
22545 : Add in command line options if available
22546 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22547
22548 : add special variables
22549 $test -f $src/patchlevel.h && \
22550 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22551 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22552 echo "PERL_CONFIG_SH=true" >>config.sh
22553
22554 : propagate old symbols
22555 if $test -f UU/config.sh; then
22556         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22557         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22558         $sort | $uniq -u >UU/oldsyms
22559         set X `cat UU/oldsyms`
22560         shift
22561         case $# in
22562         0) ;;
22563         *)
22564                 cat <<EOM
22565 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22566 EOM
22567                 echo "# Variables propagated from previous config.sh file." >>config.sh
22568                 for sym in `cat UU/oldsyms`; do
22569                         echo "    Propagating $hint variable "'$'"$sym..."
22570                         eval 'tmp="$'"${sym}"'"'
22571                         echo "$tmp" | \
22572                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22573                 done
22574                 ;;
22575         esac
22576 fi
22577
22578 : Finish up by extracting the .SH files
22579 case "$alldone" in
22580 exit)
22581         $rm -rf UU
22582         echo "Extraction done."
22583         exit 0
22584         ;;
22585 cont)
22586         ;;
22587 '')
22588         dflt=''
22589         nostick=true
22590         $cat <<EOM
22591
22592 If you'd like to make any changes to the config.sh file before I begin
22593 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22594
22595 EOM
22596         rp="Press return or use a shell escape to edit config.sh:"
22597         . UU/myread
22598         nostick=''
22599         case "$ans" in
22600         '') ;;
22601         *) : in case they cannot read
22602                 sh 1>&4 -c "$ans";;
22603         esac
22604         ;;
22605 esac
22606
22607 : if this fails, just run all the .SH files by hand
22608 . ./config.sh
22609
22610 echo " "
22611 exec 1>&4
22612 pwd=`pwd`
22613 . ./UU/extract
22614 cd "$pwd"
22615
22616 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22617         dflt=y
22618         case "$silent" in
22619         true) ;;
22620         *)
22621                 $cat <<EOM
22622
22623 Now you need to generate make dependencies by running "$make depend".
22624 You might prefer to run it in background: "$make depend > makedepend.out &"
22625 It can take a while, so you might not want to run it right now.
22626
22627 EOM
22628                 ;;
22629         esac
22630         rp="Run $make depend now?"
22631         . UU/myread
22632         case "$ans" in
22633         y*)
22634                 $make depend && echo "Now you must run '$make'."
22635                 ;;
22636         *)
22637                 echo "You must run '$make depend' then '$make'."
22638                 ;;
22639         esac
22640 elif test -f [Mm]akefile; then
22641         echo " "
22642         echo "Now you must run a $make."
22643 else
22644         echo "Configure done."
22645 fi
22646
22647 if $test -f Policy.sh; then
22648     $cat <<EOM
22649
22650 If you compile $package on a different machine or from a different object
22651 directory, copy the Policy.sh file from this object directory to the
22652 new one before you run Configure -- this will help you with most of
22653 the policy defaults.
22654
22655 EOM
22656 fi
22657 if $test -f config.msg; then
22658     echo "Hmm.  I also noted the following information while running:"
22659     echo " "
22660     $cat config.msg >&4
22661     $rm -f config.msg
22662 fi
22663 $rm -f kit*isdone ark*isdone
22664 $rm -rf UU
22665
22666 : End of Configure
22667