The ext/Cwd/Cwd.xs part of...
[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_assert=''
843 i_arpainet=''
844 i_crypt=''
845 db_hashtype=''
846 db_prefixtype=''
847 db_version_major=''
848 db_version_minor=''
849 db_version_patch=''
850 i_db=''
851 i_dbm=''
852 i_rpcsvcdbm=''
853 d_dirnamlen=''
854 direntrytype=''
855 i_dirent=''
856 i_dld=''
857 i_dlfcn=''
858 i_fcntl=''
859 i_float=''
860 i_fp=''
861 i_fp_class=''
862 i_gdbm=''
863 d_grpasswd=''
864 i_grp=''
865 i_ieeefp=''
866 i_inttypes=''
867 i_langinfo=''
868 i_libutil=''
869 i_limits=''
870 i_locale=''
871 i_machcthr=''
872 i_malloc=''
873 i_math=''
874 i_memory=''
875 i_mntent=''
876 i_ndbm=''
877 i_netdb=''
878 i_neterrno=''
879 i_netinettcp=''
880 i_niin=''
881 i_sysin=''
882 i_poll=''
883 i_prot=''
884 i_pthread=''
885 d_pwage=''
886 d_pwchange=''
887 d_pwclass=''
888 d_pwcomment=''
889 d_pwexpire=''
890 d_pwgecos=''
891 d_pwpasswd=''
892 d_pwquota=''
893 i_pwd=''
894 i_sfio=''
895 i_shadow=''
896 i_socks=''
897 i_stddef=''
898 i_stdlib=''
899 i_string=''
900 strings=''
901 i_sunmath=''
902 i_sysaccess=''
903 i_sysdir=''
904 i_sysfile=''
905 d_voidtty=''
906 i_bsdioctl=''
907 i_sysfilio=''
908 i_sysioctl=''
909 i_syssockio=''
910 i_syslog=''
911 i_sysmman=''
912 i_sysmode=''
913 i_sysmount=''
914 i_sysndir=''
915 i_sysparam=''
916 i_sysresrc=''
917 i_syssecrt=''
918 i_sysselct=''
919 i_sysstat=''
920 i_sysstatfs=''
921 i_sysstatvfs=''
922 i_systimes=''
923 i_systypes=''
924 i_sysuio=''
925 i_sysun=''
926 i_sysutsname=''
927 i_sysvfs=''
928 i_syswait=''
929 i_sgtty=''
930 i_termio=''
931 i_termios=''
932 d_tm_tm_gmtoff=''
933 d_tm_tm_zone=''
934 i_systime=''
935 i_systimek=''
936 i_time=''
937 timeincl=''
938 i_unistd=''
939 i_ustat=''
940 i_utime=''
941 i_values=''
942 i_stdarg=''
943 i_varargs=''
944 i_varhdr=''
945 i_vfork=''
946 d_inc_version_list=''
947 inc_version_list=''
948 inc_version_list_init=''
949 installprefix=''
950 installprefixexp=''
951 installstyle=''
952 installusrbinperl=''
953 intsize=''
954 longsize=''
955 shortsize=''
956 issymlink=''
957 libc=''
958 ldlibpthname=''
959 libperl=''
960 shrpenv=''
961 useshrplib=''
962 glibpth=''
963 libpth=''
964 loclibpth=''
965 plibpth=''
966 xlibpth=''
967 ignore_versioned_solibs=''
968 libs=''
969 libsdirs=''
970 libsfiles=''
971 libsfound=''
972 libspath=''
973 lns=''
974 d_PRIEUldbl=''
975 d_PRIFUldbl=''
976 d_PRIGUldbl=''
977 d_PRIeldbl=''
978 d_PRIfldbl=''
979 d_PRIgldbl=''
980 d_SCNfldbl=''
981 sPRIEUldbl=''
982 sPRIFUldbl=''
983 sPRIGUldbl=''
984 sPRIeldbl=''
985 sPRIfldbl=''
986 sPRIgldbl=''
987 sSCNfldbl=''
988 lseeksize=''
989 lseektype=''
990 mad=''
991 madlyh=''
992 madlyobj=''
993 madlysrc=''
994 make_set_make=''
995 d_mymalloc=''
996 freetype=''
997 mallocobj=''
998 mallocsrc=''
999 malloctype=''
1000 usemallocwrap=''
1001 usemymalloc=''
1002 installman1dir=''
1003 man1dir=''
1004 man1direxp=''
1005 man1ext=''
1006 installman3dir=''
1007 man3dir=''
1008 man3direxp=''
1009 man3ext=''
1010 modetype=''
1011 multiarch=''
1012 mydomain=''
1013 myhostname=''
1014 phostname=''
1015 c=''
1016 n=''
1017 d_eofnblk=''
1018 eagain=''
1019 o_nonblock=''
1020 rd_nodata=''
1021 need_va_copy=''
1022 netdb_hlen_type=''
1023 netdb_host_type=''
1024 netdb_name_type=''
1025 netdb_net_type=''
1026 groupcat=''
1027 hostcat=''
1028 passcat=''
1029 orderlib=''
1030 ranlib=''
1031 d_perl_otherlibdirs=''
1032 otherlibdirs=''
1033 package=''
1034 spackage=''
1035 pager=''
1036 api_revision=''
1037 api_subversion=''
1038 api_version=''
1039 api_versionstring=''
1040 patchlevel=''
1041 perl_patchlevel=''
1042 revision=''
1043 subversion=''
1044 version=''
1045 version_patchlevel_string=''
1046 perl5=''
1047 perladmin=''
1048 perlpath=''
1049 d_nv_preserves_uv=''
1050 d_nv_zero_is_allbits_zero=''
1051 i16size=''
1052 i16type=''
1053 i32size=''
1054 i32type=''
1055 i64size=''
1056 i64type=''
1057 i8size=''
1058 i8type=''
1059 ivsize=''
1060 ivtype=''
1061 nv_preserves_uv_bits=''
1062 nvsize=''
1063 nvtype=''
1064 u16size=''
1065 u16type=''
1066 u32size=''
1067 u32type=''
1068 u64size=''
1069 u64type=''
1070 u8size=''
1071 u8type=''
1072 uvsize=''
1073 uvtype=''
1074 ivdformat=''
1075 nvEUformat=''
1076 nvFUformat=''
1077 nvGUformat=''
1078 nveformat=''
1079 nvfformat=''
1080 nvgformat=''
1081 uvXUformat=''
1082 uvoformat=''
1083 uvuformat=''
1084 uvxformat=''
1085 pidtype=''
1086 prefix=''
1087 prefixexp=''
1088 installprivlib=''
1089 privlib=''
1090 privlibexp=''
1091 prototype=''
1092 ptrsize=''
1093 d_PRIXU64=''
1094 d_PRId64=''
1095 d_PRIi64=''
1096 d_PRIo64=''
1097 d_PRIu64=''
1098 d_PRIx64=''
1099 sPRIXU64=''
1100 sPRId64=''
1101 sPRIi64=''
1102 sPRIo64=''
1103 sPRIu64=''
1104 sPRIx64=''
1105 d_quad=''
1106 quadkind=''
1107 quadtype=''
1108 uquadtype=''
1109 drand01=''
1110 randbits=''
1111 randfunc=''
1112 randseedtype=''
1113 seedfunc=''
1114 installscript=''
1115 scriptdir=''
1116 scriptdirexp=''
1117 selectminbits=''
1118 selecttype=''
1119 sh=''
1120 sig_count=''
1121 sig_name=''
1122 sig_name_init=''
1123 sig_num=''
1124 sig_num_init=''
1125 sig_size=''
1126 d_sitearch=''
1127 installsitearch=''
1128 sitearch=''
1129 sitearchexp=''
1130 installsitebin=''
1131 sitebin=''
1132 sitebinexp=''
1133 installsitehtml1dir=''
1134 sitehtml1dir=''
1135 sitehtml1direxp=''
1136 installsitehtml3dir=''
1137 sitehtml3dir=''
1138 sitehtml3direxp=''
1139 installsitelib=''
1140 sitelib=''
1141 sitelib_stem=''
1142 sitelibexp=''
1143 installsiteman1dir=''
1144 siteman1dir=''
1145 siteman1direxp=''
1146 installsiteman3dir=''
1147 siteman3dir=''
1148 siteman3direxp=''
1149 siteprefix=''
1150 siteprefixexp=''
1151 installsitescript=''
1152 sitescript=''
1153 sitescriptexp=''
1154 sizesize=''
1155 sizetype=''
1156 so=''
1157 socksizetype=''
1158 sharpbang=''
1159 shsharp=''
1160 spitshell=''
1161 src=''
1162 ssizetype=''
1163 startperl=''
1164 startsh=''
1165 stdchar=''
1166 d_stdio_stream_array=''
1167 stdio_stream_array=''
1168 sysman=''
1169 trnl=''
1170 uidformat=''
1171 uidsign=''
1172 uidsize=''
1173 uidtype=''
1174 archname64=''
1175 use64bitall=''
1176 use64bitint=''
1177 usefaststdio=''
1178 ccflags_uselargefiles=''
1179 ldflags_uselargefiles=''
1180 libswanted_uselargefiles=''
1181 uselargefiles=''
1182 uselongdouble=''
1183 usemorebits=''
1184 usemultiplicity=''
1185 nm_opt=''
1186 nm_so_opt=''
1187 runnm=''
1188 usenm=''
1189 useperlio=''
1190 usesocks=''
1191 d_oldpthreads=''
1192 use5005threads=''
1193 useithreads=''
1194 usereentrant=''
1195 usethreads=''
1196 incpath=''
1197 mips_type=''
1198 usrinc=''
1199 d_vendorarch=''
1200 installvendorarch=''
1201 vendorarch=''
1202 vendorarchexp=''
1203 d_vendorbin=''
1204 installvendorbin=''
1205 vendorbin=''
1206 vendorbinexp=''
1207 installvendorhtml1dir=''
1208 vendorhtml1dir=''
1209 vendorhtml1direxp=''
1210 installvendorhtml3dir=''
1211 vendorhtml3dir=''
1212 vendorhtml3direxp=''
1213 d_vendorlib=''
1214 installvendorlib=''
1215 vendorlib=''
1216 vendorlib_stem=''
1217 vendorlibexp=''
1218 installvendorman1dir=''
1219 vendorman1dir=''
1220 vendorman1direxp=''
1221 installvendorman3dir=''
1222 vendorman3dir=''
1223 vendorman3direxp=''
1224 usevendorprefix=''
1225 vendorprefix=''
1226 vendorprefixexp=''
1227 d_vendorscript=''
1228 installvendorscript=''
1229 vendorscript=''
1230 vendorscriptexp=''
1231 versiononly=''
1232 defvoidused=''
1233 voidflags=''
1234 yacc=''
1235 yaccflags=''
1236 CONFIG=''
1237
1238 define='define'
1239 undef='undef'
1240 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1241 rmlist=''
1242
1243 : We must find out about Eunice early
1244 eunicefix=':'
1245 if test -f /etc/unixtovms; then
1246         eunicefix=/etc/unixtovms
1247 fi
1248 if test -f /etc/unixtovms.exe; then
1249         eunicefix=/etc/unixtovms.exe
1250 fi
1251
1252 : Set executable suffix now -- needed before hints available
1253 if test -f "/libs/version.library"; then
1254 : Amiga OS
1255     _exe=""
1256 elif test -f "/system/gnu_library/bin/ar.pm"; then
1257 : Stratus VOS
1258     _exe=".pm"
1259 elif test -n "$DJGPP"; then
1260 : DOS DJGPP
1261     _exe=".exe"
1262 elif test -d c:/. -o -n "$is_os2" ; then
1263 : OS/2 or cygwin
1264     _exe=".exe"
1265 fi
1266
1267 i_whoami=''
1268 : Trailing extension.  Override this in a hint file, if needed.
1269 : Extra object files, if any, needed on this platform.
1270 archobjs=''
1271 archname=''
1272 groupstype=''
1273 libnames=''
1274 : change the next line if compiling for Xenix/286 on Xenix/386
1275 xlibpth='/usr/lib/386 /lib/386'
1276 : Possible local library directories to search.
1277 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1278 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1279
1280 : general looking path for locating libraries
1281 glibpth="/lib /usr/lib $xlibpth"
1282 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1283 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1284 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1285 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1286
1287 : Private path used by Configure to find libraries.  Its value
1288 : is prepended to libpth. This variable takes care of special
1289 : machines, like the mips.  Usually, it should be empty.
1290 plibpth=''
1291
1292 : default library list
1293 libswanted=''
1294 : some systems want to use only the non-versioned libso:s
1295 ignore_versioned_solibs=''
1296 siteman1dir=''
1297 siteman3dir=''
1298 sitescript=''
1299 : set usethreads on the Configure command line to enable threads.
1300 usereentrant='undef'
1301 : full support for void wanted by default
1302 defvoidused=15
1303
1304 : Possible local include directories to search.
1305 : Set locincpth to "" in a hint file to defeat local include searches.
1306 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1307 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1308 :
1309 : no include file wanted by default
1310 inclwanted=''
1311
1312 : Enable -DEBUGGING and -DDEBUGGING from the command line
1313 EBUGGING=''
1314 DEBUGGING=old
1315
1316 ccname=''
1317 ccversion=''
1318 perllibs=''
1319 : set useposix=false in your hint file to disable the POSIX extension.
1320 useposix=true
1321 : set useopcode=false in your hint file to disable the Opcode extension.
1322 useopcode=true
1323 archname64=''
1324 ccflags_uselargefiles=''
1325 ldflags_uselargefiles=''
1326 libswanted_uselargefiles=''
1327 : set usemultiplicity on the Configure command line to enable multiplicity.
1328 : set usesocks on the Configure command line to enable socks.
1329 : List of libraries we want.
1330 : If anyone needs extra -lxxx, put those in a hint file.
1331 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1332 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1333 : We probably want to search /usr/shlib before most other libraries.
1334 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1335 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1336 glibpth="/usr/shlib $glibpth"
1337 : Do not use vfork unless overridden by a hint file.
1338 usevfork=false
1339
1340 : Find the basic shell for Bourne shell scripts
1341 case "$sh" in
1342 '')
1343         case "$SYSTYPE" in
1344         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1345         *) xxx='/bin/sh';;
1346         esac
1347         if test -f "$xxx"; then
1348                 sh="$xxx"
1349         else
1350                 : Build up a list and do a single loop so we can 'break' out.
1351                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1352                 for xxx in sh bash ksh pdksh ash; do
1353                         for p in $pth; do
1354                                 try="$try ${p}/${xxx}"
1355                         done
1356                 done
1357                 for xxx in $try; do
1358                         if test -f "$xxx"; then
1359                                 sh="$xxx";
1360                                 break
1361                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1362                                 sh="$xxx";
1363                                 break
1364                         elif test -f "$xxx.exe"; then
1365                                 sh="$xxx";
1366                                 break
1367                         fi
1368                 done
1369         fi
1370         ;;
1371 esac
1372
1373 case "$sh" in
1374 '')     cat >&2 <<EOM
1375 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1376
1377 Usually it's in /bin/sh.  How did you even get this far?
1378 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1379 we'll try to straighten this all out.
1380 EOM
1381         exit 1
1382         ;;
1383 esac
1384
1385 : see if sh knows # comments
1386 if `$sh -c '#' >/dev/null 2>&1`; then
1387         shsharp=true
1388         spitshell=cat
1389         xcat=/bin/cat
1390         test -f $xcat$_exe || xcat=/usr/bin/cat
1391         if test ! -f $xcat$_exe; then
1392                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1393                         if test -f $p/cat$_exe; then
1394                                 xcat=$p/cat
1395                                 break
1396                         fi
1397                 done
1398                 if test ! -f $xcat$_exe; then
1399                         echo "Can't find cat anywhere!"
1400                         exit 1
1401                 fi
1402         fi
1403         echo "#!$xcat" >sharp
1404         $eunicefix sharp
1405         chmod +x sharp
1406         ./sharp > today
1407         if test -s today; then
1408                 sharpbang='#!'
1409         else
1410                 echo "#! $xcat" > sharp
1411                 $eunicefix sharp
1412                 chmod +x sharp
1413                 ./sharp > today
1414                 if test -s today; then
1415                         sharpbang='#! '
1416                 else
1417                         sharpbang=': use '
1418                 fi
1419         fi
1420 else
1421         echo " "
1422         echo "Your $sh doesn't grok # comments--I will strip them later on."
1423         shsharp=false
1424         cd ..
1425         echo "exec grep -v '^[  ]*#'" >spitshell
1426         chmod +x spitshell
1427         $eunicefix spitshell
1428         spitshell=`pwd`/spitshell
1429         cd UU
1430         echo "I presume that if # doesn't work, #! won't work either!"
1431         sharpbang=': use '
1432 fi
1433 rm -f sharp today
1434
1435 : figure out how to guarantee sh startup
1436 case "$startsh" in
1437 '') startsh=${sharpbang}${sh} ;;
1438 *)
1439 esac
1440 cat >sharp <<EOSS
1441 $startsh
1442 set abc
1443 test "$?abc" != 1
1444 EOSS
1445
1446 chmod +x sharp
1447 $eunicefix sharp
1448 if ./sharp; then
1449         : echo "Yup, it does."
1450 else
1451         echo "Hmm... '$startsh' does not guarantee sh startup..."
1452         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1453 fi
1454 rm -f sharp
1455
1456
1457 : Save command line options in file UU/cmdline.opt for later use in
1458 : generating config.sh.
1459 cat > cmdline.opt <<EOSH
1460 # Configure command line arguments.
1461 config_arg0='$0'
1462 config_args='$*'
1463 config_argc=$#
1464 EOSH
1465 argn=1
1466 args_exp=''
1467 args_sep=''
1468 for arg in "$@"; do
1469         cat >>cmdline.opt <<EOSH
1470 config_arg$argn='$arg'
1471 EOSH
1472         # Extreme backslashitis: replace each ' by '"'"'
1473         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1474 $arg
1475 EOC
1476         arg_exp=`cat cmdl.opt`
1477         args_exp="$args_exp$args_sep'$arg_exp'"
1478         argn=`expr $argn + 1`
1479         args_sep=' '
1480 done
1481 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1482 # used by ./hints/os2.sh
1483 rm -f cmdl.opt
1484
1485 : produce awk script to parse command line options
1486 cat >options.awk <<'EOF'
1487 BEGIN {
1488         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1489
1490         len = length(optstr);
1491         for (i = 1; i <= len; i++) {
1492                 c = substr(optstr, i, 1);
1493                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1494                 if (a == ":") {
1495                         arg[c] = 1;
1496                         i++;
1497                 }
1498                 opt[c] = 1;
1499         }
1500 }
1501 {
1502         expect = 0;
1503         str = $0;
1504         if (substr(str, 1, 1) != "-") {
1505                 printf("'%s'\n", str);
1506                 next;
1507         }
1508         len = length($0);
1509         for (i = 2; i <= len; i++) {
1510                 c = substr(str, i, 1);
1511                 if (!opt[c]) {
1512                         printf("-%s\n", substr(str, i));
1513                         next;
1514                 }
1515                 printf("-%s\n", c);
1516                 if (arg[c]) {
1517                         if (i < len)
1518                                 printf("'%s'\n", substr(str, i + 1));
1519                         else
1520                                 expect = 1;
1521                         next;
1522                 }
1523         }
1524 }
1525 END {
1526         if (expect)
1527                 print "?";
1528 }
1529 EOF
1530
1531 : process the command line options
1532 set X `for arg in "$@"; do echo "X$arg"; done |
1533         sed -e s/X// | awk -f options.awk`
1534 eval "set $*"
1535 shift
1536 rm -f options.awk
1537
1538 : set up default values
1539 fastread=''
1540 reuseval=false
1541 config_sh=''
1542 alldone=''
1543 error=''
1544 silent=''
1545 extractsh=''
1546 override=''
1547 knowitall=''
1548 rm -f optdef.sh posthint.sh
1549 cat >optdef.sh <<EOS
1550 $startsh
1551 EOS
1552
1553
1554 : option parsing
1555 while test $# -gt 0; do
1556         case "$1" in
1557         -d) shift; fastread=yes;;
1558         -e) shift; alldone=cont;;
1559         -f)
1560                 shift
1561                 cd ..
1562                 if test -r "$1"; then
1563                         config_sh="$1"
1564                 else
1565                         echo "$me: cannot read config file $1." >&2
1566                         error=true
1567                 fi
1568                 cd UU
1569                 shift;;
1570         --help|\
1571         -h) shift; error=true;;
1572         -r) shift; reuseval=true;;
1573         -s) shift; silent=true; realsilent=true;;
1574         -E) shift; alldone=exit;;
1575         -K) shift; knowitall=true;;
1576         -O) shift; override=true;;
1577         -S) shift; silent=true; extractsh=true;;
1578         -D)
1579                 shift
1580                 case "$1" in
1581                 *=)
1582                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1583                         echo "$me: ignoring -D $1" >&2
1584                         ;;
1585                 *=*) echo "$1" | \
1586                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1587                 *) echo "$1='define'" >> optdef.sh;;
1588                 esac
1589                 shift
1590                 ;;
1591         -U)
1592                 shift
1593                 case "$1" in
1594                 *=) echo "$1" >> optdef.sh;;
1595                 *=*)
1596                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1597                         echo "$me: ignoring -U $1" >&2
1598                         ;;
1599                 *) echo "$1='undef'" >> optdef.sh;;
1600                 esac
1601                 shift
1602                 ;;
1603         -A)
1604             shift
1605             xxx=''
1606             yyy="$1"
1607             zzz=''
1608             uuu=undef
1609             case "$yyy" in
1610             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1611                  case "$zzz" in
1612                  *:*) zzz='' ;;
1613                  *)   xxx=append
1614                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1615                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1616                  esac
1617                  ;;
1618             esac
1619             case "$xxx" in
1620             '')  case "$yyy" in
1621                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1622                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1623                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1624                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1625                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1626                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1627                  esac
1628                  ;;       
1629             esac
1630             case "$xxx" in
1631             append)
1632                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1633             clear)
1634                 echo "$yyy=''"                  >> posthint.sh ;;
1635             define)
1636                 case "$zzz" in
1637                 '') zzz=define ;;
1638                 esac
1639                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1640             eval)
1641                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1642             prepend)
1643                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1644             undef)
1645                 case "$zzz" in
1646                 '') zzz="$uuu" ;;
1647                 esac
1648                 echo "$yyy=$zzz"                >> posthint.sh ;;
1649             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1650             esac
1651             shift
1652             ;;
1653         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1654             exit 0;;
1655         --) break;;
1656         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1657         *) break;;
1658         esac
1659 done
1660
1661 case "$error" in
1662 true)
1663         cat >&2 <<EOM
1664 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1665                  [-U symbol] [-U symbol=] [-A command:symbol...]
1666   -d : use defaults for all answers.
1667   -e : go on without questioning past the production of config.sh.
1668   -f : specify an alternate default configuration file.
1669   -h : print this help message and exit (with an error status).
1670   -r : reuse C symbols value if possible (skips costly nm extraction).
1671   -s : silent mode, only echoes questions and essential information.
1672   -D : define symbol to have some value:
1673          -D symbol         symbol gets the value 'define'
1674          -D symbol=value   symbol gets the value 'value'
1675        common used examples (see INSTALL for more info):
1676          -Duse64bitint            use 64bit integers
1677          -Duse64bitall            use 64bit integers and pointers
1678          -Dusethreads             use thread support
1679          -Dinc_version_list=none  do not include older perl trees in @INC
1680          -DEBUGGING=none          DEBUGGING options
1681          -Dcc=gcc                 choose your compiler
1682          -Dprefix=/opt/perl5      choose your destination
1683   -E : stop at the end of questions, after having produced config.sh.
1684   -K : do not use unless you know what you are doing.
1685   -O : let -D and -U override definitions from loaded configuration file.
1686   -S : perform variable substitutions on all .SH files (can mix with -f)
1687   -U : undefine symbol:
1688          -U symbol    symbol gets the value 'undef'
1689          -U symbol=   symbol gets completely empty
1690        e.g.:  -Uversiononly
1691   -A : manipulate symbol after the platform specific hints have been applied:
1692          -A append:symbol=value   append value to symbol
1693          -A symbol=value          like append:, but with a separating space
1694          -A define:symbol=value   define symbol to have value
1695          -A clear:symbol          define symbol to be ''
1696          -A define:symbol         define symbol to be 'define'
1697          -A eval:symbol=value     define symbol to be eval of value
1698          -A prepend:symbol=value  prepend value to symbol
1699          -A undef:symbol          define symbol to be 'undef'
1700          -A undef:symbol=         define symbol to be ''
1701        e.g.:  -A prepend:libswanted='cl pthread '
1702               -A ccflags=-DSOME_MACRO
1703   -V : print version number and exit (with a zero status).
1704 EOM
1705         exit 1
1706         ;;
1707 esac
1708
1709 : Sanity checks
1710 case "$fastread$alldone" in
1711 yescont|yesexit) ;;
1712 *)
1713         case "$extractsh" in
1714         true) ;;
1715         *)
1716                 if test ! -t 0; then
1717                         echo "Say 'sh Configure', not 'sh <Configure'"
1718                         exit 1
1719                 fi
1720                 ;;
1721         esac
1722         ;;
1723 esac
1724
1725 exec 4>&1
1726 case "$silent" in
1727 true) exec 1>/dev/null;;
1728 esac
1729
1730 : run the defines and the undefines, if any, but leave the file out there...
1731 touch optdef.sh
1732 . ./optdef.sh
1733 : create the posthint manipulation script and leave the file out there...
1734 touch posthint.sh
1735
1736 : set package name
1737 package=perl5
1738 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1739 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1740 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1741 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1742 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1743 esac
1744
1745 : Some greps do not return status, grrr.
1746 echo "grimblepritz" >grimble
1747 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1748         contains=contains
1749 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1750         contains=grep
1751 else
1752         contains=contains
1753 fi
1754 rm -f grimble
1755 : the following should work in any shell
1756 case "$contains" in
1757 contains*)
1758         echo " "
1759         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1760         cat >contains <<'EOSS'
1761 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1762 EOSS
1763 chmod +x contains
1764 esac
1765
1766 : Find the path to the source tree
1767 case "$src" in
1768 '') case "$0" in
1769     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1770          case "$src" in
1771          /*)    ;;
1772          .)     ;;
1773          *)     src=`cd ../$src && pwd` ;;
1774          esac
1775          ;;
1776     *)   src='.';;
1777     esac;;
1778 esac
1779 case "$src" in
1780 '')     src=/
1781         rsrc=/
1782         ;;
1783 /*) rsrc="$src";;
1784 *) rsrc="../$src";;
1785 esac
1786 if test -f $rsrc/Configure && \
1787         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1788 then
1789    : found it, so we are ok.
1790 else
1791         rsrc=''
1792         for src in . .. ../.. ../../.. ../../../..; do
1793                 if test -f ../$src/Configure && \
1794                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1795                 then
1796                         rsrc=../$src
1797                         break
1798                 fi
1799         done
1800 fi
1801 case "$rsrc" in
1802 '')
1803         cat <<EOM >&4
1804
1805 Sorry, I can't seem to locate the source dir for $package.  Please start
1806 Configure with an explicit path -- i.e. /some/path/Configure.
1807
1808 EOM
1809         exit 1
1810         ;;
1811 ../.)   rsrc='..';;
1812 *)
1813         echo " "
1814         echo "Sources for $package found in \"$src\"." >&4
1815         ;;
1816 esac
1817
1818 : script used to extract .SH files with variable substitutions
1819 cat >extract <<'EOS'
1820 PERL_CONFIG_SH=true
1821 echo "Doing variable substitutions on .SH files..."
1822 if test -f MANIFEST; then
1823         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1824 else
1825         echo "(Looking for .SH files under the source directory.)"
1826         set x `(cd "$src"; find . -name "*.SH" -print)`
1827 fi
1828 shift
1829 case $# in
1830 0) set x `(cd "$src"; echo *.SH)`; shift;;
1831 esac
1832 if test ! -f "$src/$1"; then
1833         shift
1834 fi
1835 mkdir_p='
1836 name=$1;
1837 create="";
1838 while test $name; do
1839         if test ! -d "$name"; then
1840                 create="$name $create";
1841                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1842                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1843         else
1844                 name="";
1845         fi;
1846 done;
1847 for file in $create; do
1848         mkdir $file;
1849 done
1850 '
1851 for file in $*; do
1852         case "$src" in
1853         ".")
1854                 case "$file" in
1855                 */*)
1856                         dir=`expr X$file : 'X\(.*\)/'`
1857                         file=`expr X$file : 'X.*/\(.*\)'`
1858                         (cd "$dir" && . ./$file)
1859                         ;;
1860                 *)
1861                         . ./$file
1862                         ;;
1863                 esac
1864                 ;;
1865         *)
1866                 case "$file" in
1867                 */*)
1868                         dir=`expr X$file : 'X\(.*\)/'`
1869                         file=`expr X$file : 'X.*/\(.*\)'`
1870                         (set x $dir; shift; eval $mkdir_p)
1871                         sh <"$src/$dir/$file"
1872                         ;;
1873                 *)
1874                         sh <"$src/$file"
1875                         ;;
1876                 esac
1877                 ;;
1878         esac
1879 done
1880 if test -f "$src/config_h.SH"; then
1881         if test ! -f config.h; then
1882         : oops, they left it out of MANIFEST, probably, so do it anyway.
1883         . "$src/config_h.SH"
1884         fi
1885 fi
1886 EOS
1887
1888 : extract files and exit if asked to do so
1889 case "$extractsh" in
1890 true)
1891         case "$realsilent" in
1892         true) ;;
1893         *) exec 1>&4;;
1894         esac
1895         case "$config_sh" in
1896         '') config_sh='config.sh';;
1897         esac
1898         echo " "
1899         echo "Fetching answers from $config_sh..."
1900         cd ..
1901         . $config_sh
1902         test "$override" && . ./optdef.sh
1903         echo " "
1904         . UU/extract
1905         rm -rf UU
1906         echo "Extraction done."
1907         exit 0
1908         ;;
1909 esac
1910
1911 : Eunice requires " " instead of "", can you believe it
1912 echo " "
1913 : Here we go...
1914 echo "Beginning of configuration questions for $package."
1915
1916 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1917
1918 : first determine how to suppress newline on echo command
1919 echo " "
1920 echo "Checking echo to see how to suppress newlines..."
1921 (echo "hi there\c" ; echo " ") >.echotmp
1922 if $contains c .echotmp >/dev/null 2>&1 ; then
1923         echo "...using -n."
1924         n='-n'
1925         c=''
1926 else
1927         cat <<'EOM'
1928 ...using \c
1929 EOM
1930         n=''
1931         c='\c'
1932 fi
1933 echo $n "The star should be here-->$c"
1934 echo '*'
1935 rm -f .echotmp
1936
1937 : Now test for existence of everything in MANIFEST
1938 echo " "
1939 if test -f "$rsrc/MANIFEST"; then
1940         echo "First let's make sure your kit is complete.  Checking..." >&4
1941         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1942         rm -f missing
1943         tmppwd=`pwd`
1944         for filelist in x??; do
1945                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1946         done
1947         if test -s missing; then
1948                 cat missing >&4
1949                 cat >&4 <<'EOM'
1950
1951 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1952
1953 You have the option of continuing the configuration process, despite the
1954 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1955 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1956 and contact the author (perlbug@perl.org).
1957
1958 EOM
1959                 echo $n "Continue? [n] $c" >&4
1960                 read ans
1961                 case "$ans" in
1962                 y*)
1963                         echo "Continuing..." >&4
1964                         rm -f missing
1965                         ;;
1966                 *)
1967                         echo "ABORTING..." >&4
1968                         kill $$
1969                         ;;
1970                 esac
1971         else
1972                 echo "Looks good..."
1973         fi
1974 else
1975         echo "There is no MANIFEST file.  I hope your kit is complete !"
1976 fi
1977 rm -f missing x??
1978
1979 echo " "
1980 : Find the appropriate value for a newline for tr
1981 if test -n "$DJGPP"; then
1982        trnl='\012'
1983 fi
1984 if test X"$trnl" = X; then
1985         case "`echo foo|tr '\n' x 2>/dev/null`" in
1986         foox) trnl='\n' ;;
1987         esac
1988 fi
1989 if test X"$trnl" = X; then
1990         case "`echo foo|tr '\012' x 2>/dev/null`" in
1991         foox) trnl='\012' ;;
1992         esac
1993 fi
1994 if test X"$trnl" = X; then
1995        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1996        fooxy) trnl='\n\r' ;;
1997        esac
1998 fi
1999 if test X"$trnl" = X; then
2000         cat <<EOM >&2
2001
2002 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2003
2004 EOM
2005         exit 1
2006 fi
2007
2008 : compute the number of columns on the terminal for proper question formatting
2009 case "$COLUMNS" in
2010 '') COLUMNS='80';;
2011 esac
2012
2013 : set up the echo used in my read
2014 myecho="case \"\$xxxm\" in
2015 '') echo $n \"\$rp $c\" >&4;;
2016 *) case \"\$rp\" in
2017         '') echo $n \"[\$xxxm] $c\";;
2018         *)
2019                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2020                         echo \"\$rp\" >&4
2021                         echo $n \"[\$xxxm] $c\" >&4
2022                 else
2023                         echo $n \"\$rp [\$xxxm] $c\" >&4
2024                 fi
2025                 ;;
2026         esac;;
2027 esac"
2028
2029 : now set up to do reads with possible shell escape and default assignment
2030 cat <<EOSC >myread
2031 $startsh
2032 xxxm=\$dflt
2033 $myecho
2034 ans='!'
2035 case "\$fastread" in
2036 yes) case "\$dflt" in
2037         '') ;;
2038         *) ans='';
2039                 case "\$silent-\$rp" in
2040                 true-) ;;
2041                 *) echo " " >&4;;
2042                 esac;;
2043         esac;;
2044 *) case "\$silent" in
2045         true) case "\$rp" in
2046                 '') ans='';;
2047                 esac;;
2048         esac;;
2049 esac
2050 while expr "X\$ans" : "X!" >/dev/null; do
2051         read answ
2052         set x \$xxxm
2053         shift
2054         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2055         case  "\$answ" in
2056         "!")
2057                 sh 1>&4
2058                 echo " "
2059                 $myecho
2060                 ;;
2061         !*)
2062                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2063                 shift
2064                 sh 1>&4 -c "\$*"
2065                 echo " "
2066                 $myecho
2067                 ;;
2068         "\$ans")
2069                 case "\$ans" in
2070                 \\&*)
2071                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2072                         shift
2073                         case "\$1" in
2074                         -d)
2075                                 fastread=yes
2076                                 echo "(OK, I'll run with -d after this question.)" >&4
2077                                 ;;
2078                         -*)
2079                                 echo "*** Sorry, \$1 not supported yet." >&4
2080                                 ;;
2081                         esac
2082                         $myecho
2083                         ans=!
2084                         ;;
2085                 esac;;
2086         *)
2087                 case "\$aok" in
2088                 y)
2089                         echo "*** Substitution done -- please confirm."
2090                         xxxm="\$ans"
2091                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2092                         xxxm="\$ans"
2093                         ans=!
2094                         ;;
2095                 *)
2096                         echo "*** Error -- try again."
2097                         ans=!
2098                         ;;
2099                 esac
2100                 $myecho
2101                 ;;
2102         esac
2103         case "\$ans\$xxxm\$nostick" in
2104         '')
2105                 ans=!
2106                 $myecho
2107                 ;;
2108         esac
2109 done
2110 case "\$ans" in
2111 '') ans="\$xxxm";;
2112 esac
2113 EOSC
2114
2115 : create .config dir to save info across Configure sessions
2116 test -d ../.config || mkdir ../.config
2117 cat >../.config/README <<EOF
2118 This directory created by Configure to save information that should
2119 persist across sessions for $package.
2120
2121 You may safely delete it if you wish.
2122 EOF
2123
2124 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2125 case "$usedevel" in
2126 $define|true|[yY]*) ;;
2127 *) case "$xversion" in
2128    *[13579])
2129         cat >&4 <<EOH
2130 *** WHOA THERE!!! ***
2131
2132     This is an UNSTABLE DEVELOPMENT release.
2133     The version of this $package distribution is $xversion, that is, odd,
2134     (as opposed to even) and that signifies a development release.
2135     If you want a maintenance release, you want an even-numbered version.
2136
2137     Do ***NOT*** install this into production use.
2138     Data corruption and crashes are possible.
2139
2140     It is most seriously suggested that you do not continue any further
2141     unless you want to help in developing and debugging Perl.
2142
2143     If you *still* want to build perl, you can answer 'y' now,
2144     or pass -Dusedevel to Configure.
2145
2146 EOH
2147         rp='Do you really want to continue?'
2148         dflt='n'
2149         . ./myread
2150         case "$ans" in
2151         [yY]) echo >&4 "Okay, continuing."
2152               usedevel="$define" ;;
2153         *) echo >&4 "Okay, bye."
2154            exit 1
2155            ;;
2156         esac
2157         ;;
2158     esac
2159     ;;
2160 esac
2161 case "$usedevel" in
2162 $define|true|[yY]*)
2163         case "$versiononly" in
2164         '') versiononly="$define" ;;
2165         esac
2166         case "$installusrbinperl" in
2167         '') installusrbinperl="$undef" ;;
2168         esac
2169         ;;
2170 esac
2171
2172 : general instructions
2173 needman=true
2174 firsttime=true
2175 user=`(logname) 2>/dev/null`
2176 case "$user" in
2177 '') user=`whoami 2>&1`;;
2178 esac
2179 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2180         firsttime=false
2181         echo " "
2182         rp='Would you like to see the instructions?'
2183         dflt=n
2184         . ./myread
2185         case "$ans" in
2186         [yY]*) ;;
2187         *) needman=false;;
2188         esac
2189 fi
2190 if $needman; then
2191         cat <<EOH
2192
2193 This installation shell script will examine your system and ask you questions
2194 to determine how the perl5 package should be installed. If you get
2195 stuck on a question, you may use a ! shell escape to start a subshell or
2196 execute a command.  Many of the questions will have default answers in square
2197 brackets; typing carriage return will give you the default.
2198
2199 On some of the questions which ask for file or directory names you are allowed
2200 to use the ~name construct to specify the login directory belonging to "name",
2201 even if you don't have a shell which knows about that.  Questions where this is
2202 allowed will be marked "(~name ok)".
2203
2204 EOH
2205         rp=''
2206         dflt='Type carriage return to continue'
2207         . ./myread
2208         cat <<'EOH'
2209
2210 The prompter used in this script allows you to use shell variables and
2211 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2212 in the default answer, as if the default line was a set of arguments given to a
2213 script shell.  This means you may also use $* to repeat the whole default line,
2214 so you do not have to re-type everything to add something to the default.
2215
2216 Everytime there is a substitution, you will have to confirm.  If there is an
2217 error (e.g. an unmatched backtick), the default answer will remain unchanged
2218 and you will be prompted again.
2219
2220 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2221 the questions and use the computed defaults (or the previous answers if there
2222 was already a config.sh file). Type 'Configure -h' for a list of options.
2223 You may also start interactively and then answer '& -d' at any prompt to turn
2224 on the non-interactive behaviour for the remainder of the execution.
2225
2226 EOH
2227         . ./myread
2228         cat <<EOH
2229
2230 Much effort has been expended to ensure that this shell script will run on any
2231 Unix system.  If despite that it blows up on yours, your best bet is to edit
2232 Configure and run it again.  If you can't run Configure for some reason,
2233 you'll have to generate a config.sh file by hand.  Whatever problems you
2234 have, let me (perlbug@perl.org) know how I blew it.
2235
2236 This installation script affects things in two ways:
2237
2238 1) it may do direct variable substitutions on some of the files included
2239    in this kit.
2240 2) it builds a config.h file for inclusion in C programs.  You may edit
2241    any of these files as the need arises after running this script.
2242
2243 If you make a mistake on a question, there is no easy way to back up to it
2244 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2245 files.  Configure will offer to let you do this before it runs the SH files.
2246
2247 EOH
2248         dflt='Type carriage return to continue'
2249         . ./myread
2250         case "$firsttime" in
2251         true) echo $user >>../.config/instruct;;
2252         esac
2253 fi
2254
2255 : find out where common programs are
2256 echo " "
2257 echo "Locating common programs..." >&4
2258 cat <<EOSC >loc
2259 $startsh
2260 case \$# in
2261 0) exit 1;;
2262 esac
2263 thing=\$1
2264 shift
2265 dflt=\$1
2266 shift
2267 for dir in \$*; do
2268         case "\$thing" in
2269         .)
2270         if test -d \$dir/\$thing; then
2271                 echo \$dir
2272                 exit 0
2273         fi
2274         ;;
2275         *)
2276         for thisthing in \$dir/\$thing; do
2277                 : just loop through to pick last item
2278         done
2279         if test -f \$thisthing; then
2280                 echo \$thisthing
2281                 exit 0
2282         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2283                 echo \$thisthing
2284                 exit 0
2285         elif test -f \$dir/\$thing.exe; then
2286                 if test -n "$DJGPP"; then
2287                         echo \$dir/\$thing.exe
2288                 elif test "$eunicefix" != ":"; then
2289                         : on Eunice apparently
2290                         echo \$dir/\$thing
2291                         exit 0
2292                 fi
2293                 exit 0
2294         fi
2295         ;;
2296         esac
2297 done
2298 echo \$dflt
2299 exit 1
2300 EOSC
2301 chmod +x loc
2302 $eunicefix loc
2303 loclist="
2304 awk
2305 cat
2306 chmod
2307 comm
2308 cp
2309 echo
2310 expr
2311 grep
2312 ls
2313 mkdir
2314 rm
2315 sed
2316 sort
2317 touch
2318 tr
2319 uniq
2320 "
2321 trylist="
2322 Mcc
2323 ar
2324 bison
2325 byacc
2326 cpp
2327 csh
2328 date
2329 egrep
2330 gmake
2331 gzip
2332 less
2333 ln
2334 make
2335 more
2336 nm
2337 nroff
2338 pg
2339 test
2340 uname
2341 zip
2342 "
2343 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2344 pth="$pth /lib /usr/lib"
2345 for file in $loclist; do
2346         eval xxx=\$$file
2347         case "$xxx" in
2348         /*|?:[\\/]*)
2349                 if test -f "$xxx"; then
2350                         : ok
2351                 else
2352                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2353                         xxx=`./loc $file $file $pth`
2354                 fi
2355                 ;;
2356         '') xxx=`./loc $file $file $pth`;;
2357         *) xxx=`./loc $xxx $xxx $pth`;;
2358         esac
2359         eval $file=$xxx$_exe
2360         eval _$file=$xxx
2361         case "$xxx" in
2362         /*)
2363                 echo $file is in $xxx.
2364                 ;;
2365         ?:[\\/]*)
2366                 echo $file is in $xxx.
2367                 ;;
2368         *)
2369                 echo "I don't know where '$file' is, and my life depends on it." >&4
2370                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2371                 exit 1
2372                 ;;
2373         esac
2374 done
2375 echo " "
2376 echo "Don't worry if any of the following aren't found..."
2377 say=offhand
2378 for file in $trylist; do
2379         eval xxx=\$$file
2380         case "$xxx" in
2381         /*|?:[\\/]*)
2382                 if test -f "$xxx"; then
2383                         : ok
2384                 else
2385                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2386                         xxx=`./loc $file $file $pth`
2387                 fi
2388                 ;;
2389         '') xxx=`./loc $file $file $pth`;;
2390         *) xxx=`./loc $xxx $xxx $pth`;;
2391         esac
2392         eval $file=$xxx$_exe
2393         eval _$file=$xxx
2394         case "$xxx" in
2395         /*)
2396                 echo $file is in $xxx.
2397                 ;;
2398         ?:[\\/]*)
2399                 echo $file is in $xxx.
2400                 ;;
2401         *)
2402                 echo "I don't see $file out there, $say."
2403                 say=either
2404                 ;;
2405         esac
2406 done
2407 case "$egrep" in
2408 egrep)
2409         echo "Substituting grep for egrep."
2410         egrep=$grep
2411         _egrep=$grep
2412         ;;
2413 esac
2414 case "$ln" in
2415 ln)
2416         echo "Substituting cp for ln."
2417         ln=$cp
2418         _ln=$cp
2419         ;;
2420 esac
2421 case "$make" in
2422 make)   
2423         case "$gmake" in
2424         gmake)
2425         echo "I can't find make or gmake, and my life depends on it." >&4
2426         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2427         exit 1
2428         ;;
2429         esac
2430         ;;
2431 esac    
2432 case "$gmake" in
2433 gmake)  ;;
2434 *)      # We can't have osname yet.
2435         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2436                 # Assume that gmake, if found, is definitely GNU make
2437                 # and prefer it over the system make.
2438                 echo "Substituting gmake for make."
2439                 make=$gmake
2440                 _make=$gmake
2441         fi
2442         ;;
2443 esac
2444 case "$test" in
2445 test)
2446         echo "Hopefully test is built into your sh."
2447         ;;
2448 *)
2449         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2450                 echo "Using the test built into your sh."
2451                 test=test
2452                 _test=test
2453         fi
2454         ;;
2455 esac
2456 case "$echo" in
2457 echo)
2458         echo "Hopefully echo is built into your sh."
2459         ;;
2460 '') ;;
2461 *)
2462         echo " "
2463 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2464         $echo $n "hi there$c" >foo1
2465         echo $n "hi there$c" >foo2
2466         if cmp foo1 foo2 >/dev/null 2>&1; then
2467                 echo "They are compatible.  In fact, they may be identical."
2468         else
2469                 case "$n" in
2470                 '-n') n='' c='\c';;
2471                 *) n='-n' c='';;
2472                 esac
2473                 cat <<FOO
2474 They are not compatible!  You are probably running ksh on a non-USG system.
2475 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2476 have echo built in and we may have to run some Bourne shell scripts.  That
2477 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2478
2479 FOO
2480                 $echo $n "The star should be here-->$c"
2481                 $echo "*"
2482         fi
2483         $rm -f foo1 foo2
2484         ;;
2485 esac
2486
2487 # This question was auctioned at YAPC::Europe-2007 in Vienna
2488 # I never promised you could answer it. I only auctioned the question.
2489 cat <<FOO
2490 The following message is sponsored by
2491
2492   Dresden.pm<--The stars should be here.
2493
2494 Dear Perl user, system administrator or package
2495 maintainer, the Perl community sends greetings to
2496 you. Do you (emblematical) greet back [Y/n]? n
2497
2498 FOO
2499
2500 cat <<EOS >trygcc
2501 $startsh
2502 EOS
2503 cat <<'EOSC' >>trygcc
2504 case "$cc" in
2505 '') ;;
2506 *)  $rm -f try try.*
2507     $cat >try.c <<EOM
2508 int main(int argc, char *argv[]) {
2509   return 0;
2510 }
2511 EOM
2512     if $cc -o try $ccflags $ldflags try.c; then
2513        :
2514     else
2515         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2516         despair=yes
2517         trygcc=yes
2518         case "$cc" in
2519         *gcc*) trygcc=no ;;
2520         esac
2521         # Skip this test because it gives a false match on output like:
2522         #    ./trygcc: line 23: cc: command not found
2523         # case "`$cc -v -c try.c 2>&1`" in
2524         # *gcc*) trygcc=no ;;
2525         # esac
2526         if $test X"$trygcc" = Xyes; then
2527             if gcc -o try -c try.c; then
2528                 echo " "
2529                 echo "You seem to have a working gcc, though." >&4
2530                 # Switching compilers may undo the work of hints files.
2531                 # The most common problem is -D_REENTRANT for threads.
2532                 # This heuristic catches that case, but gets false positives
2533                 # if -Dusethreads was not actually specified.  Better to
2534                 # bail out here with a useful message than fail 
2535                 # mysteriously later. Should we perhaps just try to
2536                 # re-invoke Configure -Dcc=gcc config_args ?
2537                 if $test -f usethreads.cbu; then
2538                         $cat >&4 <<EOM 
2539
2540 *** However, any setting of the C compiler flags (e.g. for thread support)
2541 *** will be lost.  It may be necessary for you to restart Configure and
2542 *** add -Dcc=gcc to your Configure command line.
2543
2544 EOM
2545                         rp="Would you like to go ahead and try gcc anyway?"
2546                         dflt=n
2547                 else
2548                         rp="Would you like to use it?"
2549                         dflt=y
2550                 fi
2551                 if $test -f myread; then
2552                     . ./myread
2553                 else
2554                     if $test -f UU/myread; then
2555                         . ./UU/myread
2556                     else
2557                         echo "Cannot find myread, sorry.  Aborting." >&2
2558                         exit 1
2559                     fi
2560                 fi  
2561                 case "$ans" in
2562                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2563                 esac
2564             fi
2565         fi
2566     fi
2567     $rm -f try try.*
2568     ;;
2569 esac
2570 EOSC
2571
2572 cat <<EOS >checkcc
2573 $startsh
2574 EOS
2575 cat <<'EOSC' >>checkcc
2576 case "$cc" in        
2577 '') ;;
2578 *)  $rm -f try try.*              
2579     $cat >try.c <<EOM
2580 int main(int argc, char *argv[]) {
2581   return 0;
2582 }
2583 EOM
2584     if $cc -o try $ccflags $ldflags try.c; then
2585        :
2586     else
2587         if $test X"$despair" = Xyes; then
2588            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2589         fi
2590         $cat >&4 <<EOM         
2591 You need to find a working C compiler.
2592 Either (purchase and) install the C compiler supplied by your OS vendor,
2593 or for a free C compiler try http://gcc.gnu.org/
2594 I cannot continue any further, aborting.
2595 EOM
2596         exit 1
2597     fi
2598     $rm -f try try.*
2599     ;;
2600 esac
2601 EOSC
2602
2603 : determine whether symbolic links are supported
2604 echo " "
2605 $touch blurfl
2606 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2607         echo "Symbolic links are supported." >&4
2608         lns="$ln -s"
2609 else
2610         echo "Symbolic links are NOT supported." >&4
2611         lns="$ln"
2612 fi
2613 $rm -f blurfl sym
2614
2615 : determine whether symbolic links are supported
2616 echo " "
2617 case "$lns" in
2618 *"ln"*" -s")
2619         echo "Checking how to test for symbolic links..." >&4
2620         $lns blurfl sym
2621         if $test "X$issymlink" = X; then
2622                 case "$newsh" in
2623                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2624                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2625                 esac
2626                 if test $? = 0; then
2627                         issymlink="test -h"
2628                 else
2629                         echo "Your builtin 'test -h' may be broken." >&4
2630                         case "$test" in
2631                         /*)     ;;
2632                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2633                                 for p in $pth
2634                                 do
2635                                         if test -f "$p/$test"; then
2636                                                 test="$p/$test"
2637                                                 break
2638                                         fi
2639                                 done
2640                                 ;;
2641                         esac
2642                         case "$test" in
2643                         /*)
2644                                 echo "Trying external '$test -h'." >&4
2645                                 issymlink="$test -h"
2646                                 if $test ! -h sym >/dev/null 2>&1; then
2647                                         echo "External '$test -h' is broken, too." >&4
2648                                         issymlink=''
2649                                 fi
2650                                 ;;
2651                         *)      issymlink='' ;;
2652                         esac
2653                 fi              
2654         fi
2655         if $test "X$issymlink" = X; then
2656                 if $test -L sym 2>/dev/null; then
2657                         issymlink="$test -L"
2658                         echo "The builtin '$test -L' worked." >&4
2659                 fi
2660         fi
2661         if $test "X$issymlink" != X; then
2662                 echo "You can test for symbolic links with '$issymlink'." >&4
2663         else
2664                 echo "I do not know how you can test for symbolic links." >&4
2665         fi
2666         $rm -f blurfl sym
2667         ;;
2668 *)      echo "No symbolic links, so not testing for their testing..." >&4
2669         ;;
2670 esac
2671 echo " "
2672
2673
2674 case "$mksymlinks" in
2675 $define|true|[yY]*)
2676         case "$src" in
2677         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2678                 exit 1
2679                 ;;
2680         *)      case "$lns:$issymlink" in
2681                 *"ln"*" -s:"*"test -"?)
2682                         echo "Creating the symbolic links..." >&4
2683                         echo "(First creating the subdirectories...)" >&4
2684                         cd ..
2685                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2686                                 read directory
2687                                 test -z "$directory" && break
2688                                 mkdir -p $directory
2689                         done
2690                         # Sanity check 1.
2691                         if test ! -d t/base; then
2692                                 echo "Failed to create the subdirectories.  Aborting." >&4
2693                                 exit 1
2694                         fi
2695                         echo "(Then creating the symlinks...)" >&4
2696                         awk '{print $1}' $src/MANIFEST | while true; do
2697                                 read filename
2698                                 test -z "$filename" && break
2699                                 if test -f $filename; then
2700                                         if $issymlink $filename; then
2701                                                 rm -f $filename
2702                                         fi
2703                                 fi
2704                                 if test -f $filename; then
2705                                         echo "$filename already exists, not symlinking."
2706                                 else
2707                                         ln -s $src/$filename $filename
2708                                 fi
2709                         done
2710                         # Sanity check 2.
2711                         if test ! -f t/base/lex.t; then
2712                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2713                                 exit 1
2714                         fi
2715                         cd UU
2716                         ;;
2717                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2718                         ;;
2719                 esac
2720                 ;;
2721         esac
2722         ;;
2723 esac
2724
2725
2726 case "$usecrosscompile" in
2727 $define|true|[yY]*)
2728         $echo "Cross-compiling..."
2729         croak=''
2730         case "$cc" in
2731         *-*-gcc) # A cross-compiling gcc, probably.
2732             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2733             ar=$targetarch-ar
2734             # leave out ld, choosing it is more complex
2735             nm=$targetarch-nm
2736             ranlib=$targetarch-ranlib
2737             $echo 'extern int foo;' > try.c
2738             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2739             shift
2740             if $test $# -gt 0; then
2741                 incpth="$incpth $*"
2742                 incpth="`$echo $incpth|$sed 's/^ //'`"
2743                 echo "Guessing incpth '$incpth'." >&4
2744                 for i in $*; do
2745                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2746                     if $test -d $j; then
2747                         libpth="$libpth $j"
2748                     fi
2749                 done   
2750                 libpth="`$echo $libpth|$sed 's/^ //'`"
2751                 echo "Guessing libpth '$libpth'." >&4
2752             fi
2753             $rm -f try.c
2754             ;;
2755         esac
2756         case "$targetarch" in
2757         '') echo "Targetarch not defined." >&4; croak=y ;;
2758         *)  echo "Using targetarch $targetarch." >&4 ;;
2759         esac
2760         case "$incpth" in
2761         '') echo "Incpth not defined." >&4; croak=y ;;
2762         *)  echo "Using incpth '$incpth'." >&4 ;;
2763         esac
2764         case "$libpth" in
2765         '') echo "Libpth not defined." >&4; croak=y ;;
2766         *)  echo "Using libpth '$libpth'." >&4 ;;
2767         esac
2768         case "$usrinc" in
2769         '') for i in $incpth; do
2770                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2771                     usrinc=$i
2772                     echo "Guessing usrinc $usrinc." >&4
2773                     break
2774                 fi
2775             done
2776             case "$usrinc" in
2777             '') echo "Usrinc not defined." >&4; croak=y ;;
2778             esac
2779             ;;
2780         *)  echo "Using usrinc $usrinc." >&4 ;;
2781         esac
2782         case "$targethost" in
2783         '') echo "Targethost not defined." >&4; croak=y ;;
2784         *)  echo "Using targethost $targethost." >&4
2785         esac
2786         locincpth=' '
2787         loclibpth=' '
2788         case "$croak" in
2789         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2790         esac
2791         case "$src" in
2792         /*) run=$src/Cross/run
2793             targetmkdir=$src/Cross/mkdir
2794             to=$src/Cross/to
2795             from=$src/Cross/from
2796             ;;
2797         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2798             run=$pwd/Cross/run
2799             targetmkdir=$pwd/Cross/mkdir
2800             to=$pwd/Cross/to
2801             from=$pwd/Cross/from
2802             ;;
2803         esac
2804         case "$targetrun" in
2805         '') targetrun=ssh ;;
2806         esac
2807         case "$targetto" in
2808         '') targetto=scp ;;
2809         esac
2810         case "$targetfrom" in
2811         '') targetfrom=scp ;;
2812         esac
2813         run=$run-$targetrun
2814         to=$to-$targetto
2815         from=$from-$targetfrom
2816         case "$targetdir" in
2817         '')  targetdir=/tmp
2818              echo "Guessing targetdir $targetdir." >&4
2819              ;;
2820         esac
2821         case "$targetuser" in
2822         '')  targetuser=root
2823              echo "Guessing targetuser $targetuser." >&4
2824              ;;
2825         esac
2826         case "$targetfrom" in
2827         scp)    q=-q ;;
2828         *)      q='' ;;
2829         esac
2830         case "$targetrun" in
2831         ssh|rsh)
2832             cat >$run <<EOF
2833 #!/bin/sh
2834 case "\$1" in
2835 -cwd)
2836   shift
2837   cwd=\$1
2838   shift
2839   ;;
2840 esac
2841 case "\$cwd" in
2842 '') cwd=$targetdir ;;
2843 esac
2844 exe=\$1
2845 shift
2846 if $test ! -f \$exe.xok; then
2847   $to \$exe
2848   $touch \$exe.xok
2849 fi
2850 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2851 EOF
2852             ;;
2853         *)  echo "Unknown targetrun '$targetrun'" >&4
2854             exit 1
2855             ;;
2856         esac
2857         case "$targetmkdir" in
2858         */Cross/mkdir)
2859             cat >$targetmkdir <<EOF
2860 #!/bin/sh
2861 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2862 EOF
2863             $chmod a+rx $targetmkdir
2864             ;;
2865         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2866             exit 1
2867             ;;
2868         esac
2869         case "$targetto" in
2870         scp|rcp)
2871             cat >$to <<EOF
2872 #!/bin/sh
2873 for f in \$@
2874 do
2875   case "\$f" in
2876   /*)
2877     $targetmkdir \`dirname \$f\`
2878     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2879     ;;
2880   *)
2881     $targetmkdir $targetdir/\`dirname \$f\`
2882     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2883     ;;
2884   esac
2885 done
2886 exit 0
2887 EOF
2888             ;;
2889         cp) cat >$to <<EOF
2890 #!/bin/sh
2891 for f in \$@
2892 do
2893   case "\$f" in
2894   /*)
2895     $mkdir -p $targetdir/\`dirname \$f\`
2896     $cp \$f $targetdir/\$f || exit 1
2897     ;;
2898   *)
2899     $targetmkdir $targetdir/\`dirname \$f\`
2900     $cp \$f $targetdir/\$f || exit 1
2901     ;;
2902   esac
2903 done
2904 exit 0
2905 EOF
2906             ;;
2907         *)  echo "Unknown targetto '$targetto'" >&4
2908             exit 1
2909             ;;
2910         esac
2911         case "$targetfrom" in
2912         scp|rcp)
2913           cat >$from <<EOF
2914 #!/bin/sh
2915 for f in \$@
2916 do
2917   $rm -f \$f
2918   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2919 done
2920 exit 0
2921 EOF
2922             ;;
2923         cp) cat >$from <<EOF
2924 #!/bin/sh
2925 for f in \$@
2926 do
2927   $rm -f \$f
2928   cp $targetdir/\$f . || exit 1
2929 done
2930 exit 0
2931 EOF
2932             ;;
2933         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2934             exit 1
2935             ;;
2936         esac
2937         if $test ! -f $run; then
2938             echo "Target 'run' script '$run' not found." >&4
2939         else
2940             $chmod a+rx $run
2941         fi
2942         if $test ! -f $to; then
2943             echo "Target 'to' script '$to' not found." >&4
2944         else
2945             $chmod a+rx $to
2946         fi
2947         if $test ! -f $from; then
2948             echo "Target 'from' script '$from' not found." >&4
2949         else
2950             $chmod a+rx $from
2951         fi
2952         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2953             exit 1
2954         fi
2955         cat >&4 <<EOF
2956 Using '$run' for remote execution,
2957 and '$from' and '$to'
2958 for remote file transfer.
2959 EOF
2960         ;;
2961 *)      run=''
2962         to=:
2963         from=:
2964         usecrosscompile='undef'
2965         targetarch=''
2966         ;;
2967 esac
2968
2969 : see whether [:lower:] and [:upper:] are supported character classes
2970 echo " "
2971 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2972 ABYZ)
2973         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2974         up='[:upper:]'
2975         low='[:lower:]'
2976         ;;
2977 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2978         # (0xd9 and 0xe2), therefore that is a nice testing point.
2979         if test "X$up" = X -o "X$low" = X; then
2980             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2981             rs) up='[A-Z]'
2982                 low='[a-z]'
2983                 ;;
2984             esac
2985         fi
2986         if test "X$up" = X -o "X$low" = X; then
2987             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2988             rs) up='A-Z'
2989                 low='a-z'
2990                 ;;
2991             esac
2992         fi
2993         if test "X$up" = X -o "X$low" = X; then
2994             case "`echo RS | od -x 2>/dev/null`" in
2995             *D9E2*|*d9e2*)
2996                 echo "Hey, this might be EBCDIC." >&4
2997                 if test "X$up" = X -o "X$low" = X; then
2998                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2999                     rs) up='[A-IJ-RS-Z]'
3000                         low='[a-ij-rs-z]'
3001                         ;;
3002                     esac
3003                 fi
3004                 if test "X$up" = X -o "X$low" = X; then
3005                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3006                     rs) up='A-IJ-RS-Z'
3007                         low='a-ij-rs-z'
3008                         ;;
3009                     esac
3010                 fi
3011                 ;;
3012             esac
3013         fi
3014 esac
3015 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3016 rs)
3017     echo "Using $up and $low to convert case." >&4
3018     ;;
3019 *)
3020     echo "I don't know how to translate letters from upper to lower case." >&4
3021     echo "Your tr is not acting any way I know of." >&4
3022     exit 1
3023     ;;
3024 esac
3025 : set up the translation script tr, must be called with ./tr of course
3026 cat >tr <<EOSC
3027 $startsh
3028 case "\$1\$2" in
3029 '[A-Z][a-z]') exec $tr '$up' '$low';;
3030 '[a-z][A-Z]') exec $tr '$low' '$up';;
3031 esac
3032 exec $tr "\$@"
3033 EOSC
3034 chmod +x tr
3035 $eunicefix tr
3036
3037 : Try to determine whether config.sh was made on this system
3038 case "$config_sh" in
3039 '')
3040 myuname=`$uname -a 2>/dev/null`
3041 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3042 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3043 # because the A-Z/a-z are not consecutive.
3044 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3045         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3046 newmyuname="$myuname"
3047 dflt=n
3048 case "$knowitall" in
3049 '')
3050         if test -f ../config.sh; then
3051                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3052                         eval "`grep myuname= ../config.sh`"
3053                 fi
3054                 if test "X$myuname" = "X$newmyuname"; then
3055                         dflt=y
3056                 fi
3057         fi
3058         ;;
3059 *) dflt=y;;
3060 esac
3061
3062 : Get old answers from old config file if Configure was run on the
3063 : same system, otherwise use the hints.
3064 hint=default
3065 cd ..
3066 if test -f config.sh; then
3067         echo " "
3068         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3069         . UU/myread
3070         case "$ans" in
3071         n*|N*) echo "OK, I'll ignore it."
3072                 mv config.sh config.sh.old
3073                 myuname="$newmyuname"
3074                 ;;
3075         *)  echo "Fetching default answers from your old config.sh file..." >&4
3076                 tmp_n="$n"
3077                 tmp_c="$c"
3078                 tmp_sh="$sh"
3079                 . ./config.sh
3080                 cp config.sh UU
3081                 n="$tmp_n"
3082                 c="$tmp_c"
3083                 : Older versions did not always set $sh.  Catch re-use of such
3084                 : an old config.sh.
3085                 case "$sh" in
3086                 '') sh="$tmp_sh" ;;
3087                 esac
3088                 hint=previous
3089                 ;;
3090         esac
3091 fi
3092 . ./UU/checkcc
3093 if test ! -f config.sh; then
3094         $cat <<EOM
3095
3096 First time through, eh?  I have some defaults handy for some systems
3097 that need some extra help getting the Configure answers right:
3098
3099 EOM
3100         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3101         dflt=''
3102         : Half the following guesses are probably wrong... If you have better
3103         : tests or hints, please send them to perlbug@perl.org
3104         : The metaconfig authors would also appreciate a copy...
3105         $test -f /irix && osname=irix
3106         $test -f /xenix && osname=sco_xenix
3107         $test -f /dynix && osname=dynix
3108         $test -f /dnix && osname=dnix
3109         $test -f /lynx.os && osname=lynxos
3110         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3111         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3112         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3113         $test -f /bin/mips && /bin/mips && osname=mips
3114         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3115                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3116         $test -d /usr/apollo/bin && osname=apollo
3117         $test -f /etc/saf/_sactab && osname=svr4
3118         $test -d /usr/include/minix && osname=minix
3119         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3120         if $test -d /MachTen -o -d /MachTen_Folder; then
3121                 osname=machten
3122                 if $test -x /sbin/version; then
3123                         osvers=`/sbin/version | $awk '{print $2}' |
3124                         $sed -e 's/[A-Za-z]$//'`
3125                 elif $test -x /usr/etc/version; then
3126                         osvers=`/usr/etc/version | $awk '{print $2}' |
3127                         $sed -e 's/[A-Za-z]$//'`
3128                 else
3129                         osvers="$2.$3"
3130                 fi
3131         fi
3132
3133         $test -f /sys/posix.dll &&
3134                 $test -f /usr/bin/what &&
3135                 set X `/usr/bin/what /sys/posix.dll` &&
3136                 $test "$3" = UWIN &&
3137                 osname=uwin &&
3138                 osvers="$5"
3139
3140         if $test -f $uname; then
3141                 set X $myuname
3142                 shift
3143
3144                 case "$5" in
3145                 fps*) osname=fps ;;
3146                 mips*)
3147                         case "$4" in
3148                         umips) osname=umips ;;
3149                         *) osname=mips ;;
3150                         esac;;
3151                 [23]100) osname=mips ;;
3152                 next*) osname=next ;;
3153                 i386*)
3154                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3155                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3156                                 osname='sco'
3157                                 osvers=$tmp
3158                         elif $test -f /etc/kconfig; then
3159                                 osname=isc
3160                                 if test "$lns" = "$ln -s"; then
3161                                         osvers=4
3162                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3163                                         osvers=3
3164                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3165                                         osvers=2
3166                                 fi
3167                         fi
3168                         tmp=''
3169                         ;;
3170                 pc*)
3171                         if test -n "$DJGPP"; then
3172                                 osname=dos
3173                                 osvers=djgpp
3174                         fi
3175                         ;;
3176                 esac
3177
3178                 case "$1" in
3179                 aix) osname=aix
3180                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3181                         case "$tmp" in
3182                         # oslevel can fail with:
3183                         # oslevel: Unable to acquire lock.
3184                         *not\ found) osvers="$4"."$3" ;;
3185                         '<3240'|'<>3240') osvers=3.2.0 ;;
3186                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3187                         '=3250'|'>3250') osvers=3.2.5 ;;
3188                         *) osvers=$tmp;;
3189                         esac
3190                         ;;
3191                 bsd386) osname=bsd386
3192                         osvers=`$uname -r`
3193                         ;;
3194                 cygwin*) osname=cygwin
3195                         osvers="$3"
3196                         ;;
3197                 *dc.osx) osname=dcosx
3198                         osvers="$3"
3199                         ;;
3200                 dnix) osname=dnix
3201                         osvers="$3"
3202                         ;;
3203                 domainos) osname=apollo
3204                         osvers="$3"
3205                         ;;
3206                 dgux)   osname=dgux
3207                         osvers="$3"
3208                         ;;
3209                 dragonfly) osname=dragonfly
3210                         osvers="$3"
3211                         ;;
3212                 dynixptx*) osname=dynixptx
3213                         osvers=`echo "$4"|sed 's/^v//'`
3214                         ;;
3215                 freebsd) osname=freebsd
3216                         osvers="$3" ;;
3217                 genix)  osname=genix ;;
3218                 gnu)    osname=gnu
3219                         osvers="$3" ;;
3220                 hp*)    osname=hpux
3221                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3222                         ;;
3223                 irix*)  osname=irix
3224                         case "$3" in
3225                         4*) osvers=4 ;;
3226                         5*) osvers=5 ;;
3227                         *)      osvers="$3" ;;
3228                         esac
3229                         ;;
3230                 linux)  osname=linux
3231                         case "$3" in
3232                         *)      osvers="$3" ;;
3233                         esac
3234                         ;;
3235                 MiNT)   osname=mint
3236                         ;;
3237                 netbsd*) osname=netbsd
3238                         osvers="$3"
3239                         ;;
3240                 news-os) osvers="$3"
3241                         case "$3" in
3242                         4*) osname=newsos4 ;;
3243                         *) osname=newsos ;;
3244                         esac
3245                         ;;
3246                 next*) osname=next ;;
3247                 nonstop-ux) osname=nonstopux ;;
3248                 openbsd) osname=openbsd
3249                         osvers="$3"
3250                         ;;
3251                 os2)    osname=os2
3252                         osvers="$4"
3253                         ;;
3254                 POSIX-BC | posix-bc ) osname=posix-bc
3255                         osvers="$3"
3256                         ;;
3257                 powerux | power_ux | powermax_os | powermaxos | \
3258                 powerunix | power_unix) osname=powerux
3259                         osvers="$3"
3260                         ;;
3261                 qnx) osname=qnx
3262                         osvers="$4"
3263                         ;;
3264                 solaris) osname=solaris
3265                         case "$3" in
3266                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3267                         *)      osvers="$3" ;;
3268                         esac
3269                         ;;
3270                 sunos) osname=sunos
3271                         case "$3" in
3272                         5*) osname=solaris
3273                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3274                         *)      osvers="$3" ;;
3275                         esac
3276                         ;;
3277                 titanos) osname=titanos
3278                         case "$3" in
3279                         1*) osvers=1 ;;
3280                         2*) osvers=2 ;;
3281                         3*) osvers=3 ;;
3282                         4*) osvers=4 ;;
3283                         *)      osvers="$3" ;;
3284                         esac
3285                         ;;
3286                 ultrix) osname=ultrix
3287                         osvers="$3"
3288                         ;;
3289                 osf1|mls+)      case "$5" in
3290                                 alpha)
3291                                         osname=dec_osf
3292                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3293                                         case "$osvers" in
3294                                         [1-9].[0-9]*) ;;
3295                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3296                                         esac
3297                                         ;;
3298                         hp*)    osname=hp_osf1  ;;
3299                         mips)   osname=mips_osf1 ;;
3300                         esac
3301                         ;;
3302                 # UnixWare 7.1.2 is known as Open UNIX 8
3303                 openunix|unixware) osname=svr5
3304                         osvers="$4"
3305                         ;;
3306                 uts)    osname=uts
3307                         osvers="$3"
3308                         ;;
3309                 vos) osvers="$3"
3310                         ;;
3311                 $2) case "$osname" in
3312                         *isc*) ;;
3313                         *freebsd*) ;;
3314                         svr*)
3315                                 : svr4.x or possibly later
3316                                 case "svr$3" in
3317                                 ${osname}*)
3318                                         osname=svr$3
3319                                         osvers=$4
3320                                         ;;
3321                                 esac
3322                                 case "$osname" in
3323                                 svr4.0)
3324                                         : Check for ESIX
3325                                         if test -f /stand/boot ; then
3326                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3327                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3328                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3329                                                         if test -n "$isesix"; then
3330                                                                 osname=esix4
3331                                                         fi
3332                                                 fi
3333                                         fi
3334                                         ;;
3335                                 esac
3336                                 ;;
3337                         *)      if test -f /etc/systemid; then
3338                                         osname=sco
3339                                         set `echo $3 | $sed 's/\./ /g'` $4
3340                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3341                                                 osvers=$1.$2.$3
3342                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3343                                                 osvers=$1.$2
3344                                         elif $test -f $src/hints/sco_$1.sh; then
3345                                                 osvers=$1
3346                                         fi
3347                                 else
3348                                         case "$osname" in
3349                                         '') : Still unknown.  Probably a generic Sys V.
3350                                                 osname="sysv"
3351                                                 osvers="$3"
3352                                                 ;;
3353                                         esac
3354                                 fi
3355                                 ;;
3356                         esac
3357                         ;;
3358                 *)      case "$osname" in
3359                         '') : Still unknown.  Probably a generic BSD.
3360                                 osname="$1"
3361                                 osvers="$3"
3362                                 ;;
3363                         esac
3364                         ;;
3365                 esac
3366         else
3367                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3368                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3369                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3370                                 osname=news_os
3371                         fi
3372                         $rm -f UU/kernel.what
3373                 elif test -d c:/. -o -n "$is_os2" ; then
3374                         set X $myuname
3375                         osname=os2
3376                         osvers="$5"
3377                 fi
3378         fi
3379
3380         case "$targetarch" in
3381         '') ;;
3382         *)  hostarch=$osname
3383             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3384             osvers=''
3385             ;;
3386         esac
3387
3388         : Now look for a hint file osname_osvers, unless one has been
3389         : specified already.
3390         case "$hintfile" in
3391         ''|' ')
3392                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3393                 : Also try without trailing minor version numbers.
3394                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3395                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3396                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3397                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3398                 case "$file" in
3399                 '') dflt=none ;;
3400                 *)  case "$osvers" in
3401                         '') dflt=$file
3402                                 ;;
3403                         *)  if $test -f $src/hints/$file.sh ; then
3404                                         dflt=$file
3405                                 elif $test -f $src/hints/$xfile.sh ; then
3406                                         dflt=$xfile
3407                                 elif $test -f $src/hints/$xxfile.sh ; then
3408                                         dflt=$xxfile
3409                                 elif $test -f $src/hints/$xxxfile.sh ; then
3410                                         dflt=$xxxfile
3411                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3412                                         dflt=$xxxxfile
3413                                 elif $test -f "$src/hints/${osname}.sh" ; then
3414                                         dflt="${osname}"
3415                                 else
3416                                         dflt=none
3417                                 fi
3418                                 ;;
3419                         esac
3420                         ;;
3421                 esac
3422                 if $test -f Policy.sh ; then
3423                         case "$dflt" in
3424                         *Policy*) ;;
3425                         none) dflt="Policy" ;;
3426                         *) dflt="Policy $dflt" ;;
3427                         esac
3428                 fi
3429                 ;;
3430         *)
3431                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3432                 ;;
3433         esac
3434
3435         if $test -f Policy.sh ; then
3436                 $cat <<EOM
3437
3438 There's also a Policy hint file available, which should make the
3439 site-specific (policy) questions easier to answer.
3440 EOM
3441
3442         fi
3443
3444         $cat <<EOM
3445
3446 You may give one or more space-separated answers, or "none" if appropriate.
3447 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3448 previous run of Configure, you may specify it as well as or instead of
3449 OS-specific hints.  If hints are provided for your OS, you should use them:
3450 although Perl can probably be built without hints on many platforms, using
3451 hints often improve performance and may enable features that Configure can't
3452 set up on its own. If there are no hints that match your OS, specify "none";
3453 DO NOT give a wrong version or a wrong OS.
3454
3455 EOM
3456
3457         rp="Which of these apply, if any?"
3458         . UU/myread
3459         tans=$ans
3460         for file in $tans; do
3461                 if $test X$file = XPolicy -a -f Policy.sh; then
3462                         . Policy.sh
3463                         $cat Policy.sh >> UU/config.sh
3464                 elif $test -f $src/hints/$file.sh; then
3465                         . $src/hints/$file.sh
3466                         $cat $src/hints/$file.sh >> UU/config.sh
3467                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3468                         : nothing
3469                 else
3470                         : Give one chance to correct a possible typo.
3471                         echo "$file.sh does not exist"
3472                         dflt=$file
3473                         rp="hint to use instead?"
3474                         . UU/myread
3475                         for file in $ans; do
3476                                 if $test -f "$src/hints/$file.sh"; then
3477                                         . $src/hints/$file.sh
3478                                         $cat $src/hints/$file.sh >> UU/config.sh
3479                                 elif $test X$ans = X -o X$ans = Xnone ; then
3480                                         : nothing
3481                                 else
3482                                         echo "$file.sh does not exist -- ignored."
3483                                 fi
3484                         done
3485                 fi
3486         done
3487
3488         hint=recommended
3489         : Remember our hint file for later.
3490         if $test -f "$src/hints/$file.sh" ; then
3491                 hintfile="$file"
3492         else
3493                 hintfile=''
3494         fi
3495 fi
3496 cd UU
3497 ;;
3498 *)
3499         echo " "
3500         echo "Fetching default answers from $config_sh..." >&4
3501         tmp_n="$n"
3502         tmp_c="$c"
3503         cd ..
3504         cp $config_sh config.sh 2>/dev/null
3505         chmod +w config.sh
3506         . ./config.sh
3507         cd UU
3508         cp ../config.sh .
3509         n="$tmp_n"
3510         c="$tmp_c"
3511         hint=previous
3512         ;;
3513 esac
3514 test "$override" && . ./optdef.sh
3515
3516 : Restore computed paths
3517 for file in $loclist $trylist; do
3518         eval $file="\$_$file"
3519 done
3520
3521 cat << EOM
3522
3523 Configure uses the operating system name and version to set some defaults.
3524 The default value is probably right if the name rings a bell. Otherwise,
3525 since spelling matters for me, either accept the default or answer "none"
3526 to leave it blank.
3527
3528 EOM
3529 case "$osname" in
3530         ''|' ')
3531                 case "$hintfile" in
3532                 ''|' '|none) dflt=none ;;
3533                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3534                 esac
3535                 ;;
3536         *) dflt="$osname" ;;
3537 esac
3538 rp="Operating system name?"
3539 . ./myread
3540 case "$ans" in
3541 none)  osname='' ;;
3542 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3543 esac
3544 echo " "
3545 case "$osvers" in
3546         ''|' ')
3547                 case "$hintfile" in
3548                 ''|' '|none) dflt=none ;;
3549                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3550                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3551                         case "$dflt" in
3552                         ''|' ') dflt=none ;;
3553                         esac
3554                         ;;
3555                 esac
3556                 ;;
3557         *) dflt="$osvers" ;;
3558 esac
3559 rp="Operating system version?"
3560 . ./myread
3561 case "$ans" in
3562 none)  osvers='' ;;
3563 *) osvers="$ans" ;;
3564 esac
3565
3566
3567 . ./posthint.sh
3568
3569 : who configured the system
3570 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3571 case "$cf_by" in
3572 "")
3573         cf_by=`(logname) 2>/dev/null`
3574         case "$cf_by" in
3575         "")
3576                 cf_by=`(whoami) 2>/dev/null`
3577                 case "$cf_by" in
3578                 "") cf_by=unknown ;;
3579                 esac ;;
3580         esac ;;
3581 esac
3582
3583 : decide how portable to be.  Allow command line overrides.
3584 case "$d_portable" in
3585 "$undef") ;;
3586 *)      d_portable="$define" ;;
3587 esac
3588
3589 : set up shell script to do ~ expansion
3590 cat >filexp <<EOSS
3591 $startsh
3592 : expand filename
3593 case "\$1" in
3594  ~/*|~)
3595         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3596         ;;
3597  ~*)
3598         if $test -f /bin/csh; then
3599                 /bin/csh -f -c "glob \$1"
3600                 failed=\$?
3601                 echo ""
3602                 exit \$failed
3603         else
3604                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3605                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3606                 if $test ! -d "\$dir"; then
3607                         me=\`basename \$0\`
3608                         echo "\$me: can't locate home directory for: \$name" >&2
3609                         exit 1
3610                 fi
3611                 case "\$1" in
3612                 */*)
3613                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3614                         ;;
3615                 *)
3616                         echo \$dir
3617                         ;;
3618                 esac
3619         fi
3620         ;;
3621 *)
3622         echo \$1
3623         ;;
3624 esac
3625 EOSS
3626 chmod +x filexp
3627 $eunicefix filexp
3628
3629 : now set up to get a file name
3630 cat <<EOS >getfile
3631 $startsh
3632 EOS
3633 cat <<'EOSC' >>getfile
3634 tilde=''
3635 fullpath=''
3636 already=''
3637 skip=''
3638 none_ok=''
3639 exp_file=''
3640 nopath_ok=''
3641 orig_rp="$rp"
3642 orig_dflt="$dflt"
3643 case "$gfpth" in
3644 '') gfpth='.' ;;
3645 esac
3646
3647 case "$fn" in
3648 *\(*)
3649         : getfile will accept an answer from the comma-separated list
3650         : enclosed in parentheses even if it does not meet other criteria.
3651         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3652         fn=`echo $fn | sed 's/(.*)//'`
3653         ;;
3654 esac
3655
3656 case "$fn" in
3657 *:*)
3658         loc_file=`expr $fn : '.*:\(.*\)'`
3659         fn=`expr $fn : '\(.*\):.*'`
3660         ;;
3661 esac
3662
3663 case "$fn" in
3664 *~*) tilde=true;;
3665 esac
3666 case "$fn" in
3667 */*) fullpath=true;;
3668 esac
3669 case "$fn" in
3670 *+*) skip=true;;
3671 esac
3672 case "$fn" in
3673 *n*) none_ok=true;;
3674 esac
3675 case "$fn" in
3676 *e*) exp_file=true;;
3677 esac
3678 case "$fn" in
3679 *p*) nopath_ok=true;;
3680 esac
3681
3682 case "$fn" in
3683 *f*) type='File';;
3684 *d*) type='Directory';;
3685 *l*) type='Locate';;
3686 esac
3687
3688 what="$type"
3689 case "$what" in
3690 Locate) what='File';;
3691 esac
3692
3693 case "$exp_file" in
3694 '')
3695         case "$d_portable" in
3696         "$define") ;;
3697         *) exp_file=true;;
3698         esac
3699         ;;
3700 esac
3701
3702 cd ..
3703 while test "$type"; do
3704         redo=''
3705         rp="$orig_rp"
3706         dflt="$orig_dflt"
3707         case "$tilde" in
3708         true) rp="$rp (~name ok)";;
3709         esac
3710         . UU/myread
3711         if test -f UU/getfile.ok && \
3712                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3713         then
3714                 value="$ans"
3715                 ansexp="$ans"
3716                 break
3717         fi
3718         case "$ans" in
3719         none)
3720                 value=''
3721                 ansexp=''
3722                 case "$none_ok" in
3723                 true) type='';;
3724                 esac
3725                 ;;
3726         *)
3727                 case "$tilde" in
3728                 '') value="$ans"
3729                         ansexp="$ans";;
3730                 *)
3731                         value=`UU/filexp $ans`
3732                         case $? in
3733                         0)
3734                                 if test "$ans" != "$value"; then
3735                                         echo "(That expands to $value on this system.)"
3736                                 fi
3737                                 ;;
3738                         *) value="$ans";;
3739                         esac
3740                         ansexp="$value"
3741                         case "$exp_file" in
3742                         '') value="$ans";;
3743                         esac
3744                         ;;
3745                 esac
3746                 case "$fullpath" in
3747                 true)
3748                         case "$ansexp" in
3749                         /*) value="$ansexp" ;;
3750                         [a-zA-Z]:/*) value="$ansexp" ;;
3751                         *)
3752                                 redo=true
3753                                 case "$already" in
3754                                 true)
3755                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3756                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3757                                         ;;
3758                                 *)
3759                                 echo "Please give a full path name, starting with slash." >&4
3760                                         case "$tilde" in
3761                                         true)
3762                                 echo "Note that using ~name is ok provided it expands well." >&4
3763                                                 already=true
3764                                                 ;;
3765                                         esac
3766                                 esac
3767                                 ;;
3768                         esac
3769                         ;;
3770                 esac
3771                 case "$redo" in
3772                 '')
3773                         case "$type" in
3774                         File)
3775                                 for fp in $gfpth; do
3776                                         if test "X$fp" = X.; then
3777                                             pf="$ansexp"
3778                                         else    
3779                                             pf="$fp/$ansexp"
3780                                         fi
3781                                         if test -f "$pf"; then
3782                                                 type=''
3783                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3784                                         then
3785                                                 echo "($value is not a plain file, but that's ok.)"
3786                                                 type=''
3787                                         fi
3788                                         if test X"$type" = X; then
3789                                             value="$pf"
3790                                             break
3791                                         fi
3792                                 done
3793                                 ;;
3794                         Directory)
3795                                 for fp in $gfpth; do
3796                                         if test "X$fp" = X.; then
3797                                             dir="$ans"
3798                                             direxp="$ansexp"
3799                                         else    
3800                                             dir="$fp/$ansexp"
3801                                             direxp="$fp/$ansexp"
3802                                         fi
3803                                         if test -d "$direxp"; then
3804                                                 type=''
3805                                                 value="$dir"
3806                                                 break
3807                                         fi
3808                                 done
3809                                 ;;
3810                         Locate)
3811                                 if test -d "$ansexp"; then
3812                                         echo "(Looking for $loc_file in directory $value.)"
3813                                         value="$value/$loc_file"
3814                                         ansexp="$ansexp/$loc_file"
3815                                 fi
3816                                 if test -f "$ansexp"; then
3817                                         type=''
3818                                 fi
3819                                 case "$nopath_ok" in
3820                                 true)   case "$value" in
3821                                         */*) ;;
3822                                         *)      echo "Assuming $value will be in people's path."
3823                                                 type=''
3824                                                 ;;
3825                                         esac
3826                                         ;;
3827                                 esac
3828                                 ;;
3829                         esac
3830
3831                         case "$skip" in
3832                         true) type='';
3833                         esac
3834
3835                         case "$type" in
3836                         '') ;;
3837                         *)
3838                                 if test "$fastread" = yes; then
3839                                         dflt=y
3840                                 else
3841                                         dflt=n
3842                                 fi
3843                                 rp="$what $value doesn't exist.  Use that name anyway?"
3844                                 . UU/myread
3845                                 dflt=''
3846                                 case "$ans" in
3847                                 y*) type='';;
3848                                 *) echo " ";;
3849                                 esac
3850                                 ;;
3851                         esac
3852                         ;;
3853                 esac
3854                 ;;
3855         esac
3856 done
3857 cd UU
3858 ans="$value"
3859 rp="$orig_rp"
3860 dflt="$orig_dflt"
3861 rm -f getfile.ok
3862 test "X$gfpthkeep" != Xy && gfpth=""
3863 EOSC
3864
3865 : determine root of directory hierarchy where package will be installed.
3866 case "$prefix" in
3867 '')
3868         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3869         ;;
3870 *?/)
3871         dflt=`echo "$prefix" | sed 's/.$//'`
3872         ;;
3873 *)
3874         dflt="$prefix"
3875         ;;
3876 esac
3877 $cat <<EOM
3878
3879 By default, $package will be installed in $dflt/bin, manual pages
3880 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3881 installation directories. Typically this is something like /usr/local.
3882 If you wish to have binaries under /usr/bin but other parts of the
3883 installation under /usr/local, that's ok: you will be prompted
3884 separately for each of the installation directories, the prefix being
3885 only used to set the defaults.
3886
3887 EOM
3888 fn=d~
3889 rp='Installation prefix to use?'
3890 . ./getfile
3891 oldprefix=''
3892 case "$prefix" in
3893 '') ;;
3894 *)
3895         case "$ans" in
3896         "$prefix") ;;
3897         *) oldprefix="$prefix";;
3898         esac
3899         ;;
3900 esac
3901 prefix="$ans"
3902 prefixexp="$ansexp"
3903
3904 case "$afsroot" in
3905 '')     afsroot=/afs ;;
3906 *)      afsroot=$afsroot ;;
3907 esac
3908
3909 : is AFS running?
3910 echo " "
3911 case "$afs" in
3912 $define|true)   afs=true ;;
3913 $undef|false)   afs=false ;;
3914 *)      if test -d $afsroot; then
3915                 afs=true
3916         else
3917                 afs=false
3918         fi
3919         ;;
3920 esac
3921 if $afs; then
3922         echo "AFS may be running... I'll be extra cautious then..." >&4
3923 else
3924         echo "AFS does not seem to be running..." >&4
3925 fi
3926
3927 : determine installation prefix for where package is to be installed.
3928 if $afs; then 
3929 $cat <<EOM
3930
3931 Since you are running AFS, I need to distinguish the directory in which
3932 files will reside from the directory in which they are installed (and from
3933 which they are presumably copied to the former directory by occult means).
3934
3935 EOM
3936         case "$installprefix" in
3937         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3938         *) dflt="$installprefix";;
3939         esac
3940 else
3941 $cat <<EOM
3942
3943 In some special cases, particularly when building $package for distribution,
3944 it is convenient to distinguish the directory in which files should be
3945 installed from the directory ($prefix) in which they will
3946 eventually reside.  For most users, these two directories are the same.
3947
3948 EOM
3949         case "$installprefix" in
3950         '') dflt=$prefix ;;
3951         *) dflt=$installprefix;;
3952         esac
3953 fi
3954 fn=d~
3955 rp='What installation prefix should I use for installing files?'
3956 . ./getfile
3957 installprefix="$ans"
3958 installprefixexp="$ansexp"
3959
3960 : Perform the prefixexp/installprefixexp correction if necessary
3961 cat <<EOS >installprefix
3962 $startsh
3963 EOS
3964 cat <<'EOSC' >>installprefix
3965 : Change installation prefix, if necessary.
3966 if $test X"$prefix" != X"$installprefix"; then
3967     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3968 else
3969     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3970 fi
3971 EOSC
3972 chmod +x installprefix
3973 $eunicefix installprefix
3974
3975 : Set variables such as privlib and privlibexp from the output of ./getfile
3976 : performing the prefixexp/installprefixexp correction if necessary.
3977 cat <<EOS >setprefixvar
3978 $startsh
3979 EOS
3980 cat <<'EOSC' >>setprefixvar
3981 eval "${prefixvar}=\"\$ans\""
3982 eval "${prefixvar}exp=\"\$ansexp\""
3983 . ./installprefix
3984 EOSC
3985 chmod +x setprefixvar
3986 $eunicefix setprefixvar
3987
3988 : set up the script used to warn in case of inconsistency
3989 cat <<EOS >whoa
3990 $startsh
3991 EOS
3992 cat <<'EOSC' >>whoa
3993 dflt=y
3994 case "$hint" in
3995     recommended)
3996         case "$hintfile" in
3997         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3998                 ;;
3999         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4000                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4001                 ;;
4002         esac
4003         ;;
4004     *)  echo " "
4005         echo "*** WHOA THERE!!! ***" >&4
4006         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4007         ;;
4008 esac
4009 rp="    Keep the $hint value?"
4010 . ./myread
4011 case "$ans" in
4012 y) td=$was; tu=$was;;
4013 esac
4014 EOSC
4015
4016 : function used to set $1 to $val
4017 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4018 case "$val$was" in
4019 $define$undef) . ./whoa; eval "$var=\$td";;
4020 $undef$define) . ./whoa; eval "$var=\$tu";;
4021 *) eval "$var=$val";;
4022 esac'
4023
4024 case "$usesocks" in
4025 $define|true|[yY]*)     dflt='y';;
4026 *) dflt='n';;
4027 esac
4028 cat <<EOM
4029
4030 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4031 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4032 to use the PerlIO abstraction layer, this will be implicitly selected.
4033
4034 If this doesn't make any sense to you, just accept the default '$dflt'.
4035 EOM
4036 rp='Build Perl for SOCKS?'
4037 . ./myread
4038 case "$ans" in
4039 y|Y)    val="$define" ;;     
4040 *)      val="$undef" ;;
4041 esac
4042 set usesocks
4043 eval $setvar
4044
4045 case "$usesocks" in
4046 $define|true|[yY]*) useperlio="$define";;
4047 esac
4048
4049 case "$useperlio" in
4050 $define|true|[yY]*|'')  dflt='y';;
4051 *) dflt='n';;
4052 esac
4053 cat <<EOM
4054
4055 Previous version of $package used the standard IO mechanisms as
4056 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4057 alternate IO mechanisms via the PerlIO abstraction layer, but the
4058 stdio mechanism is still available if needed.  The abstraction layer
4059 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4060 Using PerlIO with sfio may cause problems with some extension modules.
4061
4062 If this doesn't make any sense to you, just accept the default '$dflt'.
4063 EOM
4064 rp='Use the PerlIO abstraction layer?'
4065 . ./myread
4066 case "$ans" in
4067 y|Y) 
4068         val="$define"
4069         ;;
4070 *)      
4071         echo "Ok, doing things the stdio way."
4072         val="$undef"
4073         ;;
4074 esac
4075 set useperlio
4076 eval $setvar 
4077
4078 case "$usesocks" in
4079 $define|true|[yY]*)
4080         case "$useperlio" in
4081         $define|true|[yY]*) ;;
4082         *)      cat >&4 <<EOM
4083
4084 You are using the SOCKS proxy protocol library which means that you
4085 should also use the PerlIO layer.  You may be headed for trouble.
4086
4087 EOM
4088                 ;;
4089         esac
4090         ;;
4091 esac
4092
4093         
4094 : get the patchlevel
4095 echo " "
4096 echo "Getting the current patchlevel..." >&4
4097 if $test -r $rsrc/patchlevel.h;then
4098         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4099         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4100         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4101         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4102         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4103         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4104         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4105 else
4106         revision=0
4107         patchlevel=0
4108         subversion=0
4109         api_revision=0
4110         api_version=0
4111         api_subversion=0
4112         perl_patchlevel=0
4113         $echo "(You do not have patchlevel.h.  Eek.)"
4114 fi
4115 if $test -r $rsrc/.patch ; then
4116         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4117                 perl_patchlevel=`cat $rsrc/.patch`
4118         fi
4119 fi
4120 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4121 version_patchlevel_string="version $patchlevel subversion $subversion"
4122 case "$perl_patchlevel" in
4123 0|'') ;;
4124 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4125 esac
4126
4127 $echo "(You have $package $version_patchlevel_string.)"
4128
4129 case "$osname" in
4130 dos|vms)
4131         : XXX Should be a Configure test for double-dots in filenames.
4132         version=`echo $revision $patchlevel $subversion | \
4133                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4134         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4135                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4136         ;;
4137 *)
4138         version=`echo $revision $patchlevel $subversion | \
4139                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4140         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4141                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4142         ;;
4143 esac
4144 : Special case the 5.005_xx maintenance series, which used 5.005
4145 : without any subversion label as a subdirectory in $sitelib
4146 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4147         api_versionstring='5.005'
4148 fi
4149
4150 case "$usethreads" in
4151 $define|true|[yY]*)     dflt='y';;
4152 *)     # Catch case where user specified ithreads or 5005threads but
4153        # forgot -Dusethreads (A.D. 4/2002)
4154        case "$useithreads$use5005threads" in
4155        *$define*)      
4156                 case "$useperlio" in
4157                 "$define")      dflt='y' ;;
4158                 *)              dflt='n' ;;
4159                 esac
4160                 ;;
4161        *)       dflt='n';;
4162        esac
4163        ;;
4164 esac
4165 cat <<EOM
4166
4167 Perl can be built to take advantage of threads on some systems.
4168 To do so, Configure can be run with -Dusethreads.
4169
4170 Note that Perl built with threading support runs slightly slower
4171 and uses more memory than plain Perl. The current implementation
4172 is believed to be stable, but it is fairly new, and so should be
4173 treated with caution.
4174
4175 If this doesn't make any sense to you, just accept the default '$dflt'.
4176 EOM
4177 rp='Build a threading Perl?'
4178 . ./myread
4179 case "$ans" in
4180 y|Y)    val="$define" ;;
4181 *)      val="$undef" ;;
4182 esac
4183 set usethreads
4184 eval $setvar
4185
4186 if $test $patchlevel -lt 9; then
4187     case "$usethreads" in
4188     $define)
4189         $cat <<EOM
4190
4191 Since release 5.6, Perl has had two different threading implementations,
4192 the newer interpreter-based version (ithreads) with one interpreter per
4193 thread, and the older 5.005 version (5005threads).
4194 The 5005threads version is effectively unmaintained and will probably be
4195 removed in Perl 5.10, so there should be no need to build a Perl using it
4196 unless needed for backwards compatibility with some existing 5.005threads
4197 code.
4198
4199 EOM
4200         : Default to ithreads unless overridden on command line or with
4201         : old config.sh
4202         dflt='y'
4203         case "$use5005threads" in
4204                 $define|true|[yY]*) dflt='n';;
4205         esac
4206         case "$useithreads" in
4207                 $undef|false|[nN]*) dflt='n';;
4208         esac
4209         rp='Use the newer interpreter-based ithreads?'
4210         . ./myread
4211         case "$ans" in
4212         y|Y)    val="$define" ;;
4213         *)      val="$undef" ;;
4214         esac
4215         set useithreads
4216         eval $setvar
4217         : Now set use5005threads to the opposite value.
4218         case "$useithreads" in
4219         $define) val="$undef" ;;
4220         *) val="$define" ;;
4221         esac
4222         set use5005threads
4223         eval $setvar
4224         ;;
4225     *)
4226         useithreads="$undef"
4227         use5005threads="$undef"
4228         ;;
4229     esac
4230
4231     case "$useithreads$use5005threads" in
4232     "$define$define")
4233         $cat >&4 <<EOM
4234
4235 You cannot have both the ithreads and the 5.005 threads enabled
4236 at the same time.  Disabling the 5.005 threads since they are
4237 much less stable than the ithreads.
4238
4239 EOM
4240         use5005threads="$undef"
4241         ;;
4242     esac
4243
4244 else
4245 : perl-5.9.x and later
4246
4247     if test X"$usethreads" = "X$define"; then
4248         case "$use5005threads" in
4249             $define|true|[yY]*)
4250                 $cat >&4 <<EOM
4251
4252 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4253
4254 EOM
4255             ;;
4256         esac
4257     fi
4258
4259     use5005threads="$undef"
4260     useithreads="$usethreads"
4261 fi
4262
4263 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4264         cat >&4 <<EOF
4265 ***
4266 *** To build with ithreads you must also use the PerlIO layer.
4267 *** Cannot continue, aborting.
4268 ***
4269 EOF
4270         exit 1
4271 fi
4272
4273 case "$d_oldpthreads" in
4274 '')     : Configure tests would be welcome here.  For now, assume undef.
4275         val="$undef" ;;
4276 *)      val="$d_oldpthreads" ;;
4277 esac
4278 set d_oldpthreads
4279 eval $setvar
4280
4281
4282 : Look for a hint-file generated 'call-back-unit'.  If the
4283 : user has specified that a threading perl is to be built,
4284 : we may need to set or change some other defaults.
4285 if $test -f usethreads.cbu; then
4286     echo "Your platform has some specific hints regarding threaded builds, using them..."
4287     . ./usethreads.cbu
4288 else
4289     case "$usethreads" in
4290         "$define"|true|[yY]*)
4291                 $cat <<EOM
4292 (Your platform does not have any specific hints for threaded builds.
4293  Assuming POSIX threads, then.)
4294 EOM
4295         ;;
4296     esac
4297 fi
4298
4299 cat <<EOM
4300
4301 Perl can be built so that multiple Perl interpreters can coexist
4302 within the same Perl executable.
4303 EOM
4304
4305 case "$useithreads" in
4306 $define)
4307         cat <<EOM
4308 This multiple interpreter support is required for interpreter-based threads.
4309 EOM
4310         val="$define"
4311         ;;
4312 *)      case "$usemultiplicity" in
4313         $define|true|[yY]*)     dflt='y';;
4314         *) dflt='n';;
4315         esac
4316         echo " "
4317         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4318         rp='Build Perl for multiplicity?'
4319         . ./myread
4320         case "$ans" in
4321         y|Y)    val="$define" ;;
4322         *)      val="$undef" ;;
4323         esac
4324         ;;
4325 esac
4326 set usemultiplicity
4327 eval $setvar
4328
4329
4330 case "$usemorebits" in
4331 "$define"|true|[yY]*)
4332         use64bitint="$define"
4333         uselongdouble="$define"
4334         usemorebits="$define"
4335         ;;
4336 *)      usemorebits="$undef"
4337         ;;
4338 esac
4339
4340 : make some quick guesses about what we are up against
4341 echo " "
4342 $echo $n "Hmm...  $c"
4343 echo exit 1 >bsd
4344 echo exit 1 >usg
4345 echo exit 1 >v7
4346 echo exit 1 >osf1
4347 echo exit 1 >eunice
4348 echo exit 1 >xenix
4349 echo exit 1 >venix
4350 echo exit 1 >os2
4351 d_bsd="$undef"
4352 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4353 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4354 then
4355         echo "Looks kind of like an OSF/1 system, but we'll see..."
4356         echo exit 0 >osf1
4357 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4358         xxx=`./loc addbib blurfl $pth`
4359         if $test -f $xxx; then
4360         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4361                 echo exit 0 >bsd
4362                 echo exit 0 >usg
4363         else
4364                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4365                         echo "Looks kind of like an extended USG system, but we'll see..."
4366                 else
4367                         echo "Looks kind of like a USG system, but we'll see..."
4368                 fi
4369                 echo exit 0 >usg
4370         fi
4371 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4372         echo "Looks kind of like a BSD system, but we'll see..."
4373         d_bsd="$define"
4374         echo exit 0 >bsd
4375 else
4376         echo "Looks kind of like a Version 7 system, but we'll see..."
4377         echo exit 0 >v7
4378 fi
4379 case "$eunicefix" in
4380 *unixtovms*)
4381         $cat <<'EOI'
4382 There is, however, a strange, musty smell in the air that reminds me of
4383 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4384 EOI
4385         echo exit 0 >eunice
4386         d_eunice="$define"
4387 : it so happens the Eunice I know will not run shell scripts in Unix format
4388         ;;
4389 *)
4390         echo " "
4391         echo "Congratulations.  You aren't running Eunice."
4392         d_eunice="$undef"
4393         ;;
4394 esac
4395 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4396 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4397 : semicolon as a patch separator
4398 case "$p_" in
4399 :) ;;
4400 *)
4401         $cat <<'EOI'
4402 I have the feeling something is not exactly right, however...don't tell me...
4403 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4404 (Or you may be running DOS with DJGPP.)
4405 EOI
4406         echo exit 0 >os2
4407         ;;
4408 esac
4409 if test -f /xenix; then
4410         echo "Actually, this looks more like a XENIX system..."
4411         echo exit 0 >xenix
4412         d_xenix="$define"
4413 else
4414         echo " "
4415         echo "It's not Xenix..."
4416         d_xenix="$undef"
4417 fi
4418 chmod +x xenix
4419 $eunicefix xenix
4420 if test -f /venix; then
4421         echo "Actually, this looks more like a VENIX system..."
4422         echo exit 0 >venix
4423 else
4424         echo " "
4425         if ./xenix; then
4426                 : null
4427         else
4428                 echo "Nor is it Venix..."
4429         fi
4430 fi
4431 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4432 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4433 $rm -f foo
4434
4435 case "$cc" in
4436 '') dflt=cc;;
4437 *) dflt="$cc";;
4438 esac
4439 rp="Use which C compiler?"
4440 . ./myread
4441 cc="$ans"
4442
4443 : See if they have not cc but they do have gcc
4444 . ./trygcc
4445 : Look for a hint-file generated 'call-back-unit'.  Now that the
4446 : user has specified the compiler, we may need to set or change some
4447 : other defaults.
4448 if $test -f cc.cbu; then
4449     . ./cc.cbu
4450 fi
4451 . ./checkcc
4452
4453 echo " "
4454 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4455 $cat >try.c <<EOM
4456 #include <stdio.h>
4457 int main() {
4458 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4459 #ifdef __VERSION__
4460         printf("%s\n", __VERSION__);
4461 #else
4462         printf("%s\n", "1");
4463 #endif
4464 #endif
4465         return(0);
4466 }
4467 EOM
4468 if $cc -o try $ccflags $ldflags try.c; then
4469         gccversion=`$run ./try`
4470         case "$gccversion" in
4471         '') echo "You are not using GNU cc." ;;
4472         *)  echo "You are using GNU cc $gccversion."
4473             ccname=gcc
4474             ;;
4475         esac
4476 else
4477         echo " "
4478         echo "*** WHOA THERE!!! ***" >&4
4479         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4480         case "$knowitall" in
4481         '')
4482         echo "    You'd better start hunting for one and let me know about it." >&4
4483                 exit 1
4484                 ;;
4485         esac
4486 fi
4487 $rm -f try try.*
4488 case "$gccversion" in
4489 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4490 esac
4491 case "$gccversion" in
4492 '') gccosandvers='' ;;
4493 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4494    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4495    gccshortvers=''
4496    case "$gccosandvers" in
4497    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4498    $osname$osvers) ;; # looking good
4499    $osname*) cat <<EOM >&4
4500
4501 *** WHOA THERE!!! ***
4502
4503     Your gcc has not been compiled for the exact release of
4504     your operating system ($gccosandvers versus $osname$osvers).
4505
4506     In general it is a good idea to keep gcc synchronized with
4507     the operating system because otherwise serious problems
4508     may ensue when trying to compile software, like Perl.
4509
4510     I'm trying to be optimistic here, though, and will continue.
4511     If later during the configuration and build icky compilation
4512     problems appear (headerfile conflicts being the most common
4513     manifestation), I suggest reinstalling the gcc to match
4514     your operating system release.
4515
4516 EOM
4517       ;;
4518    *) gccosandvers='' ;; # failed to parse, better be silent
4519    esac
4520    ;;
4521 esac
4522 case "$ccname" in
4523 '') ccname="$cc" ;;
4524 esac
4525
4526 # gcc 3.* complain about adding -Idirectories that they already know about,
4527 # so we will take those off from locincpth.
4528 case "$gccversion" in
4529 3*)
4530     echo "main(){}">try.c
4531     for incdir in $locincpth; do
4532        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4533              grep '^c[cp]p*[01]: warning: changing search order '`
4534        if test "X$warn" != X; then
4535            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4536        fi
4537     done
4538     $rm -f try try.*
4539 esac
4540
4541 : What should the include directory be ?
4542 echo " "
4543 $echo $n "Hmm...  $c"
4544 dflt='/usr/include'
4545 incpath=''
4546 mips_type=''
4547 if $test -f /bin/mips && /bin/mips; then
4548         echo "Looks like a MIPS system..."
4549         $cat >usr.c <<'EOCP'
4550 #ifdef SYSTYPE_BSD43
4551 /bsd43
4552 #endif
4553 EOCP
4554         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4555                 dflt='/bsd43/usr/include'
4556                 incpath='/bsd43'
4557                 mips_type='BSD 4.3'
4558         else
4559                 mips_type='System V'
4560         fi
4561         $rm -f usr.c usr.out
4562         echo "and you're compiling with the $mips_type compiler and libraries."
4563         xxx_prompt=y
4564         echo "exit 0" >mips
4565 else
4566         echo "Doesn't look like a MIPS system."
4567         xxx_prompt=n
4568         echo "exit 1" >mips
4569 fi
4570 chmod +x mips
4571 $eunicefix mips
4572 case "$usrinc" in
4573 '') ;;
4574 *) dflt="$usrinc";;
4575 esac
4576 case "$xxx_prompt" in
4577 y)      fn=d/
4578         echo " "
4579         rp='Where are the include files you want to use?'
4580         . ./getfile
4581         usrinc="$ans"
4582         ;;
4583 *)      usrinc="$dflt"
4584         ;;
4585 esac
4586
4587 : see how we invoke the C preprocessor
4588 echo " "
4589 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4590 cat <<'EOT' >testcpp.c
4591 #define ABC abc
4592 #define XYZ xyz
4593 ABC.XYZ
4594 EOT
4595 cd ..
4596 if test ! -f cppstdin; then
4597         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4598                 # AIX cc -E doesn't show the absolute headerfile
4599                 # locations but we'll cheat by using the -M flag.
4600                 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
4601         else
4602                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4603         fi
4604 else
4605         echo "Keeping your $hint cppstdin wrapper."
4606 fi
4607 chmod 755 cppstdin
4608 wrapper=`pwd`/cppstdin
4609 ok='false'
4610 cd UU
4611
4612 if $test "X$cppstdin" != "X" && \
4613         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4614         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4615 then
4616         echo "You used to use $cppstdin $cppminus so we'll use that again."
4617         case "$cpprun" in
4618         '') echo "But let's see if we can live without a wrapper..." ;;
4619         *)
4620                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4621                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4622                 then
4623                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4624                         ok='true'
4625                 else
4626                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4627                 fi
4628                 ;;
4629         esac
4630 else
4631         case "$cppstdin" in
4632         '') ;;
4633         *)
4634                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4635                 ;;
4636         esac
4637 fi
4638
4639 if $ok; then
4640         : nothing
4641 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4642         $cc -E <testcpp.c >testcpp.out 2>&1; \
4643         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4644         echo "Yup, it does."
4645         x_cpp="$cc -E"
4646         x_minus='';
4647 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4648         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4649         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4650         echo "Yup, it does."
4651         x_cpp="$cc -E"
4652         x_minus='-';
4653 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4654         $cc -P <testcpp.c >testcpp.out 2>&1; \
4655         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4656         echo "Yipee, that works!"
4657         x_cpp="$cc -P"
4658         x_minus='';
4659 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4660         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4661         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4662         echo "At long last!"
4663         x_cpp="$cc -P"
4664         x_minus='-';
4665 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4666         $cpp <testcpp.c >testcpp.out 2>&1; \
4667         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4668         echo "It works!"
4669         x_cpp="$cpp"
4670         x_minus='';
4671 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4672         $cpp - <testcpp.c >testcpp.out 2>&1; \
4673         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4674         echo "Hooray, it works!  I was beginning to wonder."
4675         x_cpp="$cpp"
4676         x_minus='-';
4677 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4678         $wrapper <testcpp.c >testcpp.out 2>&1; \
4679         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4680         x_cpp="$wrapper"
4681         x_minus=''
4682         echo "Eureka!"
4683 else
4684         dflt=''
4685         rp="No dice.  I can't find a C preprocessor.  Name one:"
4686         . ./myread
4687         x_cpp="$ans"
4688         x_minus=''
4689         $x_cpp <testcpp.c >testcpp.out 2>&1
4690         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4691                 echo "OK, that will do." >&4
4692         else
4693 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4694                 exit 1
4695         fi
4696 fi
4697
4698 case "$ok" in
4699 false)
4700         cppstdin="$x_cpp"
4701         cppminus="$x_minus"
4702         cpprun="$x_cpp"
4703         cpplast="$x_minus"
4704         set X $x_cpp
4705         shift
4706         case "$1" in
4707         "$cpp")
4708                 echo "Perhaps can we force $cc -E using a wrapper..."
4709                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4710                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4711                 then
4712                         echo "Yup, we can."
4713                         cppstdin="$wrapper"
4714                         cppminus='';
4715                 else
4716                         echo "Nope, we'll have to live without it..."
4717                 fi
4718                 ;;
4719         esac
4720         case "$cpprun" in
4721         "$wrapper")
4722                 cpprun=''
4723                 cpplast=''
4724                 ;;
4725         esac
4726         ;;
4727 esac
4728
4729 case "$cppstdin" in
4730 "$wrapper"|'cppstdin') ;;
4731 *) $rm -f $wrapper;;
4732 esac
4733 $rm -f testcpp.c testcpp.out
4734
4735 : Set private lib path
4736 case "$plibpth" in
4737 '') if ./mips; then
4738                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4739         fi;;
4740 esac
4741 case "$libpth" in
4742 ' ') dlist='';;
4743 '') dlist="$loclibpth $plibpth $glibpth";;
4744 *) dlist="$libpth";;
4745 esac
4746
4747 : Now check and see which directories actually exist, avoiding duplicates
4748 libpth=''
4749 for xxx in $dlist
4750 do
4751     if $test -d $xxx; then
4752                 case " $libpth " in
4753                 *" $xxx "*) ;;
4754                 *) libpth="$libpth $xxx";;
4755                 esac
4756     fi
4757 done
4758 $cat <<'EOM'
4759
4760 Some systems have incompatible or broken versions of libraries.  Among
4761 the directories listed in the question below, please remove any you
4762 know not to be holding relevant libraries, and add any that are needed.
4763 Say "none" for none.
4764
4765 EOM
4766 case "$libpth" in
4767 '') dflt='none';;
4768 *)
4769         set X $libpth
4770         shift
4771         dflt=${1+"$@"}
4772         ;;
4773 esac
4774 rp="Directories to use for library searches?"
4775 . ./myread
4776 case "$ans" in
4777 none) libpth=' ';;
4778 *) libpth="$ans";;
4779 esac
4780
4781 : compute shared library extension
4782 case "$so" in
4783 '')
4784         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4785                 dflt='sl'
4786         else
4787                 dflt='so'
4788         fi
4789         ;;
4790 *) dflt="$so";;
4791 esac
4792 $cat <<EOM
4793
4794 On some systems, shared libraries may be available.  Answer 'none' if
4795 you want to suppress searching of shared libraries for the remainder
4796 of this configuration.
4797
4798 EOM
4799 rp='What is the file extension used for shared libraries?'
4800 . ./myread
4801 so="$ans"
4802
4803 : Define several unixisms.
4804 : Hints files or command line option can be used to override them.
4805 : The convoluted testing is in case hints files set either the old
4806 : or the new name.
4807 case "$_exe" in
4808 '')     case "$exe_ext" in
4809         '')     ;;
4810         *)      _exe="$exe_ext" ;;
4811         esac
4812         ;;
4813 esac
4814 case "$_a" in
4815 '')     case "$lib_ext" in
4816     '') _a='.a';;
4817         *)      _a="$lib_ext" ;;
4818         esac
4819         ;;
4820 esac
4821 case "$_o" in
4822 '') case "$obj_ext" in
4823         '')     _o='.o';;
4824         *)      _o="$obj_ext";;
4825         esac
4826         ;;
4827 esac
4828 case "$p_" in
4829 '') case "$path_sep" in
4830         '')     p_=':';;
4831         *)      p_="$path_sep";;
4832         esac
4833         ;;
4834 esac
4835 exe_ext=$_exe
4836 lib_ext=$_a
4837 obj_ext=$_o
4838 path_sep=$p_
4839
4840 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4841
4842 : Which makefile gets called first.  This is used by make depend.
4843 case "$firstmakefile" in
4844 '') firstmakefile='makefile';;
4845 esac
4846
4847 case "$ccflags" in
4848 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4849 esac
4850
4851 case "$uselongdouble" in
4852 $define|true|[yY]*)     dflt='y';;
4853 *) dflt='n';;
4854 esac
4855 cat <<EOM
4856
4857 Perl can be built to take advantage of long doubles which
4858 (if available) may give more accuracy and range for floating point numbers.
4859
4860 If this doesn't make any sense to you, just accept the default '$dflt'.
4861 EOM
4862 rp='Try to use long doubles if available?'
4863 . ./myread
4864 case "$ans" in
4865 y|Y)    val="$define"   ;;
4866 *)      val="$undef"    ;;
4867 esac
4868 set uselongdouble
4869 eval $setvar
4870
4871 case "$uselongdouble" in
4872 true|[yY]*) uselongdouble="$define" ;;
4873 esac
4874
4875 : Look for a hint-file generated 'call-back-unit'.  If the
4876 : user has specified that long doubles should be used,
4877 : we may need to set or change some other defaults.
4878 if $test -f uselongdouble.cbu; then
4879     echo "Your platform has some specific hints regarding long doubles, using them..."
4880     . ./uselongdouble.cbu
4881 else
4882     case "$uselongdouble" in
4883         $define)
4884                 $cat <<EOM
4885 (Your platform does not have any specific hints for long doubles.)
4886 EOM
4887         ;;
4888     esac
4889 fi
4890
4891 : Looking for optional libraries
4892 echo " "
4893 echo "Checking for optional libraries..." >&4
4894 case "$libs" in
4895 ' '|'') dflt='';;
4896 *) dflt="$libs";;
4897 esac
4898 case "$libswanted" in
4899 '') libswanted='c_s';;
4900 esac
4901 case "$usesocks" in
4902 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4903 esac
4904 libsfound=''
4905 libsfiles=''
4906 libsdirs=''
4907 libspath=''
4908 for thisdir in $libpth $xlibpth; do
4909   test -d $thisdir && libspath="$libspath $thisdir"
4910 done
4911 for thislib in $libswanted; do
4912         for thisdir in $libspath; do
4913             xxx=''
4914             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4915                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4916                 $test -f "$xxx" && eval $libscheck
4917                 $test -f "$xxx" && libstyle=shared
4918             fi
4919             if test ! -f "$xxx"; then
4920                 xxx=$thisdir/lib$thislib.$so
4921                 $test -f "$xxx" && eval $libscheck
4922                 $test -f "$xxx" && libstyle=shared
4923             fi  
4924             if test ! -f "$xxx"; then
4925                 xxx=$thisdir/lib$thislib$_a
4926                 $test -f "$xxx" && eval $libscheck
4927                 $test -f "$xxx" && libstyle=static
4928             fi
4929             if test ! -f "$xxx"; then
4930                 xxx=$thisdir/$thislib$_a
4931                 $test -f "$xxx" && eval $libscheck
4932                 $test -f "$xxx" && libstyle=static
4933             fi
4934             if test ! -f "$xxx"; then
4935                 xxx=$thisdir/lib${thislib}_s$_a
4936                 $test -f "$xxx" && eval $libscheck
4937                 $test -f "$xxx" && libstyle=static
4938                 $test -f "$xxx" && thislib=${thislib}_s
4939             fi
4940             if test ! -f "$xxx"; then
4941                 xxx=$thisdir/Slib$thislib$_a
4942                 $test -f "$xxx" && eval $libscheck
4943                 $test -f "$xxx" && libstyle=static
4944             fi
4945             if $test -f "$xxx"; then
4946                 case "$libstyle" in
4947                 shared) echo "Found -l$thislib (shared)." ;;
4948                 static) echo "Found -l$thislib." ;;
4949                 *)      echo "Found -l$thislib ($libstyle)." ;;
4950                 esac
4951                 case " $dflt " in
4952                 *"-l$thislib "*);;
4953                 *) dflt="$dflt -l$thislib"
4954                    libsfound="$libsfound $xxx"
4955                    yyy=`basename $xxx`
4956                    libsfiles="$libsfiles $yyy"
4957                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4958                    case " $libsdirs " in
4959                    *" $yyy "*) ;;
4960                    *) libsdirs="$libsdirs $yyy" ;;
4961                    esac
4962                    ;;
4963                 esac
4964                 break
4965             fi  
4966         done
4967         if $test ! -f "$xxx"; then
4968             echo "No -l$thislib."
4969         fi
4970 done
4971 set X $dflt
4972 shift
4973 dflt="$*"
4974 case "$libs" in
4975 '') dflt="$dflt";;
4976 *) dflt="$libs";;
4977 esac
4978 case "$dflt" in
4979 ' '|'') dflt='none';;
4980 esac
4981
4982 $cat <<EOM
4983
4984 In order to compile $package on your machine, a number of libraries
4985 are usually needed.  Include any other special libraries here as well.
4986 Say "none" for none.  The default list is almost always right.
4987 EOM
4988
4989 echo " "
4990 rp="What libraries to use?"
4991 . ./myread
4992 case "$ans" in
4993 none) libs=' ';;
4994 *) libs="$ans";;
4995 esac
4996
4997 : determine optimization, if desired, or use for debug flag also
4998 case "$optimize" in
4999 ' '|$undef) dflt='none';;
5000 '') dflt='-O';;
5001 *) dflt="$optimize";;
5002 esac
5003 $cat <<EOH
5004
5005 By default, $package compiles with the -O flag to use the optimizer.
5006 Alternately, you might want to use the symbolic debugger, which uses
5007 the -g flag (on traditional Unix systems).  Either flag can be
5008 specified here.  To use neither flag, specify the word "none".
5009
5010 EOH
5011 rp="What optimizer/debugger flag should be used?"
5012 . ./myread
5013 optimize="$ans"
5014 case "$optimize" in
5015 'none') optimize=" ";;
5016 esac
5017
5018 : Check what DEBUGGING is required from the command line
5019 : -DEBUGGING      or -DDEBUGGING or
5020 : -DEBUGGING=both                       = -g + -DDEBUGGING
5021 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5022 : -DEBUGGING=none or -UDEBUGGING        =
5023 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5024 case "$EBUGGING" in
5025 '')     ;;
5026 *)      DEBUGGING=$EBUGGING ;;
5027 esac
5028
5029 case "$DEBUGGING" in
5030 -g|both|$define)
5031     case "$optimize" in
5032         *-g*) ;;
5033         *)    optimize="$optimize -g" ;;
5034     esac ;;
5035 none|$undef)
5036     case "$optimize" in
5037         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5038                 shift
5039                 optimize="$*"
5040                 ;;
5041     esac ;;
5042 esac
5043
5044 dflt=''
5045 case "$DEBUGGING" in
5046 both|$define) dflt='-DDEBUGGING'
5047 esac
5048
5049 : argument order is deliberate, as the flag will start with - which set could
5050 : think is an option
5051 checkccflag='check=$1; flag=$2; callback=$3;
5052 echo " ";
5053 echo "Checking if your compiler accepts $flag" 2>&1;
5054 echo "int main(void) { return 0; }" > gcctest.c;
5055 if $cc -O2 $flag -o gcctest gcctest.c && ./gcctest; then
5056     echo "Yes, it does." 2>&1;
5057     case "$ccflags" in
5058     *$check*)
5059         echo "Leaving current flags $ccflags alone." 2>&1
5060         ;;
5061     *) dflt="$dflt $flag";
5062         eval $callback
5063         ;;
5064     esac
5065 else
5066     echo "Nope, it does not, but that is ok." 2>&1;
5067 fi
5068 '
5069
5070 : We will not override a previous value, but we might want to
5071 : augment a hint file
5072 case "$hint" in
5073 default|recommended)
5074         case "$gccversion" in
5075         1*) dflt="$dflt -fpcc-struct-return" ;;
5076         esac
5077         case "$optimize:$DEBUGGING" in
5078         *-g*:old) dflt="$dflt -DDEBUGGING";;
5079         esac
5080         case "$gccversion" in
5081         2*) if test -d /etc/conf/kconfig.d &&
5082                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5083                 then
5084                         # Interactive Systems (ISC) POSIX mode.
5085                         dflt="$dflt -posix"
5086                 fi
5087                 ;;
5088         esac
5089         case "$gccversion" in
5090         1*) ;;
5091         2.[0-8]*) ;;
5092         ?*)     set strict-aliasing -fno-strict-aliasing
5093                 eval $checkccflag
5094                 ;;
5095         esac
5096         # For gcc, adding -pipe speeds up compilations for some, but apparently
5097         # some assemblers can't read from stdin.  (It also slows down compilations
5098         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5099         case "$gccversion" in
5100         ?*)     set pipe -pipe
5101                 eval $checkccflag
5102                 ;;
5103         esac
5104
5105         # on x86_64 (at least) we require an extra library (libssp) in the
5106         # link command line. This library is not named, so I infer that it is
5107         # an implementation detail that may change. Hence the safest approach
5108         # is to add the flag to the flags passed to the compiler at link time,
5109         # as that way the compiler can do the right implementation dependant
5110         # thing. (NWC)
5111         case "$gccversion" in
5112         ?*)     set stack-protector -fstack-protector 'ldflags="$ldflags -fstack-protector"'
5113                 eval $checkccflag
5114                 ;;
5115         esac
5116         ;;
5117 esac
5118
5119 case "$mips_type" in
5120 *BSD*|'') inclwanted="$locincpth $usrinc";;
5121 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5122 esac
5123 for thisincl in $inclwanted; do
5124         if $test -d $thisincl; then
5125                 if $test x$thisincl != x$usrinc; then
5126                         case "$dflt" in
5127                         *" -I$thisincl "*);;
5128                         *) dflt="$dflt -I$thisincl ";;
5129                         esac
5130                 fi
5131         fi
5132 done
5133
5134 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5135         xxx=true;
5136 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5137         xxx=true;
5138 else
5139         xxx=false;
5140 fi;
5141 if $xxx; then
5142         case "$dflt" in
5143         *$2*);;
5144         *) dflt="$dflt -D$2";;
5145         esac;
5146 fi'
5147
5148 set signal.h LANGUAGE_C; eval $inctest
5149
5150 case "$usesocks" in
5151 $define)
5152         ccflags="$ccflags -DSOCKS"
5153         ;;
5154 esac
5155
5156 case "$hint" in
5157 default|recommended) dflt="$ccflags $dflt" ;;
5158 *) dflt="$ccflags";;
5159 esac
5160
5161 case "$dflt" in
5162 ''|' ') dflt=none;;
5163 esac
5164
5165 $cat <<EOH
5166
5167 Your C compiler may want other flags.  For this question you should include
5168 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5169 but you should NOT include libraries or ld flags like -lwhatever.  If you
5170 want $package to honor its debug switch, you should include -DDEBUGGING here.
5171 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5172
5173 To use no flags, specify the word "none".
5174
5175 EOH
5176 set X $dflt
5177 shift
5178 dflt=${1+"$@"}
5179 rp="Any additional cc flags?"
5180 . ./myread
5181 case "$ans" in
5182 none) ccflags='';;
5183 *) ccflags="$ans";;
5184 esac
5185
5186 : the following weeds options from ccflags that are of no interest to cpp
5187 case "$cppflags" in
5188 '') cppflags="$ccflags" ;;
5189 *)  cppflags="$cppflags $ccflags" ;;
5190 esac
5191 case "$gccversion" in
5192 1*) cppflags="$cppflags -D__GNUC__"
5193 esac
5194 case "$mips_type" in
5195 '');;
5196 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5197 esac
5198 case "$cppflags" in
5199 '');;
5200 *)
5201         echo " "
5202         echo "Let me guess what the preprocessor flags are..." >&4
5203         set X $cppflags
5204         shift
5205         cppflags=''
5206         $cat >cpp.c <<'EOM'
5207 #define BLURFL foo
5208
5209 BLURFL xx LFRULB
5210 EOM
5211         previous=''
5212         for flag in $*
5213         do
5214                 case "$flag" in
5215                 -*) ftry="$flag";;
5216                 *) ftry="$previous $flag";;
5217                 esac
5218                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5219                         >cpp1.out 2>/dev/null && \
5220                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5221                         >cpp2.out 2>/dev/null && \
5222                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5223                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5224                 then
5225                         cppflags="$cppflags $ftry"
5226                         previous=''
5227                 else
5228                         previous="$flag"
5229                 fi
5230         done
5231         set X $cppflags
5232         shift
5233         cppflags=${1+"$@"}
5234         case "$cppflags" in
5235         *-*)  echo "They appear to be: $cppflags";;
5236         esac
5237         $rm -f cpp.c cpp?.out
5238         ;;
5239 esac
5240
5241 : flags used in final linking phase
5242 case "$ldflags" in
5243 '') if ./venix; then
5244                 dflt='-i -z'
5245         else
5246                 dflt=''
5247         fi
5248         case "$ccflags" in
5249         *-posix*) dflt="$dflt -posix" ;;
5250         esac
5251         ;;
5252 *) dflt="$ldflags";;
5253 esac
5254
5255 : Try to guess additional flags to pick up local libraries.
5256 for thislibdir in $libpth; do
5257         case " $loclibpth " in
5258         *" $thislibdir "*)
5259                 case "$dflt " in
5260                 *"-L$thislibdir "*) ;;
5261                 *)  dflt="$dflt -L$thislibdir" ;;
5262                 esac
5263                 ;;
5264         esac
5265 done
5266
5267 case "$dflt" in
5268 '') dflt='none' ;;
5269 esac
5270
5271 $cat <<EOH
5272
5273 Your C linker may need flags.  For this question you should
5274 include -L/whatever and any other flags used by the C linker, but you
5275 should NOT include libraries like -lwhatever.
5276
5277 Make sure you include the appropriate -L/path flags if your C linker
5278 does not normally search all of the directories you specified above,
5279 namely
5280         $libpth
5281 To use no flags, specify the word "none".
5282
5283 EOH
5284
5285 rp="Any additional ld flags (NOT including libraries)?"
5286 . ./myread
5287 case "$ans" in
5288 none) ldflags='';;
5289 *) ldflags="$ans";;
5290 esac
5291 rmlist="$rmlist pdp11"
5292
5293 : coherency check
5294 echo " "
5295 echo "Checking your choice of C compiler and flags for coherency..." >&4
5296 $cat > try.c <<'EOF'
5297 #include <stdio.h>
5298 int main() { printf("Ok\n"); return(0); }
5299 EOF
5300 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5301 shift
5302 $cat >try.msg <<'EOM'
5303 I've tried to compile and run the following simple program:
5304
5305 EOM
5306 $cat try.c >> try.msg
5307
5308 $cat >> try.msg <<EOM
5309
5310 I used the command:
5311
5312         $*
5313         $run ./try
5314
5315 and I got the following output:
5316
5317 EOM
5318 dflt=y
5319 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5320         if $sh -c "$run ./try" >>try.msg 2>&1; then
5321                 xxx=`$run ./try`
5322                 case "$xxx" in
5323                 "Ok") dflt=n ;;
5324                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5325                         case " $libs " in
5326                         *" -lsfio "*)
5327                                 cat >> try.msg <<'EOQS'
5328 If $libs contains -lsfio, and sfio is mis-configured, then it
5329 sometimes (apparently) runs and exits with a 0 status, but with no
5330 output!  It may have to do with sfio's use of _exit vs. exit.
5331
5332 EOQS
5333                                 rp="You have a big problem.  Shall I abort Configure"
5334                                 dflt=y
5335                                 ;;
5336                         esac
5337                         ;;
5338                 esac
5339         else
5340                 echo "The program compiled OK, but exited with status $?." >>try.msg
5341                 rp="You have a problem.  Shall I abort Configure"
5342                 dflt=y
5343         fi
5344 else
5345         echo "I can't compile the test program." >>try.msg
5346         rp="You have a BIG problem.  Shall I abort Configure"
5347         dflt=y
5348 fi
5349 case "$dflt" in
5350 y)
5351         $cat try.msg >&4
5352         case "$knowitall" in
5353         '')
5354                 echo "(The supplied flags or libraries might be incorrect.)"
5355                 ;;
5356         *) dflt=n;;
5357         esac
5358         echo " "
5359         . ./myread
5360         case "$ans" in
5361         n*|N*) ;;
5362         *)      echo "Ok.  Stopping Configure." >&4
5363                 exit 1
5364                 ;;
5365         esac
5366         ;;
5367 n) echo "OK, that should do.";;
5368 esac
5369 $rm_try
5370
5371 : define a shorthand compile call
5372 compile='
5373 mc_file=$1;
5374 shift;
5375 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5376 : define a shorthand compile call for compilations that should be ok.
5377 compile_ok='
5378 mc_file=$1;
5379 shift;
5380 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5381
5382 : determine filename position in cpp output
5383 echo " "
5384 echo "Computing filename position in cpp output for #include directives..." >&4
5385 case "$osname" in
5386 vos) testaccess=-e ;;
5387 *)   testaccess=-r ;;
5388 esac
5389 echo '#include <stdio.h>' > foo.c
5390 $cat >fieldn <<EOF
5391 $startsh
5392 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5393 $grep '^[       ]*#.*stdio\.h' | \
5394 while read cline; do
5395         pos=1
5396         set \$cline
5397         while $test \$# -gt 0; do
5398                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5399                         echo "\$pos"
5400                         exit 0
5401                 fi
5402                 shift
5403                 pos=\`expr \$pos + 1\`
5404         done
5405 done
5406 EOF
5407 chmod +x fieldn
5408 fieldn=`./fieldn`
5409 $rm -f foo.c fieldn
5410 case $fieldn in
5411 '') pos='???';;
5412 1) pos=first;;
5413 2) pos=second;;
5414 3) pos=third;;
5415 *) pos="${fieldn}th";;
5416 esac
5417 echo "Your cpp writes the filename in the $pos field of the line."
5418
5419 case "$osname" in
5420 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5421 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5422 *)   cppfilter='' ;;
5423 esac
5424 : locate header file
5425 $cat >findhdr <<EOF
5426 $startsh
5427 wanted=\$1
5428 name=''
5429 for usrincdir in $usrinc
5430 do
5431         if test -f \$usrincdir/\$wanted; then
5432                 echo "\$usrincdir/\$wanted"
5433                 exit 0
5434         fi
5435 done
5436 awkprg='{ print \$$fieldn }'
5437 echo "#include <\$wanted>" > foo\$\$.c
5438 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5439 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5440 while read cline; do
5441         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5442         case "\$name" in
5443         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5444         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5445         *) exit 2;;
5446         esac;
5447 done;
5448 #
5449 # status = 0: grep returned 0 lines, case statement not executed
5450 # status = 1: headerfile found
5451 # status = 2: while loop executed, no headerfile found
5452 #
5453 status=\$?
5454 $rm -f foo\$\$.c;
5455 if test \$status -eq 1; then
5456         exit 0;
5457 fi
5458 exit 1
5459 EOF
5460 chmod +x findhdr
5461
5462 : define an alternate in-header-list? function
5463 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5464 cont=true; xxf="echo \"<\$1> found.\" >&4";
5465 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5466 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5467 esac;
5468 case $# in 4) instead=instead;; *) instead="at last";; esac;
5469 while $test "$cont"; do
5470         xxx=`./findhdr $1`
5471         var=$2; eval "was=\$$2";
5472         if $test "$xxx" && $test -r "$xxx";
5473         then eval $xxf;
5474         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5475                 cont="";
5476         else eval $xxnf;
5477         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5478         set $yyy; shift; shift; yyy=$@;
5479         case $# in 0) cont="";;
5480         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5481                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5482         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5483                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5484         esac;
5485 done;
5486 while $test "$yyy";
5487 do set $yyy; var=$2; eval "was=\$$2";
5488         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5489         set $yyy; shift; shift; yyy=$@;
5490 done'
5491
5492 : see if stdlib is available
5493 set stdlib.h i_stdlib
5494 eval $inhdr
5495
5496 : check for lengths of integral types
5497 echo " "
5498 case "$intsize" in
5499 '')
5500         echo "Checking to see how big your integers are..." >&4
5501         $cat >try.c <<EOCP
5502 #include <stdio.h>
5503 #$i_stdlib I_STDLIB
5504 #ifdef I_STDLIB
5505 #include <stdlib.h>
5506 #endif
5507 int main()
5508 {
5509         printf("intsize=%d;\n", (int)sizeof(int));
5510         printf("longsize=%d;\n", (int)sizeof(long));
5511         printf("shortsize=%d;\n", (int)sizeof(short));
5512         exit(0);
5513 }
5514 EOCP
5515         set try
5516         if eval $compile_ok && $run ./try > /dev/null; then
5517                 eval `$run ./try`
5518                 echo "Your integers are $intsize bytes long."
5519                 echo "Your long integers are $longsize bytes long."
5520                 echo "Your short integers are $shortsize bytes long."
5521         else
5522                 $cat >&4 <<EOM
5523 !
5524 Help! I can't compile and run the intsize test program: please enlighten me!
5525 (This is probably a misconfiguration in your system or libraries, and
5526 you really ought to fix it.  Still, I'll try anyway.)
5527 !
5528 EOM
5529                 dflt=4
5530                 rp="What is the size of an integer (in bytes)?"
5531                 . ./myread
5532                 intsize="$ans"
5533                 dflt=$intsize
5534                 rp="What is the size of a long integer (in bytes)?"
5535                 . ./myread
5536                 longsize="$ans"
5537                 dflt=2
5538                 rp="What is the size of a short integer (in bytes)?"
5539                 . ./myread
5540                 shortsize="$ans"
5541         fi
5542         ;;
5543 esac
5544 $rm_try
5545
5546 : check for long long
5547 echo " "
5548 echo "Checking to see if you have long long..." >&4
5549 echo 'int main() { long long x = 7; return 0; }' > try.c
5550 set try
5551 if eval $compile; then
5552         val="$define"
5553         echo "You have long long."
5554 else
5555         val="$undef"
5556         echo "You do not have long long."
5557 fi
5558 $rm_try
5559 set d_longlong
5560 eval $setvar
5561
5562 : check for length of long long
5563 case "${d_longlong}${longlongsize}" in
5564 $define)
5565         echo " "
5566         echo "Checking to see how big your long longs are..." >&4
5567         $cat >try.c <<'EOCP'
5568 #include <stdio.h>
5569 int main()
5570 {
5571     printf("%d\n", (int)sizeof(long long));
5572     return(0);
5573 }
5574 EOCP
5575         set try
5576         if eval $compile_ok; then
5577                 longlongsize=`$run ./try`
5578                 echo "Your long longs are $longlongsize bytes long."
5579         else
5580                 dflt='8'
5581                 echo " "
5582                 echo "(I can't seem to compile the test program.  Guessing...)"
5583                 rp="What is the size of a long long (in bytes)?"
5584                 . ./myread
5585                 longlongsize="$ans"
5586         fi
5587         if $test "X$longsize" = "X$longlongsize"; then
5588                 echo "(That isn't any different from an ordinary long.)"
5589         fi
5590         ;;
5591 esac
5592 $rm_try
5593
5594 : see if inttypes.h is available
5595 : we want a real compile instead of Inhdr because some systems
5596 : have an inttypes.h which includes non-existent headers
5597 echo " "
5598 $cat >try.c <<EOCP
5599 #include <inttypes.h>
5600 int main() {
5601         static int32_t foo32 = 0x12345678;
5602 }
5603 EOCP
5604 set try
5605 if eval $compile; then
5606         echo "<inttypes.h> found." >&4
5607         val="$define"
5608 else
5609         echo "<inttypes.h> NOT found." >&4
5610         val="$undef"
5611 fi
5612 $rm_try
5613 set i_inttypes
5614 eval $setvar
5615
5616 : check for int64_t
5617 echo " "
5618 echo "Checking to see if you have int64_t..." >&4
5619 $cat >try.c <<EOCP
5620 #include <sys/types.h>
5621 #$i_inttypes I_INTTYPES
5622 #ifdef I_INTTYPES
5623 #include <inttypes.h>
5624 #endif
5625 int main() { int64_t x = 7; }
5626 EOCP
5627 set try
5628 if eval $compile; then
5629         val="$define"
5630         echo "You have int64_t."
5631 else
5632         val="$undef"
5633         echo "You do not have int64_t."
5634 fi
5635 $rm_try
5636 set d_int64_t
5637 eval $setvar
5638
5639
5640 echo " "
5641 echo "Checking which 64-bit integer type we could use..." >&4
5642
5643 case "$intsize" in
5644 8) val=int
5645    set quadtype
5646    eval $setvar
5647    val='"unsigned int"'
5648    set uquadtype
5649    eval $setvar
5650    quadkind=1
5651    ;;
5652 *) case "$longsize" in
5653    8) val=long
5654       set quadtype
5655       eval $setvar
5656       val='"unsigned long"'
5657       set uquadtype
5658       eval $setvar
5659       quadkind=2
5660       ;;
5661    *) case "$d_longlong:$longlongsize" in
5662       define:8)
5663         val='"long long"'
5664         set quadtype
5665         eval $setvar
5666         val='"unsigned long long"'
5667         set uquadtype
5668         eval $setvar
5669         quadkind=3
5670         ;;
5671       *) case "$d_int64_t" in
5672          define)
5673            val=int64_t
5674            set quadtype
5675            eval $setvar
5676            val=uint64_t
5677            set uquadtype
5678            eval $setvar
5679            quadkind=4
5680            ;;
5681          esac
5682          ;;
5683       esac
5684       ;;
5685    esac
5686    ;;
5687 esac
5688
5689 case "$quadtype" in
5690 '')     echo "Alas, no 64-bit integer types in sight." >&4
5691         d_quad="$undef"
5692         ;;
5693 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5694         d_quad="$define"
5695         ;;
5696 esac
5697
5698
5699 case "$uselonglong" in
5700 "$define"|true|[yY]*)
5701         cat <<EOM >&4
5702
5703 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5704 EOM
5705         use64bitint="$define"
5706         ;;
5707 esac                          
5708 case "$use64bits" in
5709 "$define"|true|[yY]*)
5710         cat <<EOM >&4
5711
5712 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5713 EOM
5714         use64bitint="$define"
5715         ;;
5716 esac                          
5717 case "$use64bitints" in
5718 "$define"|true|[yY]*)
5719         cat <<EOM >&4
5720
5721 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5722 EOM
5723         use64bitint="$define"
5724         ;;
5725 esac                          
5726 case "$use64bitsint" in
5727 "$define"|true|[yY]*)
5728         cat <<EOM >&4
5729
5730 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5731 EOM
5732         use64bitint="$define"
5733         ;;
5734 esac                          
5735 case "$uselonglongs" in
5736 "$define"|true|[yY]*)
5737         cat <<EOM >&4
5738
5739 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5740 EOM
5741         use64bitint="$define"
5742         ;;
5743 esac                          
5744 case "$use64bitsall" in
5745 "$define"|true|[yY]*)
5746         cat <<EOM >&4
5747
5748 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5749 EOM
5750         use64bitall="$define"
5751         ;;
5752 esac                          
5753
5754 case "$ccflags" in
5755 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5756 esac
5757 case "$use64bitall" in
5758 "$define"|true|[yY]*) use64bitint="$define" ;;
5759 esac
5760
5761 case "$longsize" in
5762 8) cat <<EOM
5763
5764 You have natively 64-bit long integers.
5765 EOM
5766    val="$define"
5767    ;;
5768 *) case "$use64bitint" in
5769    "$define"|true|[yY]*) dflt='y';;
5770    *) dflt='n';;
5771    esac
5772    case "$d_quad" in
5773    "$define") ;;
5774    *) dflt='n' ;;
5775    esac
5776    cat <<EOM
5777
5778 Perl can be built to take advantage of 64-bit integer types
5779 on some systems.  To do so, Configure can be run with -Duse64bitint.
5780 Choosing this option will most probably introduce binary incompatibilities.
5781
5782 If this doesn't make any sense to you, just accept the default '$dflt'.
5783 (The default has been chosen based on your configuration.)
5784 EOM
5785    rp='Try to use 64-bit integers, if available?'
5786    . ./myread
5787    case "$ans" in
5788    [yY]*) val="$define" ;;
5789    *)     val="$undef"  ;;
5790    esac
5791    ;;
5792 esac
5793 set use64bitint
5794 eval $setvar
5795
5796 case "$use64bitall" in
5797 "$define"|true|[yY]*) dflt='y' ;;
5798 *) case "$longsize" in
5799    8) dflt='y' ;;
5800    *) dflt='n' ;;
5801    esac
5802    ;;
5803 esac    
5804 cat <<EOM
5805
5806 You may also choose to try maximal 64-bitness.  It means using as much
5807 64-bitness as possible on the platform.  This in turn means even more
5808 binary incompatibilities.  On the other hand, your platform may not
5809 have any more 64-bitness available than what you already have chosen.
5810
5811 If this doesn't make any sense to you, just accept the default '$dflt'.
5812 (The default has been chosen based on your configuration.)
5813 EOM
5814 rp='Try to use maximal 64-bit support, if available?'
5815 . ./myread
5816 case "$ans" in
5817 [yY]*) val="$define" ;;
5818 *)     val="$undef"  ;;
5819 esac
5820 set use64bitall
5821 eval $setvar
5822 case "$use64bitall" in
5823 "$define")
5824         case "$use64bitint" in
5825         "$undef")
5826                 cat <<EOM
5827
5828 Since you have chosen a maximally 64-bit build, I'm also turning on
5829 the use of 64-bit integers.
5830 EOM
5831                 use64bitint="$define" ;;
5832         esac
5833         ;;
5834 esac
5835
5836 : Look for a hint-file generated 'call-back-unit'.  If the
5837 : user has specified that a 64-bit perl is to be built,
5838 : we may need to set or change some other defaults.
5839 if $test -f use64bitint.cbu; then
5840         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5841         . ./use64bitint.cbu
5842 fi
5843 case "$use64bitint" in
5844 "$define"|true|[yY]*)
5845         case "$longsize" in
5846         4) case "$archname64" in
5847            '') archname64=64int ;;
5848            esac
5849            ;;
5850         esac
5851         ;;
5852 esac
5853
5854 : Look for a hint-file generated 'call-back-unit'.  If the
5855 : user has specified that a maximally 64-bit perl is to be built,
5856 : we may need to set or change some other defaults.
5857 if $test -f use64bitall.cbu; then
5858         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5859         . ./use64bitall.cbu
5860 fi
5861 case "$use64bitall" in
5862 "$define"|true|[yY]*)
5863         case "$longsize" in
5864         4) case "$archname64" in
5865            ''|64int) archname64=64all ;;
5866            esac
5867            ;;
5868         esac
5869         ;;
5870 esac
5871
5872 case "$d_quad:$use64bitint" in
5873 $undef:$define)
5874         cat >&4 <<EOF
5875
5876 *** You have chosen to use 64-bit integers,
5877 *** but none can be found.
5878 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5879 *** Cannot continue, aborting.
5880
5881 EOF
5882         exit 1
5883         ;;
5884 esac
5885
5886 : check for length of double
5887 echo " "
5888 case "$doublesize" in
5889 '')
5890         echo "Checking to see how big your double precision numbers are..." >&4
5891         $cat >try.c <<EOCP
5892 #include <stdio.h>
5893 #$i_stdlib I_STDLIB
5894 #ifdef I_STDLIB
5895 #include <stdlib.h>
5896 #endif
5897 int main()
5898 {
5899     printf("%d\n", (int)sizeof(double));
5900     exit(0);
5901 }
5902 EOCP
5903         set try
5904         if eval $compile_ok; then
5905                 doublesize=`$run ./try`
5906                 echo "Your double is $doublesize bytes long."
5907         else
5908                 dflt='8'
5909                 echo "(I can't seem to compile the test program.  Guessing...)"
5910                 rp="What is the size of a double precision number (in bytes)?"
5911                 . ./myread
5912                 doublesize="$ans"
5913         fi
5914         ;;
5915 esac
5916 $rm_try
5917
5918 : check for long doubles
5919 echo " "
5920 echo "Checking to see if you have long double..." >&4
5921 echo 'int main() { long double x = 7.0; }' > try.c
5922 set try
5923 if eval $compile; then
5924         val="$define"
5925         echo "You have long double."
5926 else
5927         val="$undef"
5928         echo "You do not have long double."
5929 fi
5930 $rm_try
5931 set d_longdbl
5932 eval $setvar
5933
5934 : check for length of long double
5935 case "${d_longdbl}${longdblsize}" in
5936 $define)
5937         echo " "
5938         echo "Checking to see how big your long doubles are..." >&4
5939         $cat >try.c <<'EOCP'
5940 #include <stdio.h>
5941 int main()
5942 {
5943         printf("%d\n", sizeof(long double));
5944 }
5945 EOCP
5946         set try
5947         set try
5948         if eval $compile; then
5949                 longdblsize=`$run ./try`
5950                 echo "Your long doubles are $longdblsize bytes long."
5951         else
5952                 dflt='8'
5953                 echo " "
5954                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5955                 rp="What is the size of a long double (in bytes)?"
5956                 . ./myread
5957                 longdblsize="$ans"
5958         fi
5959         if $test "X$doublesize" = "X$longdblsize"; then
5960                 echo "That isn't any different from an ordinary double."
5961                 echo "I'll keep your setting anyway, but you may see some"
5962                 echo "harmless compilation warnings."
5963         fi
5964         ;;
5965 esac
5966 $rm_try
5967
5968 : determine the architecture name
5969 echo " "
5970 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5971         tarch=`arch`"-$osname"
5972 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5973         if uname -m > tmparch 2>&1 ; then
5974                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5975                         -e 's/$/'"-$osname/" tmparch`
5976         else
5977                 tarch="$osname"
5978         fi
5979         $rm -f tmparch
5980 else
5981         tarch="$osname"
5982 fi
5983 case "$myarchname" in
5984 ''|"$tarch") ;;
5985 *)
5986         echo "(Your architecture name used to be $myarchname.)"
5987         archname=''
5988         ;;
5989 esac
5990 case "$targetarch" in
5991 '') ;;
5992 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5993 esac
5994 myarchname="$tarch"
5995 case "$archname" in
5996 '') dflt="$tarch";;
5997 *) dflt="$archname";;
5998 esac
5999 rp='What is your architecture name'
6000 . ./myread
6001 archname="$ans"
6002 case "$usethreads" in
6003 $define)
6004         echo "Threads selected." >&4
6005         case "$archname" in
6006         *-thread*) echo "...and architecture name already has -thread." >&4
6007                 ;;
6008         *)      archname="$archname-thread"
6009                 echo "...setting architecture name to $archname." >&4
6010                 ;;
6011         esac
6012         ;;
6013 esac
6014 case "$usemultiplicity" in
6015 $define)
6016         echo "Multiplicity selected." >&4
6017         case "$archname" in
6018         *-multi*) echo "...and architecture name already has -multi." >&4
6019                 ;;
6020         *)      archname="$archname-multi"
6021                 echo "...setting architecture name to $archname." >&4
6022                 ;;
6023         esac
6024         ;;
6025 esac
6026 case "$use64bitint$use64bitall" in
6027 *"$define"*)
6028         case "$archname64" in
6029         '')
6030                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6031                 ;;
6032         *)
6033                 case "$use64bitint" in
6034                 "$define") echo "64 bit integers selected." >&4 ;;
6035                 esac
6036                 case "$use64bitall" in
6037                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6038                 esac
6039                 case "$archname" in
6040                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6041                         ;;
6042                 *)      archname="$archname-$archname64"
6043                         echo "...setting architecture name to $archname." >&4
6044                         ;;
6045                 esac
6046                 ;;
6047         esac
6048 esac
6049 case "$uselongdouble" in
6050 $define)
6051         echo "Long doubles selected." >&4
6052         case "$longdblsize" in
6053         $doublesize)
6054                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6055                 ;;
6056         *)
6057                 case "$archname" in
6058                 *-ld*) echo "...and architecture name already has -ld." >&4
6059                         ;;
6060                 *)      archname="$archname-ld"
6061                         echo "...setting architecture name to $archname." >&4
6062                         ;;
6063                 esac
6064                 ;;
6065         esac
6066         ;;
6067 esac
6068 case "$useperlio" in
6069 $define)
6070         echo "Perlio selected." >&4
6071         ;;
6072 *)
6073         echo "Perlio not selected, using stdio." >&4
6074         case "$archname" in
6075         *-stdio*) echo "...and architecture name already has -stdio." >&4
6076                 ;;
6077         *)      archname="$archname-stdio"
6078                 echo "...setting architecture name to $archname." >&4
6079                 ;;
6080         esac
6081         ;;
6082 esac
6083 if $test -f archname.cbu; then
6084         echo "Your platform has some specific hints for architecture name, using them..."
6085         . ./archname.cbu
6086 fi
6087
6088 : set the prefixit variable, to compute a suitable default value
6089 prefixit='case "$3" in
6090 ""|none)
6091         case "$oldprefix" in
6092         "") eval "$1=\"\$$2\"";;
6093         *)
6094                 case "$3" in
6095                 "") eval "$1=";;
6096                 none)
6097                         eval "tp=\"\$$2\"";
6098                         case "$tp" in
6099                         ""|" ") eval "$1=\"\$$2\"";;
6100                         *) eval "$1=";;
6101                         esac;;
6102                 esac;;
6103         esac;;
6104 *)
6105         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6106         case "$tp" in
6107         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6108         /*-$oldprefix/*|\~*-$oldprefix/*)
6109                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6110         *) eval "$1=\"\$$2\"";;
6111         esac;;
6112 esac'
6113
6114 : determine installation style
6115 : For now, try to deduce it from prefix unless it is already set.
6116 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6117 case "$installstyle" in
6118 '')     case "$prefix" in
6119                 *perl*) dflt='lib';;
6120                 *) dflt='lib/perl5' ;;
6121         esac
6122         ;;
6123 *)      dflt="$installstyle" ;;
6124 esac
6125 : Probably not worth prompting for this since we prompt for all
6126 : the directories individually, and the prompt would be too long and
6127 : confusing anyway.
6128 installstyle=$dflt
6129
6130 : determine where public executables go
6131 echo " "
6132 set dflt bin bin
6133 eval $prefixit
6134 fn=d~
6135 rp='Pathname where the public executables will reside?'
6136 . ./getfile
6137 if $test "X$ansexp" != "X$binexp"; then
6138         installbin=''
6139 fi
6140 prefixvar=bin
6141 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6142 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6143 :     this via initialinstalllocation
6144 . ./setprefixvar
6145
6146 case "$userelocatableinc" in
6147 $define|true|[yY]*)     dflt='y' ;;
6148 *)                      dflt='n' ;;
6149 esac
6150 cat <<EOM
6151
6152 Would you like to build Perl so that the installation is relocatable, so that
6153 library paths in @INC are determined relative to the path of the perl binary?
6154 This is not advised for system Perl installs, or if you need to run setid
6155 scripts or scripts under taint mode.
6156
6157 If this doesn't make any sense to you, just accept the default '$dflt'.
6158 EOM
6159 rp='Use relocatable @INC?'
6160 . ./myread
6161 case "$ans" in
6162 y|Y)    val="$define" ;;
6163 *)      val="$undef"  ;;
6164 esac
6165 set userelocatableinc
6166 eval $setvar
6167
6168 initialinstalllocation="$binexp"
6169 : Default prefix is now "up one level from where the binaries are"
6170 case "$userelocatableinc" in
6171 $define|true|[yY]*)
6172     bin=".../"
6173     binexp=".../"
6174     prefix=".../.."
6175     prefixexp=".../.."
6176     installprefixexp=".../.."
6177     ;;
6178 esac
6179
6180 : determine where private library files go
6181 : Usual default is /usr/local/lib/perl5/$version.
6182 : Also allow things like /opt/perl/lib/$version, since
6183 : /opt/perl/lib/perl5... would be redundant.
6184 : The default "style" setting is made in installstyle.U
6185 case "$installstyle" in
6186 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6187 *)       set dflt privlib lib/$version ;;
6188 esac
6189 eval $prefixit
6190 $cat <<EOM
6191
6192 There are some auxiliary files for $package that need to be put into a
6193 private library directory that is accessible by everyone.
6194
6195 EOM
6196 fn=$binexp
6197 fn=d~+
6198 rp='Pathname where the private library files will reside?'
6199 . ./getfile
6200 prefixvar=privlib
6201 . ./setprefixvar
6202
6203 : set the prefixup variable, to restore leading tilda escape
6204 prefixup='case "$prefixexp" in
6205 "$prefix") ;;
6206 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6207 esac'
6208
6209 : determine where public architecture dependent libraries go
6210 set archlib archlib
6211 eval $prefixit
6212 : privlib default is /usr/local/lib/$package/$version
6213 : archlib default is /usr/local/lib/$package/$version/$archname
6214 : privlib may have an optional trailing /share.
6215 tdflt=`echo $privlib | $sed 's,/share$,,'`
6216 tdflt=$tdflt/$archname
6217 case "$archlib" in
6218 '')     dflt=$tdflt
6219         ;;
6220 *)      dflt="$archlib"
6221     ;;
6222 esac
6223 $cat <<EOM
6224
6225 $spackage contains architecture-dependent library files.  If you are
6226 sharing libraries in a heterogeneous environment, you might store
6227 these files in a separate location.  Otherwise, you can just include
6228 them with the rest of the public library files.
6229
6230 EOM
6231 fn=$binexp
6232 fn=d+~
6233 rp='Where do you want to put the public architecture-dependent libraries?'
6234 . ./getfile
6235 prefixvar=archlib
6236 . ./setprefixvar
6237 if $test X"$archlib" = X"$privlib"; then
6238         d_archlib="$undef"
6239 else
6240         d_archlib="$define"
6241 fi
6242
6243 : see if setuid scripts can be secure
6244 $cat <<EOM
6245
6246 Some kernels have a bug that prevents setuid #! scripts from being
6247 secure.  Some sites have disabled setuid #! scripts because of this.
6248
6249 First let's decide if your kernel supports secure setuid #! scripts.
6250 (If setuid #! scripts would be secure but have been disabled anyway,
6251 don't say that they are secure if asked.)
6252
6253 EOM
6254
6255 val="$undef"
6256 if $test -d /dev/fd; then
6257         echo "#!$ls" >reflect
6258         chmod +x,u+s reflect
6259         ./reflect >flect 2>&1
6260         if $contains "/dev/fd" flect >/dev/null; then
6261                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6262                 val="$define"
6263         else
6264                 $cat <<EOM
6265 If you are not sure if they are secure, I can check but I'll need a
6266 username and password different from the one you are using right now.
6267 If you don't have such a username or don't want me to test, simply
6268 enter 'none'.
6269
6270 EOM
6271                 rp='Other username to test security of setuid scripts with?'
6272                 dflt='none'
6273                 . ./myread
6274                 case "$ans" in
6275                 n|none)
6276                         case "$d_suidsafe" in
6277                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6278                                 dflt=n;;
6279                         "$undef")
6280                                 echo "Well, the $hint value is *not* secure." >&4
6281                                 dflt=n;;
6282                         *)      echo "Well, the $hint value *is* secure." >&4
6283                                 dflt=y;;
6284                         esac
6285                         ;;
6286                 *)
6287                         $rm -f reflect flect
6288                         echo "#!$ls" >reflect
6289                         chmod +x,u+s reflect
6290                         echo >flect
6291                         chmod a+w flect
6292                         echo '"su" will (probably) prompt you for '"$ans's password."
6293                         su $ans -c './reflect >flect'
6294                         if $contains "/dev/fd" flect >/dev/null; then
6295                                 echo "Okay, it looks like setuid scripts are secure." >&4
6296                                 dflt=y
6297                         else
6298                                 echo "I don't think setuid scripts are secure." >&4
6299                                 dflt=n
6300                         fi
6301                         ;;
6302                 esac
6303                 rp='Does your kernel have *secure* setuid scripts?'
6304                 . ./myread
6305                 case "$ans" in
6306                 [yY]*)  val="$define";;
6307                 *)      val="$undef";;
6308                 esac
6309         fi
6310 else
6311         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6312         echo "(That's for file descriptors, not floppy disks.)"
6313         val="$undef"
6314 fi
6315 set d_suidsafe
6316 eval $setvar
6317
6318 $rm -f reflect flect
6319
6320 : now see if they want to do setuid emulation
6321 echo " "
6322 val="$undef"
6323 case "$d_suidsafe" in
6324 "$define")
6325         val="$undef"
6326         echo "No need to emulate SUID scripts since they are secure here." >&4
6327         ;;
6328 *)
6329         $cat <<EOM
6330 Some systems have disabled setuid scripts, especially systems where
6331 setuid scripts cannot be secure.  On systems where setuid scripts have
6332 been disabled, the setuid/setgid bits on scripts are currently
6333 useless.  It is possible for $package to detect those bits and emulate
6334 setuid/setgid in a secure fashion.  This emulation will only work if
6335 setuid scripts have been disabled in your kernel.
6336
6337 EOM
6338         case "$d_dosuid" in
6339         "$define") dflt=y ;;
6340         *) dflt=n ;;
6341         esac
6342         rp="Do you want to do setuid/setgid emulation?"
6343         . ./myread
6344         case "$ans" in
6345         [yY]*)  val="$define";;
6346         *)      val="$undef";;
6347         esac
6348         ;;
6349 esac
6350 set d_dosuid
6351 eval $setvar
6352
6353 : Find perl5.005 or later.
6354 echo "Looking for a previously installed perl5.005 or later... "
6355 case "$perl5" in
6356 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6357                 : Check if this perl is recent and can load a simple module
6358                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6359                         perl5=$tdir/perl
6360                         break;
6361                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6362                         perl5=$tdir/perl5
6363                         break;
6364                 fi
6365         done
6366         ;;
6367 *)      perl5="$perl5"
6368         ;;
6369 esac
6370 case "$perl5" in
6371 '')     echo "None found.  That's ok.";;
6372 *)      echo "Using $perl5." ;;
6373 esac
6374
6375 $cat <<EOM
6376
6377 After $package is installed, you may wish to install various
6378 add-on modules and utilities.  Typically, these add-ons will
6379 be installed under $prefix with the rest
6380 of this package.  However, you may wish to install such add-ons
6381 elsewhere under a different prefix.
6382
6383 If you do not wish to put everything under a single prefix, that's
6384 ok.  You will be prompted for the individual locations; this siteprefix
6385 is only used to suggest the defaults.
6386
6387 The default should be fine for most people.
6388
6389 EOM
6390 fn=d~+
6391 rp='Installation prefix to use for add-on modules and utilities?'
6392 : XXX Here might be another good place for an installstyle setting.
6393 case "$siteprefix" in
6394 '') dflt=$prefix ;;
6395 *)  dflt=$siteprefix ;;
6396 esac
6397 . ./getfile
6398 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6399 oldsiteprefix=''
6400 case "$siteprefix" in
6401 '') ;;
6402 *)      case "$ans" in
6403         "$prefix") ;;
6404         *) oldsiteprefix="$prefix";;
6405         esac
6406         ;;
6407 esac
6408 siteprefix="$ans"
6409 siteprefixexp="$ansexp"
6410
6411 : determine where site specific libraries go.
6412 : Usual default is /usr/local/lib/perl5/site_perl/$version
6413 : The default "style" setting is made in installstyle.U
6414 : XXX No longer works with Prefixit stuff.
6415 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6416 case "$sitelib" in
6417 '') case "$installstyle" in
6418         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6419         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6420         esac
6421         ;;
6422 *)      dflt="$sitelib"
6423         ;;
6424 esac
6425 $cat <<EOM
6426
6427 The installation process will create a directory for
6428 site-specific extensions and modules.  Most users find it convenient
6429 to place all site-specific files in this directory rather than in the
6430 main distribution directory.
6431
6432 EOM
6433 fn=d~+
6434 rp='Pathname for the site-specific library files?'
6435 . ./getfile
6436 prefixvar=sitelib
6437 . ./setprefixvar
6438 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6439
6440 : Determine list of previous versions to include in @INC
6441 $cat > getverlist <<EOPL
6442 #!$perl5 -w
6443 use File::Basename;
6444 \$api_versionstring = "$api_versionstring";
6445 \$version = "$version";
6446 \$stem = "$sitelib_stem";
6447 \$archname = "$archname";
6448 EOPL
6449         $cat >> getverlist <<'EOPL'
6450 # The list found is store twice for each entry: the original name, and
6451 # the binary broken down version as pack "sss", so sorting is easy and
6452 # unambiguous. This will work for all versions that have a maximum of
6453 # three digit groups, separate by '.'s or '_'s. Names are extended with
6454 # ".0.0" to ensure at least three elements for the pack.
6455 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6456
6457 # Can't have leading @ because metaconfig interprets it as a command!
6458 ;@inc_version_list=();
6459 # XXX Redo to do opendir/readdir?
6460 if (-d $stem) {
6461     chdir($stem);
6462     ;@candidates = map {
6463         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6464 }
6465 else {
6466     ;@candidates = ();
6467 }
6468
6469 ($pversion, $aversion, $vsn5005) = map {
6470     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6471 foreach $d (@candidates) {
6472     if ($d->[1] lt $pversion) {
6473         if ($d->[1] ge $aversion) {
6474             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6475         }
6476         elsif ($d->[1] ge $vsn5005) {
6477             unshift(@inc_version_list, grep { -d } $d->[0]);
6478         }
6479     }
6480     else {
6481         # Skip newer version.  I.e. don't look in
6482         # 5.7.0 if we're installing 5.6.1.
6483     }
6484 }
6485
6486 if (@inc_version_list) {
6487     print join(' ', @inc_version_list);
6488 }
6489 else {
6490     # Blank space to preserve value for next Configure run.
6491     print " ";
6492 }
6493 EOPL
6494 chmod +x getverlist
6495 case "$inc_version_list" in
6496 '')     if test -x "$perl5$exe_ext"; then
6497                 dflt=`$perl5 getverlist`
6498         else
6499                 dflt='none'
6500         fi
6501         ;;
6502 $undef) dflt='none' ;;
6503 *)  eval dflt=\"$inc_version_list\" ;;
6504 esac
6505 case "$dflt" in
6506 ''|' ') dflt=none ;;
6507 esac
6508 case "$dflt" in
6509 5.005) dflt=none ;;
6510 esac
6511 $cat <<EOM
6512
6513 In order to ease the process of upgrading, this version of perl
6514 can be configured to use modules built and installed with earlier
6515 versions of perl that were installed under $prefix.  Specify here
6516 the list of earlier versions that this version of perl should check.
6517 If Configure detected no earlier versions of perl installed under
6518 $prefix, then the list will be empty.  Answer 'none' to tell perl
6519 to not search earlier versions.
6520
6521 The default should almost always be sensible, so if you're not sure,
6522 just accept the default.
6523 EOM
6524
6525 rp='List of earlier versions to include in @INC?'
6526 . ./myread
6527 case "$ans" in
6528 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6529 *) inc_version_list="$ans" ;;
6530 esac
6531 case "$inc_version_list" in
6532 ''|' ')
6533         inc_version_list_init='0'
6534         d_inc_version_list="$undef"
6535         ;;
6536 *)      inc_version_list_init=`echo $inc_version_list |
6537                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6538         d_inc_version_list="$define"
6539         ;;
6540 esac
6541 $rm -f getverlist
6542
6543 : see if this is a malloc.h system
6544 : we want a real compile instead of Inhdr because some systems have a
6545 : malloc.h that just gives a compile error saying to use stdlib.h instead
6546 echo " "
6547 $cat >try.c <<EOCP
6548 #include <stdlib.h>
6549 #include <malloc.h>
6550 int main () { return 0; }
6551 EOCP
6552 set try
6553 if eval $compile; then
6554     echo "<malloc.h> found." >&4
6555     val="$define"
6556 else
6557     echo "<malloc.h> NOT found." >&4
6558     val="$undef"
6559 fi
6560 $rm_try
6561 set i_malloc
6562 eval $setvar
6563
6564 : check for void type
6565 echo " "
6566 echo "Checking to see how well your C compiler groks the void type..." >&4
6567 case "$voidflags" in
6568 '')
6569         $cat >try.c <<EOCP
6570 #$i_stdlib I_STDLIB
6571 #ifdef I_STDLIB
6572 #include <stdlib.h>
6573 #endif
6574 #if TRY & 1
6575 void sub() {
6576 #else
6577 sub() {
6578 #endif
6579         extern void moo();      /* function returning void */
6580         void (*goo)();          /* ptr to func returning void */
6581 #if TRY & 8
6582         void *hue;              /* generic ptr */
6583 #endif
6584 #if TRY & 2
6585         void (*foo[10])();
6586 #endif
6587
6588 #if TRY & 4
6589         if(goo == moo) {
6590                 exit(0);
6591         }
6592 #endif
6593         exit(0);
6594 }
6595 int main() { sub(); }
6596 EOCP
6597         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6598                 voidflags=$defvoidused
6599         echo "Good.  It appears to support void to the level $package wants.">&4
6600                 if $contains warning .out >/dev/null 2>&1; then
6601                         echo "However, you might get some warnings that look like this:"
6602                         $cat .out
6603                 fi
6604         else
6605 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6606                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6607                         echo "It supports 1..."
6608                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6609                                 echo "It also supports 2..."
6610                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6611                                         voidflags=7
6612                                         echo "And it supports 4 but not 8 definitely."
6613                                 else
6614                                         echo "It doesn't support 4..."
6615                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6616                                                 voidflags=11
6617                                                 echo "But it supports 8."
6618                                         else
6619                                                 voidflags=3
6620                                                 echo "Neither does it support 8."
6621                                         fi
6622                                 fi
6623                         else
6624                                 echo "It does not support 2..."
6625                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6626                                         voidflags=13
6627                                         echo "But it supports 4 and 8."
6628                                 else
6629                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6630                                                 voidflags=5
6631                                                 echo "And it supports 4 but has not heard about 8."
6632                                         else
6633                                                 echo "However it supports 8 but not 4."
6634                                         fi
6635                                 fi
6636                         fi
6637                 else
6638                         echo "There is no support at all for void."
6639                         voidflags=0
6640                 fi
6641         fi
6642 esac
6643 case "$voidflags" in
6644 "$defvoidused") ;;
6645 *)      $cat >&4 <<'EOM'
6646   Support flag bits are:
6647     1: basic void declarations.
6648     2: arrays of pointers to functions returning void.
6649     4: operations between pointers to and addresses of void functions.
6650     8: generic void pointers.
6651 EOM
6652         dflt="$voidflags";
6653         rp="Your void support flags add up to what?"
6654         . ./myread
6655         voidflags="$ans"
6656         ;;
6657 esac
6658 $rm_try
6659
6660 : check for length of pointer
6661 echo " "
6662 case "$ptrsize" in
6663 '')
6664         echo "Checking to see how big your pointers are..." >&4
6665         if test "$voidflags" -gt 7; then
6666                 echo '#define VOID_PTR char *' > try.c
6667         else
6668                 echo '#define VOID_PTR void *' > try.c
6669         fi
6670         $cat >>try.c <<EOCP
6671 #include <stdio.h>
6672 #$i_stdlib I_STDLIB
6673 #ifdef I_STDLIB
6674 #include <stdlib.h>
6675 #endif
6676 int main()
6677 {
6678     printf("%d\n", (int)sizeof(VOID_PTR));
6679     exit(0);
6680 }
6681 EOCP
6682         set try
6683         if eval $compile_ok; then
6684                 ptrsize=`$run ./try`
6685                 echo "Your pointers are $ptrsize bytes long."
6686         else
6687                 dflt='4'
6688                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6689                 rp="What is the size of a pointer (in bytes)?"
6690                 . ./myread
6691                 ptrsize="$ans"
6692         fi
6693         ;;
6694 esac
6695 $rm_try
6696 case "$use64bitall" in
6697 "$define"|true|[yY]*)
6698         case "$ptrsize" in
6699         4)      cat <<EOM >&4
6700
6701 *** You have chosen a maximally 64-bit build,
6702 *** but your pointers are only 4 bytes wide.
6703 *** Please rerun Configure without -Duse64bitall.
6704 EOM
6705                 case "$d_quad" in
6706                 define)
6707                         cat <<EOM >&4
6708 *** Since you have quads, you could possibly try with -Duse64bitint.
6709 EOM
6710                         ;;
6711                 esac
6712                 cat <<EOM >&4
6713 *** Cannot continue, aborting.
6714
6715 EOM
6716
6717                 exit 1
6718                 ;;
6719         esac
6720         ;;
6721 esac
6722
6723
6724 : determine whether to use malloc wrapping
6725 echo " "
6726 case "$usemallocwrap" in
6727 [yY]*|true|$define)     dflt='y' ;;
6728 [nN]*|false|$undef)     dflt='n' ;;
6729 *)      case "$usedevel" in
6730         [yY]*|true|$define)     dflt='y' ;;
6731         *) dflt='n' ;;
6732         esac
6733         ;;
6734 esac
6735 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6736 . ./myread
6737 usemallocwrap="$ans"
6738 case "$ans" in
6739 y*|true)
6740         usemallocwrap="$define" ;;
6741 *)
6742         usemallocwrap="$undef" ;;
6743 esac
6744
6745 : determine which malloc to compile in
6746 echo " "
6747 case "$usemymalloc" in
6748 [yY]*|true|$define)     dflt='y' ;;
6749 [nN]*|false|$undef)     dflt='n' ;;
6750 *)      case "$ptrsize" in
6751         4) dflt='y' ;;
6752         *) dflt='n' ;;
6753         esac
6754         ;;
6755 esac
6756 rp="Do you wish to attempt to use the malloc that comes with $package?"
6757 . ./myread
6758 usemymalloc="$ans"
6759 case "$ans" in
6760 y*|true)
6761         usemymalloc='y'
6762         mallocsrc='malloc.c'
6763         mallocobj="malloc$_o"
6764         d_mymalloc="$define"
6765         case "$libs" in
6766         *-lmalloc*)
6767                 : Remove malloc from list of libraries to use
6768                 echo "Removing unneeded -lmalloc from library list" >&4
6769                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6770                 shift
6771                 libs="$*"
6772                 echo "libs = $libs" >&4
6773                 ;;
6774         esac
6775         ;;
6776 *)
6777         usemymalloc='n'
6778         mallocsrc=''
6779         mallocobj=''
6780         d_mymalloc="$undef"
6781         ;;
6782 esac
6783
6784 : compute the return types of malloc and free
6785 echo " "
6786 $cat >malloc.c <<END
6787 #$i_malloc I_MALLOC
6788 #$i_stdlib I_STDLIB
6789 #include <stdio.h>
6790 #include <sys/types.h>
6791 #ifdef I_MALLOC
6792 #include <malloc.h>
6793 #endif
6794 #ifdef I_STDLIB
6795 #include <stdlib.h>
6796 #endif
6797 #ifdef TRY_MALLOC
6798 void *malloc();
6799 #endif
6800 #ifdef TRY_FREE
6801 void free();
6802 #endif
6803 END
6804 case "$malloctype" in
6805 '')
6806         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6807                 malloctype='void *'
6808         else
6809                 malloctype='char *'
6810         fi
6811         ;;
6812 esac
6813 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6814
6815 case "$freetype" in
6816 '')
6817         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6818                 freetype='void'
6819         else
6820                 freetype='int'
6821         fi
6822         ;;
6823 esac
6824 echo "Your system uses $freetype free(), it would seem." >&4
6825 $rm -f malloc.[co]
6826 : determine where site specific architecture-dependent libraries go.
6827 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6828 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6829 : sitelib may have an optional trailing /share.
6830 case "$sitearch" in
6831 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6832         dflt="$dflt/$archname"
6833         ;;
6834 *)      dflt="$sitearch"
6835         ;;
6836 esac
6837 set sitearch sitearch none
6838 eval $prefixit
6839 $cat <<EOM
6840
6841 The installation process will also create a directory for
6842 architecture-dependent site-specific extensions and modules.
6843
6844 EOM
6845 fn=d~+
6846 rp='Pathname for the site-specific architecture-dependent library files?'
6847 . ./getfile
6848 prefixvar=sitearch
6849 . ./setprefixvar
6850 if $test X"$sitearch" = X"$sitelib"; then
6851         d_sitearch="$undef"
6852 else
6853         d_sitearch="$define"
6854 fi
6855
6856 $cat <<EOM
6857
6858 The installation process will also create a directory for
6859 vendor-supplied add-ons.  Vendors who supply perl with their system
6860 may find it convenient to place all vendor-supplied files in this
6861 directory rather than in the main distribution directory.  This will
6862 ease upgrades between binary-compatible maintenance versions of perl.
6863
6864 Of course you may also use these directories in whatever way you see
6865 fit.  For example, you might use them to access modules shared over a
6866 company-wide network.
6867
6868 The default answer should be fine for most people.
6869 This causes further questions about vendor add-ons to be skipped
6870 and no vendor-specific directories will be configured for perl.
6871
6872 EOM
6873 rp='Do you want to configure vendor-specific add-on directories?'
6874 case "$usevendorprefix" in
6875 define|true|[yY]*) dflt=y ;;
6876 *)      : User may have set vendorprefix directly on Configure command line.
6877         case "$vendorprefix" in
6878         ''|' ') dflt=n ;;
6879         *)      dflt=y ;;
6880         esac
6881         ;;
6882 esac
6883 . ./myread
6884 case "$ans" in
6885 [yY]*)  fn=d~+
6886         rp='Installation prefix to use for vendor-supplied add-ons?'
6887         case "$vendorprefix" in
6888         '') dflt='' ;;
6889         *)  dflt=$vendorprefix ;;
6890         esac
6891         . ./getfile
6892         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6893         oldvendorprefix=''
6894         case "$vendorprefix" in
6895         '') ;;
6896         *)      case "$ans" in
6897                 "$prefix") ;;
6898                 *) oldvendorprefix="$prefix";;
6899                 esac
6900                 ;;
6901         esac
6902         usevendorprefix="$define"
6903         vendorprefix="$ans"
6904         vendorprefixexp="$ansexp"
6905         ;;
6906 *)      usevendorprefix="$undef"
6907         vendorprefix=''
6908         vendorprefixexp=''
6909         ;;
6910 esac
6911
6912 case "$vendorprefix" in
6913 '')     d_vendorlib="$undef"
6914         vendorlib=''
6915         vendorlibexp=''
6916         ;;
6917 *)      d_vendorlib="$define"
6918         : determine where vendor-supplied modules go.
6919         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6920         case "$vendorlib" in
6921         '')
6922                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6923                 case "$installstyle" in
6924                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6925                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6926                 esac
6927                 ;;
6928         *)      dflt="$vendorlib"
6929                 ;;
6930         esac
6931         fn=d~+
6932         rp='Pathname for the vendor-supplied library files?'
6933         . ./getfile
6934         vendorlib="$ans"
6935         vendorlibexp="$ansexp"
6936         ;;
6937 esac
6938 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6939 prefixvar=vendorlib
6940 . ./installprefix
6941
6942 case "$vendorprefix" in
6943 '')     d_vendorarch="$undef"
6944         vendorarch=''
6945         vendorarchexp=''
6946         ;;
6947 *)      d_vendorarch="$define"
6948         : determine where vendor-supplied architecture-dependent libraries go.
6949         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6950         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6951         : vendorlib may have an optional trailing /share.
6952         case "$vendorarch" in
6953         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6954                 dflt="$dflt/$archname"
6955                 ;;
6956         *)      dflt="$vendorarch" ;;
6957         esac
6958         fn=d~+
6959         rp='Pathname for vendor-supplied architecture-dependent files?'
6960         . ./getfile
6961         vendorarch="$ans"
6962         vendorarchexp="$ansexp"
6963         ;;
6964 esac
6965 prefixvar=vendorarch
6966 . ./installprefix
6967
6968 : Final catch-all directories to search
6969 $cat <<EOM
6970
6971 Lastly, you can have perl look in other directories for extensions and
6972 modules in addition to those already specified.
6973 These directories will be searched after 
6974         $sitearch 
6975         $sitelib 
6976 EOM
6977 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6978 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6979 echo ' '
6980 case "$otherlibdirs" in
6981 ''|' ') dflt='none' ;;
6982 *)      dflt="$otherlibdirs" ;;
6983 esac
6984 $cat <<EOM
6985 Enter a colon-separated set of extra paths to include in perl's @INC
6986 search path, or enter 'none' for no extra paths.
6987
6988 EOM
6989
6990 rp='Colon-separated list of additional directories for perl to search?'
6991 . ./myread
6992 case "$ans" in
6993 ' '|''|none)    otherlibdirs=' ' ;;     
6994 *)      otherlibdirs="$ans" ;;
6995 esac
6996 case "$otherlibdirs" in
6997 ' ') val=$undef ;;
6998 *)      val=$define ;;
6999 esac
7000 set d_perl_otherlibdirs
7001 eval $setvar
7002
7003 : Cruising for prototypes
7004 echo " "
7005 echo "Checking out function prototypes..." >&4
7006 $cat >prototype.c <<EOCP
7007 #$i_stdlib I_STDLIB
7008 #ifdef I_STDLIB
7009 #include <stdlib.h>
7010 #endif
7011 int main(int argc, char *argv[]) {
7012         exit(0);}
7013 EOCP
7014 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7015         echo "Your C compiler appears to support function prototypes."
7016         val="$define"
7017 else
7018         echo "Your C compiler doesn't seem to understand function prototypes."
7019         val="$undef"
7020 fi
7021 set prototype
7022 eval $setvar
7023 $rm -f prototype*
7024
7025 case "$prototype" in
7026 "$define") ;;
7027 *)      ansi2knr='ansi2knr'
7028         echo " "
7029         cat <<EOM >&4
7030
7031 $me:  FATAL ERROR:
7032 This version of $package can only be compiled by a compiler that 
7033 understands function prototypes.  Unfortunately, your C compiler 
7034         $cc $ccflags
7035 doesn't seem to understand them.  Sorry about that.
7036
7037 If GNU cc is available for your system, perhaps you could try that instead.  
7038
7039 Eventually, we hope to support building Perl with pre-ANSI compilers.
7040 If you would like to help in that effort, please contact <perlbug@perl.org>.
7041
7042 Aborting Configure now.
7043 EOM
7044         exit 2
7045         ;;
7046 esac
7047
7048 echo " "
7049 case "$extras" in
7050 '') dflt='n';;
7051 *) dflt='y';;
7052 esac
7053 cat <<EOM
7054 Perl can be built with extra modules or bundles of modules which
7055 will be fetched from the CPAN and installed alongside Perl.
7056
7057 Notice that you will need access to the CPAN; either via the Internet,
7058 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7059 be asked later to configure the CPAN.pm module which will in turn do
7060 the installation of the rest of the extra modules or bundles.)
7061
7062 Notice also that if the modules require any external software such as
7063 libraries and headers (the libz library and the zlib.h header for the
7064 Compress::Zlib module, for example) you MUST have any such software
7065 already installed, this configuration process will NOT install such
7066 things for you.
7067
7068 If this doesn't make any sense to you, just accept the default '$dflt'.
7069 EOM
7070 rp='Install any extra modules (y or n)?'
7071 . ./myread
7072 case "$ans" in
7073 y|Y)
7074         cat <<EOM
7075
7076 Please list any extra modules or bundles to be installed from CPAN,
7077 with spaces between the names.  The names can be in any format the
7078 'install' command of CPAN.pm will understand.  (Answer 'none',
7079 without the quotes, to install no extra modules or bundles.)
7080 EOM
7081         rp='Extras?'
7082         dflt="$extras"
7083         . ./myread
7084         extras="$ans"
7085 esac
7086 case "$extras" in
7087 ''|'none')
7088         val=''
7089         $rm -f ../extras.lst
7090         ;;
7091 *)      echo "(Saving the list of extras for later...)"
7092         echo "$extras" > ../extras.lst
7093         val="'$extras'"
7094         ;;
7095 esac
7096 set extras
7097 eval $setvar
7098 echo " "
7099
7100 : determine where html pages for programs go
7101 set html1dir html1dir none
7102 eval $prefixit
7103 $cat <<EOM
7104
7105 If you wish to install html files for programs in $spackage, indicate
7106 the appropriate directory here.  To skip installing html files,
7107 answer "none".
7108 EOM
7109 case "$html1dir" in
7110 ''|none|$undef|' ') dflt=none ;;
7111 *) dflt=$html1dir ;;
7112 esac
7113 fn=dn+~
7114 rp="Directory for the main $spackage html pages?"
7115 . ./getfile
7116 prefixvar=html1dir
7117 . ./setprefixvar
7118 : Use ' ' for none so value is preserved next time through Configure
7119 $test X"$html1dir" = "X" && html1dir=' '
7120
7121 : determine where html pages for libraries and modules go
7122 set html3dir html3dir none
7123 eval $prefixit
7124 $cat <<EOM
7125
7126 If you wish to install html files for modules associated with $spackage,
7127 indicate the appropriate directory here.  To skip installing html files,
7128 answer "none".
7129 EOM
7130 : There is no obvious default.  If they have specified html1dir, then
7131 : try to key off that, possibly changing .../html1 into .../html3.
7132 case "$html3dir" in
7133 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7134 *) dflt=$html3dir ;;
7135 esac
7136 fn=dn+~
7137 rp="Directory for the $spackage module html pages?"
7138 . ./getfile
7139 prefixvar=html3dir
7140 . ./setprefixvar
7141 : Use ' ' for none so value is preserved next time through Configure
7142 $test X"$html3dir" = "X" && html3dir=' '
7143
7144 : determine whether to install perl also as /usr/bin/perl
7145
7146 echo " "
7147 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7148         $cat <<EOM
7149 Many scripts expect perl to be installed as /usr/bin/perl.
7150
7151 If you want to, I can install the perl you are about to compile
7152 as /usr/bin/perl (in addition to $bin/perl).
7153 EOM
7154         if test -f /usr/bin/perl; then
7155             $cat <<EOM
7156
7157 However, please note that because you already have a /usr/bin/perl,
7158 overwriting that with a new Perl would very probably cause problems.
7159 Therefore I'm assuming you don't want to do that (unless you insist).
7160
7161 EOM
7162             case "$installusrbinperl" in
7163             "$define"|[yY]*)    dflt='y';;
7164             *)                  dflt='n';;
7165             esac
7166         else
7167             $cat <<EOM
7168
7169 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7170
7171 EOM
7172             case "$installusrbinperl" in
7173             "$undef"|[nN]*)     dflt='n';;
7174             *)                  dflt='y';;
7175             esac
7176         fi
7177         rp="Do you want to install perl as /usr/bin/perl?"
7178         . ./myread
7179         case "$ans" in
7180         [yY]*)  val="$define";;
7181         *)      val="$undef" ;;
7182         esac
7183 else
7184         val="$undef"
7185 fi
7186 set installusrbinperl
7187 eval $setvar
7188
7189 echo " "
7190 echo "Checking for GNU C Library..." >&4
7191 cat >try.c <<'EOCP'
7192 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7193    alone are insufficient to distinguish different versions, such as
7194    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7195    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7196 */
7197 #include <stdio.h>
7198 int main(void)
7199 {
7200 #ifdef __GLIBC__
7201 #   ifdef __GLIBC_MINOR__
7202 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7203 #           include <gnu/libc-version.h>
7204             printf("%s\n",  gnu_get_libc_version());
7205 #       else
7206             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7207 #       endif
7208 #   else
7209         printf("%d\n",  __GLIBC__);
7210 #   endif
7211     return 0;
7212 #else
7213     return 1;
7214 #endif
7215 }
7216 EOCP
7217 set try
7218 if eval $compile_ok && $run ./try > glibc.ver; then
7219         val="$define"
7220         gnulibc_version=`$cat glibc.ver`
7221         echo "You are using the GNU C Library version $gnulibc_version"
7222 else
7223         val="$undef"
7224         gnulibc_version=''
7225         echo "You are not using the GNU C Library"
7226 fi
7227 $rm_try glibc.ver
7228 set d_gnulibc
7229 eval $setvar
7230
7231 : see if nm is to be used to determine whether a symbol is defined or not
7232 case "$usenm" in
7233 '')
7234         dflt=''
7235         case "$d_gnulibc" in
7236         "$define")
7237                 echo " "
7238                 echo "nm probably won't work on the GNU C Library." >&4
7239                 dflt=n
7240                 ;;
7241         esac
7242         case "$dflt" in
7243         '') 
7244                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7245                         echo " "
7246                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7247                         echo "'nm' won't be sufficient on this sytem." >&4
7248                         dflt=n
7249                 fi
7250                 ;;
7251         esac
7252         case "$dflt" in
7253         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7254                 if $test $dflt -gt 20; then
7255                         dflt=y
7256                 else
7257                         dflt=n
7258                 fi
7259                 ;;
7260         esac
7261         ;;
7262 *)
7263         case "$usenm" in
7264         true|$define) dflt=y;;
7265         *) dflt=n;;
7266         esac
7267         ;;
7268 esac
7269 $cat <<EOM
7270
7271 I can use $nm to extract the symbols from your C libraries. This
7272 is a time consuming task which may generate huge output on the disk (up
7273 to 3 megabytes) but that should make the symbols extraction faster. The
7274 alternative is to skip the 'nm' extraction part and to compile a small
7275 test program instead to determine whether each symbol is present. If
7276 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7277 this may be the best solution.
7278
7279 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7280
7281 EOM
7282 rp="Shall I use $nm to extract C symbols from the libraries?"
7283 . ./myread
7284 case "$ans" in
7285 [Nn]*) usenm=false;;
7286 *) usenm=true;;
7287 esac
7288
7289 runnm=$usenm
7290 case "$reuseval" in
7291 true) runnm=false;;
7292 esac
7293
7294 : nm options which may be necessary
7295 case "$nm_opt" in
7296 '') if $test -f /mach_boot; then
7297                 nm_opt=''       # Mach
7298         elif $test -d /usr/ccs/lib; then
7299                 nm_opt='-p'     # Solaris (and SunOS?)
7300         elif $test -f /dgux; then
7301                 nm_opt='-p'     # DG-UX
7302         elif $test -f /lib64/rld; then
7303                 nm_opt='-p'     # 64-bit Irix
7304         else
7305                 nm_opt=''
7306         fi;;
7307 esac
7308
7309 : nm options which may be necessary for shared libraries but illegal
7310 : for archive libraries.  Thank you, Linux.
7311 case "$nm_so_opt" in
7312 '')     case "$myuname" in
7313         *linux*|gnu*)
7314                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7315                         nm_so_opt='--dynamic'
7316                 fi
7317                 ;;
7318         esac
7319         ;;
7320 esac
7321
7322 case "$runnm" in
7323 true)
7324 : get list of predefined functions in a handy place
7325 echo " "
7326 case "$libc" in
7327 '') libc=unknown
7328         case "$libs" in
7329         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7330         esac
7331         ;;
7332 esac
7333 case "$libs" in
7334 '') ;;
7335 *)  for thislib in $libs; do
7336         case "$thislib" in
7337         -lc|-lc_s)
7338                 : Handle C library specially below.
7339                 ;;
7340         -l*)
7341                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7342                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7343                         :
7344                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7345                         :
7346                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7347                         :
7348                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7349                         :
7350                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7351                         :
7352                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7353                         :
7354                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7355                         :
7356                 else
7357                         try=''
7358                 fi
7359                 libnames="$libnames $try"
7360                 ;;
7361         *) libnames="$libnames $thislib" ;;
7362         esac
7363         done
7364         ;;
7365 esac
7366 xxx=normal
7367 case "$libc" in
7368 unknown)
7369         set /lib/libc.$so
7370         for xxx in $libpth; do
7371                 $test -r $1 || set $xxx/libc.$so
7372                 : The messy sed command sorts on library version numbers.
7373                 $test -r $1 || \
7374                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7375                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7376                                 h
7377                                 s/[0-9][0-9]*/0000&/g
7378                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7379                                 G
7380                                 s/\n/ /' | \
7381                          $sort | $sed -e 's/^.* //'`
7382                 eval set \$$#
7383         done
7384         $test -r $1 || set /usr/ccs/lib/libc.$so
7385         $test -r $1 || set /lib/libsys_s$_a
7386         ;;
7387 *)
7388         set blurfl
7389         ;;
7390 esac
7391 if $test -r "$1"; then
7392         echo "Your (shared) C library seems to be in $1."
7393         libc="$1"
7394 elif $test -r /lib/libc && $test -r /lib/clib; then
7395         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7396         xxx=apollo
7397         libc='/lib/clib /lib/libc'
7398         if $test -r /lib/syslib; then
7399                 echo "(Your math library is in /lib/syslib.)"
7400                 libc="$libc /lib/syslib"
7401         fi
7402 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7403         echo "Your C library seems to be in $libc, as you said before."
7404 elif $test -r $incpath/usr/lib/libc$_a; then
7405         libc=$incpath/usr/lib/libc$_a;
7406         echo "Your C library seems to be in $libc.  That's fine."
7407 elif $test -r /lib/libc$_a; then
7408         libc=/lib/libc$_a;
7409         echo "Your C library seems to be in $libc.  You're normal."
7410 else
7411         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7412                 :
7413         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7414                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7415         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7416                 :
7417         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7418                 :
7419         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7420                 :
7421         else
7422                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7423         fi
7424         if $test -r "$tans"; then
7425                 echo "Your C library seems to be in $tans, of all places."
7426                 libc=$tans
7427         else
7428                 libc='blurfl'
7429         fi
7430 fi
7431 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7432         dflt="$libc"
7433         cat <<EOM
7434
7435 If the guess above is wrong (which it might be if you're using a strange
7436 compiler, or your machine supports multiple models), you can override it here.
7437
7438 EOM
7439 else
7440         dflt=''
7441         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7442         cat >&4 <<EOM
7443 I can't seem to find your C library.  I've looked in the following places:
7444
7445 EOM
7446         $sed 's/^/      /' libpath
7447         cat <<EOM
7448
7449 None of these seems to contain your C library. I need to get its name...
7450
7451 EOM
7452 fi
7453 fn=f
7454 rp='Where is your C library?'
7455 . ./getfile
7456 libc="$ans"
7457
7458 echo " "
7459 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7460 set X `cat libnames`
7461 shift
7462 xxx=files
7463 case $# in 1) xxx=file; esac
7464 echo "Extracting names from the following $xxx for later perusal:" >&4
7465 echo " "
7466 $sed 's/^/      /' libnames >&4
7467 echo " "
7468 $echo $n "This may take a while...$c" >&4
7469
7470 for file in $*; do
7471         case $file in
7472         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7473         *) $nm $nm_opt $file 2>/dev/null;;
7474         esac
7475 done >libc.tmp
7476
7477 $echo $n ".$c"
7478 $grep fprintf libc.tmp > libc.ptf
7479 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7480 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7481 xxx='[ADTSIW]'
7482 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7483         eval $xscan;\
7484         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7485                 eval $xrun
7486 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7487         eval $xscan;\
7488         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7489                 eval $xrun
7490 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7491         eval $xscan;\
7492         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7493                 eval $xrun
7494 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7495         eval $xscan;\
7496         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7497                 eval $xrun
7498 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7499         eval $xscan;\
7500         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7501                 eval $xrun
7502 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7503         eval $xscan;\
7504         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7505                 eval $xrun
7506 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7507                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7508         eval $xscan;\
7509         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7510                 eval $xrun
7511 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7512         eval $xscan;\
7513         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7514                 eval $xrun
7515 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7516         eval $xscan;\
7517         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7518                 eval $xrun
7519 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7520         eval $xscan;\
7521         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7522                 eval $xrun
7523 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7524         eval $xscan;\
7525         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7526                 eval $xrun
7527 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7528         eval $xscan;\
7529         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7530                 eval $xrun
7531 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7532         eval $xscan;\
7533         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7534                 eval $xrun
7535 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7536         eval $xscan;\
7537         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7538                 eval $xrun
7539 else
7540         $nm -p $* 2>/dev/null >libc.tmp
7541         $grep fprintf libc.tmp > libc.ptf
7542         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7543                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7544         then
7545                 nm_opt='-p'
7546                 eval $xrun
7547         else
7548                 echo " "
7549                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7550                 com=''
7551                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7552                         for thisname in $libnames $libc; do
7553                                 $ar t $thisname >>libc.tmp
7554                         done
7555                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7556                         echo "Ok." >&4
7557                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7558                         # Repeat libc to extract forwarders to DLL entries too
7559                         for thisname in $libnames $libc; do
7560                                 $ar tv $thisname >>libc.tmp
7561                                 # Revision 50 of EMX has bug in $ar.
7562                                 # it will not extract forwarders to DLL entries
7563                                 # Use emximp which will extract exactly them.
7564                                 emximp -o tmp.imp $thisname \
7565                                     2>/dev/null && \
7566                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7567                                     < tmp.imp >>libc.tmp
7568                                 $rm tmp.imp
7569                         done
7570                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7571                         echo "Ok." >&4
7572                 else
7573                         echo "$ar didn't seem to work right." >&4
7574                         echo "Maybe this is a Cray...trying bld instead..." >&4
7575                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7576                         then
7577                                 for thisname in $libnames; do
7578                                         bld t $libnames | \
7579                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7580                                         $ar t $thisname >>libc.tmp
7581                                 done
7582                                 echo "Ok." >&4
7583                         else
7584                                 echo "That didn't work either.  Giving up." >&4
7585                                 exit 1
7586                         fi
7587                 fi
7588         fi
7589 fi
7590 nm_extract="$com"
7591 case "$PASE" in
7592 define)
7593     echo " "
7594     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7595     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7596     ;;
7597 *)  if $test -f /lib/syscalls.exp; then
7598         echo " "
7599         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7600         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7601     fi
7602     ;;
7603 esac
7604 ;;
7605 esac
7606 $rm -f libnames libpath
7607
7608 : see if dld is available
7609 set dld.h i_dld
7610 eval $inhdr
7611
7612
7613 echo " "
7614 echo "Checking for C++..." >&4
7615 $cat >try.c <<'EOCP'
7616 #include <stdio.h>
7617 int main(void)
7618 {
7619 #ifdef __cplusplus
7620     return 0;
7621 #else
7622     return 1;
7623 #endif
7624 }
7625 EOCP
7626 set try
7627 if eval $compile_ok && $run ./try; then
7628         val="$define"
7629         echo "You are using a C++ compiler."
7630 else
7631         val="$undef"
7632         echo "You are not using a C++ compiler."
7633 fi
7634 $rm_try cplusplus$$
7635 set d_cplusplus
7636 eval $setvar
7637
7638 : is a C symbol defined?
7639 csym='tlook=$1;
7640 case "$3" in
7641 -v) tf=libc.tmp; tdc="";;
7642 -a) tf=libc.tmp; tdc="[]";;
7643 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7644 esac;
7645 tx=yes;
7646 case "$reuseval-$4" in
7647 true-) ;;
7648 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7649 esac;
7650 case "$tx" in
7651 yes)
7652         tval=false;
7653         case "$d_cplusplus" in
7654                 $define) extern_C=\"C\";;
7655         esac;
7656         if $test "$runnm" = true; then
7657                 if $contains $tlook $tf >/dev/null 2>&1; then
7658                         tval=true;
7659                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7660                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7661                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7662                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7663                         $rm_try;
7664                 fi;
7665         else
7666                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7667                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7668                 $rm_try;
7669         fi;
7670         ;;
7671 *)
7672         case "$tval" in
7673         $define) tval=true;;
7674         *) tval=false;;
7675         esac;
7676         ;;
7677 esac;
7678 eval "$2=$tval"'
7679
7680 : define an is-in-libc? function
7681 inlibc='echo " "; td=$define; tu=$undef;
7682 sym=$1; var=$2; eval "was=\$$2";
7683 tx=yes;
7684 case "$reuseval$was" in
7685 true) ;;
7686 true*) tx=no;;
7687 esac;
7688 case "$tx" in
7689 yes)
7690         set $sym tres -f;
7691         eval $csym;
7692         case "$tres" in
7693         true)
7694                 echo "$sym() found." >&4;
7695                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7696         *)
7697                 echo "$sym() NOT found." >&4;
7698                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7699         esac;;
7700 *)
7701         case "$was" in
7702         $define) echo "$sym() found." >&4;;
7703         *) echo "$sym() NOT found." >&4;;
7704         esac;;
7705 esac'
7706
7707 : see if dlopen exists
7708 xxx_runnm="$runnm"
7709 xxx_ccflags="$ccflags"
7710 runnm=false
7711 : with g++ one needs -shared to get is-in-libc to work for dlopen
7712 case "$gccversion" in
7713 '')     ;;
7714 *)      case "$d_cplusplus" in
7715         "$define") ccflags="$ccflags -shared" ;;
7716         esac
7717         ;;
7718 esac
7719 set dlopen d_dlopen
7720 eval $inlibc
7721 runnm="$xxx_runnm"
7722 ccflags="$xxx_ccflags"
7723
7724 : see if this is a unistd.h system
7725 set unistd.h i_unistd
7726 eval $inhdr
7727
7728 : determine which dynamic loading, if any, to compile in
7729 echo " "
7730 dldir="ext/DynaLoader"
7731 case "$usedl" in
7732 $define|y|true)
7733         dflt='y'
7734         usedl="$define"
7735         ;;
7736 $undef|n|false)
7737         dflt='n'
7738         usedl="$undef"
7739         ;;
7740 *)
7741         dflt='n'
7742         case "$d_dlopen" in
7743             $define) dflt='y' ;;
7744         esac
7745         case "$i_dld" in
7746             $define) dflt='y' ;;
7747         esac
7748         : Does a dl_xxx.xs file exist for this operating system
7749         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7750         ;;
7751 esac
7752 rp="Do you wish to use dynamic loading?"
7753 . ./myread
7754 usedl="$ans"
7755 case "$ans" in
7756 y*) usedl="$define"
7757         case "$dlsrc" in
7758         '')
7759                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7760                         dflt="$dldir/dl_${osname}.xs"
7761                 elif $test "$d_dlopen" = "$define" ; then
7762                         dflt="$dldir/dl_dlopen.xs"
7763                 elif $test "$i_dld" = "$define" ; then
7764                         dflt="$dldir/dl_dld.xs"
7765                 else
7766                         dflt=''
7767                 fi
7768                 ;;
7769         *)      dflt="$dldir/$dlsrc"
7770                 ;;
7771         esac
7772     echo "The following dynamic loading files are available:"
7773         : Can not go over to $dldir because getfile has path hard-coded in.
7774         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7775         rp="Source file to use for dynamic loading"
7776         fn="fne"
7777         gfpth="$src"
7778         . ./getfile
7779         usedl="$define"
7780         : emulate basename
7781         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7782
7783         $cat << EOM
7784
7785 Some systems may require passing special flags to $cc -c to
7786 compile modules that will be used to create a shared library.
7787 To use no flags, say "none".
7788
7789 EOM
7790     case "$cccdlflags" in
7791     '') case "$gccversion" in
7792                 '') case "$osname" in
7793                         hpux)   dflt='+z' ;;
7794                         next)   dflt='none' ;;
7795                         irix*)  dflt='-KPIC' ;;
7796                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7797                         sunos)  dflt='-pic' ;;
7798                         *)      dflt='none' ;;
7799                     esac
7800                         ;;
7801                 *)  case "$osname" in
7802                         darwin) dflt='none' ;;
7803                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7804                         *)      dflt='-fpic' ;;
7805                     esac ;;
7806             esac ;;
7807         ' ') dflt='none' ;;
7808     *)  dflt="$cccdlflags" ;;
7809     esac
7810     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7811     . ./myread
7812     case "$ans" in
7813     none) cccdlflags=' ' ;;
7814     *) cccdlflags="$ans" ;;
7815     esac
7816
7817     cat << EOM
7818
7819 Some systems use ld to create libraries that can be dynamically loaded,
7820 while other systems (such as those using ELF) use $cc.
7821
7822 EOM
7823         case "$ld" in
7824         '')     $cat >try.c <<EOM
7825 /* Test for whether ELF binaries are produced */
7826 #include <fcntl.h>
7827 #$i_stdlib I_STDLIB
7828 #ifdef I_STDLIB
7829 #include <stdlib.h>
7830 #endif
7831 #$i_unistd I_UNISTD
7832 #ifdef I_UNISTD
7833 #include <unistd.h>
7834 #endif
7835 int main() {
7836         char b[4];
7837         int i = open("a.out",O_RDONLY);
7838         if(i == -1)
7839                 exit(1); /* fail */
7840         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7841                 exit(0); /* succeed (yes, it's ELF) */
7842         else
7843                 exit(1); /* fail */
7844 }
7845 EOM
7846                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7847                         cat <<EOM
7848 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7849 EOM
7850                         dflt="$cc"
7851                 else
7852                         echo "I'll use ld to build dynamic libraries."
7853                         dflt='ld'
7854                 fi
7855                 $rm_try
7856                 ;;
7857         *)      dflt="$ld"
7858                 ;;
7859         esac
7860
7861     rp="What command should be used to create dynamic libraries?"
7862     . ./myread
7863         ld="$ans"
7864
7865     cat << EOM
7866
7867 Some systems may require passing special flags to $ld to create a
7868 library that can be dynamically loaded.  If your ld flags include
7869 -L/other/path options to locate libraries outside your loader's normal
7870 search path, you may need to specify those -L options here as well.  To
7871 use no flags, say "none".
7872
7873 EOM
7874     case "$lddlflags" in
7875     '') case "$osname" in
7876                         beos) dflt='-nostart' ;;
7877                         hpux) dflt='-b';
7878                               case "$gccversion" in
7879                               '') dflt="$dflt +vnocompatwarnings" ;;
7880                               esac
7881                               ;;
7882                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7883                         next)  dflt='none' ;;
7884                         solaris) dflt='-G' ;;
7885                         sunos) dflt='-assert nodefinitions' ;;
7886                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7887                 *)     dflt='none' ;;
7888                         esac
7889                         ;;
7890     *) dflt="$lddlflags" ;;
7891     esac
7892
7893         : Try to guess additional flags to pick up local libraries.
7894         : Be careful not to append to a plain 'none'
7895         case "$dflt" in
7896         none) dflt='' ;;
7897         esac
7898         for thisflag in $ldflags; do
7899                 case "$thisflag" in
7900                 -L*|-R*|-Wl,-R*)
7901                         case " $dflt " in
7902                         *" $thisflag "*) ;;
7903                         *) dflt="$dflt $thisflag" ;;
7904                         esac
7905                         ;;
7906                 esac
7907         done
7908
7909         case "$dflt" in
7910         ''|' ') dflt='none' ;;
7911         esac
7912
7913     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7914     . ./myread
7915     case "$ans" in
7916     none) lddlflags=' ' ;;
7917     *) lddlflags="$ans" ;;
7918     esac
7919
7920         cat <<EOM
7921
7922 Some systems may require passing special flags to $cc to indicate that
7923 the resulting executable will use dynamic linking.  To use no flags,
7924 say "none".
7925
7926 EOM
7927     case "$ccdlflags" in
7928     '') case "$osname" in
7929             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7930             next|sunos) dflt='none' ;;
7931             *)          dflt='none' ;;
7932             esac ;;
7933     ' ')  dflt='none' ;;
7934     *)  dflt="$ccdlflags" ;;
7935     esac
7936     rp="Any special flags to pass to $cc to use dynamic linking?"
7937     . ./myread
7938     case "$ans" in
7939     none) ccdlflags=' ' ;;
7940     *) ccdlflags="$ans" ;;
7941     esac
7942     ;;
7943 *)  usedl="$undef"
7944         ld='ld'
7945     dlsrc='dl_none.xs'
7946     lddlflags=''
7947     ccdlflags=''
7948     ;;
7949 esac
7950
7951 also=''
7952 case "$usedl" in
7953 $undef)
7954         # No dynamic loading being used, so don't bother even to prompt.
7955         useshrplib='false'
7956         ;;
7957 *)      case "$useshrplib" in
7958         '')     case "$osname" in
7959                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7960                         dflt=y
7961                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7962                         ;;
7963                 next*)
7964                         case "$osvers" in
7965                         4*)     dflt=y
7966                                 also='Building a shared libperl is needed for MAB support.'
7967                                 ;;
7968                         *)      dflt=n
7969                                 ;;
7970                         esac
7971                         ;;
7972                 *)      dflt=n
7973                         ;;
7974                 esac
7975                 ;;
7976         $define|true|[Yy]*)
7977                 dflt=y
7978                 ;;
7979         *)      dflt=n
7980                 ;;
7981         esac
7982         $cat << EOM
7983
7984 The perl executable is normally obtained by linking perlmain.c with
7985 libperl${_a}, any static extensions (usually just DynaLoader), and
7986 any other libraries needed on this system (such as -lm, etc.).  Since
7987 your system supports dynamic loading, it is probably possible to build
7988 a shared libperl.$so.  If you will have more than one executable linked
7989 to libperl.$so, this will significantly reduce the size of each
7990 executable, but it may have a noticeable effect on performance.  The
7991 default is probably sensible for your system.
7992 $also
7993
7994 EOM
7995         rp="Build a shared libperl.$so (y/n)"
7996         . ./myread
7997         case "$ans" in
7998         true|$define|[Yy]*)
7999                 useshrplib='true'  ;;
8000         *)      useshrplib='false' ;;
8001         esac
8002         ;;
8003 esac
8004
8005 case "$useshrplib" in
8006 true)
8007         case "$libperl" in
8008         '')
8009                 # Figure out a good name for libperl.so.  Since it gets stored in
8010                 # a version-specific architecture-dependent library, the version
8011                 # number isn't really that important, except for making cc/ld happy.
8012                 #
8013                 # A name such as libperl.so.3.1
8014                 majmin="libperl.$so.$patchlevel.$subversion"
8015                 # A name such as libperl.so.301
8016                 majonly=`echo $patchlevel $subversion |
8017                         $awk '{printf "%d%02d", $1, $2}'`
8018                 majonly=libperl.$so.$majonly
8019                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8020                 # rely on figuring it out from the naming of libc.
8021                 case "${osname}${osvers}" in
8022                 next4*)
8023                         dflt=libperl.5.$so
8024                         # XXX How handle the --version stuff for MAB?
8025                         ;;
8026                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8027                         dflt=libperl.$so
8028                         ;;
8029                 cygwin*) # ld links against an importlib
8030                         dflt=libperl$lib_ext
8031                         ;;
8032                 *)      # Try to guess based on whether libc has major.minor.
8033                         case "$libc" in
8034                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8035                         *libc.$so.[0-9]*) dflt=$majonly ;;
8036                         *)      dflt=libperl.$so ;;
8037                         esac
8038                         ;;
8039                 esac
8040                 ;;
8041         *)      dflt=$libperl
8042                 ;;
8043         esac
8044         cat << EOM
8045
8046 I need to select a good name for the shared libperl.  If your system uses
8047 library names with major and minor numbers, then you might want something
8048 like $majmin.  Alternatively, if your system uses a single version
8049 number for shared libraries, then you might want to use $majonly.
8050 Or, your system might be quite happy with a simple libperl.$so.
8051
8052 Since the shared libperl will get installed into a version-specific
8053 architecture-dependent directory, the version number of the shared perl
8054 library probably isn't important, so the default should be o.k.
8055
8056 EOM
8057         rp='What name do you want to give to the shared libperl?'
8058         . ./myread
8059         libperl=$ans
8060         echo "Ok, I'll use $libperl"
8061         ;;
8062 *)
8063         libperl="libperl${_a}"
8064         ;;
8065 esac
8066
8067 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8068 case "$shrpdir" in
8069 '') ;;
8070 *)      $cat >&4 <<EOM
8071 WARNING:  Use of the shrpdir variable for the installation location of
8072 the shared $libperl is not supported.  It was never documented and
8073 will not work in this version.  Let me (perlbug@perl.org)
8074 know of any problems this may cause.
8075
8076 EOM
8077         case "$shrpdir" in
8078         "$archlibexp/CORE")
8079                 $cat >&4 <<EOM
8080 But your current setting of $shrpdir is
8081 the default anyway, so it's harmless.
8082 EOM
8083                 ;;
8084         *)
8085                 $cat >&4 <<EOM
8086 Further, your current attempted setting of $shrpdir
8087 conflicts with the value of $archlibexp/CORE
8088 that installperl will use.
8089 EOM
8090                 ;;
8091         esac
8092         ;;
8093 esac
8094
8095 # How will the perl executable find the installed shared $libperl?
8096 # Add $xxx to ccdlflags.
8097 # If we can't figure out a command-line option, use $shrpenv to
8098 # set env LD_RUN_PATH.  The main perl makefile uses this.
8099 shrpdir=$archlibexp/CORE
8100 xxx=''
8101 tmp_shrpenv=''
8102 if "$useshrplib"; then
8103     case "$osname" in 
8104         aix)
8105                 # We'll set it in Makefile.SH...
8106                 ;;
8107         solaris)
8108                 xxx="-R $shrpdir"
8109                 ;;
8110         freebsd|netbsd|openbsd|interix|dragonfly)
8111                 xxx="-Wl,-R$shrpdir"
8112                 ;;
8113         bsdos|linux|irix*|dec_osf|gnu*)
8114                 xxx="-Wl,-rpath,$shrpdir"
8115                 ;;
8116         next)
8117                 # next doesn't like the default...
8118                 ;;
8119         beos)
8120                 # beos doesn't like the default, either.
8121                 ;;
8122         hpux*)
8123                 # hpux doesn't like the default, either.
8124                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8125                 ;;
8126         *)
8127                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8128                 ;;
8129         esac
8130         case "$xxx" in
8131         '') ;;
8132         *)      
8133                 # Only add $xxx if it isn't already in ccdlflags.
8134                 case " $ccdlflags " in
8135                 *" $xxx "*)     ;;
8136                 *)      ccdlflags="$ccdlflags $xxx"
8137                         cat <<EOM >&4
8138
8139 Adding $xxx to the flags
8140 passed to $ld so that the perl executable will find the 
8141 installed shared $libperl.
8142
8143 EOM
8144                         ;;
8145                 esac
8146                 ;;
8147         esac
8148 fi
8149 # Fix ccdlflags in AIX for building external extensions.
8150 # (For building Perl itself bare -bE:perl.exp is needed,
8151 #  Makefile.SH takes care of this.)
8152 case "$osname" in
8153 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8154 esac
8155 # Respect a hint or command-line value.
8156 case "$shrpenv" in
8157 '') shrpenv="$tmp_shrpenv" ;;
8158 esac
8159 case "$ldlibpthname" in
8160 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8161 none)   ldlibpthname='' ;;
8162 esac
8163
8164 : determine where manual pages are on this system
8165 echo " "
8166 case "$sysman" in
8167 '') 
8168         syspath='/usr/share/man/man1 /usr/man/man1'
8169         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8170         syspath="$syspath /usr/man/u_man/man1"
8171         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8172         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8173         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8174         sysman=`./loc . /usr/man/man1 $syspath`
8175         ;;
8176 esac
8177 if $test -d "$sysman"; then
8178         echo "System manual is in $sysman." >&4
8179 else
8180         echo "Could not find manual pages in source form." >&4
8181 fi
8182
8183 : determine where manual pages go
8184 set man1dir man1dir none
8185 eval $prefixit
8186 $cat <<EOM
8187
8188 $spackage has manual pages available in source form.
8189 EOM
8190 case "$nroff" in
8191 nroff)
8192         echo "However, you don't have nroff, so they're probably useless to you."
8193         case "$man1dir" in
8194         '') man1dir="none";;
8195         esac;;
8196 esac
8197 echo "If you don't want the manual sources installed, answer 'none'."
8198 case "$man1dir" in
8199 ' ') dflt=none
8200         ;;
8201 '')
8202         lookpath="$prefixexp/share/man/man1"
8203         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8204         lookpath="$lookpath $prefixexp/man/p_man/man1"
8205         lookpath="$lookpath $prefixexp/man/u_man/man1"
8206         lookpath="$lookpath $prefixexp/man/man.1"
8207         case "$sysman" in
8208         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8209         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8210         esac
8211         set dflt
8212         eval $prefixup
8213         ;;
8214 *)  dflt="$man1dir"
8215         ;;
8216 esac
8217 echo " "
8218 fn=dn+~
8219 rp="Where do the main $spackage manual pages (source) go?"
8220 . ./getfile
8221 if $test "X$man1direxp" != "X$ansexp"; then
8222         installman1dir=''
8223 fi
8224 prefixvar=man1dir
8225 . ./setprefixvar
8226
8227 case "$man1dir" in
8228 '')     man1dir=' '
8229         installman1dir='';;
8230 esac
8231
8232 : What suffix to use on installed man pages
8233
8234 case "$man1dir" in
8235 ' ')
8236         man1ext='0'
8237         ;;
8238 *)
8239         rp="What suffix should be used for the main $spackage man pages?"
8240         case "$man1ext" in
8241         '')     case "$man1dir" in
8242                 *1)  dflt=1 ;;
8243                 *1p) dflt=1p ;;
8244                 *1pm) dflt=1pm ;;
8245                 *l) dflt=l;;
8246                 *n) dflt=n;;
8247                 *o) dflt=o;;
8248                 *p) dflt=p;;
8249                 *C) dflt=C;;
8250                 *L) dflt=L;;
8251                 *L1) dflt=L1;;
8252                 *) dflt=1;;
8253                 esac
8254                 ;;
8255         *)      dflt="$man1ext";;
8256         esac
8257         . ./myread
8258         man1ext="$ans"
8259         ;;
8260 esac
8261
8262 : see if we can have long filenames
8263 echo " "
8264 first=123456789abcdef
8265 $rm -f $first
8266 if (echo hi >$first) 2>/dev/null; then
8267         if $test -f 123456789abcde; then
8268                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8269                 val="$undef"
8270         else
8271                 echo 'You can have filenames longer than 14 characters.'>&4
8272                 val="$define"
8273         fi
8274 else
8275         $cat <<'EOM'
8276 You can't have filenames longer than 14 chars.
8277 You can't even think about them!
8278 EOM
8279         val="$undef"
8280 fi 
8281 set d_flexfnam
8282 eval $setvar
8283 $rm -rf 123456789abcde*
8284
8285 : determine where library module manual pages go
8286 set man3dir man3dir none
8287 eval $prefixit
8288 $cat <<EOM
8289
8290 $spackage has manual pages for many of the library modules.
8291 EOM
8292
8293 case "$nroff" in
8294 nroff)
8295         $cat <<'EOM'
8296 However, you don't have nroff, so they're probably useless to you.
8297 EOM
8298         case "$man3dir" in
8299         '') man3dir="none";;
8300         esac;;
8301 esac
8302
8303 case "$d_flexfnam" in
8304 undef)
8305         $cat <<'EOM'
8306 However, your system can't handle the long file names like File::Basename.3.
8307 EOM
8308         case "$man3dir" in
8309         '') man3dir="none";;
8310         esac;;
8311 esac
8312
8313 echo "If you don't want the manual sources installed, answer 'none'."
8314 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8315 case "$man3dir" in
8316 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8317         if $test -d "$privlib/man/man3"; then
8318                 cat <<EOM >&4
8319
8320 WARNING:  Previous versions of perl installed man3 pages into
8321 $privlib/man/man3.  This version will suggest a
8322 new default of $dflt.
8323 EOM
8324                 tdflt=$dflt
8325                 dflt='n'
8326                 rp='Do you wish to preserve the old behavior?(y/n)'
8327                 . ./myread
8328                 case "$ans" in
8329                 y*) dflt="$privlib/man/man3" ;;
8330                 *)  dflt=$tdflt ;;
8331                 esac
8332     fi
8333         ;;
8334 *)      dflt="$man3dir" ;;
8335 esac
8336 case "$dflt" in
8337 ' ') dflt=none ;;
8338 esac
8339 echo " "
8340 fn=dn+~
8341 rp="Where do the $package library man pages (source) go?"
8342 . ./getfile
8343 prefixvar=man3dir
8344 . ./setprefixvar
8345
8346 case "$man3dir" in
8347 '')     man3dir=' '
8348         installman3dir='';;
8349 esac
8350
8351 : What suffix to use on installed man pages
8352 case "$man3dir" in
8353 ' ')
8354         man3ext='0'
8355         ;;
8356 *)
8357         rp="What suffix should be used for the $package library man pages?"
8358         case "$man3ext" in
8359         '')     case "$man3dir" in
8360                 *3)  dflt=3 ;;
8361                 *3p) dflt=3p ;;
8362                 *3pm) dflt=3pm ;;
8363                 *l) dflt=l;;
8364                 *n) dflt=n;;
8365                 *o) dflt=o;;
8366                 *p) dflt=p;;
8367                 *C) dflt=C;;
8368                 *L) dflt=L;;
8369                 *L3) dflt=L3;;
8370                 *) dflt=3;;
8371                 esac
8372                 ;;
8373         *)      dflt="$man3ext";;
8374         esac
8375         . ./myread
8376         man3ext="$ans"
8377         ;;
8378 esac
8379
8380 : see if we have to deal with yellow pages, now NIS.
8381 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8382         if $test -f /usr/etc/nibindd; then
8383                 echo " "
8384                 echo "I'm fairly confident you're on a NeXT."
8385                 echo " "
8386                 rp='Do you get the hosts file via NetInfo?'
8387                 dflt=y
8388                 case "$hostcat" in
8389                 nidump*) ;;
8390                 '') ;;
8391                 *) dflt=n;;
8392                 esac
8393                 . ./myread
8394                 case "$ans" in
8395                 y*) hostcat='nidump hosts .';;
8396                 *)      case "$hostcat" in
8397                         nidump*) hostcat='';;
8398                         esac
8399                         ;;
8400                 esac
8401         fi
8402         case "$hostcat" in
8403         nidump*) ;;
8404         *)
8405                 case "$hostcat" in
8406                 *ypcat*) dflt=y;;
8407                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8408                                 dflt=y
8409                         else
8410                                 dflt=n
8411                         fi;;
8412                 *) dflt=n;;
8413                 esac
8414                 echo " "
8415                 rp='Are you getting the hosts file via yellow pages?'
8416                 . ./myread
8417                 case "$ans" in
8418                 y*) hostcat='ypcat hosts';;
8419                 *) hostcat='cat /etc/hosts';;
8420                 esac
8421                 ;;
8422         esac
8423 fi
8424 case "$hostcat" in
8425 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8426 esac
8427 case "$groupcat" in
8428 '') test -f /etc/group && groupcat='cat /etc/group';;
8429 esac
8430 case "$passcat" in
8431 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8432 esac
8433
8434 : now get the host name
8435 echo " "
8436 echo "Figuring out host name..." >&4
8437 case "$myhostname" in
8438 '') cont=true
8439         echo 'Maybe "hostname" will work...'
8440         if tans=`sh -c hostname 2>&1` ; then
8441                 myhostname=$tans
8442                 phostname=hostname
8443                 cont=''
8444         fi
8445         ;;
8446 *) cont='';;
8447 esac
8448 if $test "$cont"; then
8449         if ./xenix; then
8450                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8451                 if tans=`cat /etc/systemid 2>&1` ; then
8452                         myhostname=$tans
8453                         phostname='cat /etc/systemid'
8454                         echo "Whadyaknow.  Xenix always was a bit strange..."
8455                         cont=''
8456                 fi
8457         elif $test -r /etc/systemid; then
8458                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8459         fi
8460 fi
8461 if $test "$cont"; then
8462         echo 'No, maybe "uuname -l" will work...'
8463         if tans=`sh -c 'uuname -l' 2>&1` ; then
8464                 myhostname=$tans
8465                 phostname='uuname -l'
8466         else
8467                 echo 'Strange.  Maybe "uname -n" will work...'
8468                 if tans=`sh -c 'uname -n' 2>&1` ; then
8469                         myhostname=$tans
8470                         phostname='uname -n'
8471                 else
8472                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8473                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8474                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8475                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8476                         else
8477                                 case "$myhostname" in
8478                                 '') echo "Does this machine have an identity crisis or something?"
8479                                         phostname='';;
8480                                 *)
8481                                         echo "Well, you said $myhostname before..."
8482                                         phostname='echo $myhostname';;
8483                                 esac
8484                         fi
8485                 fi
8486         fi
8487 fi
8488 case "$myhostname" in
8489 '') myhostname=noname ;;
8490 esac
8491 : you do not want to know about this
8492 set $myhostname
8493 myhostname=$1
8494
8495 : verify guess
8496 if $test "$myhostname" ; then
8497         dflt=y
8498         rp='Your host name appears to be "'$myhostname'".'" Right?"
8499         . ./myread
8500         case "$ans" in
8501         y*) ;;
8502         *) myhostname='';;
8503         esac
8504 fi
8505
8506 : bad guess or no guess
8507 while $test "X$myhostname" = X ; do
8508         dflt=''
8509         rp="Please type the (one word) name of your host:"
8510         . ./myread
8511         myhostname="$ans"
8512 done
8513
8514 : translate upper to lower if necessary
8515 case "$myhostname" in
8516 *[A-Z]*)
8517         echo "(Normalizing case in your host name)"
8518         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8519         ;;
8520 esac
8521
8522 case "$myhostname" in
8523 *.*)
8524         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8525         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8526         echo "(Trimming domain name from host name--host name is now $myhostname)"
8527         ;;
8528 *) case "$mydomain" in
8529         '')
8530                 {
8531                         test "X$hostcat" = "Xypcat hosts" &&
8532                         ypmatch "$myhostname" hosts 2>/dev/null |\
8533                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8534                         $test -s hosts
8535                 } || {
8536                         test "X$hostcat" != "X" &&
8537                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8538                                         /[       ]$myhostname[  . ]/p" > hosts
8539                 }
8540                 tmp_re="[       . ]"
8541                 if $test -f hosts; then
8542                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8543                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8544                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8545                                 hosts | $sort | $uniq | \
8546                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8547                         case `$echo X$dflt` in
8548                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8549                                 dflt=.
8550                                 ;;
8551                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8552                                 ;;
8553                         esac
8554                 else
8555                         echo "(I cannot locate a hosts database anywhere)"
8556                         dflt=.
8557                 fi
8558                 case "$dflt" in
8559                 .)
8560                         tans=`./loc resolv.conf X /etc /usr/etc`
8561                         if $test -f "$tans"; then
8562                                 echo "(Attempting domain name extraction from $tans)"
8563                                 dflt=.`$sed -n -e 's/   / /g' \
8564                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8565                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8566                                 case "$dflt" in
8567                                 .) dflt=.`$sed -n -e 's/        / /g' \
8568                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8569                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8570                                         ;;
8571                                 esac
8572                         fi
8573                         ;;
8574                 esac
8575                 case "$dflt" in
8576                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8577                         dflt=.`sh -c domainname 2>/dev/null`
8578                         case "$dflt" in
8579                         '') dflt='.';;
8580                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8581                         esac
8582                         ;;
8583                 esac
8584                 case "$dflt$osname" in
8585                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8586                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8587                         ;;
8588                 esac
8589                 case "$dflt" in
8590                 .) echo "(Lost all hope -- silly guess then)"
8591                         dflt='.nonet'
8592                         ;;
8593                 esac
8594                 $rm -f hosts
8595                 ;;
8596         *) dflt="$mydomain";;
8597         esac;;
8598 esac
8599 echo " "
8600 rp="What is your domain name?"
8601 . ./myread
8602 tans="$ans"
8603 case "$ans" in
8604 '') ;;
8605 .*) ;;
8606 *) tans=".$tans";;
8607 esac
8608 mydomain="$tans"
8609
8610 : translate upper to lower if necessary
8611 case "$mydomain" in
8612 *[A-Z]*)
8613         echo "(Normalizing case in your domain name)"
8614         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8615         ;;
8616 esac
8617
8618 : a little sanity check here
8619 case "$phostname" in
8620 '') ;;
8621 *)
8622         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8623         $myhostname$mydomain|$myhostname) ;;
8624         *)
8625                 case "$phostname" in
8626                 sed*)
8627                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8628                         ;;
8629                 *)
8630                         echo "(That doesn't agree with your $phostname command, by the way.)"
8631                         ;;
8632                 esac
8633         ;;
8634         esac
8635         ;;
8636 esac
8637
8638 $cat <<EOM
8639
8640 I need to get your e-mail address in Internet format if possible, i.e.
8641 something like user@host.domain. Please answer accurately since I have
8642 no easy means to double check it. The default value provided below
8643 is most probably close to reality but may not be valid from outside
8644 your organization...
8645
8646 EOM
8647 cont=x
8648 while test "$cont"; do
8649         case "$cf_email" in
8650         '') dflt="$cf_by@$myhostname$mydomain";;
8651         *) dflt="$cf_email";;
8652         esac
8653         rp='What is your e-mail address?'
8654         . ./myread
8655         cf_email="$ans"
8656         case "$cf_email" in
8657         *@*.*) cont='' ;;
8658         *)
8659                 rp='Address does not look like an Internet one.  Use it anyway?'
8660                 case "$fastread" in
8661                 yes) dflt=y ;;
8662                 *) dflt=n ;;
8663                 esac
8664                 . ./myread
8665                 case "$ans" in
8666                 y*) cont='' ;;
8667                 *) echo " " ;;
8668                 esac
8669                 ;;
8670         esac
8671 done
8672
8673 $cat <<EOM
8674
8675 If you or somebody else will be maintaining perl at your site, please
8676 fill in the correct e-mail address here so that they may be contacted
8677 if necessary. Currently, the "perlbug" program included with perl
8678 will send mail to this address in addition to perlbug@perl.org. You may
8679 enter "none" for no administrator.
8680
8681 EOM
8682 case "$perladmin" in
8683 '') dflt="$cf_email";;
8684 *) dflt="$perladmin";;
8685 esac
8686 rp='Perl administrator e-mail address'
8687 . ./myread
8688 perladmin="$ans"
8689
8690 : determine whether to only install version-specific parts.
8691 echo " "
8692 $cat <<EOM
8693 Do you want to install only the version-specific parts of the perl
8694 distribution?  Usually you do *not* want to do this.
8695 EOM
8696 case "$versiononly" in
8697 "$define"|[Yy]*|true) dflt='y' ;;
8698 *) dflt='n';
8699 esac
8700 rp="Do you want to install only the version-specific parts of perl?"
8701 . ./myread
8702 case "$ans" in
8703 [yY]*)  val="$define";;
8704 *)      val="$undef" ;;
8705 esac
8706 set versiononly
8707 eval $setvar
8708
8709 case "$versiononly" in
8710 "$define") inc_version_list=''
8711            inc_version_list_init=0
8712            ;;
8713 esac
8714
8715 : figure out how to guarantee perl startup
8716 : XXX Note that this currently takes advantage of the bug that binexp ignores
8717 :     the Configure -Dinstallprefix setting, which in turn means that under
8718 :     relocatable @INC, initialinstalllocation is what binexp started as.
8719 case "$startperl" in
8720 '')
8721         case "$sharpbang" in
8722         *!)
8723                 $cat <<EOH
8724
8725 I can use the #! construct to start perl on your system. This will
8726 make startup of perl scripts faster, but may cause problems if you
8727 want to share those scripts and perl is not in a standard place
8728 ($initialinstalllocation/perl) on all your platforms. The alternative
8729 is to force a shell by starting the script with a single ':' character.
8730
8731 EOH
8732                 case "$versiononly" in
8733                 "$define")      dflt="$initialinstalllocation/perl$version";;
8734                 *)              dflt="$initialinstalllocation/perl";;
8735                 esac
8736                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8737                 . ./myread
8738                 case "$ans" in
8739                 none)   startperl=": # use perl";;
8740                 *)      startperl="#!$ans"
8741                         if $test 30 -lt `echo "$ans" | wc -c`; then
8742                                 $cat >&4 <<EOM
8743
8744 WARNING:  Some systems limit the #! command to 32 characters.
8745 If you experience difficulty running Perl scripts with #!, try
8746 installing Perl in a directory with a shorter pathname.
8747
8748 EOM
8749                         fi ;;
8750                 esac
8751                 ;;
8752         *) startperl=": # use perl"
8753                 ;;
8754         esac
8755         ;;
8756 esac
8757 echo "I'll use $startperl to start perl scripts."
8758
8759 : figure best path for perl in scripts
8760 case "$perlpath" in
8761 '')
8762         case "$versiononly" in
8763         "$define")      perlpath="$initialinstalllocation/perl$version";;
8764         *)              perlpath="$initialinstalllocation/perl";;
8765         esac
8766         case "$startperl" in
8767         *!*) ;;
8768         *)
8769                 $cat <<EOH
8770
8771 I will use the "eval 'exec'" idiom to start Perl on your system.
8772 I can use the full path of your Perl binary for this purpose, but
8773 doing so may cause problems if you want to share those scripts and
8774 Perl is not always in a standard place ($initialinstalllocation/perl).
8775
8776 EOH
8777                 dflt="$initialinstalllocation/perl"
8778                 rp="What path shall I use in \"eval 'exec'\"?"
8779                 . ./myread
8780                 perlpath="$ans"
8781                 ;;
8782         esac
8783         ;;
8784 esac
8785 case "$startperl" in
8786 *!*)    ;;
8787 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8788 esac
8789
8790 : determine where public executable scripts go
8791 set scriptdir scriptdir
8792 eval $prefixit
8793 case "$scriptdir" in
8794 '')
8795         dflt="$bin"
8796         : guess some guesses
8797         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8798         $test -d /usr/share/bin     && dflt=/usr/share/bin
8799         $test -d /usr/local/script  && dflt=/usr/local/script
8800         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8801         $test -d $prefixexp/script  && dflt=$prefixexp/script
8802         set dflt
8803         eval $prefixup
8804         ;;
8805 *)  dflt="$scriptdir"
8806         ;;
8807 esac
8808 $cat <<EOM
8809
8810 Some installations have a separate directory just for executable scripts so
8811 that they can mount it across multiple architectures but keep the scripts in
8812 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8813 Or you might just lump your scripts in with all your other executables.
8814
8815 EOM
8816 fn=d~
8817 rp='Where do you keep publicly executable scripts?'
8818 . ./getfile
8819 if $test "X$ansexp" != "X$scriptdirexp"; then
8820         installscript=''
8821 fi
8822 installscriptdir=''
8823 prefixvar=scriptdir
8824 . ./setprefixvar
8825 : A little fix up for an irregularly named variable.
8826 installscript="$installscriptdir"
8827
8828 : determine where add-on public executables go
8829 case "$sitebin" in
8830 '')     dflt=$siteprefix/bin ;;
8831 *)      dflt=$sitebin ;;
8832 esac
8833 fn=d~
8834 rp='Pathname where the add-on public executables should be installed?'
8835 . ./getfile
8836 prefixvar=sitebin
8837 . ./setprefixvar
8838
8839 : determine where add-on html pages go
8840 : There is no standard location, so try to copy the previously-selected
8841 : directory structure for the core html pages.
8842 case "$sitehtml1dir" in
8843 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8844 *)     dflt=$sitehtml1dir ;;
8845 esac
8846 case "$dflt" in
8847 ''|' ') dflt=none ;;
8848 esac
8849 fn=dn+~
8850 rp='Pathname where the site-specific html pages should be installed?'
8851 . ./getfile
8852 prefixvar=sitehtml1dir
8853 . ./setprefixvar
8854
8855 : determine where add-on library html pages go
8856 : There is no standard location, so try to copy the previously-selected
8857 : directory structure for the core html pages.
8858 case "$sitehtml3dir" in
8859 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8860 *)     dflt=$sitehtml3dir ;;
8861 esac
8862 case "$dflt" in
8863 ''|' ') dflt=none ;;
8864 esac
8865 fn=dn+~
8866 rp='Pathname where the site-specific library html pages should be installed?'
8867 . ./getfile
8868 prefixvar=sitehtml3dir
8869 . ./setprefixvar
8870
8871 : determine where add-on manual pages go
8872 case "$siteman1dir" in
8873 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8874 *)      dflt=$siteman1dir ;;
8875 esac
8876 case "$dflt" in
8877 ''|' ') dflt=none ;;
8878 esac
8879 fn=dn+~
8880 rp='Pathname where the site-specific manual pages should be installed?'
8881 . ./getfile
8882 prefixvar=siteman1dir
8883 . ./setprefixvar
8884
8885 : determine where add-on library man pages go
8886 case "$siteman3dir" in
8887 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8888 *)      dflt=$siteman3dir ;;
8889 esac
8890 case "$dflt" in
8891 ''|' ') dflt=none ;;
8892 esac
8893 fn=dn+~
8894 rp='Pathname where the site-specific library manual pages should be installed?'
8895 . ./getfile
8896 prefixvar=siteman3dir
8897 . ./setprefixvar
8898
8899 : determine where add-on public executable scripts go
8900 case "$sitescript" in
8901 '')     dflt=$siteprefix/script
8902         $test -d $dflt || dflt=$sitebin ;;
8903 *)  dflt="$sitescript" ;;
8904 esac
8905 fn=d~+
8906 rp='Pathname where add-on public executable scripts should be installed?'
8907 . ./getfile
8908 prefixvar=sitescript
8909 . ./setprefixvar
8910
8911 case "$usefaststdio" in
8912 $define|true|[yY]*|'')
8913         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8914         case "$xversion" in
8915         [68])   dflt='y' ;;
8916         *)      dflt='n' ;;
8917         esac
8918         ;;
8919 *) dflt='n';;
8920 esac
8921 cat <<EOM
8922
8923 Perl can be built to use 'fast stdio', which means using the stdio
8924 library but also directly manipulating the stdio buffers to enable
8925 faster I/O.  Using stdio is better for backward compatibility (especially
8926 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8927 interface has been preferred instead of stdio.
8928
8929 If this doesn't make any sense to you, just accept the default '$dflt'.
8930 EOM
8931 rp='Use the "fast stdio" if available?'
8932 . ./myread
8933 case "$ans" in
8934 y|Y)    val="$define" ;;     
8935 *)      val="$undef" ;;
8936 esac
8937 set usefaststdio
8938 eval $setvar
8939
8940
8941 : define an is-a-typedef? function
8942 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8943 case "$inclist" in
8944 "") inclist="sys/types.h";;
8945 esac;
8946 eval "varval=\$$var";
8947 case "$varval" in
8948 "")
8949         $rm -f temp.c;
8950         for inc in $inclist; do
8951                 echo "#include <$inc>" >>temp.c;
8952         done;
8953         echo "#ifdef $type" >> temp.c;
8954         echo "printf(\"We have $type\");" >> temp.c;
8955         echo "#endif" >> temp.c;
8956         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8957         if $contains $type temp.E >/dev/null 2>&1; then
8958                 eval "$var=\$type";
8959         else
8960                 eval "$var=\$def";
8961         fi;
8962         $rm -f temp.?;;
8963 *) eval "$var=\$varval";;
8964 esac'
8965
8966 : define an is-a-typedef? function that prompts if the type is not available.
8967 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8968 case "$inclist" in
8969 "") inclist="sys/types.h";;
8970 esac;
8971 eval "varval=\$$var";
8972 case "$varval" in
8973 "")
8974         $rm -f temp.c;
8975         for inc in $inclist; do
8976                 echo "#include <$inc>" >>temp.c;
8977         done;
8978         echo "#ifdef $type" >> temp.c;
8979         echo "printf(\"We have $type\");" >> temp.c;
8980         echo "#endif" >> temp.c;
8981         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8982         echo " " ;
8983         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8984         if $contains $type temp.E >/dev/null 2>&1; then
8985                 echo "$type found." >&4;
8986                 eval "$var=\$type";
8987         else
8988                 echo "$type NOT found." >&4;
8989                 dflt="$def";
8990                 . ./myread ;
8991                 eval "$var=\$ans";
8992         fi;
8993         $rm -f temp.?;;
8994 *) eval "$var=\$varval";;
8995 esac'
8996
8997 : see what type lseek is declared as in the kernel
8998 rp="What is the type used for lseek's offset on this system?"
8999 set off_t lseektype long stdio.h sys/types.h
9000 eval $typedef_ask
9001
9002 echo " "
9003 echo "Checking to see how big your file offsets are..." >&4
9004 $cat >try.c <<EOCP
9005 #include <sys/types.h>
9006 #include <stdio.h>
9007 int main()
9008 {
9009     printf("%d\n", (int)sizeof($lseektype));
9010     return(0);
9011 }
9012 EOCP
9013 set try
9014 if eval $compile_ok; then
9015         lseeksize=`$run ./try`
9016         echo "Your file offsets are $lseeksize bytes long."
9017 else
9018         dflt=$longsize
9019         echo " "
9020         echo "(I can't seem to compile the test program.  Guessing...)"
9021         rp="What is the size of your file offsets (in bytes)?"
9022         . ./myread
9023         lseeksize="$ans"
9024 fi
9025 $rm_try
9026
9027 : see what type file positions are declared as in the library
9028 rp="What is the type for file position used by fsetpos()?"
9029 set fpos_t fpostype long stdio.h sys/types.h
9030 eval $typedef_ask
9031
9032 echo " "
9033 case "$fpostype" in
9034 *_t) zzz="$fpostype"    ;;
9035 *)   zzz="fpos_t"       ;;
9036 esac
9037 echo "Checking the size of $zzz..." >&4 
9038 cat > try.c <<EOCP
9039 #include <sys/types.h>
9040 #include <stdio.h>
9041 #$i_stdlib I_STDLIB
9042 #ifdef I_STDLIB
9043 #include <stdlib.h>
9044 #endif
9045 int main() {
9046     printf("%d\n", (int)sizeof($fpostype));
9047     exit(0);
9048 }
9049 EOCP
9050 set try
9051 if eval $compile_ok; then
9052         yyy=`$run ./try`
9053         case "$yyy" in
9054         '')     fpossize=4
9055                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9056                 ;;
9057         *)      fpossize=$yyy
9058                 echo "Your $zzz is $fpossize bytes long."
9059                 ;;
9060         esac
9061 else
9062         dflt="$longsize"
9063         echo " " >&4
9064         echo "(I can't compile the test program.  Guessing...)" >&4
9065         rp="What is the size of your file positions (in bytes)?"
9066         . ./myread
9067         fpossize="$ans"
9068 fi
9069
9070 # Backward compatibility (uselfs is deprecated).
9071 case "$uselfs" in
9072 "$define"|true|[yY]*)
9073         cat <<EOM >&4
9074
9075 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9076 EOM
9077         uselargefiles="$define"
9078         ;;
9079 esac
9080
9081 case "$lseeksize:$fpossize" in
9082 8:8) cat <<EOM
9083
9084 You can have files larger than 2 gigabytes.
9085 EOM
9086    val="$define" ;;
9087 *)    case "$uselargefiles" in
9088    "$undef"|false|[nN]*) dflt='n' ;;
9089    *)   dflt='y' ;;
9090    esac
9091    cat <<EOM
9092
9093 Perl can be built to understand large files (files larger than 2 gigabytes)
9094 on some systems.  To do so, Configure can be run with -Duselargefiles.
9095
9096 If this doesn't make any sense to you, just accept the default '$dflt'.
9097 EOM
9098    rp='Try to understand large files, if available?'
9099    . ./myread
9100    case "$ans" in
9101    y|Y)         val="$define" ;;
9102    *)           val="$undef"  ;;
9103    esac
9104    ;;
9105 esac
9106 set uselargefiles
9107 eval $setvar
9108 : Look for a hint-file generated 'call-back-unit'.  If the
9109 : user has specified that a large files perl is to be built,
9110 : we may need to set or change some other defaults.
9111 if $test -f uselargefiles.cbu; then
9112         echo "Your platform has some specific hints regarding large file builds, using them..."
9113         . ./uselargefiles.cbu
9114 fi
9115 case "$uselargefiles" in
9116 "$define")
9117         if $test -f uselargefiles.cbu; then
9118                 echo " "
9119                 echo "Rechecking to see how big your file offsets are..." >&4
9120                 $cat >try.c <<EOCP
9121 #include <sys/types.h>
9122 #include <stdio.h>
9123 int main()
9124 {
9125     printf("%d\n", (int)sizeof($lseektype));
9126     return(0);
9127 }
9128 EOCP
9129                 set try
9130                 if eval $compile_ok; then
9131                         lseeksize=`$run ./try`
9132                         $echo "Your file offsets are now $lseeksize bytes long."
9133                 else
9134                         dflt="$lseeksize"
9135                         echo " "
9136                         echo "(I can't seem to compile the test program.  Guessing...)"
9137                         rp="What is the size of your file offsets (in bytes)?"
9138                         . ./myread
9139                         lseeksize="$ans"
9140                 fi
9141                 case "$fpostype" in
9142                 *_t) zzz="$fpostype"    ;;
9143                 *)   zzz="fpos_t"       ;;
9144                 esac
9145                 $echo $n "Rechecking the size of $zzz...$c" >&4
9146                 $cat > try.c <<EOCP
9147 #include <sys/types.h>
9148 #include <stdio.h>
9149 #$i_stdlib I_STDLIB
9150 #ifdef I_STDLIB
9151 #include <stdlib.h>
9152 #endif
9153 int main() {
9154     printf("%d\n", (int)sizeof($fpostype));
9155     return(0);
9156 }
9157 EOCP
9158                 set try
9159                 if eval $compile_ok; then
9160                         yyy=`$run ./try`
9161                         dflt="$lseeksize"
9162                         case "$yyy" in
9163                         '')     echo " "
9164                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9165                                 ;;
9166                         *)      fpossize=$yyy
9167                                 echo " $fpossize bytes." >&4
9168                                 ;;
9169                         esac
9170                 else
9171                         dflt="$fpossize"
9172                         echo " "
9173                         echo "(I can't compile the test program.  Guessing...)" >&4
9174                         rp="What is the size of your file positions (in bytes)?"
9175                         . ./myread
9176                         fpossize="$ans"
9177                 fi
9178                 $rm_try
9179         fi
9180         ;;
9181 esac
9182
9183 case "$vendorprefix" in
9184 '')     d_vendorbin="$undef"
9185         vendorbin=''
9186         vendorbinexp=''
9187         ;;
9188 *)      d_vendorbin="$define"
9189         : determine where vendor-supplied executables go.
9190         case "$vendorbin" in
9191         '') dflt=$vendorprefix/bin ;;
9192         *)      dflt="$vendorbin" ;;
9193         esac
9194         fn=d~+
9195         rp='Pathname for the vendor-supplied executables directory?'
9196         . ./getfile
9197         vendorbin="$ans"
9198         vendorbinexp="$ansexp"
9199         ;;
9200 esac
9201 prefixvar=vendorbin
9202 . ./installprefix
9203
9204 case "$vendorprefix" in
9205 '')     vendorhtml1dir=''
9206         vendorhtml1direxp=''
9207         ;;
9208 *)      : determine where vendor-supplied html pages go.
9209         : There is no standard location, so try to copy the previously-selected
9210         : directory structure for the core html pages.
9211         : XXX Better default suggestions would be welcome.
9212         case "$vendorhtml1dir" in
9213         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9214         *)      dflt=$vendorhtml1dir ;;
9215         esac
9216         case "$dflt" in
9217         ''|' ') dflt=none ;;
9218         esac
9219         fn=dn+~
9220         rp='Pathname for the vendor-supplied html pages?'
9221         . ./getfile
9222         vendorhtml1dir="$ans"
9223         vendorhtml1direxp="$ansexp"
9224         ;;
9225 esac
9226 : Use ' ' for none so value is preserved next time through Configure
9227 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9228 prefixvar=vendorhtml1dir
9229 . ./installprefix
9230
9231 case "$vendorprefix" in
9232 '')     vendorhtml3dir=''
9233         vendorhtml3direxp=''
9234         ;;
9235 *)      : determine where vendor-supplied module html pages go.
9236         : There is no standard location, so try to copy the previously-selected
9237         : directory structure for the core html pages.
9238         : XXX Better default suggestions would be welcome.
9239         case "$vendorhtml3dir" in
9240         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9241         *)      dflt=$vendorhtml3dir ;;
9242         esac
9243         case "$dflt" in
9244         ''|' ') dflt=none ;;
9245         esac
9246         fn=dn+~
9247         rp='Pathname for the vendor-supplied html pages?'
9248         . ./getfile
9249         vendorhtml3dir="$ans"
9250         vendorhtml3direxp="$ansexp"
9251         ;;
9252 esac
9253 : Use ' ' for none so value is preserved next time through Configure
9254 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9255 prefixvar=vendorhtml3dir
9256 . ./installprefix
9257
9258 case "$vendorprefix" in
9259 '')     vendorman1dir=''
9260         vendorman1direxp=''
9261         ;;
9262 *)      : determine where vendor-supplied manual pages go.
9263         case "$vendorman1dir" in
9264         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9265         *)      dflt=$vendorman1dir ;;
9266         esac
9267         case "$dflt" in
9268         ''|' ') dflt=none ;;
9269         esac
9270         fn=nd~+
9271         rp='Pathname for the vendor-supplied manual section 1 pages?'
9272         . ./getfile
9273         vendorman1dir="$ans"
9274         vendorman1direxp="$ansexp"
9275         ;;
9276 esac
9277 : Use ' ' for none so value is preserved next time through Configure
9278 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9279 prefixvar=vendorman1dir
9280 . ./installprefix
9281
9282 case "$vendorprefix" in
9283 '')     vendorman3dir=''
9284         vendorman3direxp=''
9285         ;;
9286 *)      : determine where vendor-supplied module manual pages go.
9287         case "$vendorman3dir" in
9288         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9289         *)      dflt=$vendorman3dir ;;
9290         esac
9291         case "$dflt" in
9292         ''|' ') dflt=none ;;
9293         esac
9294         fn=nd~+
9295         rp='Pathname for the vendor-supplied manual section 3 pages?'
9296         . ./getfile
9297         vendorman3dir="$ans"
9298         vendorman3direxp="$ansexp"
9299         ;;
9300 esac
9301 : Use ' ' for none so value is preserved next time through Configure
9302 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9303 prefixvar=vendorman3dir
9304 . ./installprefix
9305
9306 case "$vendorprefix" in
9307 '')     d_vendorscript="$undef"
9308         vendorscript=''
9309         vendorscriptexp=''
9310         ;;
9311 *)      d_vendorscript="$define"
9312         : determine where vendor-supplied scripts go.
9313         case "$vendorscript" in
9314         '')     dflt=$vendorprefix/script
9315                 $test -d $dflt || dflt=$vendorbin ;;
9316         *)  dflt="$vendorscript" ;;
9317         esac
9318         $cat <<EOM
9319
9320 The installation process will create a directory for
9321 vendor-supplied scripts.
9322
9323 EOM
9324         fn=d~+
9325         rp='Pathname for the vendor-supplied scripts directory?'
9326         . ./getfile
9327         vendorscript="$ans"
9328         vendorscriptexp="$ansexp"
9329         ;;
9330 esac
9331 prefixvar=vendorscript
9332 . ./installprefix
9333
9334 : see if qgcvt exists
9335 set qgcvt d_qgcvt
9336 eval $inlibc
9337
9338 echo " "
9339
9340 if $test X"$d_longdbl" = X"$define"; then
9341
9342 echo "Checking how to print long doubles..." >&4
9343
9344 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9345         $cat >try.c <<'EOCP'
9346 #include <sys/types.h>
9347 #include <stdio.h>
9348 int main() {
9349   double d = 123.456;
9350   printf("%.3f\n", d);
9351 }
9352 EOCP
9353         set try
9354         if eval $compile; then
9355                 yyy=`$run ./try`
9356                 case "$yyy" in
9357                 123.456)
9358                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9359                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9360                         echo "We will use %f."
9361                         ;;
9362                 esac
9363         fi
9364 fi
9365
9366 if $test X"$sPRIfldbl" = X; then
9367         $cat >try.c <<'EOCP'
9368 #include <sys/types.h>
9369 #include <stdio.h>
9370 int main() {
9371   long double d = 123.456;
9372   printf("%.3Lf\n", d);
9373 }
9374 EOCP
9375         set try
9376         if eval $compile; then
9377                 yyy=`$run ./try`
9378                 case "$yyy" in
9379                 123.456)
9380                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9381                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9382                         echo "We will use %Lf."
9383                         ;;
9384                 esac
9385         fi
9386 fi
9387
9388 if $test X"$sPRIfldbl" = X; then
9389         $cat >try.c <<'EOCP'
9390 #include <sys/types.h>
9391 #include <stdio.h>
9392 int main() {
9393   long double d = 123.456;
9394   printf("%.3llf\n", d);
9395 }
9396 EOCP
9397         set try
9398         if eval $compile; then
9399                 yyy=`$run ./try`
9400                 case "$yyy" in
9401                 123.456)
9402                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9403                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9404                         echo "We will use %llf."
9405                         ;;
9406                 esac
9407         fi
9408 fi
9409
9410 if $test X"$sPRIfldbl" = X; then
9411         $cat >try.c <<'EOCP'
9412 #include <sys/types.h>
9413 #include <stdio.h>
9414 int main() {
9415   long double d = 123.456;
9416   printf("%.3lf\n", d);
9417 }
9418 EOCP
9419         set try
9420         if eval $compile; then
9421                 yyy=`$run ./try`
9422                 case "$yyy" in
9423                 123.456)
9424                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9425                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9426                         echo "We will use %lf."
9427                         ;;
9428                 esac
9429         fi
9430 fi
9431
9432 if $test X"$sPRIfldbl" = X; then
9433         echo "Cannot figure out how to print long doubles." >&4
9434 else
9435         sSCNfldbl=$sPRIfldbl    # expect consistency
9436 fi
9437
9438 $rm_try
9439
9440 fi # d_longdbl
9441
9442 case "$sPRIfldbl" in
9443 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9444         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9445         d_SCNfldbl="$undef";
9446         ;;
9447 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9448         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9449         d_SCNfldbl="$define";
9450         ;;
9451 esac
9452
9453 : Check how to convert floats to strings.
9454
9455 if test "X$d_Gconvert" = X; then
9456
9457 echo " "
9458 echo "Checking for an efficient way to convert floats to strings."
9459 echo " " > try.c
9460 case "$uselongdouble" in
9461 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9462 esac
9463 case "$d_longdbl" in
9464 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9465 esac
9466 case "$d_PRIgldbl" in
9467 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9468 esac
9469 $cat >>try.c <<EOP
9470 #ifdef TRY_gconvert
9471 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9472 char *myname = "gconvert";
9473 #endif
9474 #ifdef TRY_gcvt
9475 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9476 char *myname = "gcvt";
9477 #endif
9478 #ifdef TRY_qgcvt
9479 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9480 char *myname = "qgcvt";
9481 #define DOUBLETYPE long double
9482 #endif
9483 #ifdef TRY_sprintf
9484 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9485 #ifdef HAS_PRIgldbl
9486 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9487 #else
9488 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9489 #endif
9490 #else
9491 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9492 #endif
9493 char *myname = "sprintf";
9494 #endif
9495
9496 #ifndef DOUBLETYPE
9497 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9498 #define DOUBLETYPE long double
9499 #else
9500 #define DOUBLETYPE double
9501 #endif
9502 #endif
9503
9504 #include <stdio.h>
9505
9506 #define I_STDLIB $i_stdlib
9507 #ifdef I_STDLIB
9508 #include <stdlib.h>
9509 #endif
9510
9511 int
9512 checkit(expect, got)
9513 char *expect;
9514 char *got;
9515 {
9516     if (strcmp(expect, got)) {
9517                 printf("%s oddity:  Expected %s, got %s\n",
9518                         myname, expect, got);
9519                 exit(1);
9520         }
9521 }
9522
9523 int main()
9524 {
9525         char buf[64];
9526         buf[63] = '\0';
9527
9528         /* This must be 1st test on (which?) platform */
9529         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9530         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9531         checkit("0.1", buf);
9532
9533         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9534         checkit("0.01", buf);
9535
9536         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9537         checkit("0.001", buf);
9538
9539         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9540         checkit("0.0001", buf);
9541
9542         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9543         if (strlen(buf) > 5)
9544             checkit("9e-005", buf); /* for Microsoft ?? */
9545         else
9546             checkit("9e-05", buf);
9547
9548         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9549         checkit("1", buf);
9550
9551         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9552         checkit("1.1", buf);
9553
9554         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9555         checkit("1.01", buf);
9556
9557         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9558         checkit("1.001", buf);
9559
9560         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9561         checkit("1.0001", buf);
9562
9563         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9564         checkit("1.00001", buf);
9565
9566         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9567         checkit("1.000001", buf);
9568
9569         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9570         checkit("0", buf);
9571
9572         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9573         checkit("-1", buf);
9574
9575         /* Some Linux gcvt's give 1.e+5 here. */
9576         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9577         checkit("100000", buf);
9578
9579         /* Some Linux gcvt's give -1.e+5 here. */
9580         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9581         checkit("-100000", buf);
9582
9583         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9584         checkit("123.456", buf);
9585
9586         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9587         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9588         /* 34 should be enough to scare even long double
9589          * places into using the e notation. */
9590         if (strlen(buf) > 5)
9591             checkit("1e+034", buf); /* for Microsoft */
9592         else
9593             checkit("1e+34", buf);
9594
9595         /* For Perl, if you add additional tests here, also add them to
9596          * t/base/num.t for benefit of platforms not using Configure or
9597          * overriding d_Gconvert */
9598
9599         exit(0);
9600 }
9601 EOP
9602 : first add preferred functions to our list
9603 xxx_list=""
9604 for xxx_convert in $gconvert_preference; do
9605     case $xxx_convert in
9606     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9607     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9608     esac
9609 done
9610 : then add any others
9611 for xxx_convert in gconvert gcvt sprintf; do
9612     case "$xxx_list" in
9613     *$xxx_convert*) ;;
9614     *) xxx_list="$xxx_list $xxx_convert" ;;
9615     esac
9616 done
9617
9618 case "$d_longdbl$uselongdouble" in
9619 "$define$define")
9620     : again, add prefered functions to our list first
9621     xxx_ld_list=""
9622     for xxx_convert in $gconvert_ld_preference; do
9623         case $xxx_convert in
9624         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9625         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9626         esac
9627     done
9628     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9629     for xxx_convert in qgcvt sprintf $xxx_list; do
9630         case "$xxx_ld_list" in
9631         $xxx_convert*|*" $xxx_convert"*) ;;
9632         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9633         esac
9634     done
9635     : if sprintf cannot do long doubles, move it to the end
9636     if test "$d_PRIgldbl" != "$define"; then
9637         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9638     fi
9639     : if no qgcvt, remove it
9640     if test "$d_qgcvt" != "$define"; then
9641         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9642     fi
9643     : use the ld_list
9644     xxx_list="$xxx_ld_list"
9645     ;;
9646 esac
9647
9648 for xxx_convert in $xxx_list; do
9649         echo "Trying $xxx_convert..."
9650         $rm -f try try$_o core
9651         set try -DTRY_$xxx_convert
9652         if eval $compile; then
9653                 echo "$xxx_convert() found." >&4
9654                 if $run ./try; then
9655                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9656                         break;
9657                 else
9658                         echo "...But $xxx_convert didn't work as I expected."
9659                         xxx_convert=''
9660                 fi
9661         else
9662                 echo "$xxx_convert NOT found." >&4
9663         fi
9664 done
9665
9666 if test X$xxx_convert = X; then
9667     echo "*** WHOA THERE!!! ***" >&4
9668     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9669     xxx_convert=sprintf
9670 fi
9671
9672 case "$xxx_convert" in
9673 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9674 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9675 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9676 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9677    "$define$define$define")
9678       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9679    "$define$define$undef")
9680       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9681    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9682    esac
9683    ;;
9684 esac
9685
9686 fi
9687 $rm_try
9688
9689 : see if _fwalk exists
9690 set fwalk d__fwalk
9691 eval $inlibc
9692
9693 : Initialize h_fcntl
9694 h_fcntl=false
9695
9696 : Initialize h_sysfile
9697 h_sysfile=false
9698
9699 : access call always available on UNIX
9700 set access d_access
9701 eval $inlibc
9702
9703 : locate the flags for 'access()'
9704 case "$d_access" in
9705 "$define")
9706         echo " "
9707         $cat >access.c <<EOCP
9708 #include <sys/types.h>
9709 #ifdef I_FCNTL
9710 #include <fcntl.h>
9711 #endif
9712 #ifdef I_SYS_FILE
9713 #include <sys/file.h>
9714 #endif
9715 #ifdef I_UNISTD
9716 #include <unistd.h>
9717 #endif
9718 #$i_stdlib I_STDLIB
9719 #ifdef I_STDLIB
9720 #include <stdlib.h>
9721 #endif
9722 int main() {
9723         exit(R_OK);
9724 }
9725 EOCP
9726         : check sys/file.h first, no particular reason here
9727         if $test `./findhdr sys/file.h` && \
9728                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9729                 h_sysfile=true;
9730                 echo "<sys/file.h> defines the *_OK access constants." >&4
9731         elif $test `./findhdr fcntl.h` && \
9732                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9733                 h_fcntl=true;
9734                 echo "<fcntl.h> defines the *_OK access constants." >&4
9735         elif $test `./findhdr unistd.h` && \
9736                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9737                 echo "<unistd.h> defines the *_OK access constants." >&4
9738         else
9739                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9740         fi
9741         ;;
9742 esac
9743 $rm -f access*
9744
9745 : see if accessx exists
9746 set accessx d_accessx
9747 eval $inlibc
9748
9749 : see if aintl exists
9750 set aintl d_aintl
9751 eval $inlibc
9752
9753 : see if alarm exists
9754 set alarm d_alarm
9755 eval $inlibc
9756
9757 : see if POSIX threads are available
9758 set pthread.h i_pthread
9759 eval $inhdr
9760
9761 : define a fucntion to check prototypes
9762 $cat > protochk <<EOSH
9763 $startsh
9764 cc="$cc"
9765 optimize="$optimize"
9766 ccflags="$ccflags"
9767 prototype="$prototype"
9768 define="$define"
9769 rm_try="$rm_try"
9770 usethreads=$usethreads
9771 i_pthread=$i_pthread
9772 pthread_h_first=$pthread_h_first
9773 EOSH
9774
9775 $cat >> protochk <<'EOSH'
9776
9777 $rm_try
9778 foo="$1"
9779 shift
9780 while test $# -ge 2; do
9781         case "$1" in
9782                 $define) echo "#include <$2>" >> try.c ;;
9783                 literal) echo "$2" >> try.c ;;
9784         esac
9785     # Extra magic for the benefit of systems that need pthread.h
9786     # to be included early to correctly detect threadsafe functions.
9787     # Such functions must guarantee themselves, though, that the usethreads
9788     # and i_pthread have been defined, before calling protochk.
9789     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9790         echo "#include <pthread.h>" >> try.c
9791         pthread_h_done=yes
9792     fi
9793     shift 2
9794 done
9795 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9796 cat >> try.c <<'EOCP'
9797 #ifdef CAN_PROTOTYPE
9798 #define _(args) args
9799 #else
9800 #define _(args) ()
9801 #endif
9802 EOCP
9803 echo "$foo" >> try.c
9804 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9805 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9806 status=$?
9807 $rm_try
9808 exit $status
9809 EOSH
9810 chmod +x protochk
9811 $eunicefix protochk
9812
9813 hasproto='varname=$1; func=$2; shift; shift;
9814 while $test $# -ge 2; do
9815         case "$1" in
9816         $define) echo "#include <$2>";;
9817         esac ;
9818     shift 2;
9819 done > try.c;
9820 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9821 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9822         echo "$func() prototype found.";
9823         val="$define";
9824 else
9825         echo "$func() prototype NOT found.";
9826         val="$undef";
9827 fi;
9828 set $varname;
9829 eval $setvar;
9830 $rm_try tryout.c'
9831
9832 : see if sys/types.h has to be included
9833 set sys/types.h i_systypes
9834 eval $inhdr
9835
9836 : see if sys/select.h has to be included
9837 set sys/select.h i_sysselct
9838 eval $inhdr
9839
9840 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9841 while $test $# -ge 2; do
9842         case "$1" in
9843         $define) echo "#include <$2>";;
9844         esac ;
9845     shift 2;
9846 done > try.c;
9847 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9848 set try;
9849 if eval $compile; then
9850         val="$define";
9851 else
9852         val="$undef";
9853 fi;
9854 set $varname;
9855 eval $setvar;
9856 $rm_try'
9857
9858 : see if we should include time.h, sys/time.h, or both
9859 echo " "
9860 if test "X$timeincl" = X; then
9861         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9862         $echo $n "I'm now running the test program...$c"
9863         $cat >try.c <<EOCP
9864 #include <sys/types.h>
9865 #ifdef I_TIME
9866 #include <time.h>
9867 #endif
9868 #ifdef I_SYSTIME
9869 #ifdef SYSTIMEKERNEL
9870 #define KERNEL
9871 #endif
9872 #include <sys/time.h>
9873 #endif
9874 #ifdef I_SYSSELECT
9875 #include <sys/select.h>
9876 #endif
9877 #$i_stdlib I_STDLIB
9878 #ifdef I_STDLIB
9879 #include <stdlib.h>
9880 #endif
9881 int main()
9882 {
9883         struct tm foo;
9884 #ifdef S_TIMEVAL
9885         struct timeval bar;
9886 #endif
9887 #ifdef S_TIMEZONE
9888         struct timezone tzp;
9889 #endif
9890         if (foo.tm_sec == foo.tm_sec)
9891                 exit(0);
9892 #ifdef S_TIMEVAL
9893         if (bar.tv_sec == bar.tv_sec)
9894                 exit(0);
9895 #endif
9896         exit(1);
9897 }
9898 EOCP
9899         flags=''
9900         for s_timezone in '-DS_TIMEZONE' ''; do
9901         sysselect=''
9902         for s_timeval in '-DS_TIMEVAL' ''; do
9903         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9904         for i_time in '' '-DI_TIME'; do
9905         for i_systime in '-DI_SYSTIME' ''; do
9906                 case "$flags" in
9907                 '') $echo $n ".$c"
9908                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9909                         if eval $compile; then
9910                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9911                                 shift
9912                                 flags="$*"
9913                                 echo " "
9914                                 $echo $n "Succeeded with $flags$c"
9915                         fi
9916                         ;;
9917                 esac
9918         done
9919         done
9920         done
9921         done
9922         done
9923         timeincl=''
9924         echo " "
9925         case "$flags" in
9926         *SYSTIMEKERNEL*) i_systimek="$define"
9927                 timeincl=`./findhdr sys/time.h`
9928                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9929         *) i_systimek="$undef";;
9930         esac
9931         case "$flags" in
9932         *I_TIME*) i_time="$define"
9933                 timeincl=`./findhdr time.h`" $timeincl"
9934                 echo "We'll include <time.h>." >&4;;
9935         *) i_time="$undef";;
9936         esac
9937         case "$flags" in
9938         *I_SYSTIME*) i_systime="$define"
9939                 timeincl=`./findhdr sys/time.h`" $timeincl"
9940                 echo "We'll include <sys/time.h>." >&4;;
9941         *) i_systime="$undef";;
9942         esac
9943         $rm_try
9944 fi
9945 : see if struct tm knows about tm_zone
9946 case "$i_systime$i_time" in
9947 *$define*)
9948         echo " "
9949         echo "Checking to see if your struct tm has tm_zone field..." >&4
9950         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9951         eval $hasfield
9952         ;;
9953 *)      val="$undef"
9954         set d_tm_tm_zone
9955         eval $setvar
9956         ;;
9957 esac
9958 case "$d_tm_tm_zone" in
9959 "$define")      echo "Yes, it does."   ;;
9960 *)              echo "No, it doesn't." ;;
9961 esac
9962 : see if struct tm knows about tm_gmtoff
9963 case "$i_systime$i_time" in
9964 *$define*)
9965         echo " "
9966         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9967         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9968         eval $hasfield
9969         ;;
9970 *)      val="$undef"
9971         set d_tm_tm_gmtoff
9972         eval $setvar
9973         ;;
9974 esac
9975 case "$d_tm_tm_gmtoff" in
9976 "$define")      echo "Yes, it does."   ;;
9977 *)              echo "No, it doesn't." ;;
9978 esac
9979
9980 : see if asctime_r exists
9981 set asctime_r d_asctime_r
9982 eval $inlibc
9983 case "$d_asctime_r" in
9984 "$define")
9985         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9986         case "$d_asctime_r_proto:$usethreads" in
9987         ":define")      d_asctime_r_proto=define
9988                 set d_asctime_r_proto asctime_r $hdrs
9989                 eval $hasproto ;;
9990         *)      ;;
9991         esac
9992         case "$d_asctime_r_proto" in
9993         define)
9994         case "$asctime_r_proto" in
9995         ''|0) try='char* asctime_r(const struct tm*, char*);'
9996         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9997         esac
9998         case "$asctime_r_proto" in
9999         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10000         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10001         esac
10002         case "$asctime_r_proto" in
10003         ''|0) try='int asctime_r(const struct tm*, char*);'
10004         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10005         esac
10006         case "$asctime_r_proto" in
10007         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10008         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10009         esac
10010         case "$asctime_r_proto" in
10011         ''|0)   d_asctime_r=undef
10012                 asctime_r_proto=0
10013                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10014         * )     case "$asctime_r_proto" in
10015                 REENTRANT_PROTO*) ;;
10016                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10017                 esac
10018                 echo "Prototype: $try" ;;
10019         esac
10020         ;;
10021         *)      case "$usethreads" in
10022                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10023                 esac
10024                 d_asctime_r=undef
10025                 asctime_r_proto=0
10026                 ;;
10027         esac
10028         ;;
10029 *)      asctime_r_proto=0
10030         ;;
10031 esac
10032
10033 : see if atolf exists
10034 set atolf d_atolf
10035 eval $inlibc
10036
10037 : see if atoll exists
10038 set atoll d_atoll
10039 eval $inlibc
10040
10041 : Look for GCC-style attribute format
10042 case "$d_attribute_format" in
10043 '')
10044 echo " "
10045 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10046 $cat >attrib.c <<'EOCP'
10047 #include <stdio.h>
10048 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10049 EOCP
10050 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10051         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10052                 echo "Your C compiler doesn't support __attribute__((format))."
10053                 val="$undef"
10054         else
10055                 echo "Your C compiler supports __attribute__((format))."
10056                 val="$define"
10057         fi
10058 else
10059         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10060         val="$undef"
10061 fi
10062 ;;
10063 *) val="$d_attribute_format" ;;
10064 esac
10065 set d_attribute_format
10066 eval $setvar
10067 $rm -f attrib*
10068
10069 : Look for GCC-style attribute format with null format allowed
10070 case "$d_printf_format_null" in
10071 '') case "$d_attribute_format" in
10072     $define)
10073         echo " "
10074         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10075 $cat >attrib.c <<EOCP
10076 #include <stdio.h>
10077 #$i_stdlib I_STDLIB
10078 #ifdef I_STDLIB
10079 #include <stdlib.h>
10080 #endif
10081 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10082 int null_printf (char* pat,...) { return (int)pat; }
10083 int main () { exit(null_printf(NULL)); }
10084 EOCP
10085         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10086             : run the executable in case it produces a run-time warning
10087             if $run ./attrib >>attrib.out 2>&1; then
10088                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10089                     echo "Your C compiler doesn't allow __printf__ format to be null."
10090                     val="$undef"
10091                 else
10092                     echo "Your C compiler allows __printf__ format to be null."
10093                     val="$define"
10094                 fi
10095             else
10096             echo "Your C compiler executable failed with __printf__ format null."
10097             val="$undef"
10098         fi
10099     else
10100         echo "Your C compiler fails with __printf__ format null."
10101         val="$undef"
10102     fi
10103     ;;
10104     *)  val="$undef" ;;
10105     esac
10106 ;;
10107 *)  val="$d_printf_format_null" ;;
10108 esac
10109 set d_printf_format_null
10110 eval $setvar
10111 $rm -f attrib*
10112
10113 : Look for GCC-style attribute malloc
10114 case "$d_attribute_malloc" in
10115 '')
10116 echo " "
10117 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10118 $cat >attrib.c <<'EOCP'
10119 #include <stdio.h>
10120 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10121 EOCP
10122 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10123         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10124                 echo "Your C compiler doesn't support __attribute__((malloc))."
10125                 val="$undef"
10126         else
10127                 echo "Your C compiler supports __attribute__((malloc))."
10128                 val="$define"
10129         fi
10130 else
10131         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10132         val="$undef"
10133 fi
10134 ;;
10135 *) val="$d_attribute_malloc" ;;
10136 esac
10137 set d_attribute_malloc
10138 eval $setvar
10139 $rm -f attrib*
10140
10141 : Look for GCC-style attribute nonnull
10142 case "$d_attribute_nonnull" in
10143 '')
10144 echo " "
10145 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10146 $cat >attrib.c <<'EOCP'
10147 #include <stdio.h>
10148 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10149 EOCP
10150 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10151         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10152                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10153                 val="$undef"
10154         else
10155                 echo "Your C compiler supports __attribute__((nonnull))."
10156                 val="$define"
10157         fi
10158 else
10159         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10160         val="$undef"
10161 fi
10162 ;;
10163 *) val="$d_attribute_nonnull" ;;
10164 esac
10165 set d_attribute_nonnull
10166 eval $setvar
10167 $rm -f attrib*
10168
10169 : Look for GCC-style attribute noreturn
10170 case "$d_attribute_noreturn" in
10171 '')
10172 echo " "
10173 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10174 $cat >attrib.c <<'EOCP'
10175 #include <stdio.h>
10176 void fall_over_dead( void ) __attribute__((noreturn));
10177 EOCP
10178 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10179         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10180                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10181                 val="$undef"
10182         else
10183                 echo "Your C compiler supports __attribute__((noreturn))."
10184                 val="$define"
10185         fi
10186 else
10187         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10188         val="$undef"
10189 fi
10190 ;;
10191 *) val="$d_attribute_noreturn" ;;
10192 esac
10193 set d_attribute_noreturn
10194 eval $setvar
10195 $rm -f attrib*
10196
10197 : Look for GCC-style attribute pure
10198 case "$d_attribute_pure" in
10199 '')
10200 echo " "
10201 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10202 $cat >attrib.c <<'EOCP'
10203 #include <stdio.h>
10204 int square( int n ) __attribute__((pure));
10205 EOCP
10206 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10207         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10208                 echo "Your C compiler doesn't support __attribute__((pure))."
10209                 val="$undef"
10210         else
10211                 echo "Your C compiler supports __attribute__((pure))."
10212                 val="$define"
10213         fi
10214 else
10215         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10216         val="$undef"
10217 fi
10218 ;;
10219 *) val="$d_attribute_pure" ;;
10220 esac
10221 set d_attribute_pure
10222 eval $setvar
10223 $rm -f attrib*
10224
10225 : Look for GCC-style attribute unused
10226 case "$d_attribute_unused" in
10227 '')
10228 echo " "
10229 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10230 $cat >attrib.c <<'EOCP'
10231 #include <stdio.h>
10232 int do_something( int dummy __attribute__((unused)), int n );
10233 EOCP
10234 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10235         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10236                 echo "Your C compiler doesn't support __attribute__((unused))."
10237                 val="$undef"
10238         else
10239                 echo "Your C compiler supports __attribute__((unused))."
10240                 val="$define"
10241         fi
10242 else
10243         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10244         val="$undef"
10245 fi
10246 ;;
10247 *) val="$d_attribute_unused" ;;
10248 esac
10249 set d_attribute_unused
10250 eval $setvar
10251 $rm -f attrib*
10252
10253 : Look for GCC-style attribute warn_unused_result
10254 case "$d_attribute_warn_unused_result" in
10255 '')
10256 echo " "
10257 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10258 $cat >attrib.c <<'EOCP'
10259 #include <stdio.h>
10260 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10261 EOCP
10262 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10263         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10264                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10265                 val="$undef"
10266         else
10267                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10268                 val="$define"
10269         fi
10270 else
10271         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10272         val="$undef"
10273 fi
10274 ;;
10275 *) val="$d_attribute_warn_unused_result" ;;
10276 esac
10277 set d_attribute_warn_unused_result
10278 eval $setvar
10279 $rm -f attrib*
10280
10281 : see if bcmp exists
10282 set bcmp d_bcmp
10283 eval $inlibc
10284
10285 : see if bcopy exists
10286 set bcopy d_bcopy
10287 eval $inlibc
10288
10289 : see if getpgrp exists
10290 set getpgrp d_getpgrp
10291 eval $inlibc
10292
10293 case "$d_getpgrp" in
10294 "$define")
10295         echo " "
10296         echo "Checking to see which flavor of getpgrp is in use..."
10297         $cat >try.c <<EOP
10298 #$i_unistd I_UNISTD
10299 #include <sys/types.h>
10300 #ifdef I_UNISTD
10301 #  include <unistd.h>
10302 #endif
10303 #$i_stdlib I_STDLIB
10304 #ifdef I_STDLIB
10305 #include <stdlib.h>
10306 #endif
10307 int main()
10308 {
10309         if (getuid() == 0) {
10310                 printf("(I see you are running Configure as super-user...)\n");
10311                 setuid(1);
10312         }
10313 #ifdef TRY_BSD_PGRP
10314         if (getpgrp(1) == 0)
10315                 exit(0);
10316 #else
10317         if (getpgrp() > 0)
10318                 exit(0);
10319 #endif
10320         exit(1);
10321 }
10322 EOP
10323         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10324                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10325                 val="$define"
10326         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10327                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10328                 val="$undef"
10329         else
10330                 echo "I can't seem to compile and run the test program."
10331                 if ./usg; then
10332                         xxx="a USG one, i.e. you use getpgrp()."
10333                 else
10334                         # SVR4 systems can appear rather BSD-ish.
10335                         case "$i_unistd" in
10336                         $undef)
10337                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10338                                 val="$define"
10339                                 ;;
10340                         $define)
10341                                 xxx="probably a USG one, i.e. you use getpgrp()."
10342                                 val="$undef"
10343                                 ;;
10344                         esac
10345                 fi
10346                 echo "Assuming your getpgrp is $xxx" >&4
10347         fi
10348         ;;
10349 *) val="$undef";;
10350 esac
10351 set d_bsdgetpgrp
10352 eval $setvar
10353 $rm_try
10354
10355 : see if setpgrp exists
10356 set setpgrp d_setpgrp
10357 eval $inlibc
10358
10359 case "$d_setpgrp" in
10360 "$define")
10361         echo " "
10362         echo "Checking to see which flavor of setpgrp is in use..."
10363         $cat >try.c <<EOP
10364 #$i_unistd I_UNISTD
10365 #include <sys/types.h>
10366 #ifdef I_UNISTD
10367 #  include <unistd.h>
10368 #endif
10369 #$i_stdlib I_STDLIB
10370 #ifdef I_STDLIB
10371 #include <stdlib.h>
10372 #endif
10373 int main()
10374 {
10375         if (getuid() == 0) {
10376                 printf("(I see you are running Configure as super-user...)\n");
10377                 setuid(1);
10378         }
10379 #ifdef TRY_BSD_PGRP
10380         if (-1 == setpgrp(1, 1))
10381                 exit(0);
10382 #else
10383         if (setpgrp() != -1)
10384                 exit(0);
10385 #endif
10386         exit(1);
10387 }
10388 EOP
10389         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10390                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10391                 val="$define"
10392         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10393                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10394                 val="$undef"
10395         else
10396                 echo "(I can't seem to compile and run the test program.)"
10397                 if ./usg; then
10398                         xxx="a USG one, i.e. you use setpgrp()."
10399                 else
10400                         # SVR4 systems can appear rather BSD-ish.
10401                         case "$i_unistd" in
10402                         $undef)
10403                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10404                                 val="$define"
10405                                 ;;
10406                         $define)
10407                                 xxx="probably a USG one, i.e. you use setpgrp()."
10408                                 val="$undef"
10409                                 ;;
10410                         esac
10411                 fi
10412                 echo "Assuming your setpgrp is $xxx" >&4
10413         fi
10414         ;;
10415 *) val="$undef";;
10416 esac
10417 set d_bsdsetpgrp
10418 eval $setvar
10419 $rm_try
10420
10421 : Look for GCC-style __builtin_choose_expr
10422 case "$d_builtin_choose_expr" in
10423 '')
10424     echo " "
10425     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10426     $cat >try.c <<'EOCP'
10427 #include <assert.h>
10428 #include <stdlib.h>
10429 #include <stdio.h>
10430
10431 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10432
10433 int main(void) {
10434     assert( SYRINX(1) == 2112 );
10435     assert( SYRINX(1) != 5150 );
10436     assert( SYRINX(0) == 5150 );
10437     assert( SYRINX(0) != 2112 );
10438     puts( "All good!" );
10439     exit(0);
10440 }
10441
10442 EOCP
10443     set try
10444     if eval $compile; then
10445         echo "Your C compiler supports __builtin_choose_expr."
10446         val="$define"
10447     else
10448         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10449         val="$undef"
10450     fi
10451 ;;
10452 *) val="$d_builtin_choose_expr" ;;
10453 esac
10454
10455 set d_builtin_choose_expr
10456 eval $setvar
10457 $rm_try
10458
10459 : Look for GCC-style __builtin_expect
10460 case "$d_builtin_expect" in
10461 '')
10462     echo " "
10463     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10464     $cat >builtin.c <<'EOCP'
10465 int main(void) {
10466     int n = 50;
10467     if ( __builtin_expect(n, 0) ) n = 1;
10468 }
10469 EOCP
10470     set try
10471     if eval $compile; then
10472         echo "Your C compiler supports __builtin_choose_expr."
10473         val="$define"
10474     else
10475         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10476         val="$undef"
10477     fi
10478     ;;
10479 *) val="$d_builtin_expect" ;;
10480 esac
10481
10482 set d_builtin_expect
10483 eval $setvar
10484 $rm_try
10485
10486 : see if bzero exists
10487 set bzero d_bzero
10488 eval $inlibc
10489
10490 : see if stdarg is available
10491 echo " "
10492 if $test `./findhdr stdarg.h`; then
10493         echo "<stdarg.h> found." >&4
10494         valstd="$define"
10495 else
10496         echo "<stdarg.h> NOT found." >&4
10497         valstd="$undef"
10498 fi
10499
10500 : see if varags is available
10501 echo " "
10502 if $test `./findhdr varargs.h`; then
10503         echo "<varargs.h> found." >&4
10504 else
10505         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10506 fi
10507
10508 : set up the varargs testing programs
10509 $cat > varargs.c <<EOP
10510 #ifdef I_STDARG
10511 #include <stdarg.h>
10512 #endif
10513 #ifdef I_VARARGS
10514 #include <varargs.h>
10515 #endif
10516
10517 #ifdef I_STDARG
10518 int f(char *p, ...)
10519 #else
10520 int f(va_alist)
10521 va_dcl
10522 #endif
10523 {
10524         va_list ap;
10525 #ifndef I_STDARG
10526         char *p;
10527 #endif
10528 #ifdef I_STDARG
10529         va_start(ap,p);
10530 #else
10531         va_start(ap);
10532         p = va_arg(ap, char *);
10533 #endif
10534         va_end(ap);
10535         return 0;
10536 }
10537 EOP
10538 $cat > varargs <<EOP
10539 $startsh
10540 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10541         echo "true"
10542 else
10543         echo "false"
10544 fi
10545 $rm -f varargs$_o
10546 EOP
10547 chmod +x varargs
10548
10549 : now check which varargs header should be included
10550 echo " "
10551 i_varhdr=''
10552 case "$valstd" in
10553 "$define")
10554         if `./varargs I_STDARG`; then
10555                 val='stdarg.h'
10556         elif `./varargs I_VARARGS`; then
10557                 val='varargs.h'
10558         fi
10559         ;;
10560 *)
10561         if `./varargs I_VARARGS`; then
10562                 val='varargs.h'
10563         fi
10564         ;;
10565 esac
10566 case "$val" in
10567 '')
10568 echo "I could not find the definition for va_dcl... You have problems..." >&4
10569         val="$undef"; set i_stdarg; eval $setvar
10570         val="$undef"; set i_varargs; eval $setvar
10571         ;;
10572 *) 
10573         set i_varhdr
10574         eval $setvar
10575         case "$i_varhdr" in
10576         stdarg.h)
10577                 val="$define"; set i_stdarg; eval $setvar
10578                 val="$undef"; set i_varargs; eval $setvar
10579                 ;;
10580         varargs.h)
10581                 val="$undef"; set i_stdarg; eval $setvar
10582                 val="$define"; set i_varargs; eval $setvar
10583                 ;;
10584         esac
10585         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10586 esac
10587 $rm -f varargs*
10588
10589 : see if the Compiler supports C99 variadic macros
10590 case "$i_stdarg$i_stdlib" in
10591     "$define$define")
10592     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10593     $cat >try.c <<EOCP
10594 #include <stdio.h>
10595 #include <stdarg.h>
10596
10597 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10598
10599 int main() {
10600   char buf[20];
10601   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10602   puts(buf);
10603   return 0;
10604 }
10605 EOCP
10606     set try
10607     if eval $compile && $run ./try 2>&1 >/dev/null; then
10608         case "`$run ./try`" in
10609             "123 456 789")
10610             echo "You have C99 variadic macros." >&4
10611             d_c99_variadic_macros="$define"
10612             ;;
10613             *)
10614             echo "You don't have functional C99 variadic macros." >&4
10615             d_c99_variadic_macros="$undef"
10616             ;;
10617         esac
10618     else
10619         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10620         d_c99_variadic_macros="$undef"
10621     fi
10622     $rm_try
10623     ;;
10624     *)
10625     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10626     d_c99_variadic_macros="$undef"
10627     ;;
10628 esac
10629
10630 : see if signal is declared as pointer to function returning int or void
10631 echo " "
10632 xxx=`./findhdr signal.h`
10633 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10634 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10635         echo "You have int (*signal())() instead of void." >&4
10636         val="$undef"
10637 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10638         echo "You have void (*signal())()." >&4
10639         val="$define"
10640 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10641         echo "You have int (*signal())() instead of void." >&4
10642         val="$undef"
10643 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10644         echo "You have void (*signal())()." >&4
10645         val="$define"
10646 else
10647         case "$d_voidsig" in
10648         '')
10649         echo "I can't determine whether signal handler returns void or int..." >&4
10650                 dflt=void
10651                 rp="What type does your signal handler return?"
10652                 . ./myread
10653                 case "$ans" in
10654                 v*) val="$define";;
10655                 *) val="$undef";;
10656                 esac;;
10657         "$define")
10658                 echo "As you already told me, signal handler returns void." >&4
10659                 val="$define"
10660                 ;;
10661         *)      echo "As you already told me, signal handler returns int." >&4
10662                 val="$undef"
10663                 ;;
10664         esac
10665 fi
10666 set d_voidsig
10667 eval $setvar
10668 case "$d_voidsig" in
10669 "$define") signal_t="void";;
10670 *) signal_t="int";;
10671 esac
10672 $rm -f $$.tmp
10673
10674 : check for ability to cast large floats to 32-bit ints.
10675 echo " "
10676 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10677 if $test "$intsize" -ge 4; then
10678         xxx=int
10679 else
10680         xxx=long
10681 fi
10682 $cat >try.c <<EOCP
10683 #include <stdio.h>
10684 #$i_stdlib I_STDLIB
10685 #ifdef I_STDLIB
10686 #include <stdlib.h>
10687 #endif
10688 #include <sys/types.h>
10689 #include <signal.h>
10690 $signal_t blech(int s) { exit(3); }
10691 int main()
10692 {
10693         $xxx i32;
10694         double f, g;
10695         int result = 0;
10696         char str[16];
10697         signal(SIGFPE, blech);
10698
10699         /* Don't let compiler optimize the test away.  Store the number
10700            in a writable string for gcc to pass to sscanf under HP/UX.
10701         */
10702         sprintf(str, "2147483647");
10703         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10704         g = 10 * f;
10705         i32  = ($xxx) g;
10706
10707         /* x86 processors will probably give 0x8000 0000, which is a
10708            sign change.  We don't want that.  We want to mimic SPARC
10709            behavior here, which is to preserve the sign and give
10710            back 0x7fff ffff.
10711         */
10712         if (i32 != ($xxx) f)
10713                 result |= 1;
10714         exit(result);
10715 }
10716 EOCP
10717 set try
10718 if eval $compile_ok; then
10719         $run ./try
10720         yyy=$?
10721 else
10722         echo "(I can't seem to compile the test program--assuming it can't)"
10723         yyy=1
10724 fi
10725 case "$yyy" in
10726 0)      val="$define"
10727         echo "Yup, it can."
10728         ;;
10729 *)      val="$undef"
10730         echo "Nope, it can't."
10731         ;;
10732 esac
10733 set d_casti32
10734 eval $setvar
10735 $rm_try
10736
10737 : check for ability to cast negative floats to unsigned
10738 echo " "
10739 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10740 $cat >try.c <<EOCP
10741 #include <stdio.h>
10742 #$i_stdlib I_STDLIB
10743 #ifdef I_STDLIB
10744 #include <stdlib.h>
10745 #endif
10746 #include <sys/types.h>
10747 #include <signal.h>
10748 $signal_t blech(int s) { exit(7); }
10749 $signal_t blech_in_list(int s) { exit(4); }
10750 unsigned long dummy_long(unsigned long p) { return p; }
10751 unsigned int dummy_int(unsigned int p) { return p; }
10752 unsigned short dummy_short(unsigned short p) { return p; }
10753 int main()
10754 {
10755         double f;
10756         unsigned long along;
10757         unsigned int aint;
10758         unsigned short ashort;
10759         int result = 0;
10760         char str[16];
10761
10762         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10763            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10764            optimized the whole file away
10765         */
10766         /* Store the number in a writable string for gcc to pass to
10767            sscanf under HP/UX.
10768         */
10769         sprintf(str, "-123");
10770         sscanf(str, "%lf", &f);  /* f = -123.; */
10771
10772         signal(SIGFPE, blech);
10773         along = (unsigned long)f;
10774         aint = (unsigned int)f;
10775         ashort = (unsigned short)f;
10776         if (along != (unsigned long)-123)
10777                 result |= 1;
10778         if (aint != (unsigned int)-123)
10779                 result |= 1;
10780         if (ashort != (unsigned short)-123)
10781                 result |= 1;
10782         sprintf(str, "1073741824.");
10783         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10784         f = f + f;
10785         along = 0;
10786         along = (unsigned long)f;
10787         if (along != 0x80000000)
10788                 result |= 2;
10789         f -= 1.;
10790         along = 0;
10791         along = (unsigned long)f;
10792         if (along != 0x7fffffff)
10793                 result |= 1;
10794         f += 2.;
10795         along = 0;
10796         along = (unsigned long)f;
10797         if (along != 0x80000001)
10798                 result |= 2;
10799         if (result)
10800                 exit(result);
10801         signal(SIGFPE, blech_in_list);
10802         sprintf(str, "123.");
10803         sscanf(str, "%lf", &f);  /* f = 123.; */
10804         along = dummy_long((unsigned long)f);
10805         aint = dummy_int((unsigned int)f);
10806         ashort = dummy_short((unsigned short)f);
10807         if (along != (unsigned long)123)
10808                 result |= 4;
10809         if (aint != (unsigned int)123)
10810                 result |= 4;
10811         if (ashort != (unsigned short)123)
10812                 result |= 4;
10813         exit(result);
10814
10815 }
10816 EOCP
10817 set try
10818 if eval $compile_ok; then
10819         $run ./try
10820         castflags=$?
10821 else
10822         echo "(I can't seem to compile the test program--assuming it can't)"
10823         castflags=7
10824 fi
10825 case "$castflags" in
10826 0)      val="$define"
10827         echo "Yup, it can."
10828         ;;
10829 *)      val="$undef"
10830         echo "Nope, it can't."
10831         ;;
10832 esac
10833 set d_castneg
10834 eval $setvar
10835 $rm_try
10836
10837 : see if vprintf exists
10838 echo " "
10839 if set vprintf val -f d_vprintf; eval $csym; $val; then
10840         echo 'vprintf() found.' >&4
10841         val="$define"
10842         $cat >try.c <<EOF
10843 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10844 #$i_varargs I_VARARGS
10845
10846 #$i_stdlib I_STDLIB
10847 #$i_unistd I_UNISTD
10848
10849 #ifdef I_STDARG
10850 #  include <stdarg.h>
10851 #else /* I_VARARGS */
10852 #  include <varargs.h>
10853 #endif
10854
10855 #ifdef I_UNISTD
10856 #  include <unistd.h>
10857 #endif
10858
10859 #ifdef I_STDLIB
10860 #  include <stdlib.h>
10861 #endif
10862
10863 #include <stdio.h> /* vsprintf prototype */
10864
10865 #ifdef I_STDARG
10866 void xxx(int n, ...)
10867 {
10868     va_list args;
10869     char buf[10];
10870     va_start(args, n);
10871     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10872 }
10873 int main() { xxx(1, "foo"); }
10874
10875 #else /* I_VARARGS */
10876
10877 xxx(va_alist)
10878 va_dcl
10879 {
10880     va_list args;
10881     char buf[10];
10882     va_start(args);
10883     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10884 }
10885 int main() { xxx("foo"); }
10886
10887 #endif
10888
10889 EOF
10890         set try
10891         if eval $compile_ok; then
10892                 if $run ./try; then
10893                         echo "Your vsprintf() returns (int)." >&4
10894                         val2="$undef"
10895                 else
10896                         echo "Your vsprintf() returns (char*)." >&4
10897                         val2="$define"
10898                 fi
10899         else
10900                 echo 'I am unable to compile the vsprintf() test program.' >&4
10901                 # We shouldn't get here.  If we do, assume the standard signature,
10902                 # not the old BSD one.
10903                 echo 'Guessing that vsprintf() returns (int).' >&4
10904                 val2="$undef"
10905         fi
10906 else
10907         echo 'vprintf() NOT found.' >&4
10908         val="$undef"
10909         val2="$undef"
10910 fi
10911 $rm_try
10912 set d_vprintf
10913 eval $setvar
10914 val=$val2
10915 set d_charvspr
10916 eval $setvar
10917
10918 : see if chown exists
10919 set chown d_chown
10920 eval $inlibc
10921
10922 : see if chroot exists
10923 set chroot d_chroot
10924 eval $inlibc
10925
10926 : see if chsize exists
10927 set chsize d_chsize
10928 eval $inlibc
10929
10930 : see if class exists
10931 set class d_class
10932 eval $inlibc
10933
10934 : see if clearenv exists
10935 set clearenv d_clearenv
10936 eval $inlibc
10937
10938 hasstruct='varname=$1; struct=$2; shift; shift;
10939 while $test $# -ge 2; do
10940         case "$1" in
10941         $define) echo "#include <$2>";;
10942         esac ;
10943     shift 2;
10944 done > try.c;
10945 echo "int main () { struct $struct foo; }" >> try.c;
10946 set try;
10947 if eval $compile; then
10948         val="$define";
10949 else
10950         val="$undef";
10951 fi;
10952 set $varname;
10953 eval $setvar;
10954 $rm_try'
10955
10956 socketlib=''
10957 sockethdr=''
10958 : see whether socket exists
10959 echo " "
10960 $echo $n "Hmm... $c" >&4
10961 if set socket val -f d_socket; eval $csym; $val; then
10962         echo "Looks like you have Berkeley networking support." >&4
10963         d_socket="$define"
10964         if set setsockopt val -f; eval $csym; $val; then
10965                 d_oldsock="$undef"
10966         else
10967                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10968                 d_oldsock="$define"
10969         fi
10970 else
10971         if $contains socklib libc.list >/dev/null 2>&1; then
10972                 echo "Looks like you have Berkeley networking support." >&4
10973                 d_socket="$define"
10974                 : we will have to assume that it supports the 4.2 BSD interface
10975                 d_oldsock="$undef"
10976         else
10977                 echo "You don't have Berkeley networking in libc$_a..." >&4
10978                 if test "X$d_socket" = "X$define"; then
10979                    echo "...but you seem to believe that you have sockets." >&4
10980                 else
10981                         for net in net socket
10982                         do
10983                                 if test -f /usr/lib/lib$net$_a; then
10984                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10985                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10986                                         if $contains socket libc.list >/dev/null 2>&1; then
10987                                                 d_socket="$define"
10988                                                 socketlib="-l$net"
10989                                                 case "$net" in
10990                                                 net)
10991                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10992                                                         sockethdr="-I/usr/netinclude"
10993                                                         ;;
10994                                                 esac
10995                                                 echo "Found Berkeley sockets interface in lib$net." >&4
10996                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10997                                                         d_oldsock="$undef"
10998                                                 else
10999                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11000                                                         d_oldsock="$define"
11001                                                 fi
11002                                                 break
11003                                         fi
11004                                 fi
11005                         done
11006                         if test "X$d_socket" != "X$define"; then
11007                            echo "or anywhere else I see." >&4
11008                            d_socket="$undef"
11009                            d_oldsock="$undef"
11010                         fi
11011                 fi
11012         fi
11013 fi
11014
11015 : see if socketpair exists
11016 set socketpair d_sockpair
11017 eval $inlibc
11018
11019
11020 echo " "
11021 echo "Checking the availability of certain socket constants..." >&4
11022 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11023         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11024         $cat >try.c <<EOF
11025 #include <sys/types.h>
11026 #include <sys/socket.h>
11027 int main() {
11028     int i = $ENUM;
11029 }
11030 EOF
11031         val="$undef"
11032         set try; if eval $compile; then
11033                 val="$define"
11034         fi
11035         set d_${enum}; eval $setvar
11036         $rm_try
11037 done
11038
11039 : see if this is a sys/uio.h system
11040 set sys/uio.h i_sysuio
11041 eval $inhdr
11042
11043
11044 echo " "
11045 echo "Checking to see if your system supports struct cmsghdr..." >&4
11046 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11047 eval $hasstruct
11048 case "$d_cmsghdr_s" in
11049 "$define")      echo "Yes, it does."   ;;
11050 *)              echo "No, it doesn't." ;;
11051 esac
11052
11053
11054 : check for const keyword
11055 echo " "
11056 echo 'Checking to see if your C compiler knows about "const"...' >&4
11057 $cat >const.c <<'EOCP'
11058 typedef struct spug { int drokk; } spug;
11059 int main()
11060 {
11061         const char *foo;
11062         const spug y = { 0 };
11063 }
11064 EOCP
11065 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11066         val="$define"
11067         echo "Yup, it does."
11068 else
11069         val="$undef"
11070         echo "Nope, it doesn't."
11071 fi
11072 set d_const
11073 eval $setvar
11074
11075 : see if copysignl exists
11076 set copysignl d_copysignl
11077 eval $inlibc
11078
11079 : see if crypt exists
11080 echo " "
11081 set crypt d_crypt
11082 eval $inlibc
11083 case "$d_crypt" in
11084 $define) cryptlib='' ;;
11085 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11086                 echo 'crypt() found.' >&4
11087                 val="$define"
11088                 cryptlib=''
11089         else
11090                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11091                 if $test -z "$cryptlib"; then
11092                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11093                 else
11094                         cryptlib=-lcrypt
11095                 fi
11096                 if $test -z "$cryptlib"; then
11097                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11098                 else
11099                         cryptlib=-lcrypt
11100                 fi
11101                 if $test -z "$cryptlib"; then
11102                         cryptlib=`./loc libcrypt$_a "" $libpth`
11103                 else
11104                         cryptlib=-lcrypt
11105                 fi
11106                 if $test -z "$cryptlib"; then
11107                         echo 'crypt() NOT found.' >&4
11108                         val="$undef"
11109                 else
11110                         val="$define"
11111                 fi
11112         fi
11113         set d_crypt
11114         eval $setvar
11115         ;;
11116 esac
11117
11118 : see if this is a crypt.h system
11119 set crypt.h i_crypt
11120 eval $inhdr
11121
11122 : see if crypt_r exists
11123 set crypt_r d_crypt_r
11124 eval $inlibc
11125 case "$d_crypt_r" in
11126 "$define")
11127         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11128         case "$d_crypt_r_proto:$usethreads" in
11129         ":define")      d_crypt_r_proto=define
11130                 set d_crypt_r_proto crypt_r $hdrs
11131                 eval $hasproto ;;
11132         *)      ;;
11133         esac
11134         case "$d_crypt_r_proto" in
11135         define)
11136         case "$crypt_r_proto" in
11137         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11138         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11139         esac
11140         case "$crypt_r_proto" in
11141         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11142         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11143         esac
11144         case "$crypt_r_proto" in
11145         ''|0)   d_crypt_r=undef
11146                 crypt_r_proto=0
11147                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11148         * )     case "$crypt_r_proto" in
11149                 REENTRANT_PROTO*) ;;
11150                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11151                 esac
11152                 echo "Prototype: $try" ;;
11153         esac
11154         ;;
11155         *)      case "$usethreads" in
11156                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11157                 esac
11158                 d_crypt_r=undef
11159                 crypt_r_proto=0
11160                 ;;
11161         esac
11162         ;;
11163 *)      crypt_r_proto=0
11164         ;;
11165 esac
11166
11167 : get csh whereabouts
11168 case "$csh" in
11169 'csh') val="$undef" ;;
11170 *) val="$define" ;;
11171 esac
11172 set d_csh
11173 eval $setvar
11174 : Respect a hint or command line value for full_csh.
11175 case "$full_csh" in
11176 '') full_csh=$csh ;;
11177 esac
11178
11179 : see if ctermid exists
11180 set ctermid d_ctermid
11181 eval $inlibc
11182
11183 : see if ctermid_r exists
11184 set ctermid_r d_ctermid_r
11185 eval $inlibc
11186 case "$d_ctermid_r" in
11187 "$define")
11188         hdrs="$i_systypes sys/types.h define stdio.h "
11189         case "$d_ctermid_r_proto:$usethreads" in
11190         ":define")      d_ctermid_r_proto=define
11191                 set d_ctermid_r_proto ctermid_r $hdrs
11192                 eval $hasproto ;;
11193         *)      ;;
11194         esac
11195         case "$d_ctermid_r_proto" in
11196         define)
11197         case "$ctermid_r_proto" in
11198         ''|0) try='char* ctermid_r(char*);'
11199         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11200         esac
11201         case "$ctermid_r_proto" in
11202         ''|0)   d_ctermid_r=undef
11203                 ctermid_r_proto=0
11204                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11205         * )     case "$ctermid_r_proto" in
11206                 REENTRANT_PROTO*) ;;
11207                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11208                 esac
11209                 echo "Prototype: $try" ;;
11210         esac
11211         ;;
11212         *)      case "$usethreads" in
11213                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11214                 esac
11215                 d_ctermid_r=undef
11216                 ctermid_r_proto=0
11217                 ;;
11218         esac
11219         ;;
11220 *)      ctermid_r_proto=0
11221         ;;
11222 esac
11223
11224 : see if ctime_r exists
11225 set ctime_r d_ctime_r
11226 eval $inlibc
11227 case "$d_ctime_r" in
11228 "$define")
11229         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11230         case "$d_ctime_r_proto:$usethreads" in
11231         ":define")      d_ctime_r_proto=define
11232                 set d_ctime_r_proto ctime_r $hdrs
11233                 eval $hasproto ;;
11234         *)      ;;
11235         esac
11236         case "$d_ctime_r_proto" in
11237         define)
11238         case "$ctime_r_proto" in
11239         ''|0) try='char* ctime_r(const time_t*, char*);'
11240         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11241         esac
11242         case "$ctime_r_proto" in
11243         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11244         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11245         esac
11246         case "$ctime_r_proto" in
11247         ''|0) try='int ctime_r(const time_t*, char*);'
11248         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11249         esac
11250         case "$ctime_r_proto" in
11251         ''|0) try='int ctime_r(const time_t*, char*, int);'
11252         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11253         esac
11254         case "$ctime_r_proto" in
11255         ''|0)   d_ctime_r=undef
11256                 ctime_r_proto=0
11257                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11258         * )     case "$ctime_r_proto" in
11259                 REENTRANT_PROTO*) ;;
11260                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11261                 esac
11262                 echo "Prototype: $try" ;;
11263         esac
11264         ;;
11265         *)      case "$usethreads" in
11266                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11267                 esac
11268                 d_ctime_r=undef
11269                 ctime_r_proto=0
11270                 ;;
11271         esac
11272         ;;
11273 *)      ctime_r_proto=0
11274         ;;
11275 esac
11276
11277 : see if cuserid exists
11278 set cuserid d_cuserid
11279 eval $inlibc
11280
11281 : see if this is a limits.h system
11282 set limits.h i_limits
11283 eval $inhdr
11284
11285 : see if this is a float.h system
11286 set float.h i_float
11287 eval $inhdr
11288
11289 : See if number of significant digits in a double precision number is known
11290 echo " "
11291 $cat >dbl_dig.c <<EOM
11292 #$i_limits I_LIMITS
11293 #$i_float I_FLOAT
11294 #ifdef I_LIMITS
11295 #include <limits.h>
11296 #endif
11297 #ifdef I_FLOAT
11298 #include <float.h>
11299 #endif
11300 #ifdef DBL_DIG
11301 printf("Contains DBL_DIG");
11302 #endif
11303 EOM
11304 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11305 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11306         echo "DBL_DIG found." >&4
11307         val="$define"
11308 else
11309         echo "DBL_DIG NOT found." >&4
11310         val="$undef"
11311 fi
11312 $rm -f dbl_dig.?
11313 set d_dbl_dig
11314 eval $setvar
11315
11316 : see if dbm.h is available
11317 : see if dbmclose exists
11318 set dbmclose d_dbmclose
11319 eval $inlibc
11320
11321 case "$d_dbmclose" in
11322 $define)
11323         set dbm.h i_dbm
11324         eval $inhdr
11325         case "$i_dbm" in
11326         $define)
11327                 val="$undef"
11328                 set i_rpcsvcdbm
11329                 eval $setvar
11330                 ;;
11331         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11332                 eval $inhdr
11333                 ;;
11334         esac
11335         ;;
11336 *)      echo "We won't be including <dbm.h>"
11337         val="$undef"
11338         set i_dbm
11339         eval $setvar
11340         val="$undef"
11341         set i_rpcsvcdbm
11342         eval $setvar
11343         ;;
11344 esac
11345
11346 : see if prototype for dbminit is available
11347 echo " "
11348 set d_dbminitproto dbminit $i_dbm dbm.h
11349 eval $hasproto
11350
11351 : see if difftime exists
11352 set difftime d_difftime
11353 eval $inlibc
11354
11355 : see if this is a dirent system
11356 echo " "
11357 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11358         val="$define"
11359         echo "<dirent.h> found." >&4
11360 else
11361         val="$undef"
11362         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11363                 echo "<sys/dir.h> found." >&4
11364                 echo " "
11365         else
11366                 xinc=`./findhdr sys/ndir.h`
11367         fi
11368         echo "<dirent.h> NOT found." >&4
11369 fi
11370 set i_dirent
11371 eval $setvar
11372
11373 : Look for type of directory structure.
11374 echo " "
11375 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11376
11377 case "$direntrytype" in
11378 ''|' ')
11379         case "$i_dirent" in
11380         $define) guess1='struct dirent' ;;
11381         *) guess1='struct direct'  ;;
11382         esac
11383         ;;
11384 *)      guess1="$direntrytype"
11385         ;;
11386 esac
11387
11388 case "$guess1" in
11389 'struct dirent') guess2='struct direct' ;;
11390 *) guess2='struct dirent' ;;
11391 esac
11392
11393 if $contains "$guess1" try.c >/dev/null 2>&1; then
11394         direntrytype="$guess1"
11395         echo "Your directory entries are $direntrytype." >&4
11396 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11397         direntrytype="$guess2"
11398         echo "Your directory entries seem to be $direntrytype." >&4
11399 else
11400         echo "I don't recognize your system's directory entries." >&4
11401         rp="What type is used for directory entries on this system?"
11402         dflt="$guess1"
11403         . ./myread
11404         direntrytype="$ans"
11405 fi
11406 $rm_try
11407
11408 : see if the directory entry stores field length
11409 echo " "
11410 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11411 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11412         echo "Good, your directory entry keeps length information in d_namlen." >&4
11413         val="$define"
11414 else
11415         echo "Your directory entry does not know about the d_namlen field." >&4
11416         val="$undef"
11417 fi
11418 set d_dirnamlen
11419 eval $setvar
11420 $rm_try
11421
11422 : Look for DIR.dd_fd
11423 case "$i_dirent" in
11424 "$define")
11425     echo "Checking to see if DIR has a dd_fd member variable" >&4
11426     $cat >try.c <<EOCP
11427 #$i_stdlib I_STDLIB
11428 #ifdef I_STDLIB
11429 #include <stdlib.h>
11430 #endif
11431 #include <dirent.h>
11432
11433 int main() {
11434     DIR dir;
11435     dir.dd_fd = 1;
11436     return 0;
11437 }
11438 EOCP
11439     val=$undef
11440     set try
11441     if eval $compile; then
11442         echo "Yes, it does."
11443         val="$define"
11444     else
11445         echo "No, it does not."
11446         val="$undef"
11447     fi
11448     ;;
11449 *)
11450     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11451     val="$undef"
11452     ;;
11453 esac
11454 set d_dir_dd_fd
11455 eval $setvar
11456 $rm_try
11457
11458 : see if this is an sysdir system
11459 set sys/dir.h i_sysdir
11460 eval $inhdr
11461
11462 : see if this is an sysndir system
11463 set sys/ndir.h i_sysndir
11464 eval $inhdr
11465
11466 : Look for dirfd
11467 echo " "
11468 $cat >dirfd.c <<EOM
11469 #include <stdio.h>
11470 #$i_stdlib I_STDLIB
11471 #ifdef I_STDLIB
11472 #include <stdlib.h>
11473 #endif
11474 #$i_dirent I_DIRENT             /**/
11475 #$i_sysdir I_SYS_DIR            /**/
11476 #$i_sysndir I_SYS_NDIR          /**/
11477 #$i_systypes I_SYS_TYPES        /**/
11478 #if defined(I_SYS_TYPES)
11479 #include <sys/types.h>
11480 #endif
11481 #if defined(I_DIRENT)
11482 #include <dirent.h>
11483 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11484 #include <sys/dir.h>
11485 #endif
11486 #else
11487 #ifdef I_SYS_NDIR
11488 #include <sys/ndir.h>
11489 #else
11490 #ifdef I_SYS_DIR
11491 #ifdef hp9000s500
11492 #include <ndir.h>       /* may be wrong in the future */
11493 #else
11494 #include <sys/dir.h>
11495 #endif
11496 #endif
11497 #endif
11498 #endif 
11499 int main() {
11500         DIR *dirp = opendir(".");
11501         if (dirfd(dirp) >= 0)
11502                 exit(0);
11503         else
11504                 exit(1);
11505 }
11506 EOM
11507 val=$undef
11508 set dirfd
11509 if eval $compile; then
11510         val="$define"
11511 fi
11512 case "$val" in
11513 $define)        echo "dirfd() found." >&4       ;;
11514 *)              echo "dirfd() NOT found." >&4   ;;
11515 esac
11516 set d_dirfd
11517 eval $setvar
11518 $rm -f dirfd*
11519
11520 : see if dlerror exists
11521 xxx_runnm="$runnm"
11522 runnm=false
11523 set dlerror d_dlerror
11524 eval $inlibc
11525 runnm="$xxx_runnm"
11526
11527 : see if dlfcn is available
11528 set dlfcn.h i_dlfcn
11529 eval $inhdr
11530
11531 case "$usedl" in
11532 $define|y|true)
11533         $cat << EOM
11534
11535 On a few systems, the dynamically loaded modules that perl generates and uses
11536 will need a different extension than shared libs. The default will probably
11537 be appropriate.
11538
11539 EOM
11540         case "$dlext" in
11541         '')     dflt="$so" ;;
11542         *)      dflt="$dlext" ;;
11543         esac
11544         rp='What is the extension of dynamically loaded modules'
11545         . ./myread
11546         dlext="$ans"
11547         ;;
11548 *)
11549         dlext="none"
11550         ;;
11551 esac
11552
11553 : Check if dlsym need a leading underscore
11554 echo " "
11555 val="$undef"
11556
11557 case "$dlsrc" in
11558 dl_dlopen.xs)
11559         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11560         $cat >dyna.c <<'EOM'
11561 fred () { }
11562 EOM
11563
11564 $cat >fred.c<<EOM
11565
11566 #include <stdio.h>
11567 #$i_stdlib I_STDLIB
11568 #ifdef I_STDLIB
11569 #include <stdlib.h>
11570 #endif
11571 #$i_dlfcn I_DLFCN
11572 #ifdef I_DLFCN
11573 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11574 #else
11575 #include <sys/types.h>
11576 #include <nlist.h>
11577 #include <link.h>
11578 #endif
11579
11580 extern int fred() ;
11581
11582 int main()
11583 {
11584     void * handle ;
11585     void * symbol ;
11586 #ifndef RTLD_LAZY
11587     int mode = 1 ;
11588 #else
11589     int mode = RTLD_LAZY ;
11590 #endif
11591     handle = dlopen("./dyna.$dlext", mode) ;
11592     if (handle == NULL) {
11593         printf ("1\n") ;
11594         fflush (stdout) ;
11595         exit(0);
11596     }
11597     symbol = dlsym(handle, "fred") ;
11598     if (symbol == NULL) {
11599         /* try putting a leading underscore */
11600         symbol = dlsym(handle, "_fred") ;
11601         if (symbol == NULL) {
11602             printf ("2\n") ;
11603             fflush (stdout) ;
11604             exit(0);
11605         }
11606         printf ("3\n") ;
11607     }
11608     else
11609         printf ("4\n") ;
11610     fflush (stdout) ;
11611     exit(0);
11612 }
11613 EOM
11614         : Call the object file tmp-dyna.o in case dlext=o.
11615         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11616                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11617                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11618                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11619                 xxx=`$run ./fred`
11620                 case $xxx in
11621                 1)      echo "Test program failed using dlopen." >&4
11622                         echo "Perhaps you should not use dynamic loading." >&4;;
11623                 2)      echo "Test program failed using dlsym." >&4
11624                         echo "Perhaps you should not use dynamic loading." >&4;;
11625                 3)      echo "dlsym needs a leading underscore" >&4
11626                         val="$define" ;;
11627                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11628                 esac
11629         else
11630                 echo "I can't compile and run the test program." >&4
11631                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11632         fi
11633         ;;
11634 esac
11635                 
11636 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11637
11638 set d_dlsymun
11639 eval $setvar
11640
11641 : see if drand48_r exists
11642 set drand48_r d_drand48_r
11643 eval $inlibc
11644 case "$d_drand48_r" in
11645 "$define")
11646         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11647         case "$d_drand48_r_proto:$usethreads" in
11648         ":define")      d_drand48_r_proto=define
11649                 set d_drand48_r_proto drand48_r $hdrs
11650                 eval $hasproto ;;
11651         *)      ;;
11652         esac
11653         case "$d_drand48_r_proto" in
11654         define)
11655         case "$drand48_r_proto" in
11656         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11657         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11658         esac
11659         case "$drand48_r_proto" in
11660         ''|0)   d_drand48_r=undef
11661                 drand48_r_proto=0
11662                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11663         * )     case "$drand48_r_proto" in
11664                 REENTRANT_PROTO*) ;;
11665                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11666                 esac
11667                 echo "Prototype: $try" ;;
11668         esac
11669         ;;
11670         *)      case "$usethreads" in
11671                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11672                 esac
11673                 d_drand48_r=undef
11674                 drand48_r_proto=0
11675                 ;;
11676         esac
11677         ;;
11678 *)      drand48_r_proto=0
11679         ;;
11680 esac
11681
11682 : see if prototype for drand48 is available
11683 echo " "
11684 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11685 eval $hasproto
11686
11687 : see if dup2 exists
11688 set dup2 d_dup2
11689 eval $inlibc
11690
11691 : see if eaccess exists
11692 set eaccess d_eaccess
11693 eval $inlibc
11694
11695 : see if endgrent exists
11696 set endgrent d_endgrent
11697 eval $inlibc
11698
11699 : see if this is an grp system
11700 set grp.h i_grp
11701 eval $inhdr
11702
11703 case "$i_grp" in
11704 $define)
11705         xxx=`./findhdr grp.h`
11706         $cppstdin $cppflags $cppminus < $xxx >$$.h
11707
11708         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11709                 val="$define"
11710         else
11711                 val="$undef"
11712         fi
11713         set d_grpasswd
11714         eval $setvar
11715
11716         $rm -f $$.h
11717         ;;
11718 *)
11719         val="$undef";
11720         set d_grpasswd; eval $setvar
11721         ;;
11722 esac
11723
11724 : see if endgrent_r exists
11725 set endgrent_r d_endgrent_r
11726 eval $inlibc
11727 case "$d_endgrent_r" in
11728 "$define")
11729         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11730         case "$d_endgrent_r_proto:$usethreads" in
11731         ":define")      d_endgrent_r_proto=define
11732                 set d_endgrent_r_proto endgrent_r $hdrs
11733                 eval $hasproto ;;
11734         *)      ;;
11735         esac
11736         case "$d_endgrent_r_proto" in
11737         define)
11738         case "$endgrent_r_proto" in
11739         ''|0) try='int endgrent_r(FILE**);'
11740         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11741         esac
11742         case "$endgrent_r_proto" in
11743         ''|0) try='void endgrent_r(FILE**);'
11744         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11745         esac
11746         case "$endgrent_r_proto" in
11747         ''|0)   d_endgrent_r=undef
11748                 endgrent_r_proto=0
11749                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11750         * )     case "$endgrent_r_proto" in
11751                 REENTRANT_PROTO*) ;;
11752                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11753                 esac
11754                 echo "Prototype: $try" ;;
11755         esac
11756         ;;
11757         *)      case "$usethreads" in
11758                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11759                 esac
11760                 d_endgrent_r=undef
11761                 endgrent_r_proto=0
11762                 ;;
11763         esac
11764         ;;
11765 *)      endgrent_r_proto=0
11766         ;;
11767 esac
11768
11769 : see if endhostent exists
11770 set endhostent d_endhent
11771 eval $inlibc
11772
11773 : see if this is a netdb.h system
11774 set netdb.h i_netdb
11775 eval $inhdr
11776
11777 : see if endhostent_r exists
11778 set endhostent_r d_endhostent_r
11779 eval $inlibc
11780 case "$d_endhostent_r" in
11781 "$define")
11782         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11783         case "$d_endhostent_r_proto:$usethreads" in
11784         ":define")      d_endhostent_r_proto=define
11785                 set d_endhostent_r_proto endhostent_r $hdrs
11786                 eval $hasproto ;;
11787         *)      ;;
11788         esac
11789         case "$d_endhostent_r_proto" in
11790         define)
11791         case "$endhostent_r_proto" in
11792         ''|0) try='int endhostent_r(struct hostent_data*);'
11793         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11794         esac
11795         case "$endhostent_r_proto" in
11796         ''|0) try='void endhostent_r(struct hostent_data*);'
11797         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11798         esac
11799         case "$endhostent_r_proto" in
11800         ''|0)   d_endhostent_r=undef
11801                 endhostent_r_proto=0
11802                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11803         * )     case "$endhostent_r_proto" in
11804                 REENTRANT_PROTO*) ;;
11805                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11806                 esac
11807                 echo "Prototype: $try" ;;
11808         esac
11809         ;;
11810         *)      case "$usethreads" in
11811                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11812                 esac
11813                 d_endhostent_r=undef
11814                 endhostent_r_proto=0
11815                 ;;
11816         esac
11817         ;;
11818 *)      endhostent_r_proto=0
11819         ;;
11820 esac
11821
11822 : see if endnetent exists
11823 set endnetent d_endnent
11824 eval $inlibc
11825
11826 : see if endnetent_r exists
11827 set endnetent_r d_endnetent_r
11828 eval $inlibc
11829 case "$d_endnetent_r" in
11830 "$define")
11831         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11832         case "$d_endnetent_r_proto:$usethreads" in
11833         ":define")      d_endnetent_r_proto=define
11834                 set d_endnetent_r_proto endnetent_r $hdrs
11835                 eval $hasproto ;;
11836         *)      ;;
11837         esac
11838         case "$d_endnetent_r_proto" in
11839         define)
11840         case "$endnetent_r_proto" in
11841         ''|0) try='int endnetent_r(struct netent_data*);'
11842         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11843         esac
11844         case "$endnetent_r_proto" in
11845         ''|0) try='void endnetent_r(struct netent_data*);'
11846         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11847         esac
11848         case "$endnetent_r_proto" in
11849         ''|0)   d_endnetent_r=undef
11850                 endnetent_r_proto=0
11851                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11852         * )     case "$endnetent_r_proto" in
11853                 REENTRANT_PROTO*) ;;
11854                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11855                 esac
11856                 echo "Prototype: $try" ;;
11857         esac
11858         ;;
11859         *)      case "$usethreads" in
11860                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11861                 esac
11862                 d_endnetent_r=undef
11863                 endnetent_r_proto=0
11864                 ;;
11865         esac
11866         ;;
11867 *)      endnetent_r_proto=0
11868         ;;
11869 esac
11870
11871 : see if endprotoent exists
11872 set endprotoent d_endpent
11873 eval $inlibc
11874
11875 : see if endprotoent_r exists
11876 set endprotoent_r d_endprotoent_r
11877 eval $inlibc
11878 case "$d_endprotoent_r" in
11879 "$define")
11880         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11881         case "$d_endprotoent_r_proto:$usethreads" in
11882         ":define")      d_endprotoent_r_proto=define
11883                 set d_endprotoent_r_proto endprotoent_r $hdrs
11884                 eval $hasproto ;;
11885         *)      ;;
11886         esac
11887         case "$d_endprotoent_r_proto" in
11888         define)
11889         case "$endprotoent_r_proto" in
11890         ''|0) try='int endprotoent_r(struct protoent_data*);'
11891         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11892         esac
11893         case "$endprotoent_r_proto" in
11894         ''|0) try='void endprotoent_r(struct protoent_data*);'
11895         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11896         esac
11897         case "$endprotoent_r_proto" in
11898         ''|0)   d_endprotoent_r=undef
11899                 endprotoent_r_proto=0
11900                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11901         * )     case "$endprotoent_r_proto" in
11902                 REENTRANT_PROTO*) ;;
11903                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11904                 esac
11905                 echo "Prototype: $try" ;;
11906         esac
11907         ;;
11908         *)      case "$usethreads" in
11909                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11910                 esac
11911                 d_endprotoent_r=undef
11912                 endprotoent_r_proto=0
11913                 ;;
11914         esac
11915         ;;
11916 *)      endprotoent_r_proto=0
11917         ;;
11918 esac
11919
11920 : see if endpwent exists
11921 set endpwent d_endpwent
11922 eval $inlibc
11923
11924 : see if this is a pwd.h system
11925 set pwd.h i_pwd
11926 eval $inhdr
11927
11928 case "$i_pwd" in
11929 $define)
11930         xxx=`./findhdr pwd.h`
11931         $cppstdin $cppflags $cppminus < $xxx >$$.h
11932
11933         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11934                 val="$define"
11935         else
11936                 val="$undef"
11937         fi
11938         set d_pwquota
11939         eval $setvar
11940
11941         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11942                 val="$define"
11943         else
11944                 val="$undef"
11945         fi
11946         set d_pwage
11947         eval $setvar
11948
11949         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11950                 val="$define"
11951         else
11952                 val="$undef"
11953         fi
11954         set d_pwchange
11955         eval $setvar
11956
11957         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11958                 val="$define"
11959         else
11960                 val="$undef"
11961         fi
11962         set d_pwclass
11963         eval $setvar
11964
11965         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11966                 val="$define"
11967         else
11968                 val="$undef"
11969         fi
11970         set d_pwexpire
11971         eval $setvar
11972
11973         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11974                 val="$define"
11975         else
11976                 val="$undef"
11977         fi
11978         set d_pwcomment
11979         eval $setvar
11980
11981         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11982                 val="$define"
11983         else
11984                 val="$undef"
11985         fi
11986         set d_pwgecos
11987         eval $setvar
11988
11989         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11990                 val="$define"
11991         else
11992                 val="$undef"
11993         fi
11994         set d_pwpasswd
11995         eval $setvar
11996
11997         $rm -f $$.h
11998         ;;
11999 *)
12000         val="$undef"; 
12001         set d_pwquota; eval $setvar
12002         set d_pwage; eval $setvar
12003         set d_pwchange; eval $setvar
12004         set d_pwclass; eval $setvar
12005         set d_pwexpire; eval $setvar
12006         set d_pwcomment; eval $setvar
12007         set d_pwgecos; eval $setvar
12008         set d_pwpasswd; eval $setvar
12009         ;;
12010 esac
12011
12012 : see if endpwent_r exists
12013 set endpwent_r d_endpwent_r
12014 eval $inlibc
12015 case "$d_endpwent_r" in
12016 "$define")
12017         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12018         case "$d_endpwent_r_proto:$usethreads" in
12019         ":define")      d_endpwent_r_proto=define
12020                 set d_endpwent_r_proto endpwent_r $hdrs
12021                 eval $hasproto ;;
12022         *)      ;;
12023         esac
12024         case "$d_endpwent_r_proto" in
12025         define)
12026         case "$endpwent_r_proto" in
12027         ''|0) try='int endpwent_r(FILE**);'
12028         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12029         esac
12030         case "$endpwent_r_proto" in
12031         ''|0) try='void endpwent_r(FILE**);'
12032         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12033         esac
12034         case "$endpwent_r_proto" in
12035         ''|0)   d_endpwent_r=undef
12036                 endpwent_r_proto=0
12037                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12038         * )     case "$endpwent_r_proto" in
12039                 REENTRANT_PROTO*) ;;
12040                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12041                 esac
12042                 echo "Prototype: $try" ;;
12043         esac
12044         ;;
12045         *)      case "$usethreads" in
12046                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12047                 esac
12048                 d_endpwent_r=undef
12049                 endpwent_r_proto=0
12050                 ;;
12051         esac
12052         ;;
12053 *)      endpwent_r_proto=0
12054         ;;
12055 esac
12056
12057 : see if endservent exists
12058 set endservent d_endsent
12059 eval $inlibc
12060
12061 : see if endservent_r exists
12062 set endservent_r d_endservent_r
12063 eval $inlibc
12064 case "$d_endservent_r" in
12065 "$define")
12066         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12067         case "$d_endservent_r_proto:$usethreads" in
12068         ":define")      d_endservent_r_proto=define
12069                 set d_endservent_r_proto endservent_r $hdrs
12070                 eval $hasproto ;;
12071         *)      ;;
12072         esac
12073         case "$d_endservent_r_proto" in
12074         define)
12075         case "$endservent_r_proto" in
12076         ''|0) try='int endservent_r(struct servent_data*);'
12077         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12078         esac
12079         case "$endservent_r_proto" in
12080         ''|0) try='void endservent_r(struct servent_data*);'
12081         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12082         esac
12083         case "$endservent_r_proto" in
12084         ''|0)   d_endservent_r=undef
12085                 endservent_r_proto=0
12086                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12087         * )     case "$endservent_r_proto" in
12088                 REENTRANT_PROTO*) ;;
12089                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12090                 esac
12091                 echo "Prototype: $try" ;;
12092         esac
12093         ;;
12094         *)      case "$usethreads" in
12095                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12096                 esac
12097                 d_endservent_r=undef
12098                 endservent_r_proto=0
12099                 ;;
12100         esac
12101         ;;
12102 *)      endservent_r_proto=0
12103         ;;
12104 esac
12105
12106 : Locate the flags for 'open()'
12107 echo " "
12108 $cat >try.c <<EOCP
12109 #include <sys/types.h>
12110 #ifdef I_FCNTL
12111 #include <fcntl.h>
12112 #endif
12113 #ifdef I_SYS_FILE
12114 #include <sys/file.h>
12115 #endif
12116 #$i_stdlib I_STDLIB
12117 #ifdef I_STDLIB
12118 #include <stdlib.h>
12119 #endif
12120 int main() {
12121         if(O_RDONLY);
12122 #ifdef O_TRUNC
12123         exit(0);
12124 #else
12125         exit(1);
12126 #endif
12127 }
12128 EOCP
12129 : check sys/file.h first to get FREAD on Sun
12130 if $test `./findhdr sys/file.h` && \
12131                 set try -DI_SYS_FILE && eval $compile; then
12132         h_sysfile=true;
12133         echo "<sys/file.h> defines the O_* constants..." >&4
12134         if $run ./try; then
12135                 echo "and you have the 3 argument form of open()." >&4
12136                 val="$define"
12137         else
12138                 echo "but not the 3 argument form of open().  Oh, well." >&4
12139                 val="$undef"
12140         fi
12141 elif $test `./findhdr fcntl.h` && \
12142                 set try -DI_FCNTL && eval $compile; then
12143         h_fcntl=true;
12144         echo "<fcntl.h> defines the O_* constants..." >&4
12145         if $run ./try; then
12146                 echo "and you have the 3 argument form of open()." >&4
12147                 val="$define"
12148         else
12149                 echo "but not the 3 argument form of open().  Oh, well." >&4
12150                 val="$undef"
12151         fi
12152 else
12153         val="$undef"
12154         echo "I can't find the O_* constant definitions!  You got problems." >&4
12155 fi
12156 set d_open3
12157 eval $setvar
12158 $rm_try
12159
12160 : see which of string.h or strings.h is needed
12161 echo " "
12162 strings=`./findhdr string.h`
12163 if $test "$strings" && $test -r "$strings"; then
12164         echo "Using <string.h> instead of <strings.h>." >&4
12165         val="$define"
12166 else
12167         val="$undef"
12168         strings=`./findhdr strings.h`
12169         if $test "$strings" && $test -r "$strings"; then
12170                 echo "Using <strings.h> instead of <string.h>." >&4
12171         else
12172                 echo "No string header found -- You'll surely have problems." >&4
12173         fi
12174 fi
12175 set i_string
12176 eval $setvar
12177 case "$i_string" in
12178 "$undef") strings=`./findhdr strings.h`;;
12179 *)        strings=`./findhdr string.h`;;
12180 esac
12181
12182 : see if this is a sys/file.h system
12183 val=''
12184 set sys/file.h val
12185 eval $inhdr
12186
12187 : do we need to include sys/file.h ?
12188 case "$val" in
12189 "$define")
12190         echo " "
12191         if $h_sysfile; then
12192                 val="$define"
12193                 echo "We'll be including <sys/file.h>." >&4
12194         else
12195                 val="$undef"
12196                 echo "We won't be including <sys/file.h>." >&4
12197         fi
12198         ;;
12199 *)
12200         h_sysfile=false
12201         ;;
12202 esac
12203 set i_sysfile
12204 eval $setvar
12205
12206 : see if fcntl.h is there
12207 val=''
12208 set fcntl.h val
12209 eval $inhdr
12210
12211 : see if we can include fcntl.h
12212 case "$val" in
12213 "$define")
12214         echo " "
12215         if $h_fcntl; then
12216                 val="$define"
12217                 echo "We'll be including <fcntl.h>." >&4
12218         else
12219                 val="$undef"
12220                 if $h_sysfile; then
12221         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12222                 else
12223                         echo "We won't be including <fcntl.h>." >&4
12224                 fi
12225         fi
12226         ;;
12227 *)
12228         h_fcntl=false
12229         val="$undef"
12230         ;;
12231 esac
12232 set i_fcntl
12233 eval $setvar
12234
12235 : see if fork exists
12236 set fork d_fork
12237 eval $inlibc
12238
12239 : see if pipe exists
12240 set pipe d_pipe
12241 eval $inlibc
12242
12243 : check for non-blocking I/O stuff
12244 case "$h_sysfile" in
12245 true) echo "#include <sys/file.h>" > head.c;;
12246 *)
12247        case "$h_fcntl" in
12248        true) echo "#include <fcntl.h>" > head.c;;
12249        *) echo "#include <sys/fcntl.h>" > head.c;;
12250        esac
12251        ;;
12252 esac
12253 echo " "
12254 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12255 case "$o_nonblock" in
12256 '')
12257         $cat head.c > try.c
12258         $cat >>try.c <<EOCP
12259 #include <stdio.h>
12260 #$i_stdlib I_STDLIB
12261 #ifdef I_STDLIB
12262 #include <stdlib.h>
12263 #endif
12264 #$i_fcntl I_FCNTL
12265 #ifdef I_FCNTL
12266 #include <fcntl.h>
12267 #endif
12268 int main() {
12269 #ifdef O_NONBLOCK
12270         printf("O_NONBLOCK\n");
12271         exit(0);
12272 #endif
12273 #ifdef O_NDELAY
12274         printf("O_NDELAY\n");
12275         exit(0);
12276 #endif
12277 #ifdef FNDELAY
12278         printf("FNDELAY\n");
12279         exit(0);
12280 #endif
12281         exit(0);
12282 }
12283 EOCP
12284         set try
12285         if eval $compile_ok; then
12286                 o_nonblock=`$run ./try`
12287                 case "$o_nonblock" in
12288                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12289                 *) echo "Seems like we can use $o_nonblock.";;
12290                 esac
12291         else
12292                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12293         fi
12294         ;;
12295 *) echo "Using $hint value $o_nonblock.";;
12296 esac
12297 $rm_try
12298
12299 echo " "
12300 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12301 case "$eagain" in
12302 '')
12303         case "$d_fork:$d_pipe" in
12304         define:define)
12305         $cat head.c > try.c
12306         $cat >>try.c <<EOCP
12307 #include <errno.h>
12308 #include <sys/types.h>
12309 #include <signal.h>
12310 #include <stdio.h>
12311 #$i_stdlib I_STDLIB
12312 #ifdef I_STDLIB
12313 #include <stdlib.h>
12314 #endif
12315 #$i_fcntl I_FCNTL
12316 #ifdef I_FCNTL
12317 #include <fcntl.h>
12318 #endif
12319 #define MY_O_NONBLOCK $o_nonblock
12320 #ifndef errno  /* XXX need better Configure test */
12321 extern int errno;
12322 #endif
12323 #$i_unistd I_UNISTD
12324 #ifdef I_UNISTD
12325 #include <unistd.h>
12326 #endif
12327 #$i_string I_STRING
12328 #ifdef I_STRING
12329 #include <string.h>
12330 #else
12331 #include <strings.h>
12332 #endif
12333 $signal_t blech(int x) { exit(3); }
12334 EOCP
12335         $cat >> try.c <<'EOCP'
12336 int main()
12337 {
12338         int pd[2];
12339         int pu[2];
12340         char buf[1];
12341         char string[100];
12342
12343         pipe(pd);       /* Down: child -> parent */
12344         pipe(pu);       /* Up: parent -> child */
12345         if (0 != fork()) {
12346                 int ret;
12347                 close(pd[1]);   /* Parent reads from pd[0] */
12348                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12349 #ifdef F_SETFL
12350                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12351                         exit(1);
12352 #else
12353                 exit(4);
12354 #endif
12355                 signal(SIGALRM, blech);
12356                 alarm(5);
12357                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12358                         exit(2);
12359                 sprintf(string, "%d\n", ret);
12360                 write(2, string, strlen(string));
12361                 alarm(0);
12362 #ifdef EAGAIN
12363                 if (errno == EAGAIN) {
12364                         printf("EAGAIN\n");
12365                         goto ok;
12366                 }
12367 #endif
12368 #ifdef EWOULDBLOCK
12369                 if (errno == EWOULDBLOCK)
12370                         printf("EWOULDBLOCK\n");
12371 #endif
12372         ok:
12373                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12374                 sleep(2);                               /* Give it time to close our pipe */
12375                 alarm(5);
12376                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12377                 alarm(0);
12378                 sprintf(string, "%d\n", ret);
12379                 write(4, string, strlen(string));
12380                 exit(0);
12381         }
12382
12383         close(pd[0]);                   /* We write to pd[1] */
12384         close(pu[1]);                   /* We read from pu[0] */
12385         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12386         close(pd[1]);                   /* Pipe pd is now fully closed! */
12387         exit(0);                                /* Bye bye, thank you for playing! */
12388 }
12389 EOCP
12390         set try
12391         if eval $compile_ok; then
12392                 echo "$startsh" >mtry
12393                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12394                 chmod +x mtry
12395                 ./mtry >/dev/null 2>&1
12396                 case $? in
12397                 0) eagain=`$cat try.out`;;
12398                 1) echo "Could not perform non-blocking setting!";;
12399                 2) echo "I did a successful read() for something that was not there!";;
12400                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12401                 4) echo "Could not find F_SETFL!";;
12402                 *) echo "Something terribly wrong happened during testing.";;
12403                 esac
12404                 rd_nodata=`$cat try.ret`
12405                 echo "A read() system call with no data present returns $rd_nodata."
12406                 case "$rd_nodata" in
12407                 0|-1) ;;
12408                 *)
12409                         echo "(That's peculiar, fixing that to be -1.)"
12410                         rd_nodata=-1
12411                         ;;
12412                 esac
12413                 case "$eagain" in
12414                 '')
12415                         echo "Forcing errno EAGAIN on read() with no data available."
12416                         eagain=EAGAIN
12417                         ;;
12418                 *)
12419                         echo "Your read() sets errno to $eagain when no data is available."
12420                         ;;
12421                 esac
12422                 status=`$cat try.err`
12423                 case "$status" in
12424                 0) echo "And it correctly returns 0 to signal EOF.";;
12425                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12426                 *) echo "However, your read() returns '$status' on EOF??";;
12427                 esac
12428                 val="$define"
12429                 if test "$status" = "$rd_nodata"; then
12430                         echo "WARNING: you can't distinguish between EOF and no data!"
12431                         val="$undef"
12432                 fi
12433         else
12434                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12435                 eagain=EAGAIN
12436         fi
12437         ;;
12438         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12439                 eagain=EAGAIN
12440                 val="$define"
12441                 ;;
12442         esac
12443         set d_eofnblk
12444         eval $setvar
12445         ;;
12446 *)
12447         echo "Using $hint value $eagain."
12448         echo "Your read() returns $rd_nodata when no data is present."
12449         case "$d_eofnblk" in
12450         "$define") echo "And you can see EOF because read() returns 0.";;
12451         "$undef") echo "But you can't see EOF status from read() returned value.";;
12452         *)
12453                 echo "(Assuming you can't see EOF status from read anyway.)"
12454                 d_eofnblk=$undef
12455                 ;;
12456         esac
12457         ;;
12458 esac
12459 $rm_try head.c mtry
12460
12461 : see if _ptr and _cnt from stdio act std
12462 echo " "
12463
12464 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12465         echo "(Looks like you have stdio.h from BSD.)"
12466         case "$stdio_ptr" in
12467         '') stdio_ptr='((fp)->_p)'
12468                 ptr_lval=$define
12469                 ;;
12470         *)      ptr_lval=$d_stdio_ptr_lval;;
12471         esac
12472         case "$stdio_cnt" in
12473         '') stdio_cnt='((fp)->_r)'
12474                 cnt_lval=$define
12475                 ;;
12476         *)      cnt_lval=$d_stdio_cnt_lval;;
12477         esac
12478         case "$stdio_base" in
12479         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12480         esac
12481         case "$stdio_bufsiz" in
12482         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12483         esac
12484 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12485         echo "(Looks like you have stdio.h from Linux.)"
12486         case "$stdio_ptr" in
12487         '') stdio_ptr='((fp)->_IO_read_ptr)'
12488                 ptr_lval=$define
12489                 ;;
12490         *)      ptr_lval=$d_stdio_ptr_lval;;
12491         esac
12492         case "$stdio_cnt" in
12493         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12494                 cnt_lval=$undef
12495                 ;;
12496         *)      cnt_lval=$d_stdio_cnt_lval;;
12497         esac
12498         case "$stdio_base" in
12499         '') stdio_base='((fp)->_IO_read_base)';;
12500         esac
12501         case "$stdio_bufsiz" in
12502         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12503         esac
12504 else
12505         case "$stdio_ptr" in
12506         '') stdio_ptr='((fp)->_ptr)'
12507                 ptr_lval=$define
12508                 ;;
12509         *)      ptr_lval=$d_stdio_ptr_lval;;
12510         esac
12511         case "$stdio_cnt" in
12512         '') stdio_cnt='((fp)->_cnt)'
12513                 cnt_lval=$define
12514                 ;;
12515         *)      cnt_lval=$d_stdio_cnt_lval;;
12516         esac
12517         case "$stdio_base" in
12518         '') stdio_base='((fp)->_base)';;
12519         esac
12520         case "$stdio_bufsiz" in
12521         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12522         esac
12523 fi
12524
12525 : test whether _ptr and _cnt really work
12526 echo "Checking how std your stdio is..." >&4
12527 $cat >try.c <<EOP
12528 #include <stdio.h>
12529 #$i_stdlib I_STDLIB
12530 #ifdef I_STDLIB
12531 #include <stdlib.h>
12532 #endif
12533 #define FILE_ptr(fp)    $stdio_ptr
12534 #define FILE_cnt(fp)    $stdio_cnt
12535 int main() {
12536         FILE *fp = fopen("try.c", "r");
12537         char c = getc(fp);
12538         if (
12539                 18 <= FILE_cnt(fp) &&
12540                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12541         )
12542                 exit(0);
12543         exit(1);
12544 }
12545 EOP
12546 val="$undef"
12547 set try
12548 if eval $compile && $to try.c; then
12549         if $run ./try; then
12550                 echo "Your stdio acts pretty std."
12551                 val="$define"
12552         else
12553                 echo "Your stdio isn't very std."
12554         fi
12555 else
12556         echo "Your stdio doesn't appear very std."
12557 fi
12558 $rm_try
12559
12560 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12561 # direct buffer manipulation no longer works.  The Configure tests
12562 # should be changed to correctly detect this, but until then,
12563 # the following check should at least let perl compile and run.
12564 # (This quick fix should be updated before 5.8.1.)
12565 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12566 # A. Dougherty, June 3, 2002.
12567 case "$d_gnulibc" in
12568 $define)
12569         case "$gnulibc_version" in
12570         2.[01]*)  ;;
12571         2.2) ;;
12572         2.2.[0-9]) ;;
12573         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12574                 val="$undef"
12575                 ;;
12576         esac
12577         ;;
12578 esac
12579 set d_stdstdio
12580 eval $setvar
12581
12582 : Can _ptr be used as an lvalue?
12583 case "$d_stdstdio$ptr_lval" in
12584 $define$define) val=$define ;;
12585 *) val=$undef ;;
12586 esac
12587 set d_stdio_ptr_lval
12588 eval $setvar
12589
12590 : Can _cnt be used as an lvalue?
12591 case "$d_stdstdio$cnt_lval" in
12592 $define$define) val=$define ;;
12593 *) val=$undef ;;
12594 esac
12595 set d_stdio_cnt_lval
12596 eval $setvar
12597
12598
12599 : test whether setting _ptr sets _cnt as a side effect
12600 d_stdio_ptr_lval_sets_cnt="$undef"
12601 d_stdio_ptr_lval_nochange_cnt="$undef"
12602 case "$d_stdio_ptr_lval$d_stdstdio" in
12603 $define$define)
12604         echo "Checking to see what happens if we set the stdio ptr..." >&4
12605 $cat >try.c <<EOP
12606 #include <stdio.h>
12607 /* Can we scream? */
12608 /* Eat dust sed :-) */
12609 /* In the buffer space, no one can hear you scream. */
12610 #$i_stdlib I_STDLIB
12611 #ifdef I_STDLIB
12612 #include <stdlib.h>
12613 #endif
12614 #define FILE_ptr(fp)    $stdio_ptr
12615 #define FILE_cnt(fp)    $stdio_cnt
12616 #include <sys/types.h>
12617 int main() {
12618         FILE *fp = fopen("try.c", "r");
12619         int c;
12620         char *ptr;
12621         size_t cnt;
12622         if (!fp) {
12623             puts("Fail even to read");
12624             exit(1);
12625         }
12626         c = getc(fp); /* Read away the first # */
12627         if (c == EOF) {
12628             puts("Fail even to read");
12629             exit(1);
12630         }
12631         if (!(
12632                 18 <= FILE_cnt(fp) &&
12633                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12634         )) {
12635                 puts("Fail even to read");
12636                 exit (1);
12637         }
12638         ptr = (char*) FILE_ptr(fp);
12639         cnt = (size_t)FILE_cnt(fp);
12640
12641         FILE_ptr(fp) += 42;
12642
12643         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12644                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12645                 exit (1);
12646         }
12647         if (FILE_cnt(fp) <= 20) {
12648                 printf ("Fail (<20 chars to test)");
12649                 exit (1);
12650         }
12651         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12652                 puts("Fail compare");
12653                 exit (1);
12654         }
12655         if (cnt == FILE_cnt(fp)) {
12656                 puts("Pass_unchanged");
12657                 exit (0);
12658         }
12659         if (FILE_cnt(fp) == (cnt - 42)) {
12660                 puts("Pass_changed");
12661                 exit (0);
12662         }
12663         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12664         return 1;
12665
12666 }
12667 EOP
12668         set try
12669         if eval $compile && $to try.c; then
12670                 case `$run ./try` in
12671                 Pass_changed)
12672                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12673                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12674                 Pass_unchanged)
12675                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12676                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12677                 Fail*)
12678                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12679                 *)
12680                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12681         esac
12682         else
12683                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12684         fi
12685         $rm_try
12686         ;;
12687 esac
12688
12689 : see if _base is also standard
12690 val="$undef"
12691 case "$d_stdstdio" in
12692 $define)
12693         $cat >try.c <<EOP
12694 #include <stdio.h>
12695 #$i_stdlib I_STDLIB
12696 #ifdef I_STDLIB
12697 #include <stdlib.h>
12698 #endif
12699 #define FILE_base(fp)   $stdio_base
12700 #define FILE_bufsiz(fp) $stdio_bufsiz
12701 int main() {
12702         FILE *fp = fopen("try.c", "r");
12703         char c = getc(fp);
12704         if (
12705                 19 <= FILE_bufsiz(fp) &&
12706                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12707         )
12708                 exit(0);
12709         exit(1);
12710 }
12711 EOP
12712         set try
12713         if eval $compile && $to try.c; then
12714                 if $run ./try; then
12715                         echo "And its _base field acts std."
12716                         val="$define"
12717                 else
12718                         echo "But its _base field isn't std."
12719                 fi
12720         else
12721                 echo "However, it seems to be lacking the _base field."
12722         fi
12723         $rm_try
12724         ;;
12725 esac
12726 set d_stdiobase
12727 eval $setvar
12728
12729 : see if fast_stdio exists
12730 val="$undef"
12731 case "$d_stdstdio:$d_stdio_ptr_lval" in
12732 "$define:$define")
12733         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12734         *$define*)
12735                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12736                 val="$define"
12737                 ;;
12738         esac
12739         ;;
12740 esac
12741 set d_faststdio
12742 eval $setvar
12743
12744
12745
12746 : see if fchdir exists
12747 set fchdir d_fchdir
12748 eval $inlibc
12749
12750 : see if fchmod exists
12751 set fchmod d_fchmod
12752 eval $inlibc
12753
12754 : see if fchown exists
12755 set fchown d_fchown
12756 eval $inlibc
12757
12758 : see if this is an fcntl system
12759 set fcntl d_fcntl
12760 eval $inlibc
12761
12762 echo " "
12763 : See if fcntl-based locking works.
12764 $cat >try.c <<EOCP
12765 #$i_stdlib I_STDLIB
12766 #ifdef I_STDLIB
12767 #include <stdlib.h>
12768 #endif
12769 #include <unistd.h>
12770 #include <fcntl.h>
12771 #include <signal.h>
12772 $signal_t blech(int x) { exit(3); }
12773 int main() {
12774 #if defined(F_SETLK) && defined(F_SETLKW)
12775      struct flock flock;
12776      int retval, fd;
12777      fd = open("try.c", O_RDONLY);
12778      flock.l_type = F_RDLCK;
12779      flock.l_whence = SEEK_SET;
12780      flock.l_start = flock.l_len = 0;
12781      signal(SIGALRM, blech);
12782      alarm(10);
12783      retval = fcntl(fd, F_SETLK, &flock);
12784      close(fd);
12785      (retval < 0 ? exit(2) : exit(0));
12786 #else
12787      exit(2);
12788 #endif
12789 }
12790 EOCP
12791 echo "Checking if fcntl-based file locking works... "
12792 case "$d_fcntl" in
12793 "$define")
12794         set try
12795         if eval $compile_ok; then
12796                 if $run ./try; then
12797                         echo "Yes, it seems to work."
12798                         val="$define"
12799                 else
12800                         echo "Nope, it didn't work."
12801                         val="$undef"
12802                         case "$?" in
12803                         3) $cat >&4 <<EOM
12804 ***
12805 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12806 *** This is (almost) impossible.
12807 *** If your NFS lock daemons are not feeling well, something like
12808 *** this may happen, please investigate.  Cannot continue, aborting.
12809 ***
12810 EOM
12811                                 exit 1
12812                                 ;;
12813                         esac
12814                 fi
12815         else
12816                 echo "I'm unable to compile the test program, so I'll assume not."
12817                 val="$undef"
12818         fi
12819         ;;
12820 *) val="$undef";
12821         echo "Nope, since you don't even have fcntl()."
12822         ;;
12823 esac
12824 set d_fcntl_can_lock
12825 eval $setvar
12826 $rm_try
12827
12828 : check for fd_set items
12829 $cat <<EOM
12830
12831 Checking to see how well your C compiler handles fd_set and friends ...
12832 EOM
12833 $cat >try.c <<EOCP
12834 #$i_stdlib I_STDLIB
12835 #ifdef I_STDLIB
12836 #include <stdlib.h>
12837 #endif
12838 #$i_systime I_SYS_TIME
12839 #$i_sysselct I_SYS_SELECT
12840 #$d_socket HAS_SOCKET
12841 #include <sys/types.h>
12842 #ifdef HAS_SOCKET
12843 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12844 #endif
12845 #ifdef I_SYS_TIME
12846 #include <sys/time.h>
12847 #endif
12848 #ifdef I_SYS_SELECT
12849 #include <sys/select.h>
12850 #endif
12851 int main() {
12852         fd_set fds;
12853
12854 #ifdef TRYBITS
12855         if(fds.fds_bits);
12856 #endif
12857
12858 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12859         exit(0);
12860 #else
12861         exit(1);
12862 #endif
12863 }
12864 EOCP
12865 set try -DTRYBITS
12866 if eval $compile; then
12867         d_fds_bits="$define"
12868         d_fd_set="$define"
12869         echo "Well, your system knows about the normal fd_set typedef..." >&4
12870         if $run ./try; then
12871                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12872                 d_fd_macros="$define"
12873         else
12874                 $cat >&4 <<'EOM'
12875 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12876 EOM
12877                 d_fd_macros="$undef"
12878         fi
12879 else
12880         $cat <<'EOM'
12881 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12882 EOM
12883         set try
12884         if eval $compile; then
12885                 d_fds_bits="$undef"
12886                 d_fd_set="$define"
12887                 echo "Well, your system has some sort of fd_set available..." >&4
12888                 if $run ./try; then
12889                         echo "and you have the normal fd_set macros." >&4
12890                         d_fd_macros="$define"
12891                 else
12892                         $cat <<'EOM'
12893 but not the normal fd_set macros!  Gross!  More work for me...
12894 EOM
12895                         d_fd_macros="$undef"
12896                 fi
12897         else
12898         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12899                 d_fd_set="$undef"
12900                 d_fds_bits="$undef"
12901                 d_fd_macros="$undef"
12902         fi
12903 fi
12904 $rm_try
12905
12906 : see if fgetpos exists
12907 set fgetpos d_fgetpos
12908 eval $inlibc
12909
12910 : see if finite exists
12911 set finite d_finite
12912 eval $inlibc
12913
12914 : see if finitel exists
12915 set finitel d_finitel
12916 eval $inlibc
12917
12918 : see if flock exists
12919 set flock d_flock
12920 eval $inlibc
12921
12922 : see if prototype for flock is available
12923 echo " "
12924 set d_flockproto flock $i_sysfile sys/file.h
12925 eval $hasproto
12926
12927 : see if fp_class exists
12928 set fp_class d_fp_class
12929 eval $inlibc
12930
12931 : see if pathconf exists
12932 set pathconf d_pathconf
12933 eval $inlibc
12934
12935 : see if fpathconf exists
12936 set fpathconf d_fpathconf
12937 eval $inlibc
12938
12939 : see if fpclass exists
12940 set fpclass d_fpclass
12941 eval $inlibc
12942
12943 : see if fpclassify exists
12944 set fpclassify d_fpclassify
12945 eval $inlibc
12946
12947 : see if fpclassl exists
12948 set fpclassl d_fpclassl
12949 eval $inlibc
12950
12951
12952 : check for fpos64_t
12953 echo " "
12954 echo "Checking to see if you have fpos64_t..." >&4
12955 $cat >try.c <<EOCP
12956 #include <stdio.h>
12957 int main() { fpos64_t x = 7; }
12958 EOCP
12959 set try
12960 if eval $compile; then
12961         val="$define"
12962         echo "You have fpos64_t."
12963 else
12964         val="$undef"
12965         echo "You do not have fpos64_t."
12966         case "$fpossize" in
12967         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12968         esac
12969 fi
12970 $rm_try
12971 set d_fpos64_t
12972 eval $setvar
12973
12974 : see if frexpl exists
12975 set frexpl d_frexpl
12976 eval $inlibc
12977
12978 : see if this is a sys/param system
12979 set sys/param.h i_sysparam
12980 eval $inhdr
12981
12982 : see if this is a sys/mount.h system
12983 set sys/mount.h i_sysmount
12984 eval $inhdr
12985
12986
12987 echo " "
12988 echo "Checking to see if your system supports struct fs_data..." >&4
12989 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12990 eval $hasstruct
12991 case "$d_fs_data_s" in
12992 "$define")      echo "Yes, it does."   ;;
12993 *)              echo "No, it doesn't." ;;
12994 esac
12995
12996 : see if fseeko exists
12997 set fseeko d_fseeko
12998 eval $inlibc
12999 case "$longsize" in
13000 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13001 esac
13002
13003 : see if fsetpos exists
13004 set fsetpos d_fsetpos
13005 eval $inlibc
13006
13007
13008 : see if fstatfs exists
13009 set fstatfs d_fstatfs
13010 eval $inlibc
13011
13012
13013 : see if statvfs exists
13014 set statvfs d_statvfs
13015 eval $inlibc
13016
13017 : see if fstatvfs exists
13018 set fstatvfs d_fstatvfs
13019 eval $inlibc
13020
13021
13022 : see if fsync exists
13023 set fsync d_fsync
13024 eval $inlibc
13025
13026 : see if ftello exists
13027 set ftello d_ftello
13028 eval $inlibc
13029 case "$longsize" in
13030 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13031 esac
13032
13033 d_futimes="$undef"
13034 : check for a working futimes
13035 echo " "
13036 echo "Checking if you have a working futimes()" >&4
13037 $cat >try.c <<EOCP
13038 #include <stdio.h>
13039 #include <sys/time.h>
13040 #include <errno.h>
13041 #include <fcntl.h>
13042
13043 int main ()
13044 {
13045     int fd, rv;
13046     fd = open ("try.c", O_RDWR);
13047     if (-1 == fd) exit (1);
13048     rv = futimes (fd, NULL);
13049     exit (rv == -1 ? errno : 0);
13050 }
13051 EOCP
13052 set try
13053 if eval $compile; then
13054     `$run ./try`
13055     rc=$?
13056     case "$rc" in
13057         0)  echo "Yes, you have" >&4
13058             d_futimes="$define"
13059             ;;
13060         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13061             ;;
13062     esac
13063 else
13064     echo "No, it does not (probably harmless)" >&4
13065 fi
13066 $rm_try
13067
13068 : see if getcwd exists
13069 set getcwd d_getcwd
13070 eval $inlibc
13071
13072 : see if getespwnam exists
13073 set getespwnam d_getespwnam
13074 eval $inlibc
13075
13076
13077 : see if getfsstat exists
13078 set getfsstat d_getfsstat
13079 eval $inlibc
13080
13081 : see if getgrent exists
13082 set getgrent d_getgrent
13083 eval $inlibc
13084
13085 : see if getgrent_r exists
13086 set getgrent_r d_getgrent_r
13087 eval $inlibc
13088 case "$d_getgrent_r" in
13089 "$define")
13090         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13091         case "$d_getgrent_r_proto:$usethreads" in
13092         ":define")      d_getgrent_r_proto=define
13093                 set d_getgrent_r_proto getgrent_r $hdrs
13094                 eval $hasproto ;;
13095         *)      ;;
13096         esac
13097         case "$d_getgrent_r_proto" in
13098         define)
13099         case "$getgrent_r_proto" in
13100         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13101         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13102         esac
13103         case "$getgrent_r_proto" in
13104         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13105         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13106         esac
13107         case "$getgrent_r_proto" in
13108         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13109         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13110         esac
13111         case "$getgrent_r_proto" in
13112         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13113         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13114         esac
13115         case "$getgrent_r_proto" in
13116         ''|0) try='int getgrent_r(struct group*, char*, int);'
13117         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13118         esac
13119         case "$getgrent_r_proto" in
13120         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13121         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13122         esac
13123         case "$getgrent_r_proto" in
13124         ''|0)   d_getgrent_r=undef
13125                 getgrent_r_proto=0
13126                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13127         * )     case "$getgrent_r_proto" in
13128                 REENTRANT_PROTO*) ;;
13129                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13130                 esac
13131                 echo "Prototype: $try" ;;
13132         esac
13133         ;;
13134         *)      case "$usethreads" in
13135                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13136                 esac
13137                 d_getgrent_r=undef
13138                 getgrent_r_proto=0
13139                 ;;
13140         esac
13141         ;;
13142 *)      getgrent_r_proto=0
13143         ;;
13144 esac
13145
13146 : see if getgrgid_r exists
13147 set getgrgid_r d_getgrgid_r
13148 eval $inlibc
13149 case "$d_getgrgid_r" in
13150 "$define")
13151         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13152         case "$d_getgrgid_r_proto:$usethreads" in
13153         ":define")      d_getgrgid_r_proto=define
13154                 set d_getgrgid_r_proto getgrgid_r $hdrs
13155                 eval $hasproto ;;
13156         *)      ;;
13157         esac
13158         case "$d_getgrgid_r_proto" in
13159         define)
13160         case "$getgrgid_r_proto" in
13161         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13162         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13163         esac
13164         case "$getgrgid_r_proto" in
13165         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13166         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13167         esac
13168         case "$getgrgid_r_proto" in
13169         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13170         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13171         esac
13172         case "$getgrgid_r_proto" in
13173         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13174         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13175         esac
13176         case "$getgrgid_r_proto" in
13177         ''|0)   d_getgrgid_r=undef
13178                 getgrgid_r_proto=0
13179                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13180         * )     case "$getgrgid_r_proto" in
13181                 REENTRANT_PROTO*) ;;
13182                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13183                 esac
13184                 echo "Prototype: $try" ;;
13185         esac
13186         ;;
13187         *)      case "$usethreads" in
13188                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13189                 esac
13190                 d_getgrgid_r=undef
13191                 getgrgid_r_proto=0
13192                 ;;
13193         esac
13194         ;;
13195 *)      getgrgid_r_proto=0
13196         ;;
13197 esac
13198
13199 : see if getgrnam_r exists
13200 set getgrnam_r d_getgrnam_r
13201 eval $inlibc
13202 case "$d_getgrnam_r" in
13203 "$define")
13204         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13205         case "$d_getgrnam_r_proto:$usethreads" in
13206         ":define")      d_getgrnam_r_proto=define
13207                 set d_getgrnam_r_proto getgrnam_r $hdrs
13208                 eval $hasproto ;;
13209         *)      ;;
13210         esac
13211         case "$d_getgrnam_r_proto" in
13212         define)
13213         case "$getgrnam_r_proto" in
13214         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13215         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13216         esac
13217         case "$getgrnam_r_proto" in
13218         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13219         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13220         esac
13221         case "$getgrnam_r_proto" in
13222         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13223         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13224         esac
13225         case "$getgrnam_r_proto" in
13226         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13227         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13228         esac
13229         case "$getgrnam_r_proto" in
13230         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13231         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13232         esac
13233         case "$getgrnam_r_proto" in
13234         ''|0)   d_getgrnam_r=undef
13235                 getgrnam_r_proto=0
13236                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13237         * )     case "$getgrnam_r_proto" in
13238                 REENTRANT_PROTO*) ;;
13239                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13240                 esac
13241                 echo "Prototype: $try" ;;
13242         esac
13243         ;;
13244         *)      case "$usethreads" in
13245                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13246                 esac
13247                 d_getgrnam_r=undef
13248                 getgrnam_r_proto=0
13249                 ;;
13250         esac
13251         ;;
13252 *)      getgrnam_r_proto=0
13253         ;;
13254 esac
13255
13256 : see if gethostbyaddr exists
13257 set gethostbyaddr d_gethbyaddr
13258 eval $inlibc
13259
13260 : see if gethostbyname exists
13261 set gethostbyname d_gethbyname
13262 eval $inlibc
13263
13264 : see if gethostent exists
13265 set gethostent d_gethent
13266 eval $inlibc
13267
13268 : see how we will look up host name
13269 echo " "
13270 call=''
13271 if set gethostname val -f d_gethname; eval $csym; $val; then
13272         echo 'gethostname() found.' >&4
13273         d_gethname="$define"
13274         call=gethostname
13275 fi
13276 if set uname val -f d_uname; eval $csym; $val; then
13277         if ./xenix; then
13278                 $cat <<'EOM'
13279 uname() was found, but you're running xenix, and older versions of xenix
13280 have a broken uname(). If you don't really know whether your xenix is old
13281 enough to have a broken system call, use the default answer.
13282
13283 EOM
13284                 dflt=y
13285                 case "$d_uname" in
13286                 "$define") dflt=n;;
13287                 esac
13288                 rp='Is your uname() broken?'
13289                 . ./myread
13290                 case "$ans" in
13291                 n*) d_uname="$define"; call=uname;;
13292                 esac
13293         else
13294                 echo 'uname() found.' >&4
13295                 d_uname="$define"
13296                 case "$call" in
13297                 '') call=uname ;;
13298                 esac
13299         fi
13300 fi
13301 case "$d_gethname" in
13302 '') d_gethname="$undef";;
13303 esac
13304 case "$d_uname" in
13305 '') d_uname="$undef";;
13306 esac
13307 case "$d_uname$d_gethname" in
13308 *define*)
13309         dflt=n
13310         cat <<EOM
13311  
13312 Every now and then someone has a $call() that lies about the hostname
13313 but can't be fixed for political or economic reasons.  If you wish, I can
13314 pretend $call() isn't there and maybe compute hostname at run-time
13315 thanks to the '$phostname' command.
13316
13317 EOM
13318         rp="Shall I ignore $call() from now on?"
13319         . ./myread
13320         case "$ans" in
13321         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13322         esac;;
13323 esac
13324 case "$phostname" in
13325 '') aphostname='';;
13326 *) case "$aphostname" in
13327         /*) ;;
13328         *) set X $phostname
13329                 shift
13330                 file=$1
13331                 shift
13332                 file=`./loc $file $file $pth`
13333                 aphostname=`echo $file $*`
13334                 ;;
13335         esac
13336         ;;
13337 esac
13338 case "$d_uname$d_gethname" in
13339 *define*) ;;
13340 *)
13341         case "$phostname" in
13342         '')
13343                 echo "There will be no way for $package to get your hostname." >&4;;
13344         *)
13345         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13346                 ;;
13347         esac;;
13348 esac
13349 case "$d_phostname" in
13350 '') d_phostname="$undef";;
13351 esac
13352
13353 : see if gethostbyaddr_r exists
13354 set gethostbyaddr_r d_gethostbyaddr_r
13355 eval $inlibc
13356 case "$d_gethostbyaddr_r" in
13357 "$define")
13358         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13359         case "$d_gethostbyaddr_r_proto:$usethreads" in
13360         ":define")      d_gethostbyaddr_r_proto=define
13361                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13362                 eval $hasproto ;;
13363         *)      ;;
13364         esac
13365         case "$d_gethostbyaddr_r_proto" in
13366         define)
13367         case "$gethostbyaddr_r_proto" in
13368         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13369         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13370         esac
13371         case "$gethostbyaddr_r_proto" in
13372         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13373         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13374         esac
13375         case "$gethostbyaddr_r_proto" in
13376         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13377         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13378         esac
13379         case "$gethostbyaddr_r_proto" in
13380         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13381         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13382         esac
13383         case "$gethostbyaddr_r_proto" in
13384         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13385         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13386         esac
13387         case "$gethostbyaddr_r_proto" in
13388         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13389         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13390         esac
13391         case "$gethostbyaddr_r_proto" in
13392         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13393         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13394         esac
13395         case "$gethostbyaddr_r_proto" in
13396         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13397         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13398         esac
13399         case "$gethostbyaddr_r_proto" in
13400         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13401         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13402         esac
13403         case "$gethostbyaddr_r_proto" in
13404         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13405         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13406         esac
13407         case "$gethostbyaddr_r_proto" in
13408         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13409         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13410         esac
13411         case "$gethostbyaddr_r_proto" in
13412         ''|0)   d_gethostbyaddr_r=undef
13413                 gethostbyaddr_r_proto=0
13414                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13415         * )     case "$gethostbyaddr_r_proto" in
13416                 REENTRANT_PROTO*) ;;
13417                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13418                 esac
13419                 echo "Prototype: $try" ;;
13420         esac
13421         ;;
13422         *)      case "$usethreads" in
13423                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13424                 esac
13425                 d_gethostbyaddr_r=undef
13426                 gethostbyaddr_r_proto=0
13427                 ;;
13428         esac
13429         ;;
13430 *)      gethostbyaddr_r_proto=0
13431         ;;
13432 esac
13433
13434 : see if gethostbyname_r exists
13435 set gethostbyname_r d_gethostbyname_r
13436 eval $inlibc
13437 case "$d_gethostbyname_r" in
13438 "$define")
13439         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13440         case "$d_gethostbyname_r_proto:$usethreads" in
13441         ":define")      d_gethostbyname_r_proto=define
13442                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13443                 eval $hasproto ;;
13444         *)      ;;
13445         esac
13446         case "$d_gethostbyname_r_proto" in
13447         define)
13448         case "$gethostbyname_r_proto" in
13449         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13450         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13451         esac
13452         case "$gethostbyname_r_proto" in
13453         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13454         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13455         esac
13456         case "$gethostbyname_r_proto" in
13457         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13458         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13459         esac
13460         case "$gethostbyname_r_proto" in
13461         ''|0)   d_gethostbyname_r=undef
13462                 gethostbyname_r_proto=0
13463                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13464         * )     case "$gethostbyname_r_proto" in
13465                 REENTRANT_PROTO*) ;;
13466                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13467                 esac
13468                 echo "Prototype: $try" ;;
13469         esac
13470         ;;
13471         *)      case "$usethreads" in
13472                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13473                 esac
13474                 d_gethostbyname_r=undef
13475                 gethostbyname_r_proto=0
13476                 ;;
13477         esac
13478         ;;
13479 *)      gethostbyname_r_proto=0
13480         ;;
13481 esac
13482
13483 : see if gethostent_r exists
13484 set gethostent_r d_gethostent_r
13485 eval $inlibc
13486 case "$d_gethostent_r" in
13487 "$define")
13488         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13489         case "$d_gethostent_r_proto:$usethreads" in
13490         ":define")      d_gethostent_r_proto=define
13491                 set d_gethostent_r_proto gethostent_r $hdrs
13492                 eval $hasproto ;;
13493         *)      ;;
13494         esac
13495         case "$d_gethostent_r_proto" in
13496         define)
13497         case "$gethostent_r_proto" in
13498         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13499         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13500         esac
13501         case "$gethostent_r_proto" in
13502         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13503         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13504         esac
13505         case "$gethostent_r_proto" in
13506         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13507         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13508         esac
13509         case "$gethostent_r_proto" in
13510         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13511         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13512         esac
13513         case "$gethostent_r_proto" in
13514         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13515         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13516         esac
13517         case "$gethostent_r_proto" in
13518         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13519         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13520         esac
13521         case "$gethostent_r_proto" in
13522         ''|0)   d_gethostent_r=undef
13523                 gethostent_r_proto=0
13524                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13525         * )     case "$gethostent_r_proto" in
13526                 REENTRANT_PROTO*) ;;
13527                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13528                 esac
13529                 echo "Prototype: $try" ;;
13530         esac
13531         ;;
13532         *)      case "$usethreads" in
13533                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13534                 esac
13535                 d_gethostent_r=undef
13536                 gethostent_r_proto=0
13537                 ;;
13538         esac
13539         ;;
13540 *)      gethostent_r_proto=0
13541         ;;
13542 esac
13543
13544 : see if prototypes for various gethostxxx netdb.h functions are available
13545 echo " "
13546 set d_gethostprotos gethostent $i_netdb netdb.h
13547 eval $hasproto
13548
13549 : see if getitimer exists
13550 set getitimer d_getitimer
13551 eval $inlibc
13552
13553 : see if getlogin exists
13554 set getlogin d_getlogin
13555 eval $inlibc
13556
13557 : see if getlogin_r exists
13558 set getlogin_r d_getlogin_r
13559 eval $inlibc
13560 case "$d_getlogin_r" in
13561 "$define")
13562         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13563         case "$d_getlogin_r_proto:$usethreads" in
13564         ":define")      d_getlogin_r_proto=define
13565                 set d_getlogin_r_proto getlogin_r $hdrs
13566                 eval $hasproto ;;
13567         *)      ;;
13568         esac
13569         case "$d_getlogin_r_proto" in
13570         define)
13571         case "$getlogin_r_proto" in
13572         ''|0) try='int getlogin_r(char*, size_t);'
13573         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13574         esac
13575         case "$getlogin_r_proto" in
13576         ''|0) try='int getlogin_r(char*, int);'
13577         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13578         esac
13579         case "$getlogin_r_proto" in
13580         ''|0) try='char* getlogin_r(char*, size_t);'
13581         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13582         esac
13583         case "$getlogin_r_proto" in
13584         ''|0) try='char* getlogin_r(char*, int);'
13585         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13586         esac
13587         case "$getlogin_r_proto" in
13588         ''|0)   d_getlogin_r=undef
13589                 getlogin_r_proto=0
13590                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13591         * )     case "$getlogin_r_proto" in
13592                 REENTRANT_PROTO*) ;;
13593                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13594                 esac
13595                 echo "Prototype: $try" ;;
13596         esac
13597         ;;
13598         *)      case "$usethreads" in
13599                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13600                 esac
13601                 d_getlogin_r=undef
13602                 getlogin_r_proto=0
13603                 ;;
13604         esac
13605         ;;
13606 *)      getlogin_r_proto=0
13607         ;;
13608 esac
13609
13610 : see if getmnt exists
13611 set getmnt d_getmnt
13612 eval $inlibc
13613
13614 : see if getmntent exists
13615 set getmntent d_getmntent
13616 eval $inlibc
13617
13618 : see if getnetbyaddr exists
13619 set getnetbyaddr d_getnbyaddr
13620 eval $inlibc
13621
13622 : see if getnetbyname exists
13623 set getnetbyname d_getnbyname
13624 eval $inlibc
13625
13626 : see if getnetent exists
13627 set getnetent d_getnent
13628 eval $inlibc
13629
13630 : see if getnetbyaddr_r exists
13631 set getnetbyaddr_r d_getnetbyaddr_r
13632 eval $inlibc
13633 case "$d_getnetbyaddr_r" in
13634 "$define")
13635         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13636         case "$d_getnetbyaddr_r_proto:$usethreads" in
13637         ":define")      d_getnetbyaddr_r_proto=define
13638                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13639                 eval $hasproto ;;
13640         *)      ;;
13641         esac
13642         case "$d_getnetbyaddr_r_proto" in
13643         define)
13644         case "$getnetbyaddr_r_proto" in
13645         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13646         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13647         esac
13648         case "$getnetbyaddr_r_proto" in
13649         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13650         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13651         esac
13652         case "$getnetbyaddr_r_proto" in
13653         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13654         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13655         esac
13656         case "$getnetbyaddr_r_proto" in
13657         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13658         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13659         esac
13660         case "$getnetbyaddr_r_proto" in
13661         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13662         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13663         esac
13664         case "$getnetbyaddr_r_proto" in
13665         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13666         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13667         esac
13668         case "$getnetbyaddr_r_proto" in
13669         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13670         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13671         esac
13672         case "$getnetbyaddr_r_proto" in
13673         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13674         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13675         esac
13676         case "$getnetbyaddr_r_proto" in
13677         ''|0)   d_getnetbyaddr_r=undef
13678                 getnetbyaddr_r_proto=0
13679                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13680         * )     case "$getnetbyaddr_r_proto" in
13681                 REENTRANT_PROTO*) ;;
13682                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13683                 esac
13684                 echo "Prototype: $try" ;;
13685         esac
13686         ;;
13687         *)      case "$usethreads" in
13688                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13689                 esac
13690                 d_getnetbyaddr_r=undef
13691                 getnetbyaddr_r_proto=0
13692                 ;;
13693         esac
13694         ;;
13695 *)      getnetbyaddr_r_proto=0
13696         ;;
13697 esac
13698
13699 : see if getnetbyname_r exists
13700 set getnetbyname_r d_getnetbyname_r
13701 eval $inlibc
13702 case "$d_getnetbyname_r" in
13703 "$define")
13704         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13705         case "$d_getnetbyname_r_proto:$usethreads" in
13706         ":define")      d_getnetbyname_r_proto=define
13707                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13708                 eval $hasproto ;;
13709         *)      ;;
13710         esac
13711         case "$d_getnetbyname_r_proto" in
13712         define)
13713         case "$getnetbyname_r_proto" in
13714         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13715         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13716         esac
13717         case "$getnetbyname_r_proto" in
13718         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13719         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13720         esac
13721         case "$getnetbyname_r_proto" in
13722         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13723         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13724         esac
13725         case "$getnetbyname_r_proto" in
13726         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13727         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13728         esac
13729         case "$getnetbyname_r_proto" in
13730         ''|0)   d_getnetbyname_r=undef
13731                 getnetbyname_r_proto=0
13732                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13733         * )     case "$getnetbyname_r_proto" in
13734                 REENTRANT_PROTO*) ;;
13735                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13736                 esac
13737                 echo "Prototype: $try" ;;
13738         esac
13739         ;;
13740         *)      case "$usethreads" in
13741                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13742                 esac
13743                 d_getnetbyname_r=undef
13744                 getnetbyname_r_proto=0
13745                 ;;
13746         esac
13747         ;;
13748 *)      getnetbyname_r_proto=0
13749         ;;
13750 esac
13751
13752 : see if getnetent_r exists
13753 set getnetent_r d_getnetent_r
13754 eval $inlibc
13755 case "$d_getnetent_r" in
13756 "$define")
13757         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13758         case "$d_getnetent_r_proto:$usethreads" in
13759         ":define")      d_getnetent_r_proto=define
13760                 set d_getnetent_r_proto getnetent_r $hdrs
13761                 eval $hasproto ;;
13762         *)      ;;
13763         esac
13764         case "$d_getnetent_r_proto" in
13765         define)
13766         case "$getnetent_r_proto" in
13767         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13768         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13769         esac
13770         case "$getnetent_r_proto" in
13771         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13772         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13773         esac
13774         case "$getnetent_r_proto" in
13775         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13776         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13777         esac
13778         case "$getnetent_r_proto" in
13779         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13780         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13781         esac
13782         case "$getnetent_r_proto" in
13783         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13784         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13785         esac
13786         case "$getnetent_r_proto" in
13787         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13788         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13789         esac
13790         case "$getnetent_r_proto" in
13791         ''|0)   d_getnetent_r=undef
13792                 getnetent_r_proto=0
13793                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13794         * )     case "$getnetent_r_proto" in
13795                 REENTRANT_PROTO*) ;;
13796                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13797                 esac
13798                 echo "Prototype: $try" ;;
13799         esac
13800         ;;
13801         *)      case "$usethreads" in
13802                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13803                 esac
13804                 d_getnetent_r=undef
13805                 getnetent_r_proto=0
13806                 ;;
13807         esac
13808         ;;
13809 *)      getnetent_r_proto=0
13810         ;;
13811 esac
13812
13813 : see if prototypes for various getnetxxx netdb.h functions are available
13814 echo " "
13815 set d_getnetprotos getnetent $i_netdb netdb.h
13816 eval $hasproto
13817
13818 : see if getpagesize exists
13819 set getpagesize d_getpagsz
13820 eval $inlibc
13821
13822
13823 : see if getprotobyname exists
13824 set getprotobyname d_getpbyname
13825 eval $inlibc
13826
13827 : see if getprotobynumber exists
13828 set getprotobynumber d_getpbynumber
13829 eval $inlibc
13830
13831 : see if getprotoent exists
13832 set getprotoent d_getpent
13833 eval $inlibc
13834
13835 : see if getpgid exists
13836 set getpgid d_getpgid
13837 eval $inlibc
13838
13839 : see if getpgrp2 exists
13840 set getpgrp2 d_getpgrp2
13841 eval $inlibc
13842
13843 : see if getppid exists
13844 set getppid d_getppid
13845 eval $inlibc
13846
13847 : see if getpriority exists
13848 set getpriority d_getprior
13849 eval $inlibc
13850
13851 : see if getprotobyname_r exists
13852 set getprotobyname_r d_getprotobyname_r
13853 eval $inlibc
13854 case "$d_getprotobyname_r" in
13855 "$define")
13856         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13857         case "$d_getprotobyname_r_proto:$usethreads" in
13858         ":define")      d_getprotobyname_r_proto=define
13859                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13860                 eval $hasproto ;;
13861         *)      ;;
13862         esac
13863         case "$d_getprotobyname_r_proto" in
13864         define)
13865         case "$getprotobyname_r_proto" in
13866         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13867         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13868         esac
13869         case "$getprotobyname_r_proto" in
13870         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13871         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13872         esac
13873         case "$getprotobyname_r_proto" in
13874         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13875         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13876         esac
13877         case "$getprotobyname_r_proto" in
13878         ''|0)   d_getprotobyname_r=undef
13879                 getprotobyname_r_proto=0
13880                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13881         * )     case "$getprotobyname_r_proto" in
13882                 REENTRANT_PROTO*) ;;
13883                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13884                 esac
13885                 echo "Prototype: $try" ;;
13886         esac
13887         ;;
13888         *)      case "$usethreads" in
13889                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13890                 esac
13891                 d_getprotobyname_r=undef
13892                 getprotobyname_r_proto=0
13893                 ;;
13894         esac
13895         ;;
13896 *)      getprotobyname_r_proto=0
13897         ;;
13898 esac
13899
13900 : see if getprotobynumber_r exists
13901 set getprotobynumber_r d_getprotobynumber_r
13902 eval $inlibc
13903 case "$d_getprotobynumber_r" in
13904 "$define")
13905         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13906         case "$d_getprotobynumber_r_proto:$usethreads" in
13907         ":define")      d_getprotobynumber_r_proto=define
13908                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13909                 eval $hasproto ;;
13910         *)      ;;
13911         esac
13912         case "$d_getprotobynumber_r_proto" in
13913         define)
13914         case "$getprotobynumber_r_proto" in
13915         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13916         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13917         esac
13918         case "$getprotobynumber_r_proto" in
13919         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13920         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13921         esac
13922         case "$getprotobynumber_r_proto" in
13923         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13924         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13925         esac
13926         case "$getprotobynumber_r_proto" in
13927         ''|0)   d_getprotobynumber_r=undef
13928                 getprotobynumber_r_proto=0
13929                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13930         * )     case "$getprotobynumber_r_proto" in
13931                 REENTRANT_PROTO*) ;;
13932                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13933                 esac
13934                 echo "Prototype: $try" ;;
13935         esac
13936         ;;
13937         *)      case "$usethreads" in
13938                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13939                 esac
13940                 d_getprotobynumber_r=undef
13941                 getprotobynumber_r_proto=0
13942                 ;;
13943         esac
13944         ;;
13945 *)      getprotobynumber_r_proto=0
13946         ;;
13947 esac
13948
13949 : see if getprotoent_r exists
13950 set getprotoent_r d_getprotoent_r
13951 eval $inlibc
13952 case "$d_getprotoent_r" in
13953 "$define")
13954         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13955         case "$d_getprotoent_r_proto:$usethreads" in
13956         ":define")      d_getprotoent_r_proto=define
13957                 set d_getprotoent_r_proto getprotoent_r $hdrs
13958                 eval $hasproto ;;
13959         *)      ;;
13960         esac
13961         case "$d_getprotoent_r_proto" in
13962         define)
13963         case "$getprotoent_r_proto" in
13964         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13965         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13966         esac
13967         case "$getprotoent_r_proto" in
13968         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13969         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13970         esac
13971         case "$getprotoent_r_proto" in
13972         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13973         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13974         esac
13975         case "$getprotoent_r_proto" in
13976         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13977         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13978         esac
13979         case "$getprotoent_r_proto" in
13980         ''|0)   d_getprotoent_r=undef
13981                 getprotoent_r_proto=0
13982                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13983         * )     case "$getprotoent_r_proto" in
13984                 REENTRANT_PROTO*) ;;
13985                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13986                 esac
13987                 echo "Prototype: $try" ;;
13988         esac
13989         ;;
13990         *)      case "$usethreads" in
13991                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13992                 esac
13993                 d_getprotoent_r=undef
13994                 getprotoent_r_proto=0
13995                 ;;
13996         esac
13997         ;;
13998 *)      getprotoent_r_proto=0
13999         ;;
14000 esac
14001
14002 : see if prototypes for various getprotoxxx netdb.h functions are available
14003 echo " "
14004 set d_getprotoprotos getprotoent $i_netdb netdb.h
14005 eval $hasproto
14006
14007 : see if getprpwnam exists
14008 set getprpwnam d_getprpwnam
14009 eval $inlibc
14010
14011 : see if getpwent exists
14012 set getpwent d_getpwent
14013 eval $inlibc
14014
14015 : see if getpwent_r exists
14016 set getpwent_r d_getpwent_r
14017 eval $inlibc
14018 case "$d_getpwent_r" in
14019 "$define")
14020         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14021         case "$d_getpwent_r_proto:$usethreads" in
14022         ":define")      d_getpwent_r_proto=define
14023                 set d_getpwent_r_proto getpwent_r $hdrs
14024                 eval $hasproto ;;
14025         *)      ;;
14026         esac
14027         case "$d_getpwent_r_proto" in
14028         define)
14029         case "$getpwent_r_proto" in
14030         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14031         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14032         esac
14033         case "$getpwent_r_proto" in
14034         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14035         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14036         esac
14037         case "$getpwent_r_proto" in
14038         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14039         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14040         esac
14041         case "$getpwent_r_proto" in
14042         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14043         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14044         esac
14045         case "$getpwent_r_proto" in
14046         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14047         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14048         esac
14049         case "$getpwent_r_proto" in
14050         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14051         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14052         esac
14053         case "$getpwent_r_proto" in
14054         ''|0)   d_getpwent_r=undef
14055                 getpwent_r_proto=0
14056                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14057         * )     case "$getpwent_r_proto" in
14058                 REENTRANT_PROTO*) ;;
14059                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14060                 esac
14061                 echo "Prototype: $try" ;;
14062         esac
14063         ;;
14064         *)      case "$usethreads" in
14065                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14066                 esac
14067                 d_getpwent_r=undef
14068                 getpwent_r_proto=0
14069                 ;;
14070         esac
14071         ;;
14072 *)      getpwent_r_proto=0
14073         ;;
14074 esac
14075
14076 : see if getpwnam_r exists
14077 set getpwnam_r d_getpwnam_r
14078 eval $inlibc
14079 case "$d_getpwnam_r" in
14080 "$define")
14081         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14082         case "$d_getpwnam_r_proto:$usethreads" in
14083         ":define")      d_getpwnam_r_proto=define
14084                 set d_getpwnam_r_proto getpwnam_r $hdrs
14085                 eval $hasproto ;;
14086         *)      ;;
14087         esac
14088         case "$d_getpwnam_r_proto" in
14089         define)
14090         case "$getpwnam_r_proto" in
14091         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14092         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14093         esac
14094         case "$getpwnam_r_proto" in
14095         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14096         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14097         esac
14098         case "$getpwnam_r_proto" in
14099         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14100         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14101         esac
14102         case "$getpwnam_r_proto" in
14103         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14104         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14105         esac
14106         case "$getpwnam_r_proto" in
14107         ''|0)   d_getpwnam_r=undef
14108                 getpwnam_r_proto=0
14109                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14110         * )     case "$getpwnam_r_proto" in
14111                 REENTRANT_PROTO*) ;;
14112                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14113                 esac
14114                 echo "Prototype: $try" ;;
14115         esac
14116         ;;
14117         *)      case "$usethreads" in
14118                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14119                 esac
14120                 d_getpwnam_r=undef
14121                 getpwnam_r_proto=0
14122                 ;;
14123         esac
14124         ;;
14125 *)      getpwnam_r_proto=0
14126         ;;
14127 esac
14128
14129 : see if getpwuid_r exists
14130 set getpwuid_r d_getpwuid_r
14131 eval $inlibc
14132 case "$d_getpwuid_r" in
14133 "$define")
14134         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14135         case "$d_getpwuid_r_proto:$usethreads" in
14136         ":define")      d_getpwuid_r_proto=define
14137                 set d_getpwuid_r_proto getpwuid_r $hdrs
14138                 eval $hasproto ;;
14139         *)      ;;
14140         esac
14141         case "$d_getpwuid_r_proto" in
14142         define)
14143         case "$getpwuid_r_proto" in
14144         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14145         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14146         esac
14147         case "$getpwuid_r_proto" in
14148         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14149         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14150         esac
14151         case "$getpwuid_r_proto" in
14152         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14153         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14154         esac
14155         case "$getpwuid_r_proto" in
14156         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14157         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14158         esac
14159         case "$getpwuid_r_proto" in
14160         ''|0)   d_getpwuid_r=undef
14161                 getpwuid_r_proto=0
14162                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14163         * )     case "$getpwuid_r_proto" in
14164                 REENTRANT_PROTO*) ;;
14165                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14166                 esac
14167                 echo "Prototype: $try" ;;
14168         esac
14169         ;;
14170         *)      case "$usethreads" in
14171                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14172                 esac
14173                 d_getpwuid_r=undef
14174                 getpwuid_r_proto=0
14175                 ;;
14176         esac
14177         ;;
14178 *)      getpwuid_r_proto=0
14179         ;;
14180 esac
14181
14182
14183 : see if getservbyname exists
14184 set getservbyname d_getsbyname
14185 eval $inlibc
14186
14187 : see if getservbyport exists
14188 set getservbyport d_getsbyport
14189 eval $inlibc
14190
14191 : see if getservent exists
14192 set getservent d_getsent
14193 eval $inlibc
14194
14195 : see if getservbyname_r exists
14196 set getservbyname_r d_getservbyname_r
14197 eval $inlibc
14198 case "$d_getservbyname_r" in
14199 "$define")
14200         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14201         case "$d_getservbyname_r_proto:$usethreads" in
14202         ":define")      d_getservbyname_r_proto=define
14203                 set d_getservbyname_r_proto getservbyname_r $hdrs
14204                 eval $hasproto ;;
14205         *)      ;;
14206         esac
14207         case "$d_getservbyname_r_proto" in
14208         define)
14209         case "$getservbyname_r_proto" in
14210         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14211         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14212         esac
14213         case "$getservbyname_r_proto" in
14214         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14215         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14216         esac
14217         case "$getservbyname_r_proto" in
14218         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14219         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14220         esac
14221         case "$getservbyname_r_proto" in
14222         ''|0)   d_getservbyname_r=undef
14223                 getservbyname_r_proto=0
14224                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14225         * )     case "$getservbyname_r_proto" in
14226                 REENTRANT_PROTO*) ;;
14227                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14228                 esac
14229                 echo "Prototype: $try" ;;
14230         esac
14231         ;;
14232         *)      case "$usethreads" in
14233                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14234                 esac
14235                 d_getservbyname_r=undef
14236                 getservbyname_r_proto=0
14237                 ;;
14238         esac
14239         ;;
14240 *)      getservbyname_r_proto=0
14241         ;;
14242 esac
14243
14244 : see if getservbyport_r exists
14245 set getservbyport_r d_getservbyport_r
14246 eval $inlibc
14247 case "$d_getservbyport_r" in
14248 "$define")
14249         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14250         case "$d_getservbyport_r_proto:$usethreads" in
14251         ":define")      d_getservbyport_r_proto=define
14252                 set d_getservbyport_r_proto getservbyport_r $hdrs
14253                 eval $hasproto ;;
14254         *)      ;;
14255         esac
14256         case "$d_getservbyport_r_proto" in
14257         define)
14258         case "$getservbyport_r_proto" in
14259         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14260         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14261         esac
14262         case "$getservbyport_r_proto" in
14263         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14264         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14265         esac
14266         case "$getservbyport_r_proto" in
14267         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14268         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14269         esac
14270         case "$getservbyport_r_proto" in
14271         ''|0)   d_getservbyport_r=undef
14272                 getservbyport_r_proto=0
14273                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14274         * )     case "$getservbyport_r_proto" in
14275                 REENTRANT_PROTO*) ;;
14276                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14277                 esac
14278                 echo "Prototype: $try" ;;
14279         esac
14280         ;;
14281         *)      case "$usethreads" in
14282                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14283                 esac
14284                 d_getservbyport_r=undef
14285                 getservbyport_r_proto=0
14286                 ;;
14287         esac
14288         ;;
14289 *)      getservbyport_r_proto=0
14290         ;;
14291 esac
14292
14293 : see if getservent_r exists
14294 set getservent_r d_getservent_r
14295 eval $inlibc
14296 case "$d_getservent_r" in
14297 "$define")
14298         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14299         case "$d_getservent_r_proto:$usethreads" in
14300         ":define")      d_getservent_r_proto=define
14301                 set d_getservent_r_proto getservent_r $hdrs
14302                 eval $hasproto ;;
14303         *)      ;;
14304         esac
14305         case "$d_getservent_r_proto" in
14306         define)
14307         case "$getservent_r_proto" in
14308         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14309         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14310         esac
14311         case "$getservent_r_proto" in
14312         ''|0) try='int getservent_r(struct servent*, char*, int);'
14313         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14314         esac
14315         case "$getservent_r_proto" in
14316         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14317         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14318         esac
14319         case "$getservent_r_proto" in
14320         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14321         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14322         esac
14323         case "$getservent_r_proto" in
14324         ''|0)   d_getservent_r=undef
14325                 getservent_r_proto=0
14326                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14327         * )     case "$getservent_r_proto" in
14328                 REENTRANT_PROTO*) ;;
14329                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14330                 esac
14331                 echo "Prototype: $try" ;;
14332         esac
14333         ;;
14334         *)      case "$usethreads" in
14335                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14336                 esac
14337                 d_getservent_r=undef
14338                 getservent_r_proto=0
14339                 ;;
14340         esac
14341         ;;
14342 *)      getservent_r_proto=0
14343         ;;
14344 esac
14345
14346 : see if prototypes for various getservxxx netdb.h functions are available
14347 echo " "
14348 set d_getservprotos getservent $i_netdb netdb.h
14349 eval $hasproto
14350
14351 : see if getspnam exists
14352 set getspnam d_getspnam
14353 eval $inlibc
14354
14355 : see if this is a shadow.h system
14356 set shadow.h i_shadow
14357 eval $inhdr
14358
14359 : see if getspnam_r exists
14360 set getspnam_r d_getspnam_r
14361 eval $inlibc
14362 case "$d_getspnam_r" in
14363 "$define")
14364         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14365         case "$d_getspnam_r_proto:$usethreads" in
14366         ":define")      d_getspnam_r_proto=define
14367                 set d_getspnam_r_proto getspnam_r $hdrs
14368                 eval $hasproto ;;
14369         *)      ;;
14370         esac
14371         case "$d_getspnam_r_proto" in
14372         define)
14373         case "$getspnam_r_proto" in
14374         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14375         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14376         esac
14377         case "$getspnam_r_proto" in
14378         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14379         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14380         esac
14381         case "$getspnam_r_proto" in
14382         ''|0)   d_getspnam_r=undef
14383                 getspnam_r_proto=0
14384                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14385         * )     case "$getspnam_r_proto" in
14386                 REENTRANT_PROTO*) ;;
14387                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14388                 esac
14389                 echo "Prototype: $try" ;;
14390         esac
14391         ;;
14392         *)      case "$usethreads" in
14393                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14394                 esac
14395                 d_getspnam_r=undef
14396                 getspnam_r_proto=0
14397                 ;;
14398         esac
14399         ;;
14400 *)      getspnam_r_proto=0
14401         ;;
14402 esac
14403
14404 : see if gettimeofday or ftime exists
14405 set gettimeofday d_gettimeod
14406 eval $inlibc
14407 case "$d_gettimeod" in
14408 "$undef")
14409         set ftime d_ftime 
14410         eval $inlibc
14411         ;;
14412 *)
14413         val="$undef"; set d_ftime; eval $setvar
14414         ;;
14415 esac
14416 case "$d_gettimeod$d_ftime" in
14417 "$undef$undef")
14418         echo " "
14419         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14420         ;;
14421 esac
14422
14423 : see if gmtime_r exists
14424 set gmtime_r d_gmtime_r
14425 eval $inlibc
14426 case "$d_gmtime_r" in
14427 "$define")
14428         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14429         case "$d_gmtime_r_proto:$usethreads" in
14430         ":define")      d_gmtime_r_proto=define
14431                 set d_gmtime_r_proto gmtime_r $hdrs
14432                 eval $hasproto ;;
14433         *)      ;;
14434         esac
14435         case "$d_gmtime_r_proto" in
14436         define)
14437         case "$gmtime_r_proto" in
14438         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14439         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14440         esac
14441         case "$gmtime_r_proto" in
14442         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14443         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14444         esac
14445         case "$gmtime_r_proto" in
14446         ''|0)   d_gmtime_r=undef
14447                 gmtime_r_proto=0
14448                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14449         * )     case "$gmtime_r_proto" in
14450                 REENTRANT_PROTO*) ;;
14451                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14452                 esac
14453                 echo "Prototype: $try" ;;
14454         esac
14455         ;;
14456         *)      case "$usethreads" in
14457                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14458                 esac
14459                 d_gmtime_r=undef
14460                 gmtime_r_proto=0
14461                 ;;
14462         esac
14463         ;;
14464 *)      gmtime_r_proto=0
14465         ;;
14466 esac
14467
14468 : see if hasmntopt exists
14469 set hasmntopt d_hasmntopt
14470 eval $inlibc
14471
14472 : see if this is a netinet/in.h or sys/in.h system
14473 set netinet/in.h i_niin sys/in.h i_sysin
14474 eval $inhdr
14475
14476 : see if arpa/inet.h has to be included
14477 set arpa/inet.h i_arpainet
14478 eval $inhdr
14479
14480 : see if htonl --and friends-- exists
14481 val=''
14482 set htonl val
14483 eval $inlibc
14484
14485 : Maybe they are macros.
14486 case "$val" in
14487 $undef)
14488         $cat >htonl.c <<EOM
14489 #include <stdio.h>
14490 #include <sys/types.h>
14491 #$i_niin I_NETINET_IN
14492 #$i_sysin I_SYS_IN
14493 #$i_arpainet I_ARPA_INET
14494 #ifdef I_NETINET_IN
14495 #include <netinet/in.h>
14496 #endif
14497 #ifdef I_SYS_IN
14498 #include <sys/in.h>
14499 #endif
14500 #ifdef I_ARPA_INET
14501 #include <arpa/inet.h>
14502 #endif
14503 #ifdef htonl
14504 printf("Defined as a macro.");
14505 #endif
14506 EOM
14507         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14508         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14509                 val="$define"
14510                 echo "But it seems to be defined as a macro." >&4
14511         fi
14512         $rm -f htonl.?
14513         ;;
14514 esac
14515 set d_htonl
14516 eval $setvar
14517
14518 : see if ilogbl exists
14519 set ilogbl d_ilogbl
14520 eval $inlibc
14521
14522 : index or strchr
14523 echo " "
14524 if set index val -f; eval $csym; $val; then
14525         if set strchr val -f d_strchr; eval $csym; $val; then
14526                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14527                         val="$define"
14528                         vali="$undef"
14529                         echo "strchr() found." >&4
14530                 else
14531                         val="$undef"
14532                         vali="$define"
14533                         echo "index() found." >&4
14534                 fi
14535         else
14536                 val="$undef"
14537                 vali="$define"
14538                 echo "index() found." >&4
14539         fi
14540 else
14541         if set strchr val -f d_strchr; eval $csym; $val; then
14542                 val="$define"
14543                 vali="$undef"
14544                 echo "strchr() found." >&4
14545         else
14546                 echo "No index() or strchr() found!" >&4
14547                 val="$undef"
14548                 vali="$undef"
14549         fi
14550 fi
14551 set d_strchr; eval $setvar
14552 val="$vali"
14553 set d_index; eval $setvar
14554
14555 : check whether inet_aton exists
14556 set inet_aton d_inetaton
14557 eval $inlibc
14558
14559 : Look for isascii
14560 echo " "
14561 $cat >isascii.c <<EOCP
14562 #include <stdio.h>
14563 #include <ctype.h>
14564 #$i_stdlib I_STDLIB
14565 #ifdef I_STDLIB
14566 #include <stdlib.h>
14567 #endif
14568 int main() {
14569         int c = 'A';
14570         if (isascii(c))
14571                 exit(0);
14572         else
14573                 exit(1);
14574 }
14575 EOCP
14576 set isascii
14577 if eval $compile; then
14578         echo "isascii() found." >&4
14579         val="$define"
14580 else
14581         echo "isascii() NOT found." >&4
14582         val="$undef"
14583 fi
14584 set d_isascii
14585 eval $setvar
14586 $rm -f isascii*
14587
14588 : see if isfinite exists
14589 set isfinite d_isfinite
14590 eval $inlibc
14591
14592 : see if isinf exists
14593 set isinf d_isinf
14594 eval $inlibc
14595
14596 : see if isnan exists
14597 set isnan d_isnan
14598 eval $inlibc
14599
14600 : see if isnanl exists
14601 set isnanl d_isnanl
14602 eval $inlibc
14603
14604 : see if killpg exists
14605 set killpg d_killpg
14606 eval $inlibc
14607
14608 : see if lchown exists
14609 echo " "
14610 $cat > try.c <<'EOCP'
14611 /* System header to define __stub macros and hopefully few prototypes,
14612     which can conflict with char lchown(); below.  */
14613 #include <assert.h>
14614 /* Override any gcc2 internal prototype to avoid an error.  */
14615 /* We use char because int might match the return type of a gcc2
14616    builtin and then its argument prototype would still apply.  */
14617 char lchown();
14618 int main() {
14619     /*  The GNU C library defines this for functions which it implements
14620         to always fail with ENOSYS.  Some functions are actually named
14621         something starting with __ and the normal name is an alias.  */
14622 #if defined (__stub_lchown) || defined (__stub___lchown)
14623 choke me
14624 #else
14625 lchown();
14626 #endif
14627 ; return 0; }
14628 EOCP
14629 set try
14630 if eval $compile; then
14631     $echo "lchown() found." >&4
14632     val="$define"
14633 else
14634     $echo "lchown() NOT found." >&4
14635     val="$undef"
14636 fi
14637 set d_lchown
14638 eval $setvar
14639
14640 : See if number of significant digits in a double precision number is known
14641 echo " "
14642 $cat >ldbl_dig.c <<EOM
14643 #$i_limits I_LIMITS
14644 #$i_float I_FLOAT
14645 #ifdef I_LIMITS
14646 #include <limits.h>
14647 #endif
14648 #ifdef I_FLOAT
14649 #include <float.h>
14650 #endif
14651 #ifdef LDBL_DIG
14652 printf("Contains LDBL_DIG");
14653 #endif
14654 EOM
14655 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14656 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14657         echo "LDBL_DIG found." >&4
14658         val="$define"
14659 else
14660         echo "LDBL_DIG NOT found." >&4
14661         val="$undef"
14662 fi
14663 $rm -f ldbl_dig.?
14664 set d_ldbl_dig
14665 eval $setvar
14666
14667 : see if this is a math.h system
14668 set math.h i_math
14669 eval $inhdr
14670
14671 d_libm_lib_version="$undef"
14672 case $i_math in
14673     $define)
14674         : check to see if math.h defines _LIB_VERSION
14675         echo " "
14676         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14677         $cat >try.c <<EOCP
14678 #include <unistd.h>
14679 #include <math.h>
14680 int main (int argc, char *argv[])
14681 {
14682     printf ("%d\n", _LIB_VERSION);
14683     return (0);
14684     } /* main */
14685 EOCP
14686         set try
14687         if eval $compile; then
14688             foo=`$run ./try`
14689             echo "Yes, it does ($foo)" >&4
14690             d_libm_lib_version="$define"
14691         else
14692             echo "No, it does not (probably harmless)" >&4
14693             fi
14694         $rm_try
14695         ;;
14696
14697     esac
14698
14699 : see if link exists
14700 set link d_link
14701 eval $inlibc
14702
14703 : see if localtime_r exists
14704 set localtime_r d_localtime_r
14705 eval $inlibc
14706 case "$d_localtime_r" in
14707 "$define")
14708         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14709         case "$d_localtime_r_proto:$usethreads" in
14710         ":define")      d_localtime_r_proto=define
14711                 set d_localtime_r_proto localtime_r $hdrs
14712                 eval $hasproto ;;
14713         *)      ;;
14714         esac
14715         case "$d_localtime_r_proto" in
14716         define)
14717         case "$localtime_r_proto" in
14718         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14719         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14720         esac
14721         case "$localtime_r_proto" in
14722         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14723         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14724         esac
14725         case "$localtime_r_proto" in
14726         ''|0)   d_localtime_r=undef
14727                 localtime_r_proto=0
14728                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14729         * )     case "$localtime_r_proto" in
14730                 REENTRANT_PROTO*) ;;
14731                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14732                 esac
14733                 echo "Prototype: $try" ;;
14734         esac
14735         ;;
14736         *)      case "$usethreads" in
14737                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14738                 esac
14739                 d_localtime_r=undef
14740                 localtime_r_proto=0
14741                 ;;
14742         esac
14743         ;;
14744 *)      localtime_r_proto=0
14745         ;;
14746 esac
14747
14748 : see if localtime_r calls tzset
14749 case "$localtime_r_proto" in
14750 REENTRANT_PROTO*)
14751         $cat >try.c <<EOCP
14752 /*  Does our libc's localtime_r call tzset ?
14753  *  return 0 if so, 1 otherwise.
14754  */
14755 #include <sys/types.h>
14756 #include <unistd.h>
14757 #include <time.h>
14758 #include <string.h>
14759 #include <malloc.h>
14760 int main()
14761 {
14762     time_t t = time(0L);
14763     char w_tz[]="TZ" "=GMT+5",
14764          e_tz[]="TZ" "=GMT-5",
14765         *tz_e = (char*)malloc(16),
14766         *tz_w = (char*)malloc(16);
14767     struct tm tm_e, tm_w;
14768     memset(&tm_e,'\0',sizeof(struct tm));
14769     memset(&tm_w,'\0',sizeof(struct tm));
14770     strcpy(tz_e,e_tz);
14771     strcpy(tz_w,w_tz);
14772
14773     putenv(tz_e);
14774     localtime_r(&t, &tm_e);
14775
14776     putenv(tz_w);
14777     localtime_r(&t, &tm_w);
14778
14779     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14780         return 1;
14781     return 0;
14782 }
14783 EOCP
14784         set try
14785         if eval $compile; then
14786             if $run ./try; then
14787                 d_localtime_r_needs_tzset=undef;
14788             else
14789                 d_localtime_r_needs_tzset=define;
14790             fi;
14791         else
14792             d_localtime_r_needs_tzset=undef;
14793         fi;
14794      ;;
14795   *)
14796      d_localtime_r_needs_tzset=undef;
14797      ;;
14798 esac
14799 $rm_try
14800
14801 : see if localeconv exists
14802 set localeconv d_locconv
14803 eval $inlibc
14804
14805 : see if lockf exists
14806 set lockf d_lockf
14807 eval $inlibc
14808
14809 : see if prototype for lseek is available
14810 echo " "
14811 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14812 eval $hasproto
14813
14814 : see if lstat exists
14815 set lstat d_lstat
14816 eval $inlibc
14817
14818 : see if madvise exists
14819 set madvise d_madvise
14820 eval $inlibc
14821
14822 : see if malloc_size exists
14823 set malloc_size d_malloc_size
14824 eval $inlibc
14825
14826 : see if malloc_size_good exists
14827 set malloc_good_size d_malloc_good_size
14828 eval $inlibc
14829
14830 : see if mblen exists
14831 set mblen d_mblen
14832 eval $inlibc
14833
14834 : see if mbstowcs exists
14835 set mbstowcs d_mbstowcs
14836 eval $inlibc
14837
14838 : see if mbtowc exists
14839 set mbtowc d_mbtowc
14840 eval $inlibc
14841
14842 : see if memchr exists
14843 set memchr d_memchr
14844 eval $inlibc
14845
14846 : see if memcmp exists
14847 set memcmp d_memcmp
14848 eval $inlibc
14849
14850 : see if memcpy exists
14851 set memcpy d_memcpy
14852 eval $inlibc
14853
14854 : see if memmove exists
14855 set memmove d_memmove
14856 eval $inlibc
14857
14858 : see if memset exists
14859 set memset d_memset
14860 eval $inlibc
14861
14862 : see if mkdir exists
14863 set mkdir d_mkdir
14864 eval $inlibc
14865
14866 : see if mkdtemp exists
14867 set mkdtemp d_mkdtemp
14868 eval $inlibc
14869
14870 : see if mkfifo exists
14871 set mkfifo d_mkfifo
14872 eval $inlibc
14873
14874 : see if mkstemp exists
14875 set mkstemp d_mkstemp
14876 eval $inlibc
14877
14878 : see if mkstemps exists
14879 set mkstemps d_mkstemps
14880 eval $inlibc
14881
14882 : see if mktime exists
14883 set mktime d_mktime
14884 eval $inlibc
14885
14886 : see if this is a sys/mman.h system
14887 set sys/mman.h i_sysmman
14888 eval $inhdr
14889
14890 : see if mmap exists
14891 set mmap d_mmap
14892 eval $inlibc
14893 : see what shmat returns
14894 : default to something harmless
14895 mmaptype='void *'
14896 case "$i_sysmman$d_mmap" in
14897 "$define$define")
14898         $cat >mmap.c <<'END'
14899 #include <sys/mman.h>
14900 void *mmap();
14901 END
14902         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14903                 mmaptype='void *'
14904         else
14905                 mmaptype='caddr_t'
14906         fi
14907         echo "and it returns ($mmaptype)." >&4
14908         ;;
14909 esac
14910
14911
14912
14913 : see if sqrtl exists
14914 set sqrtl d_sqrtl
14915 eval $inlibc
14916
14917 : see if scalbnl exists
14918 set scalbnl d_scalbnl
14919 eval $inlibc
14920
14921 : see if modfl exists
14922 set modfl d_modfl
14923 eval $inlibc
14924
14925 : see if prototype for modfl is available
14926 echo " "
14927 set d_modflproto modfl $i_math math.h
14928 eval $hasproto
14929
14930 d_modfl_pow32_bug="$undef"
14931
14932 case "$d_longdbl$d_modfl" in
14933 $define$define)
14934         $cat <<EOM
14935 Checking to see whether your modfl() is okay for large values...
14936 EOM
14937 $cat >try.c <<EOCP
14938 #include <math.h>
14939 #include <stdio.h>
14940 EOCP
14941 if $test "X$d_modflproto" != "X$define"; then
14942         $cat >>try.c <<EOCP
14943 /* Sigh. many current glibcs provide the function, but do not prototype it. */
14944 long double modfl (long double, long double *);
14945 EOCP
14946 fi
14947 $cat >>try.c <<EOCP
14948 int main() {
14949     long double nv = 4294967303.15;
14950     long double v, w;
14951     v = modfl(nv, &w);
14952 #ifdef __GLIBC__
14953     printf("glibc");
14954 #endif
14955     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14956     return 0;
14957 }
14958 EOCP
14959         case "$osname:$gccversion" in
14960         aix:)   saveccflags="$ccflags"
14961                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14962         esac
14963         set try
14964         if eval $compile; then
14965                 foo=`$run ./try`
14966                 case "$foo" in
14967                 *" 4294967303.150000 1.150000 4294967302.000000")
14968                         echo >&4 "Your modfl() is broken for large values."
14969                         d_modfl_pow32_bug="$define"
14970                         case "$foo" in
14971                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14972                         ;;
14973                         esac
14974                         ;;
14975                 *" 4294967303.150000 0.150000 4294967303.000000")
14976                         echo >&4 "Your modfl() seems okay for large values."
14977                         ;;
14978                 *)      echo >&4 "I don't understand your modfl() at all."
14979                         d_modfl="$undef"
14980                         ;;
14981                 esac
14982                 $rm_try
14983         else
14984                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14985                 d_modfl="$undef"
14986         fi
14987         case "$osname:$gccversion" in
14988         aix:)   ccflags="$saveccflags" ;; # restore
14989         esac
14990         ;;
14991 esac
14992
14993 if $test "$uselongdouble" = "$define"; then
14994     message=""
14995     if $test "$d_sqrtl" != "$define"; then
14996         message="$message sqrtl"
14997     fi
14998     if $test "$d_modfl" != "$define"; then
14999         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15000             echo "You have both aintl and copysignl, so I can emulate modfl."
15001         else
15002             message="$message modfl"
15003         fi
15004     fi
15005     if $test "$d_frexpl" != "$define"; then
15006         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15007             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15008         else
15009             message="$message frexpl"
15010         fi
15011     fi
15012
15013     if $test "$message" != ""; then
15014         $cat <<EOM >&4
15015
15016 *** You requested the use of long doubles but you do not seem to have
15017 *** the following mathematical functions needed for long double support:
15018 ***    $message
15019 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15020 *** Cannot continue, aborting.
15021
15022 EOM
15023
15024         exit 1
15025     fi
15026 fi
15027
15028 : see if mprotect exists
15029 set mprotect d_mprotect
15030 eval $inlibc
15031
15032 : see if msgctl exists
15033 set msgctl d_msgctl
15034 eval $inlibc
15035
15036 : see if msgget exists
15037 set msgget d_msgget
15038 eval $inlibc
15039
15040 : see if msgsnd exists
15041 set msgsnd d_msgsnd
15042 eval $inlibc
15043
15044 : see if msgrcv exists
15045 set msgrcv d_msgrcv
15046 eval $inlibc
15047
15048 : see how much of the 'msg*(2)' library is present.
15049 h_msg=true
15050 echo " "
15051 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15052 *"$undef"*) h_msg=false;;
15053 esac
15054 case "$osname" in
15055 freebsd)
15056     case "`ipcs 2>&1`" in
15057     "SVID messages"*"not configured"*)
15058         echo "Your $osname does not have the msg*(2) configured." >&4
15059         h_msg=false
15060         val="$undef"
15061         set msgctl d_msgctl
15062         eval $setvar
15063         set msgget d_msgget
15064         eval $setvar
15065         set msgsnd d_msgsnd
15066         eval $setvar
15067         set msgrcv d_msgrcv
15068         eval $setvar
15069         ;;
15070     esac
15071     ;;
15072 esac
15073 : we could also check for sys/ipc.h ...
15074 if $h_msg && $test `./findhdr sys/msg.h`; then
15075         echo "You have the full msg*(2) library." >&4
15076         val="$define"
15077 else
15078         echo "You don't have the full msg*(2) library." >&4
15079         val="$undef"
15080 fi
15081 set d_msg
15082 eval $setvar
15083
15084
15085 echo " "
15086 echo "Checking to see if your system supports struct msghdr..." >&4
15087 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15088 eval $hasstruct
15089 case "$d_msghdr_s" in
15090 "$define")      echo "Yes, it does."   ;;
15091 *)              echo "No, it doesn't." ;;
15092 esac
15093
15094
15095 : see if msync exists
15096 set msync d_msync
15097 eval $inlibc
15098
15099 : see if munmap exists
15100 set munmap d_munmap
15101 eval $inlibc
15102
15103 : see if nice exists
15104 set nice d_nice
15105 eval $inlibc
15106
15107 : see if this is a langinfo.h system
15108 set langinfo.h i_langinfo
15109 eval $inhdr
15110
15111 : see if nl_langinfo exists
15112 set nl_langinfo d_nl_langinfo
15113 eval $inlibc
15114
15115 : check for volatile keyword
15116 echo " "
15117 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15118 $cat >try.c <<'EOCP'
15119 int main()
15120 {
15121         typedef struct _goo_struct goo_struct;
15122         goo_struct * volatile goo = ((goo_struct *)0);
15123         struct _goo_struct {
15124                 long long_int;
15125                 int reg_int;
15126                 char char_var;
15127         };
15128         typedef unsigned short foo_t;
15129         char *volatile foo;
15130         volatile int bar;
15131         volatile foo_t blech;
15132         foo = foo;
15133 }
15134 EOCP
15135 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15136         val="$define"
15137         echo "Yup, it does."
15138 else
15139         val="$undef"
15140         echo "Nope, it doesn't."
15141 fi
15142 set d_volatile
15143 eval $setvar
15144 $rm_try
15145
15146
15147 echo " "
15148 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15149
15150 case "$use64bitint:$d_quad:$quadtype" in
15151 define:define:?*)
15152         ivtype="$quadtype"
15153         uvtype="$uquadtype"
15154         ivsize=8
15155         uvsize=8
15156         ;;
15157 *)      ivtype="long"
15158         uvtype="unsigned long"
15159         ivsize=$longsize
15160         uvsize=$longsize
15161         ;;
15162 esac
15163
15164 case "$uselongdouble:$d_longdbl" in
15165 define:define)
15166         nvtype="long double"
15167         nvsize=$longdblsize
15168         ;;
15169 *)      nvtype=double
15170         nvsize=$doublesize
15171         ;;
15172 esac
15173
15174 $echo "(IV will be "$ivtype", $ivsize bytes)"
15175 $echo "(UV will be "$uvtype", $uvsize bytes)"
15176 $echo "(NV will be "$nvtype", $nvsize bytes)"
15177
15178 $cat >try.c <<EOCP
15179 #$i_inttypes I_INTTYPES
15180 #ifdef I_INTTYPES
15181 #include <inttypes.h>
15182 #endif
15183 #include <stdio.h>
15184 int main() {
15185 #ifdef INT8
15186    int8_t i =  INT8_MAX;
15187   uint8_t u = UINT8_MAX;
15188   printf("int8_t\n");
15189 #endif
15190 #ifdef INT16
15191    int16_t i =  INT16_MAX;
15192   uint16_t i = UINT16_MAX;
15193   printf("int16_t\n");
15194 #endif
15195 #ifdef INT32
15196    int32_t i =  INT32_MAX;
15197   uint32_t u = UINT32_MAX;
15198   printf("int32_t\n");
15199 #endif
15200 }
15201 EOCP
15202
15203 i8type="signed char"
15204 u8type="unsigned char"
15205 i8size=1
15206 u8size=1
15207
15208 case "$i16type" in
15209 '')     case "$shortsize" in
15210         2)      i16type=short
15211                 u16type="unsigned short"
15212                 i16size=$shortsize
15213                 u16size=$shortsize
15214                 ;;
15215         esac
15216         ;;
15217 esac
15218 case "$i16type" in
15219 '')     set try -DINT16
15220         if eval $compile; then
15221                 case "`$run ./try`" in
15222                 int16_t)
15223                         i16type=int16_t
15224                         u16type=uint16_t
15225                         i16size=2
15226                         u16size=2
15227                         ;;
15228                 esac
15229         fi
15230         ;;
15231 esac
15232 case "$i16type" in
15233 '')     if $test $shortsize -ge 2; then
15234                 i16type=short
15235                 u16type="unsigned short"
15236                 i16size=$shortsize
15237                 u16size=$shortsize
15238         fi
15239         ;;
15240 esac
15241
15242 case "$i32type" in
15243 '')     case "$longsize" in
15244         4)      i32type=long
15245                 u32type="unsigned long"
15246                 i32size=$longsize
15247                 u32size=$longsize
15248                 ;;
15249         *)      case "$intsize" in
15250                 4)      i32type=int
15251                         u32type="unsigned int"
15252                         i32size=$intsize
15253                         u32size=$intsize
15254                         ;;
15255                 esac
15256                 ;;
15257         esac
15258         ;;
15259 esac
15260 case "$i32type" in
15261 '')     set try -DINT32
15262         if eval $compile; then
15263                 case "`$run ./try`" in
15264                 int32_t)
15265                         i32type=int32_t
15266                         u32type=uint32_t
15267                         i32size=4
15268                         u32size=4
15269                         ;;
15270                 esac
15271         fi
15272         ;;
15273 esac
15274 case "$i32type" in
15275 '')     if $test $intsize -ge 4; then
15276                 i32type=int
15277                 u32type="unsigned int"
15278                 i32size=$intsize
15279                 u32size=$intsize
15280         fi
15281         ;;
15282 esac
15283
15284 case "$i64type" in
15285 '')     case "$d_quad:$quadtype" in
15286         define:?*)
15287                 i64type="$quadtype"
15288                 u64type="$uquadtype"
15289                 i64size=8
15290                 u64size=8
15291                 ;;
15292         esac
15293         ;;
15294 esac
15295
15296 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15297 : volatile so that the compiler has to store it out to memory.
15298 if test X"$d_volatile" = X"$define"; then
15299         volatile=volatile
15300 fi
15301 $cat <<EOP >try.c
15302 #include <stdio.h>
15303 #$i_stdlib I_STDLIB
15304 #ifdef I_STDLIB
15305 #include <stdlib.h>
15306 #endif
15307 #include <sys/types.h>
15308 #include <signal.h>
15309 #ifdef SIGFPE
15310 $volatile int bletched = 0;
15311 $signal_t blech(int s) { bletched = 1; }
15312 #endif
15313 int main() {
15314     $uvtype u = 0;
15315     $nvtype d;
15316     int     n = 8 * $uvsize;
15317     int     i;
15318 #ifdef SIGFPE
15319     signal(SIGFPE, blech);
15320 #endif
15321
15322     for (i = 0; i < n; i++) {
15323       u = u << 1 | ($uvtype)1;
15324       d = ($nvtype)u;
15325       if (($uvtype)d != u)
15326         break;
15327       if (d <= 0)
15328         break;
15329       d = ($nvtype)(u - 1);
15330       if (($uvtype)d != (u - 1))
15331         break;
15332 #ifdef SIGFPE
15333       if (bletched)
15334         break;
15335 #endif
15336     }
15337     printf("%d\n", ((i == n) ? -n : i));
15338     exit(0);
15339 }
15340 EOP
15341 set try
15342
15343 d_nv_preserves_uv="$undef"
15344 if eval $compile; then
15345         nv_preserves_uv_bits="`$run ./try`"
15346 fi
15347 case "$nv_preserves_uv_bits" in
15348 \-[1-9]*)
15349         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15350         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15351         d_nv_preserves_uv="$define"
15352         ;;
15353 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15354         d_nv_preserves_uv="$undef" ;;
15355 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15356         nv_preserves_uv_bits="0" ;;
15357 esac
15358 $rm_try
15359
15360 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15361 : volatile so that the compiler has to store it out to memory.
15362 if test X"$d_volatile" = X"$define"; then
15363         volatile=volatile
15364 fi
15365 $cat <<EOP >try.c
15366 #include <stdio.h>
15367 #$i_stdlib I_STDLIB
15368 #ifdef I_STDLIB
15369 #include <stdlib.h>
15370 #endif
15371 #$i_string I_STRING
15372 #ifdef I_STRING
15373 #  include <string.h>
15374 #else
15375 #  include <strings.h>
15376 #endif
15377 #include <sys/types.h>
15378 #include <signal.h>
15379 #ifdef SIGFPE
15380 $volatile int bletched = 0;
15381 $signal_t blech(int s) { bletched = 1; }
15382 #endif
15383
15384 int checkit($nvtype d, char *where) {
15385     unsigned char *p = (char *)&d;
15386     unsigned char *end = p + sizeof(d);
15387     int fail = 0;
15388
15389     while (p < end)
15390         fail += *p++;
15391
15392     if (!fail)
15393         return 0;
15394
15395     p = (char *)&d;
15396     printf("No - %s: 0x", where);
15397     while (p < end)
15398         printf ("%02X", *p++);
15399     printf("\n");
15400     return 1;
15401 }
15402
15403 int main(int argc, char **argv) {
15404     $nvtype d = 0.0;
15405     int fail = 0;
15406     fail += checkit(d, "0.0");
15407
15408     /* The compiler shouldn't be assuming that bletched is 0  */
15409     d = bletched;
15410
15411     fail += checkit(d, "bleched");
15412
15413 #ifdef SIGFPE
15414     signal(SIGFPE, blech);
15415 #endif
15416
15417     /* Paranoia - the compiler should have no way of knowing that ANSI says
15418        that argv[argc] will always be NULL.  Actually, if it did assume this it
15419        would be buggy, as this is C and main() can be called from elsewhere in
15420        the program.  */
15421     d = argv[argc] ? 1 : 0;
15422
15423     if (d) {
15424         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15425     }
15426
15427     fail += checkit(d, "ternary");
15428
15429     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15430
15431     if (d != 0.0) {
15432         printf("No - memset doesn't give 0.0\n");
15433         /* This might just blow up:  */
15434         printf("(gives %g)\n", d);
15435         return 1;
15436     }
15437
15438 #ifdef SIGFPE
15439     if (bletched) {
15440         printf("No - something bleched\n");
15441         return 1;
15442     }
15443 #endif
15444     if (fail) {
15445       printf("No - %d fail(s)\n", fail);
15446       return 1;
15447     }
15448     printf("Yes\n");
15449     return 0;
15450 }
15451 EOP
15452 set try
15453
15454 d_nv_zero_is_allbits_zero="$undef"
15455 if eval $compile; then
15456     xxx="`$run ./try`"
15457     case "$?" in
15458         0)
15459             case "$xxx" in
15460                 Yes)  cat >&4 <<EOM
15461 0.0 is represented as all bits zero in memory
15462 EOM
15463                     d_nv_zero_is_allbits_zero="$define"
15464                     ;;
15465                 *)  cat >&4 <<EOM
15466 0.0 is not represented as all bits zero in memory
15467 EOM
15468                     d_nv_zero_is_allbits_zero="$undef"
15469                     ;;
15470             esac
15471             ;;
15472         *)  cat >&4 <<EOM
15473 0.0 is not represented as all bits zero in memory
15474 EOM
15475             d_nv_zero_is_allbits_zero="$undef"
15476             ;;
15477     esac
15478 fi
15479 $rm_try
15480
15481 : check for off64_t
15482 echo " "
15483 echo "Checking to see if you have off64_t..." >&4
15484 $cat >try.c <<EOCP
15485 #include <sys/types.h>
15486 #include <unistd.h>
15487 int main() { off64_t x = 7; }
15488 EOCP
15489 set try
15490 if eval $compile; then
15491         val="$define"
15492         echo "You have off64_t."
15493 else
15494         val="$undef"
15495         echo "You do not have off64_t."
15496         case "$lseeksize" in
15497         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15498         esac
15499 fi
15500 $rm_try
15501 set d_off64_t
15502 eval $setvar
15503
15504 : how to create joinable pthreads
15505 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15506         echo " "
15507         echo "Checking what constant to use for creating joinable pthreads..." >&4
15508         $cat >try.c <<'EOCP'
15509 #include <pthread.h>
15510 int main() {
15511     int detachstate = JOINABLE;
15512 }
15513 EOCP
15514         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15515         if eval $compile; then
15516                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15517                 val="$undef" # Yes, undef.
15518                 set d_old_pthread_create_joinable
15519                 eval $setvar
15520                 val=""
15521                 set old_pthread_create_joinable
15522                 eval $setvar
15523         else
15524                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15525                 if eval $compile; then
15526                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15527                         val="$define"
15528                         set d_old_pthread_create_joinable
15529                         eval $setvar
15530                         val=PTHREAD_CREATE_UNDETACHED
15531                         set old_pthread_create_joinable
15532                         eval $setvar
15533                 else
15534                         set try -DJOINABLE=__UNDETACHED
15535                         if eval $compile; then
15536                                 echo "You seem to use __UNDETACHED." >&4
15537                                 val="$define"
15538                                 set d_old_pthread_create_joinable
15539                                 eval $setvar
15540                                 val=__UNDETACHED
15541                                 set old_pthread_create_joinable
15542                                 eval $setvar
15543                         else
15544                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15545                                 val="$define"
15546                                 set d_old_pthread_create_joinable
15547                                 eval $setvar
15548                                 val=0
15549                                 set old_pthread_create_joinable
15550                                 eval $setvar
15551                         fi
15552                 fi
15553         fi
15554         $rm_try
15555 else
15556     d_old_pthread_create_joinable="$undef"
15557     old_pthread_create_joinable=""
15558 fi
15559
15560 : see if pause exists
15561 set pause d_pause
15562 eval $inlibc
15563
15564 : see if poll exists
15565 set poll d_poll
15566 eval $inlibc
15567
15568 : see if readlink exists
15569 set readlink d_readlink
15570 eval $inlibc
15571
15572 echo " "
15573 procselfexe=''
15574 val="$undef"
15575 case "$d_readlink" in
15576 "$define")
15577         if $issymlink /proc/self/exe ; then
15578                 $ls -l /proc/self/exe > reflect
15579                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15580                         echo "You have Linux-like /proc/self/exe."
15581                         procselfexe='"/proc/self/exe"'
15582                         val="$define"
15583                 fi
15584         fi
15585         if $issymlink /proc/curproc/file ; then
15586                 $ls -l /proc/curproc/file > reflect
15587                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15588                         echo "You have BSD-like /proc/curproc/file."
15589                         procselfexe='"/proc/curproc/file"'
15590                         val="$define"
15591                 fi
15592         fi
15593         ;;
15594 esac
15595 $rm -f reflect
15596 set d_procselfexe
15597 eval $setvar
15598
15599 : backward compatibility for d_hvfork
15600 if test X$d_hvfork != X; then
15601         d_vfork="$d_hvfork"
15602         d_hvfork=''
15603 fi
15604 : see if there is a vfork
15605 val=''
15606 set vfork val
15607 eval $inlibc
15608
15609 d_pseudofork=$undef
15610
15611 : Ok, but do we want to use it. vfork is reportedly unreliable in
15612 : perl on Solaris 2.x, and probably elsewhere.
15613 case "$val" in
15614 $define)
15615         echo " "
15616         case "$usevfork" in
15617         false) dflt='n';;
15618         *) dflt='y';;
15619         esac
15620         cat <<'EOM'
15621
15622 Perl can only use a vfork() that doesn't suffer from strict
15623 restrictions on calling functions or modifying global data in
15624 the child.  For example, glibc-2.1 contains such a vfork()
15625 that is unsuitable.  If your system provides a proper fork()
15626 call, chances are that you do NOT want perl to use vfork().
15627
15628 EOM
15629         rp="Do you still want to use vfork()?"
15630         . ./myread
15631         case "$ans" in
15632         y|Y) ;;
15633         *)
15634                 echo "Ok, we won't use vfork()."
15635                 val="$undef"
15636                 ;;
15637         esac
15638         ;;
15639 esac
15640 set d_vfork
15641 eval $setvar
15642 case "$d_vfork" in
15643 $define) usevfork='true';;
15644 *) usevfork='false';;
15645 esac
15646
15647 : see whether the pthread_atfork exists
15648 $cat >try.c <<EOP
15649 #include <pthread.h>
15650 #include <stdio.h>
15651 int main() {
15652 #ifdef  PTHREAD_ATFORK
15653         pthread_atfork(NULL,NULL,NULL);
15654 #endif
15655 }
15656 EOP
15657
15658 : see if pthread_atfork exists
15659 set try -DPTHREAD_ATFORK
15660 if eval $compile; then
15661     val="$define"
15662 else
15663     val="$undef"
15664 fi
15665 case "$usethreads" in
15666 $define)
15667         case "$val" in
15668         $define) echo 'pthread_atfork found.' >&4        ;;
15669         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15670         esac
15671 esac
15672 set d_pthread_atfork
15673 eval $setvar
15674
15675 : see if pthread_attr_setscope exists
15676 set pthread_attr_setscope d_pthread_attr_setscope
15677 eval $inlibc
15678
15679
15680 : see whether the various POSIXish _yields exist
15681 $cat >try.c <<EOP
15682 #include <pthread.h>
15683 #include <stdio.h>
15684 int main() {
15685 #ifdef SCHED_YIELD
15686         sched_yield();
15687 #else
15688 #ifdef PTHREAD_YIELD
15689         pthread_yield();
15690 #else
15691 #ifdef PTHREAD_YIELD_NULL
15692         pthread_yield(NULL);
15693 #endif
15694 #endif
15695 #endif
15696 }
15697 EOP
15698 : see if sched_yield exists
15699 set try -DSCHED_YIELD
15700 if eval $compile; then
15701     val="$define"
15702     sched_yield='sched_yield()'
15703 else
15704     val="$undef"
15705 fi
15706 case "$usethreads" in
15707 $define)
15708         case "$val" in
15709         $define) echo 'sched_yield() found.' >&4        ;;
15710         *)       echo 'sched_yield() NOT found.' >&4    ;;
15711         esac
15712 esac
15713 set d_sched_yield
15714 eval $setvar
15715
15716 : see if pthread_yield exists
15717 set try -DPTHREAD_YIELD
15718 if eval $compile; then
15719     val="$define"
15720     case "$sched_yield" in
15721     '') sched_yield='pthread_yield()' ;;
15722     esac
15723 else
15724     set try -DPTHREAD_YIELD_NULL
15725     if eval $compile; then
15726         val="$define"
15727         case "$sched_yield" in
15728         '') sched_yield='pthread_yield(NULL)' ;;
15729         esac
15730     else
15731         val="$undef"
15732     fi
15733 fi
15734 case "$usethreads" in
15735 $define)
15736         case "$val" in
15737         $define) echo 'pthread_yield() found.' >&4      ;;
15738         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15739         esac
15740         ;;
15741 esac
15742 set d_pthread_yield
15743 eval $setvar
15744 case "$sched_yield" in
15745 '') sched_yield=undef ;;
15746 esac
15747 $rm_try
15748
15749 : see if random_r exists
15750 set random_r d_random_r
15751 eval $inlibc
15752 case "$d_random_r" in
15753 "$define")
15754         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15755         case "$d_random_r_proto:$usethreads" in
15756         ":define")      d_random_r_proto=define
15757                 set d_random_r_proto random_r $hdrs
15758                 eval $hasproto ;;
15759         *)      ;;
15760         esac
15761         case "$d_random_r_proto" in
15762         define)
15763         case "$random_r_proto" in
15764         ''|0) try='int random_r(int*, struct random_data*);'
15765         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15766         esac
15767         case "$random_r_proto" in
15768         ''|0) try='int random_r(long*, struct random_data*);'
15769         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15770         esac
15771         case "$random_r_proto" in
15772         ''|0) try='int random_r(struct random_data*, int32_t*);'
15773         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15774         esac
15775         case "$random_r_proto" in
15776         ''|0)   d_random_r=undef
15777                 random_r_proto=0
15778                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15779         * )     case "$random_r_proto" in
15780                 REENTRANT_PROTO*) ;;
15781                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15782                 esac
15783                 echo "Prototype: $try" ;;
15784         esac
15785         ;;
15786         *)      case "$usethreads" in
15787                 define) echo "random_r has no prototype, not using it." >&4 ;;
15788                 esac
15789                 d_random_r=undef
15790                 random_r_proto=0
15791                 ;;
15792         esac
15793         ;;
15794 *)      random_r_proto=0
15795         ;;
15796 esac
15797
15798 : see if readdir and friends exist
15799 set readdir d_readdir
15800 eval $inlibc
15801 set seekdir d_seekdir
15802 eval $inlibc
15803 set telldir d_telldir
15804 eval $inlibc
15805 set rewinddir d_rewinddir
15806 eval $inlibc
15807
15808 : see if readdir64_r exists
15809 set readdir64_r d_readdir64_r
15810 eval $inlibc
15811 case "$d_readdir64_r" in
15812 "$define")
15813         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15814         case "$d_readdir64_r_proto:$usethreads" in
15815         ":define")      d_readdir64_r_proto=define
15816                 set d_readdir64_r_proto readdir64_r $hdrs
15817                 eval $hasproto ;;
15818         *)      ;;
15819         esac
15820         case "$d_readdir64_r_proto" in
15821         define)
15822         case "$readdir64_r_proto" in
15823         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15824         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15825         esac
15826         case "$readdir64_r_proto" in
15827         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15828         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15829         esac
15830         case "$readdir64_r_proto" in
15831         ''|0)   d_readdir64_r=undef
15832                 readdir64_r_proto=0
15833                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15834         * )     case "$readdir64_r_proto" in
15835                 REENTRANT_PROTO*) ;;
15836                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15837                 esac
15838                 echo "Prototype: $try" ;;
15839         esac
15840         ;;
15841         *)      case "$usethreads" in
15842                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15843                 esac
15844                 d_readdir64_r=undef
15845                 readdir64_r_proto=0
15846                 ;;
15847         esac
15848         ;;
15849 *)      readdir64_r_proto=0
15850         ;;
15851 esac
15852
15853 : see if readdir_r exists
15854 set readdir_r d_readdir_r
15855 eval $inlibc
15856 case "$d_readdir_r" in
15857 "$define")
15858         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15859         case "$d_readdir_r_proto:$usethreads" in
15860         ":define")      d_readdir_r_proto=define
15861                 set d_readdir_r_proto readdir_r $hdrs
15862                 eval $hasproto ;;
15863         *)      ;;
15864         esac
15865         case "$d_readdir_r_proto" in
15866         define)
15867         case "$readdir_r_proto" in
15868         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15869         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15870         esac
15871         case "$readdir_r_proto" in
15872         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15873         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15874         esac
15875         case "$readdir_r_proto" in
15876         ''|0)   d_readdir_r=undef
15877                 readdir_r_proto=0
15878                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15879         * )     case "$readdir_r_proto" in
15880                 REENTRANT_PROTO*) ;;
15881                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15882                 esac
15883                 echo "Prototype: $try" ;;
15884         esac
15885         ;;
15886         *)      case "$usethreads" in
15887                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15888                 esac
15889                 d_readdir_r=undef
15890                 readdir_r_proto=0
15891                 ;;
15892         esac
15893         ;;
15894 *)      readdir_r_proto=0
15895         ;;
15896 esac
15897
15898 : see if readv exists
15899 set readv d_readv
15900 eval $inlibc
15901
15902 : see if recvmsg exists
15903 set recvmsg d_recvmsg
15904 eval $inlibc
15905
15906 : see if rename exists
15907 set rename d_rename
15908 eval $inlibc
15909
15910 : see if rmdir exists
15911 set rmdir d_rmdir
15912 eval $inlibc
15913
15914 : see if memory.h is available.
15915 val=''
15916 set memory.h val
15917 eval $inhdr
15918
15919 : See if it conflicts with string.h
15920 case "$val" in
15921 $define)
15922         case "$strings" in
15923         '') ;;
15924         *)
15925                 $cppstdin $cppflags $cppminus < $strings > mem.h
15926                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15927                         echo " "
15928                         echo "We won't be including <memory.h>."
15929                         val="$undef"
15930                 fi
15931                 $rm -f mem.h
15932                 ;;
15933         esac
15934 esac
15935 set i_memory
15936 eval $setvar
15937
15938 : can bcopy handle overlapping blocks?
15939 echo " "
15940 val="$undef"
15941 case "$d_memmove" in
15942 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15943 *)      case "$d_bcopy" in
15944         "$define")
15945                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15946                 $cat >try.c <<EOCP
15947 #$i_memory I_MEMORY
15948 #$i_stdlib I_STDLIB
15949 #$i_string I_STRING
15950 #$i_unistd I_UNISTD
15951 EOCP
15952         $cat >>try.c <<'EOCP'
15953 #include <stdio.h>
15954 #ifdef I_MEMORY
15955 #  include <memory.h>
15956 #endif
15957 #ifdef I_STDLIB
15958 #  include <stdlib.h>
15959 #endif
15960 #ifdef I_STRING
15961 #  include <string.h>
15962 #else
15963 #  include <strings.h>
15964 #endif
15965 #ifdef I_UNISTD
15966 #  include <unistd.h>  /* Needed for NetBSD */
15967 #endif
15968 int main()
15969 {
15970 char buf[128], abc[128];
15971 char *b;
15972 int len;
15973 int off;
15974 int align;
15975
15976 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15977    try to store the string in read-only memory. */
15978 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15979
15980 for (align = 7; align >= 0; align--) {
15981         for (len = 36; len; len--) {
15982                 b = buf+align;
15983                 bcopy(abc, b, len);
15984                 for (off = 1; off <= len; off++) {
15985                         bcopy(b, b+off, len);
15986                         bcopy(b+off, b, len);
15987                         if (bcmp(b, abc, len))
15988                                 exit(1);
15989                 }
15990         }
15991 }
15992 exit(0);
15993 }
15994 EOCP
15995                 set try
15996                 if eval $compile_ok; then
15997                         if $run ./try 2>/dev/null; then
15998                                 echo "Yes, it can."
15999                                 val="$define"
16000                         else
16001                                 echo "It can't, sorry."
16002                         fi
16003                 else
16004                         echo "(I can't compile the test program, so we'll assume not...)"
16005                 fi
16006                 ;;
16007         esac
16008         $rm_try
16009         ;;
16010 esac
16011 set d_safebcpy
16012 eval $setvar
16013
16014 : can memcpy handle overlapping blocks?
16015 echo " "
16016 val="$undef"
16017 case "$d_memmove" in
16018 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16019 *)      case "$d_memcpy" in
16020         "$define")
16021                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16022                 $cat >try.c <<EOCP
16023 #$i_memory I_MEMORY
16024 #$i_stdlib I_STDLIB
16025 #$i_string I_STRING
16026 #$i_unistd I_UNISTD
16027 EOCP
16028         $cat >>try.c <<'EOCP'
16029 #include <stdio.h>
16030 #ifdef I_MEMORY
16031 #  include <memory.h>
16032 #endif
16033 #ifdef I_STDLIB
16034 #  include <stdlib.h>
16035 #endif
16036 #ifdef I_STRING
16037 #  include <string.h>
16038 #else
16039 #  include <strings.h>
16040 #endif
16041 #ifdef I_UNISTD
16042 #  include <unistd.h>  /* Needed for NetBSD */
16043 #endif
16044 int main()
16045 {
16046 char buf[128], abc[128];
16047 char *b;
16048 int len;
16049 int off;
16050 int align;
16051
16052 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16053    try to store the string in read-only memory. */
16054 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16055
16056 for (align = 7; align >= 0; align--) {
16057         for (len = 36; len; len--) {
16058                 b = buf+align;
16059                 memcpy(b, abc, len);
16060                 for (off = 1; off <= len; off++) {
16061                         memcpy(b+off, b, len);
16062                         memcpy(b, b+off, len);
16063                         if (memcmp(b, abc, len))
16064                                 exit(1);
16065                 }
16066         }
16067 }
16068 exit(0);
16069 }
16070 EOCP
16071                 set try
16072                 if eval $compile_ok; then
16073                         if $run ./try 2>/dev/null; then
16074                                 echo "Yes, it can."
16075                                 val="$define"
16076                         else
16077                                 echo "It can't, sorry."
16078                         fi
16079                 else
16080                         echo "(I can't compile the test program, so we'll assume not...)"
16081                 fi
16082                 ;;
16083         esac
16084         $rm_try
16085         ;;
16086 esac
16087 set d_safemcpy
16088 eval $setvar
16089
16090 : can memcmp be trusted to compare relative magnitude?
16091 val="$undef"
16092 case "$d_memcmp" in
16093 "$define")
16094         echo " "
16095         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16096         $cat >try.c <<EOCP
16097 #$i_memory I_MEMORY
16098 #$i_stdlib I_STDLIB
16099 #$i_string I_STRING
16100 #$i_unistd I_UNISTD
16101 EOCP
16102         $cat >>try.c <<'EOCP'
16103 #include <stdio.h>
16104 #ifdef I_MEMORY
16105 #  include <memory.h>
16106 #endif
16107 #ifdef I_STDLIB
16108 #  include <stdlib.h>
16109 #endif
16110 #ifdef I_STRING
16111 #  include <string.h>
16112 #else
16113 #  include <strings.h>
16114 #endif
16115 #ifdef I_UNISTD
16116 #  include <unistd.h>  /* Needed for NetBSD */
16117 #endif
16118 int main()
16119 {
16120 char a = -1;
16121 char b = 0;
16122 if ((a < b) && memcmp(&a, &b, 1) < 0)
16123         exit(1);
16124 exit(0);
16125 }
16126 EOCP
16127         set try
16128         if eval $compile_ok; then
16129                 if $run ./try 2>/dev/null; then
16130                         echo "Yes, it can."
16131                         val="$define"
16132                 else
16133                         echo "No, it can't (it uses signed chars)."
16134                 fi
16135         else
16136                 echo "(I can't compile the test program, so we'll assume not...)"
16137         fi
16138         ;;
16139 esac
16140 $rm_try
16141 set d_sanemcmp
16142 eval $setvar
16143
16144 : see if prototype for sbrk is available
16145 echo " "
16146 set d_sbrkproto sbrk $i_unistd unistd.h
16147 eval $hasproto
16148
16149 : see if select exists
16150 set select d_select
16151 eval $inlibc
16152
16153 : see if semctl exists
16154 set semctl d_semctl
16155 eval $inlibc
16156
16157 : see if semget exists
16158 set semget d_semget
16159 eval $inlibc
16160
16161 : see if semop exists
16162 set semop d_semop
16163 eval $inlibc
16164
16165 : see how much of the 'sem*(2)' library is present.
16166 h_sem=true
16167 echo " "
16168 case "$d_semctl$d_semget$d_semop" in
16169 *"$undef"*) h_sem=false;;
16170 esac
16171 case "$osname" in
16172 freebsd)
16173     case "`ipcs 2>&1`" in
16174     "SVID messages"*"not configured"*)
16175         echo "Your $osname does not have the sem*(2) configured." >&4
16176         h_sem=false
16177         val="$undef"
16178         set semctl d_semctl
16179         eval $setvar
16180         set semget d_semget
16181         eval $setvar
16182         set semop d_semop
16183         eval $setvar
16184         ;;
16185     esac
16186     ;;
16187 esac
16188 : we could also check for sys/ipc.h ...
16189 if $h_sem && $test `./findhdr sys/sem.h`; then
16190         echo "You have the full sem*(2) library." >&4
16191         val="$define"
16192 else
16193         echo "You don't have the full sem*(2) library." >&4
16194         val="$undef"
16195 fi
16196 set d_sem
16197 eval $setvar
16198
16199 : see whether sys/sem.h defines union semun
16200 echo " "
16201 $cat > try.c <<'END'
16202 #include <sys/types.h>
16203 #include <sys/ipc.h>
16204 #include <sys/sem.h>
16205 int main () { union semun semun; semun.buf = 0; }
16206 END
16207 set try
16208 if eval $compile; then
16209     echo "You have union semun in <sys/sem.h>." >&4
16210     val="$define"
16211 else
16212     echo "You do not have union semun in <sys/sem.h>." >&4
16213     val="$undef"
16214 fi
16215 $rm_try
16216 set d_union_semun
16217 eval $setvar
16218
16219 : see how to do semctl IPC_STAT
16220 case "$d_sem" in
16221 $define)
16222     echo " "
16223     $cat > tryh.h <<END
16224 #ifndef S_IRUSR
16225 #   ifdef S_IREAD
16226 #       define S_IRUSR S_IREAD
16227 #       define S_IWUSR S_IWRITE
16228 #       define S_IXUSR S_IEXEC
16229 #   else
16230 #       define S_IRUSR 0400
16231 #       define S_IWUSR 0200
16232 #       define S_IXUSR 0100
16233 #   endif
16234 #   define S_IRGRP (S_IRUSR>>3)
16235 #   define S_IWGRP (S_IWUSR>>3)
16236 #   define S_IXGRP (S_IXUSR>>3)
16237 #   define S_IROTH (S_IRUSR>>6)
16238 #   define S_IWOTH (S_IWUSR>>6)
16239 #   define S_IXOTH (S_IXUSR>>6)
16240 #endif
16241 #ifndef S_IRWXU
16242 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16243 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16244 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16245 #endif
16246 END
16247     : see whether semctl IPC_STAT can use union semun
16248     case "$d_semctl_semun" in
16249     '')
16250       val="$undef"
16251       $cat > try.c <<END
16252 #include <sys/types.h>
16253 #include <sys/ipc.h>
16254 #include <sys/sem.h>
16255 #include <sys/stat.h>
16256 #include <stdio.h>
16257 #include <errno.h>
16258 #include "tryh.h"
16259 #ifndef errno
16260 extern int errno;
16261 #endif
16262 #$d_union_semun HAS_UNION_SEMUN
16263 int main() {
16264     union semun
16265 #ifndef HAS_UNION_SEMUN
16266     {
16267         int val;
16268         struct semid_ds *buf;
16269         unsigned short *array;
16270     }
16271 #endif
16272     arg;
16273     int sem, st;
16274
16275 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16276     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16277     if (sem > -1) {
16278         struct semid_ds argbuf;
16279         arg.buf = &argbuf;
16280 #       ifdef IPC_STAT
16281         st = semctl(sem, 0, IPC_STAT, arg);
16282         if (st == 0)
16283             printf("semun\n");
16284         else
16285 #       endif /* IPC_STAT */
16286             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16287 #       ifdef IPC_RMID
16288         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16289 #       endif /* IPC_RMID */
16290             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16291     } else
16292 #endif /* IPC_PRIVATE && ... */
16293         printf("semget failed: errno = %d\n", errno);
16294   return 0;
16295 }
16296 END
16297       set try
16298       if eval $compile; then
16299           xxx=`$run ./try`
16300           case "$xxx" in
16301           semun) val="$define" ;;
16302           esac
16303       fi
16304       $rm_try
16305       set d_semctl_semun
16306       eval $setvar
16307       ;;
16308     esac
16309     case "$d_semctl_semun" in
16310     $define)
16311         echo "You can use union semun for semctl IPC_STAT." >&4
16312         also='also'
16313         ;;
16314     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16315         also=''
16316         ;;
16317     esac
16318
16319     : see whether semctl IPC_STAT can use struct semid_ds pointer
16320     case "$d_semctl_semid_ds" in
16321     '')
16322       val="$undef"
16323       $cat > try.c <<'END'
16324 #include <sys/types.h>
16325 #include <sys/ipc.h>
16326 #include <sys/sem.h>
16327 #include <sys/stat.h>
16328 #include "tryh.h"
16329 #include <stdio.h>
16330 #include <errno.h>
16331 #ifndef errno
16332 extern int errno;
16333 #endif
16334 int main() {
16335     struct semid_ds arg;
16336     int sem, st;
16337
16338 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16339     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16340     if (sem > -1) {
16341 #       ifdef IPC_STAT
16342         st = semctl(sem, 0, IPC_STAT, &arg);
16343         if (st == 0)
16344             printf("semid_ds\n");
16345         else
16346 #       endif /* IPC_STAT */
16347             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16348 #       ifdef IPC_RMID
16349         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16350 #       endif /* IPC_RMID */
16351             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16352     } else
16353 #endif /* IPC_PRIVATE && ... */
16354         printf("semget failed: errno = %d\n", errno);
16355
16356     return 0;
16357 }
16358 END
16359       set try
16360       if eval $compile; then
16361           xxx=`$run ./try`
16362           case "$xxx" in
16363           semid_ds) val="$define" ;;
16364           esac
16365       fi
16366       $rm_try
16367       set d_semctl_semid_ds
16368       eval $setvar
16369       ;;
16370     esac
16371     case "$d_semctl_semid_ds" in
16372     $define)
16373         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16374         ;;
16375     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16376         ;;
16377     esac
16378     ;;
16379 *)  val="$undef"
16380
16381     # We do not have the full sem*(2) library, so assume we can not
16382     # use either.
16383
16384     set d_semctl_semun
16385     eval $setvar
16386
16387     set d_semctl_semid_ds
16388     eval $setvar
16389     ;;
16390 esac
16391 $rm_try tryh.h
16392
16393 : see if sendmsg exists
16394 set sendmsg d_sendmsg
16395 eval $inlibc
16396
16397 : see if setegid exists
16398 set setegid d_setegid
16399 eval $inlibc
16400
16401 : see if seteuid exists
16402 set seteuid d_seteuid
16403 eval $inlibc
16404
16405 : see if setgrent exists
16406 set setgrent d_setgrent
16407 eval $inlibc
16408
16409 : see if setgrent_r exists
16410 set setgrent_r d_setgrent_r
16411 eval $inlibc
16412 case "$d_setgrent_r" in
16413 "$define")
16414         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16415         case "$d_setgrent_r_proto:$usethreads" in
16416         ":define")      d_setgrent_r_proto=define
16417                 set d_setgrent_r_proto setgrent_r $hdrs
16418                 eval $hasproto ;;
16419         *)      ;;
16420         esac
16421         case "$d_setgrent_r_proto" in
16422         define)
16423         case "$setgrent_r_proto" in
16424         ''|0) try='int setgrent_r(FILE**);'
16425         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16426         esac
16427         case "$setgrent_r_proto" in
16428         ''|0) try='void setgrent_r(FILE**);'
16429         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16430         esac
16431         case "$setgrent_r_proto" in
16432         ''|0)   d_setgrent_r=undef
16433                 setgrent_r_proto=0
16434                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16435         * )     case "$setgrent_r_proto" in
16436                 REENTRANT_PROTO*) ;;
16437                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16438                 esac
16439                 echo "Prototype: $try" ;;
16440         esac
16441         ;;
16442         *)      case "$usethreads" in
16443                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16444                 esac
16445                 d_setgrent_r=undef
16446                 setgrent_r_proto=0
16447                 ;;
16448         esac
16449         ;;
16450 *)      setgrent_r_proto=0
16451         ;;
16452 esac
16453
16454 : see if sethostent exists
16455 set sethostent d_sethent
16456 eval $inlibc
16457
16458 : see if sethostent_r exists
16459 set sethostent_r d_sethostent_r
16460 eval $inlibc
16461 case "$d_sethostent_r" in
16462 "$define")
16463         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16464         case "$d_sethostent_r_proto:$usethreads" in
16465         ":define")      d_sethostent_r_proto=define
16466                 set d_sethostent_r_proto sethostent_r $hdrs
16467                 eval $hasproto ;;
16468         *)      ;;
16469         esac
16470         case "$d_sethostent_r_proto" in
16471         define)
16472         case "$sethostent_r_proto" in
16473         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16474         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16475         esac
16476         case "$sethostent_r_proto" in
16477         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16478         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16479         esac
16480         case "$sethostent_r_proto" in
16481         ''|0)   d_sethostent_r=undef
16482                 sethostent_r_proto=0
16483                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16484         * )     case "$sethostent_r_proto" in
16485                 REENTRANT_PROTO*) ;;
16486                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16487                 esac
16488                 echo "Prototype: $try" ;;
16489         esac
16490         ;;
16491         *)      case "$usethreads" in
16492                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16493                 esac
16494                 d_sethostent_r=undef
16495                 sethostent_r_proto=0
16496                 ;;
16497         esac
16498         ;;
16499 *)      sethostent_r_proto=0
16500         ;;
16501 esac
16502
16503 : see if setitimer exists
16504 set setitimer d_setitimer
16505 eval $inlibc
16506
16507 : see if setlinebuf exists
16508 set setlinebuf d_setlinebuf
16509 eval $inlibc
16510
16511 : see if setlocale exists
16512 set setlocale d_setlocale
16513 eval $inlibc
16514
16515 : see if locale.h is available
16516 set locale.h i_locale
16517 eval $inhdr
16518
16519 : see if setlocale_r exists
16520 set setlocale_r d_setlocale_r
16521 eval $inlibc
16522 case "$d_setlocale_r" in
16523 "$define")
16524         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16525         case "$d_setlocale_r_proto:$usethreads" in
16526         ":define")      d_setlocale_r_proto=define
16527                 set d_setlocale_r_proto setlocale_r $hdrs
16528                 eval $hasproto ;;
16529         *)      ;;
16530         esac
16531         case "$d_setlocale_r_proto" in
16532         define)
16533         case "$setlocale_r_proto" in
16534         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16535         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16536         esac
16537         case "$setlocale_r_proto" in
16538         ''|0)   d_setlocale_r=undef
16539                 setlocale_r_proto=0
16540                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16541         * )     case "$setlocale_r_proto" in
16542                 REENTRANT_PROTO*) ;;
16543                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16544                 esac
16545                 echo "Prototype: $try" ;;
16546         esac
16547         ;;
16548         *)      case "$usethreads" in
16549                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16550                 esac
16551                 d_setlocale_r=undef
16552                 setlocale_r_proto=0
16553                 ;;
16554         esac
16555         ;;
16556 *)      setlocale_r_proto=0
16557         ;;
16558 esac
16559
16560 : see if setnetent exists
16561 set setnetent d_setnent
16562 eval $inlibc
16563
16564 : see if setnetent_r exists
16565 set setnetent_r d_setnetent_r
16566 eval $inlibc
16567 case "$d_setnetent_r" in
16568 "$define")
16569         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16570         case "$d_setnetent_r_proto:$usethreads" in
16571         ":define")      d_setnetent_r_proto=define
16572                 set d_setnetent_r_proto setnetent_r $hdrs
16573                 eval $hasproto ;;
16574         *)      ;;
16575         esac
16576         case "$d_setnetent_r_proto" in
16577         define)
16578         case "$setnetent_r_proto" in
16579         ''|0) try='int setnetent_r(int, struct netent_data*);'
16580         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16581         esac
16582         case "$setnetent_r_proto" in
16583         ''|0) try='void setnetent_r(int, struct netent_data*);'
16584         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16585         esac
16586         case "$setnetent_r_proto" in
16587         ''|0)   d_setnetent_r=undef
16588                 setnetent_r_proto=0
16589                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16590         * )     case "$setnetent_r_proto" in
16591                 REENTRANT_PROTO*) ;;
16592                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16593                 esac
16594                 echo "Prototype: $try" ;;
16595         esac
16596         ;;
16597         *)      case "$usethreads" in
16598                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16599                 esac
16600                 d_setnetent_r=undef
16601                 setnetent_r_proto=0
16602                 ;;
16603         esac
16604         ;;
16605 *)      setnetent_r_proto=0
16606         ;;
16607 esac
16608
16609 : see if setprotoent exists
16610 set setprotoent d_setpent
16611 eval $inlibc
16612
16613 : see if setpgid exists
16614 set setpgid d_setpgid
16615 eval $inlibc
16616
16617 : see if setpgrp2 exists
16618 set setpgrp2 d_setpgrp2
16619 eval $inlibc
16620
16621 : see if setpriority exists
16622 set setpriority d_setprior
16623 eval $inlibc
16624
16625 : see if setproctitle exists
16626 set setproctitle d_setproctitle
16627 eval $inlibc
16628
16629 : see if setprotoent_r exists
16630 set setprotoent_r d_setprotoent_r
16631 eval $inlibc
16632 case "$d_setprotoent_r" in
16633 "$define")
16634         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16635         case "$d_setprotoent_r_proto:$usethreads" in
16636         ":define")      d_setprotoent_r_proto=define
16637                 set d_setprotoent_r_proto setprotoent_r $hdrs
16638                 eval $hasproto ;;
16639         *)      ;;
16640         esac
16641         case "$d_setprotoent_r_proto" in
16642         define)
16643         case "$setprotoent_r_proto" in
16644         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16645         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16646         esac
16647         case "$setprotoent_r_proto" in
16648         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16649         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16650         esac
16651         case "$setprotoent_r_proto" in
16652         ''|0)   d_setprotoent_r=undef
16653                 setprotoent_r_proto=0
16654                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16655         * )     case "$setprotoent_r_proto" in
16656                 REENTRANT_PROTO*) ;;
16657                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16658                 esac
16659                 echo "Prototype: $try" ;;
16660         esac
16661         ;;
16662         *)      case "$usethreads" in
16663                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16664                 esac
16665                 d_setprotoent_r=undef
16666                 setprotoent_r_proto=0
16667                 ;;
16668         esac
16669         ;;
16670 *)      setprotoent_r_proto=0
16671         ;;
16672 esac
16673
16674 : see if setpwent exists
16675 set setpwent d_setpwent
16676 eval $inlibc
16677
16678 : see if setpwent_r exists
16679 set setpwent_r d_setpwent_r
16680 eval $inlibc
16681 case "$d_setpwent_r" in
16682 "$define")
16683         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16684         case "$d_setpwent_r_proto:$usethreads" in
16685         ":define")      d_setpwent_r_proto=define
16686                 set d_setpwent_r_proto setpwent_r $hdrs
16687                 eval $hasproto ;;
16688         *)      ;;
16689         esac
16690         case "$d_setpwent_r_proto" in
16691         define)
16692         case "$setpwent_r_proto" in
16693         ''|0) try='int setpwent_r(FILE**);'
16694         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16695         esac
16696         case "$setpwent_r_proto" in
16697         ''|0) try='void setpwent_r(FILE**);'
16698         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16699         esac
16700         case "$setpwent_r_proto" in
16701         ''|0)   d_setpwent_r=undef
16702                 setpwent_r_proto=0
16703                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16704         * )     case "$setpwent_r_proto" in
16705                 REENTRANT_PROTO*) ;;
16706                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16707                 esac
16708                 echo "Prototype: $try" ;;
16709         esac
16710         ;;
16711         *)      case "$usethreads" in
16712                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16713                 esac
16714                 d_setpwent_r=undef
16715                 setpwent_r_proto=0
16716                 ;;
16717         esac
16718         ;;
16719 *)      setpwent_r_proto=0
16720         ;;
16721 esac
16722
16723 : see if setregid exists
16724 set setregid d_setregid
16725 eval $inlibc
16726 set setresgid d_setresgid
16727 eval $inlibc
16728
16729 : see if setreuid exists
16730 set setreuid d_setreuid
16731 eval $inlibc
16732 set setresuid d_setresuid
16733 eval $inlibc
16734
16735 : see if setrgid exists
16736 set setrgid d_setrgid
16737 eval $inlibc
16738
16739 : see if setruid exists
16740 set setruid d_setruid
16741 eval $inlibc
16742
16743 : see if setservent exists
16744 set setservent d_setsent
16745 eval $inlibc
16746
16747 : see if setservent_r exists
16748 set setservent_r d_setservent_r
16749 eval $inlibc
16750 case "$d_setservent_r" in
16751 "$define")
16752         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16753         case "$d_setservent_r_proto:$usethreads" in
16754         ":define")      d_setservent_r_proto=define
16755                 set d_setservent_r_proto setservent_r $hdrs
16756                 eval $hasproto ;;
16757         *)      ;;
16758         esac
16759         case "$d_setservent_r_proto" in
16760         define)
16761         case "$setservent_r_proto" in
16762         ''|0) try='int setservent_r(int, struct servent_data*);'
16763         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16764         esac
16765         case "$setservent_r_proto" in
16766         ''|0) try='void setservent_r(int, struct servent_data*);'
16767         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16768         esac
16769         case "$setservent_r_proto" in
16770         ''|0)   d_setservent_r=undef
16771                 setservent_r_proto=0
16772                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16773         * )     case "$setservent_r_proto" in
16774                 REENTRANT_PROTO*) ;;
16775                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16776                 esac
16777                 echo "Prototype: $try" ;;
16778         esac
16779         ;;
16780         *)      case "$usethreads" in
16781                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16782                 esac
16783                 d_setservent_r=undef
16784                 setservent_r_proto=0
16785                 ;;
16786         esac
16787         ;;
16788 *)      setservent_r_proto=0
16789         ;;
16790 esac
16791
16792 : see if setsid exists
16793 set setsid d_setsid
16794 eval $inlibc
16795
16796 : see if setvbuf exists
16797 set setvbuf d_setvbuf
16798 eval $inlibc
16799
16800 : see if sfio.h is available
16801 set sfio.h i_sfio
16802 eval $inhdr
16803
16804
16805 : see if sfio library is available
16806 case "$i_sfio" in
16807 $define)
16808         val=''
16809         set sfreserve val
16810         eval $inlibc
16811         ;;
16812 *)
16813         val="$undef"
16814         ;;
16815 esac
16816 : Ok, but do we want to use it.
16817 case "$val" in
16818 $define)
16819         case "$usesfio" in
16820         true|$define|[yY]*) dflt='y';;
16821         *) dflt='n';;
16822         esac
16823         echo "$package can use the sfio library, but it is experimental."
16824         case "$useperlio" in
16825         "$undef")
16826             echo "For sfio also the PerlIO abstraction layer is needed."
16827             echo "Earlier you said you wouldn't want that."
16828             ;;
16829         esac
16830         rp="You seem to have sfio available, do you want to try using it?"
16831         . ./myread
16832         case "$ans" in
16833         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16834                 useperlio="$define"
16835                 val="$define"
16836                 ;;
16837         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16838                 val="$undef"
16839                 ;;
16840         esac
16841         ;;
16842 *)      case "$usesfio" in
16843         true|$define|[yY]*)
16844                 echo "Sorry, cannot find sfio on this machine." >&4
16845                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16846                 val="$undef"
16847                 ;;
16848         esac
16849         ;;
16850 esac
16851 set d_sfio
16852 eval $setvar
16853 case "$d_sfio" in
16854 $define) usesfio='true';;
16855 *) usesfio='false';;
16856 esac
16857 case "$d_sfio" in
16858 $define) ;;
16859 *)      : Remove sfio from list of libraries to use
16860         case "$libs" in
16861         *-lsfio*)
16862                 echo "Removing unneeded -lsfio from library list" >&4
16863                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16864                 shift
16865                 libs="$*"
16866                 echo "libs = $libs" >&4
16867                 ;;
16868         esac
16869 ;;
16870 esac
16871
16872
16873 : see if shmctl exists
16874 set shmctl d_shmctl
16875 eval $inlibc
16876
16877 : see if shmget exists
16878 set shmget d_shmget
16879 eval $inlibc
16880
16881 : see if shmat exists
16882 set shmat d_shmat
16883 eval $inlibc
16884 : see what shmat returns
16885 case "$d_shmat" in
16886 "$define")
16887         $cat >shmat.c <<'END'
16888 #include <sys/shm.h>
16889 void *shmat();
16890 END
16891         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16892                 shmattype='void *'
16893         else
16894                 shmattype='char *'
16895         fi
16896         echo "and it returns ($shmattype)." >&4
16897         : see if a prototype for shmat is available
16898         xxx=`./findhdr sys/shm.h`
16899         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16900         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16901                 val="$define"
16902         else
16903                 val="$undef"
16904         fi
16905         $rm -f shmat.[co]
16906         ;;
16907 *)
16908         val="$undef"
16909         ;;
16910 esac
16911 set d_shmatprototype
16912 eval $setvar
16913
16914 : see if shmdt exists
16915 set shmdt d_shmdt
16916 eval $inlibc
16917
16918 : see how much of the 'shm*(2)' library is present.
16919 h_shm=true
16920 echo " "
16921 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16922 *"$undef"*) h_shm=false;;
16923 esac
16924 case "$osname" in
16925 freebsd)
16926     case "`ipcs 2>&1`" in
16927     "SVID shared memory"*"not configured"*)
16928         echo "Your $osname does not have the shm*(2) configured." >&4
16929         h_shm=false
16930         val="$undef"
16931         set shmctl d_shmctl
16932         evat $setvar
16933         set shmget d_shmget
16934         evat $setvar
16935         set shmat d_shmat
16936         evat $setvar
16937         set shmdt d_shmdt
16938         evat $setvar
16939         ;;
16940     esac
16941     ;;
16942 esac
16943 : we could also check for sys/ipc.h ...
16944 if $h_shm && $test `./findhdr sys/shm.h`; then
16945         echo "You have the full shm*(2) library." >&4
16946         val="$define"
16947 else
16948         echo "You don't have the full shm*(2) library." >&4
16949         val="$undef"
16950 fi
16951 set d_shm
16952 eval $setvar
16953
16954 echo " "
16955 : see if we have sigaction
16956 if set sigaction val -f d_sigaction; eval $csym; $val; then
16957         echo 'sigaction() found.' >&4
16958         $cat > try.c <<EOP
16959 #include <stdio.h>
16960 #include <sys/types.h>
16961 #include <signal.h>
16962 #$i_stdlib I_STDLIB
16963 #ifdef I_STDLIB
16964 #include <stdlib.h>
16965 #endif
16966 int main()
16967 {
16968     struct sigaction act, oact;
16969     act.sa_flags = 0;
16970     oact.sa_handler = 0;
16971     /* so that act and oact are used */
16972     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16973 }
16974 EOP
16975         set try
16976         if eval $compile_ok; then
16977                 val="$define"
16978         else
16979                 echo "But you don't seem to have a useable struct sigaction." >&4
16980                 val="$undef"
16981         fi
16982 else
16983         echo 'sigaction NOT found.' >&4
16984         val="$undef"
16985 fi
16986 set d_sigaction; eval $setvar
16987 $rm_try
16988
16989 : see if this is a sunmath.h system
16990 set sunmath.h i_sunmath
16991 eval $inhdr
16992
16993 : see if signbit exists
16994 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
16995 $cat >try.c <<EOCP
16996 #$i_math I_MATH
16997 #$i_sunmath I_SUNMATH
16998 #ifdef I_MATH
16999 #  include <math.h>
17000 #endif
17001 #ifdef I_SUNMATH  /* Solaris special math library */
17002 #  include <sunmath.h>
17003 #endif
17004 #define NV $nvtype
17005 int main(int argc, char **argv)
17006 {
17007     NV x = 0.0;
17008     NV y = -0.0;
17009     if ((signbit(x) == 0) && (signbit(y) != 0))
17010         return 0;
17011     else
17012         return 1;
17013 }
17014 EOCP
17015 val="$undef"
17016 set try
17017 if eval $compile; then
17018     if $run ./try; then
17019         $echo "Yes." >&4
17020         val="$define"
17021     else
17022         $echo "Signbit seems to be available, but doesn't work as I expected."
17023         $echo "I won't use it." >&4
17024         val="$undef"
17025     fi
17026 else
17027     $echo "Nope." >&4
17028     dflt="$undef"
17029 fi
17030 set d_signbit
17031 eval $setvar
17032 $rm_try
17033
17034 : see if sigprocmask exists
17035 set sigprocmask d_sigprocmask
17036 eval $inlibc
17037
17038 : see if sigsetjmp exists
17039 echo " "
17040 case "$d_sigsetjmp" in
17041 '')
17042         $cat >try.c <<EOP
17043 #include <setjmp.h>
17044 #$i_stdlib I_STDLIB
17045 #ifdef I_STDLIB
17046 #include <stdlib.h>
17047 #endif
17048 sigjmp_buf env;
17049 int set = 1;
17050 int main()
17051 {
17052         if (sigsetjmp(env,1))
17053                 exit(set);
17054         set = 0;
17055         siglongjmp(env, 1);
17056         exit(1);
17057 }
17058 EOP
17059         set try
17060         if eval $compile; then
17061                 if $run ./try >/dev/null 2>&1; then
17062                         echo "POSIX sigsetjmp found." >&4
17063                         val="$define"
17064                 else
17065                         $cat >&4 <<EOM
17066 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17067 I'll ignore them.
17068 EOM
17069                         val="$undef"
17070                 fi
17071         else
17072                 echo "sigsetjmp not found." >&4
17073                 val="$undef"
17074         fi
17075         ;;
17076 *) val="$d_sigsetjmp"
17077         case "$d_sigsetjmp" in
17078         $define) echo "POSIX sigsetjmp found." >&4;;
17079         $undef) echo "sigsetjmp not found." >&4;;
17080         esac
17081         ;;
17082 esac
17083 set d_sigsetjmp
17084 eval $setvar
17085 $rm_try
17086
17087 : see if snprintf exists
17088 set snprintf d_snprintf
17089 eval $inlibc
17090
17091 : see if vsnprintf exists
17092 set vsnprintf d_vsnprintf
17093 eval $inlibc
17094
17095 case "$d_snprintf-$d_vsnprintf" in
17096 "$define-$define")
17097     $cat <<EOM
17098 Checking whether your snprintf() and vsnprintf() work okay...
17099 EOM
17100     $cat >try.c <<'EOCP'
17101 /* v?snprintf testing logic courtesy of Russ Allbery.
17102  * According to C99:
17103  * - if the buffer is too short it still must be \0-terminated
17104  * - if the buffer is too short the potentially required length
17105  *   must be returned and not -1
17106  * - if the buffer is NULL the potentially required length
17107  *   must be returned and not -1 or core dump
17108  */
17109 #include <stdio.h>
17110 #include <stdarg.h>
17111
17112 char buf[2];
17113
17114 int test (char *format, ...)
17115 {
17116     va_list args;
17117     int count;
17118
17119     va_start (args, format);
17120     count = vsnprintf (buf, sizeof buf, format, args);
17121     va_end (args);
17122     return count;
17123 }
17124
17125 int main ()
17126 {
17127     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17128              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17129 }
17130 EOCP
17131     set try
17132     if eval $compile; then
17133         `$run ./try`
17134         case "$?" in
17135         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17136         *) cat <<EOM >&4
17137 Your snprintf() and snprintf() don't seem to be working okay.
17138 EOM
17139            d_snprintf="$undef"
17140            d_vsnprintf="$undef"
17141            ;;
17142         esac
17143     else
17144         echo "(I can't seem to compile the test program--assuming they don't)"
17145         d_snprintf="$undef"
17146         d_vsnprintf="$undef"
17147     fi
17148     $rm_try
17149     ;;
17150 esac
17151
17152 : see if sockatmark exists
17153 set sockatmark d_sockatmark
17154 eval $inlibc
17155
17156 : see if prototype for sockatmark is available
17157 echo " "
17158 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17159 eval $hasproto
17160
17161 : see if socks5_init exists
17162 set socks5_init d_socks5_init
17163 eval $inlibc
17164
17165 : see if sprintf returns the length of the string in the buffer as per ANSI
17166 $echo "Checking whether sprintf returns the length of the string..." >&4
17167 $cat <<EOP >try.c
17168 #include <stdio.h>
17169 #$i_stdlib I_STDLIB
17170 #ifdef I_STDLIB
17171 #include <stdlib.h>
17172 #endif
17173 #$i_string I_STRING
17174 #ifdef I_STRING
17175 #  include <string.h>
17176 #else
17177 #  include <strings.h>
17178 #endif
17179 #$i_math I_MATH
17180 #ifdef I_MATH
17181 #include <math.h>
17182 #endif
17183
17184 char buffer[256];
17185
17186 int check (size_t expect, int test) {
17187   size_t got = strlen(buffer);
17188   if (expect == got)
17189     return 0;
17190
17191   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17192        test, buffer);
17193   exit (test);
17194 }
17195
17196 int main(int argc, char **argv) {
17197   int test = 0;
17198
17199   check(sprintf(buffer, ""), ++test);
17200   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17201   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17202
17203   return 0;
17204 }
17205 EOP
17206 set try
17207
17208 d_sprintf_returns_strlen="$undef"
17209 if eval $compile; then
17210     xxx="`$run ./try`"
17211     case "$?" in
17212         0) cat >&4 <<EOM
17213 sprintf returns the length of the string (as ANSI says it should)
17214 EOM
17215         d_sprintf_returns_strlen="$define"
17216         ;;
17217         *) cat >&4 <<EOM
17218 sprintf does not return the length of the string (how old is this system?)
17219 EOM
17220         d_sprintf_returns_strlen="$undef"
17221         ;;
17222     esac
17223 fi
17224 $rm_try
17225
17226 : see if srand48_r exists
17227 set srand48_r d_srand48_r
17228 eval $inlibc
17229 case "$d_srand48_r" in
17230 "$define")
17231         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17232         case "$d_srand48_r_proto:$usethreads" in
17233         ":define")      d_srand48_r_proto=define
17234                 set d_srand48_r_proto srand48_r $hdrs
17235                 eval $hasproto ;;
17236         *)      ;;
17237         esac
17238         case "$d_srand48_r_proto" in
17239         define)
17240         case "$srand48_r_proto" in
17241         ''|0) try='int srand48_r(long, struct drand48_data*);'
17242         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17243         esac
17244         case "$srand48_r_proto" in
17245         ''|0)   d_srand48_r=undef
17246                 srand48_r_proto=0
17247                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17248         * )     case "$srand48_r_proto" in
17249                 REENTRANT_PROTO*) ;;
17250                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17251                 esac
17252                 echo "Prototype: $try" ;;
17253         esac
17254         ;;
17255         *)      case "$usethreads" in
17256                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17257                 esac
17258                 d_srand48_r=undef
17259                 srand48_r_proto=0
17260                 ;;
17261         esac
17262         ;;
17263 *)      srand48_r_proto=0
17264         ;;
17265 esac
17266
17267 : see if srandom_r exists
17268 set srandom_r d_srandom_r
17269 eval $inlibc
17270 case "$d_srandom_r" in
17271 "$define")
17272         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17273         case "$d_srandom_r_proto:$usethreads" in
17274         ":define")      d_srandom_r_proto=define
17275                 set d_srandom_r_proto srandom_r $hdrs
17276                 eval $hasproto ;;
17277         *)      ;;
17278         esac
17279         case "$d_srandom_r_proto" in
17280         define)
17281         case "$srandom_r_proto" in
17282         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17283         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17284         esac
17285         case "$srandom_r_proto" in
17286         ''|0)   d_srandom_r=undef
17287                 srandom_r_proto=0
17288                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17289         * )     case "$srandom_r_proto" in
17290                 REENTRANT_PROTO*) ;;
17291                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17292                 esac
17293                 echo "Prototype: $try" ;;
17294         esac
17295         ;;
17296         *)      case "$usethreads" in
17297                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17298                 esac
17299                 d_srandom_r=undef
17300                 srandom_r_proto=0
17301                 ;;
17302         esac
17303         ;;
17304 *)      srandom_r_proto=0
17305         ;;
17306 esac
17307
17308 : see if prototype for setresgid is available
17309 echo " "
17310 set d_sresgproto setresgid $i_unistd unistd.h
17311 eval $hasproto
17312
17313 : see if prototype for setresuid is available
17314 echo " "
17315 set d_sresuproto setresuid $i_unistd unistd.h
17316 eval $hasproto
17317
17318 : see if sys/stat.h is available
17319 set sys/stat.h i_sysstat
17320 eval $inhdr
17321
17322
17323 : see if stat knows about block sizes
17324 echo " "
17325 echo "Checking to see if your struct stat has st_blocks field..." >&4
17326 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17327 eval $hasfield
17328
17329
17330 : see if this is a sys/vfs.h system
17331 set sys/vfs.h i_sysvfs
17332 eval $inhdr
17333
17334
17335 : see if this is a sys/statfs.h system
17336 set sys/statfs.h i_sysstatfs
17337 eval $inhdr
17338
17339
17340 echo " "
17341 echo "Checking to see if your system supports struct statfs..." >&4
17342 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
17343 eval $hasstruct
17344 case "$d_statfs_s" in
17345 "$define")      echo "Yes, it does."   ;;
17346 *)              echo "No, it doesn't." ;;
17347 esac
17348
17349
17350
17351 : see if struct statfs knows about f_flags
17352 case "$d_statfs_s" in
17353 define) 
17354         echo " "
17355         echo "Checking to see if your struct statfs has f_flags field..." >&4
17356         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
17357         eval $hasfield
17358         ;;
17359 *)      val="$undef"
17360         set d_statfs_f_flags
17361         eval $setvar
17362         ;;
17363 esac
17364 case "$d_statfs_f_flags" in
17365 "$define")      echo "Yes, it does."   ;;
17366 *)              echo "No, it doesn't." ;;
17367 esac
17368
17369 $cat >&4 <<EOM
17370 Checking how to access stdio streams by file descriptor number...
17371 EOM
17372 case "$stdio_stream_array" in
17373 '')     $cat >try.c <<EOCP
17374 #include <stdio.h>
17375 int main() {
17376   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17377     printf("yes\n");
17378 }
17379 EOCP
17380         for s in _iob __iob __sF
17381         do
17382                 set try -DSTDIO_STREAM_ARRAY=$s
17383                 if eval $compile; then
17384                         case "`$run ./try`" in
17385                         yes)    stdio_stream_array=$s; break ;;
17386                         esac
17387                 fi
17388         done
17389         $rm_try
17390 esac
17391 case "$stdio_stream_array" in
17392 '')     $cat >&4 <<EOM
17393 I can't figure out how to access stdio streams by file descriptor number.
17394 EOM
17395         d_stdio_stream_array="$undef"
17396         ;;
17397 *)      $cat >&4 <<EOM
17398 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17399 EOM
17400         d_stdio_stream_array="$define"
17401         ;;
17402 esac
17403
17404 : see if strcoll exists
17405 set strcoll d_strcoll
17406 eval $inlibc
17407
17408 : check for structure copying
17409 echo " "
17410 echo "Checking to see if your C compiler can copy structs..." >&4
17411 $cat >try.c <<'EOCP'
17412 int main()
17413 {
17414         struct blurfl {
17415                 int dyick;
17416         } foo, bar;
17417
17418         foo = bar;
17419 }
17420 EOCP
17421 if $cc -c try.c >/dev/null 2>&1 ; then
17422         val="$define"
17423         echo "Yup, it can."
17424 else
17425         val="$undef"
17426         echo "Nope, it can't."
17427 fi
17428 set d_strctcpy
17429 eval $setvar
17430 $rm_try
17431
17432 : see if strerror and/or sys_errlist[] exist
17433 echo " "
17434 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17435     if set strerror val -f d_strerror; eval $csym; $val; then
17436                 echo 'strerror() found.' >&4
17437                 d_strerror="$define"
17438                 d_strerrm='strerror(e)'
17439                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17440                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17441                         d_syserrlst="$define"
17442                 else
17443                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17444                         d_syserrlst="$undef"
17445                 fi
17446     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17447                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17448                 echo 'strerror() found in string header.' >&4
17449                 d_strerror="$define"
17450                 d_strerrm='strerror(e)'
17451                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17452                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17453                                 d_syserrlst="$define"
17454                 else
17455                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17456                         d_syserrlst="$undef"
17457                 fi
17458     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17459                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17460                 d_strerror="$undef"
17461                 d_syserrlst="$define"
17462                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17463     else
17464                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17465                 d_strerror="$undef"
17466                 d_syserrlst="$undef"
17467                 d_strerrm='"unknown"'
17468     fi
17469 fi
17470
17471 : see if strerror_r exists
17472 set strerror_r d_strerror_r
17473 eval $inlibc
17474 case "$d_strerror_r" in
17475 "$define")
17476         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17477         case "$d_strerror_r_proto:$usethreads" in
17478         ":define")      d_strerror_r_proto=define
17479                 set d_strerror_r_proto strerror_r $hdrs
17480                 eval $hasproto ;;
17481         *)      ;;
17482         esac
17483         case "$d_strerror_r_proto" in
17484         define)
17485         case "$strerror_r_proto" in
17486         ''|0) try='int strerror_r(int, char*, size_t);'
17487         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17488         esac
17489         case "$strerror_r_proto" in
17490         ''|0) try='int strerror_r(int, char*, int);'
17491         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17492         esac
17493         case "$strerror_r_proto" in
17494         ''|0) try='char* strerror_r(int, char*, size_t);'
17495         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17496         esac
17497         case "$strerror_r_proto" in
17498         ''|0)   d_strerror_r=undef
17499                 strerror_r_proto=0
17500                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17501         * )     case "$strerror_r_proto" in
17502                 REENTRANT_PROTO*) ;;
17503                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17504                 esac
17505                 echo "Prototype: $try" ;;
17506         esac
17507         ;;
17508         *)      case "$usethreads" in
17509                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17510                 esac
17511                 d_strerror_r=undef
17512                 strerror_r_proto=0
17513                 ;;
17514         esac
17515         ;;
17516 *)      strerror_r_proto=0
17517         ;;
17518 esac
17519
17520 : see if strftime exists
17521 set strftime d_strftime
17522 eval $inlibc
17523
17524 : see if strlcat exists
17525 set strlcat d_strlcat
17526 eval $inlibc
17527
17528 : see if strlcpy exists
17529 set strlcpy d_strlcpy
17530 eval $inlibc
17531
17532 : see if strtod exists
17533 set strtod d_strtod
17534 eval $inlibc
17535
17536 : see if strtol exists
17537 set strtol d_strtol
17538 eval $inlibc
17539
17540 : see if strtold exists
17541 set strtold d_strtold
17542 eval $inlibc
17543
17544 : see if strtoll exists
17545 set strtoll d_strtoll
17546 eval $inlibc
17547
17548 case "$d_longlong-$d_strtoll" in
17549 "$define-$define")
17550         $cat <<EOM
17551 Checking whether your strtoll() works okay...
17552 EOM
17553         $cat >try.c <<'EOCP'
17554 #include <errno.h>
17555 #ifdef __hpux
17556 #define strtoll __strtoll
17557 #endif
17558 #ifdef __EMX__
17559 #define strtoll _strtoll
17560 #endif
17561 #include <stdio.h>
17562 extern long long int strtoll(char *s, char **, int); 
17563 static int bad = 0;
17564 int check(char *s, long long ell, int een) {
17565         long long gll;
17566         errno = 0;
17567         gll = strtoll(s, 0, 10);
17568         if (!((gll == ell) && (errno == een)))
17569                 bad++;
17570 }
17571 int main() {
17572         check(" 1",                                      1LL, 0);
17573         check(" 0",                                      0LL, 0);
17574         check("-1",                                     -1LL, 0);
17575         check("-9223372036854775808", -9223372036854775808LL, 0);
17576         check("-9223372036854775808", -9223372036854775808LL, 0);
17577         check(" 9223372036854775807",  9223372036854775807LL, 0);
17578         check("-9223372036854775808", -9223372036854775808LL, 0);
17579         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17580         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17581         if (!bad)
17582                 printf("ok\n");
17583 }
17584 EOCP
17585         set try
17586         if eval $compile; then
17587                 yyy=`$run ./try`
17588                 case "$yyy" in
17589                 ok) echo "Your strtoll() seems to be working okay." ;;
17590                 *) cat <<EOM >&4
17591 Your strtoll() doesn't seem to be working okay.
17592 EOM
17593                    d_strtoll="$undef"
17594                    ;;
17595                 esac
17596         else
17597                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17598                 d_strtoll="$undef"
17599         fi
17600         ;;
17601 esac
17602
17603 : see if strtoq exists
17604 set strtoq d_strtoq
17605 eval $inlibc
17606
17607 : see if strtoul exists
17608 set strtoul d_strtoul
17609 eval $inlibc
17610
17611 case "$d_strtoul" in
17612 "$define")
17613         $cat <<EOM
17614 Checking whether your strtoul() works okay...
17615 EOM
17616         $cat >try.c <<'EOCP'
17617 #include <errno.h>
17618 #include <stdio.h>
17619 extern unsigned long int strtoul(char *s, char **, int); 
17620 static int bad = 0;
17621 void check(char *s, unsigned long eul, int een) {
17622         unsigned long gul;
17623         errno = 0;
17624         gul = strtoul(s, 0, 10);
17625         if (!((gul == eul) && (errno == een)))
17626                 bad++;
17627 }
17628 int main() {
17629         check(" 1", 1L, 0);
17630         check(" 0", 0L, 0);
17631 EOCP
17632         case "$longsize" in
17633         8)
17634             $cat >>try.c <<'EOCP'
17635         check("18446744073709551615", 18446744073709551615UL, 0);
17636         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17637 #if 0 /* strtoul() for /^-/ strings is undefined. */
17638         check("-1", 18446744073709551615UL, 0);
17639         check("-18446744073709551614", 2, 0);
17640         check("-18446744073709551615", 1, 0);
17641         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17642         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17643 #endif
17644 EOCP
17645                 ;;
17646         4)
17647                     $cat >>try.c <<'EOCP'
17648         check("4294967295", 4294967295UL, 0);
17649         check("4294967296", 4294967295UL, ERANGE);
17650 #if 0 /* strtoul() for /^-/ strings is undefined. */
17651         check("-1", 4294967295UL, 0);
17652         check("-4294967294", 2, 0);
17653         check("-4294967295", 1, 0);
17654         check("-4294967296", 4294967295UL, ERANGE);
17655         check("-4294967297", 4294967295UL, ERANGE);
17656 #endif
17657 EOCP
17658                 ;;
17659         *)
17660 : Should we write these tests to be more portable by sprintf-ing
17661 : ~0 and then manipulating that char string as input for strtol?
17662                 ;;
17663         esac
17664         $cat >>try.c <<'EOCP'
17665         if (!bad)
17666                 printf("ok\n");
17667         return 0;
17668 }
17669 EOCP
17670         set try
17671         if eval $compile; then
17672                 case "`$run ./try`" in
17673                 ok) echo "Your strtoul() seems to be working okay." ;;
17674                 *) cat <<EOM >&4
17675 Your strtoul() doesn't seem to be working okay.
17676 EOM
17677                    d_strtoul="$undef"
17678                    ;;
17679                 esac
17680         else
17681                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17682                 d_strtoul="$undef"
17683         fi
17684         ;;
17685 esac
17686
17687 : see if strtoull exists
17688 set strtoull d_strtoull
17689 eval $inlibc
17690
17691 case "$d_longlong-$d_strtoull" in
17692 "$define-$define")
17693         $cat <<EOM
17694 Checking whether your strtoull() works okay...
17695 EOM
17696         $cat >try.c <<'EOCP'
17697 #include <errno.h>
17698 #ifdef __hpux
17699 #define strtoull __strtoull
17700 #endif
17701 #include <stdio.h>
17702 extern unsigned long long int strtoull(char *s, char **, int); 
17703 static int bad = 0;
17704 int check(char *s, long long eull, int een) {
17705         long long gull;
17706         errno = 0;
17707         gull = strtoull(s, 0, 10);
17708         if (!((gull == eull) && (errno == een)))
17709                 bad++;
17710 }
17711 int main() {
17712         check(" 1",                                        1LL, 0);
17713         check(" 0",                                        0LL, 0);
17714         check("18446744073709551615",  18446744073709551615ULL, 0);
17715         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17716 #if 0 /* strtoull() for /^-/ strings is undefined. */
17717         check("-1",                    18446744073709551615ULL, 0);
17718         check("-18446744073709551614",                     2LL, 0);
17719         check("-18446744073709551615",                     1LL, 0);
17720         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17721         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17722 #endif
17723         if (!bad)
17724                 printf("ok\n");
17725 }
17726 EOCP
17727         set try
17728         if eval $compile; then
17729                 case "`$run ./try`" in
17730                 ok) echo "Your strtoull() seems to be working okay." ;;
17731                 *) cat <<EOM >&4
17732 Your strtoull() doesn't seem to be working okay.
17733 EOM
17734                    d_strtoull="$undef"
17735                    ;;
17736                 esac
17737         else
17738                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17739                 d_strtoull="$undef"
17740         fi
17741         ;;
17742 esac
17743
17744 : see if strtouq exists
17745 set strtouq d_strtouq
17746 eval $inlibc
17747
17748 case "$d_strtouq" in
17749 "$define")
17750         $cat <<EOM
17751 Checking whether your strtouq() works okay...
17752 EOM
17753         $cat >try.c <<'EOCP'
17754 #include <errno.h>
17755 #include <stdio.h>
17756 extern unsigned long long int strtouq(char *s, char **, int); 
17757 static int bad = 0;
17758 void check(char *s, unsigned long long eull, int een) {
17759         unsigned long long gull;
17760         errno = 0;
17761         gull = strtouq(s, 0, 10);
17762         if (!((gull == eull) && (errno == een)))
17763                 bad++;
17764 }
17765 int main() {
17766         check(" 1",                                        1LL, 0);
17767         check(" 0",                                        0LL, 0);
17768         check("18446744073709551615",  18446744073709551615ULL, 0);
17769         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17770 #if 0 /* strtouq() for /^-/ strings is undefined. */
17771         check("-1",                    18446744073709551615ULL, 0);
17772         check("-18446744073709551614",                     2LL, 0);
17773         check("-18446744073709551615",                     1LL, 0);
17774         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17775         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17776 #endif
17777         if (!bad)
17778                 printf("ok\n");
17779         return 0;
17780 }
17781 EOCP
17782         set try
17783         if eval $compile; then
17784                 case "`$run ./try`" in
17785                 ok) echo "Your strtouq() seems to be working okay." ;;
17786                 *) cat <<EOM >&4
17787 Your strtouq() doesn't seem to be working okay.
17788 EOM
17789                    d_strtouq="$undef"
17790                    ;;
17791                 esac
17792         else
17793                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17794                 d_strtouq="$undef"
17795         fi
17796         ;;
17797 esac
17798
17799 : see if strxfrm exists
17800 set strxfrm d_strxfrm
17801 eval $inlibc
17802
17803 : see if symlink exists
17804 set symlink d_symlink
17805 eval $inlibc
17806
17807 : see if syscall exists
17808 set syscall d_syscall
17809 eval $inlibc
17810
17811 : see if prototype for syscall is available
17812 echo " "
17813 set d_syscallproto syscall $i_unistd unistd.h
17814 eval $hasproto
17815
17816 : see if sysconf exists
17817 set sysconf d_sysconf
17818 eval $inlibc
17819
17820 : see if system exists
17821 set system d_system
17822 eval $inlibc
17823
17824 : see if tcgetpgrp exists
17825 set tcgetpgrp d_tcgetpgrp
17826 eval $inlibc
17827
17828 : see if tcsetpgrp exists
17829 set tcsetpgrp d_tcsetpgrp
17830 eval $inlibc
17831
17832 : see if prototype for telldir is available
17833 echo " "
17834 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17835 eval $hasproto
17836
17837 : see if time exists
17838 echo " "
17839 if test "X$d_time" = X -o X"$timetype" = X; then
17840     if set time val -f d_time; eval $csym; $val; then
17841                 echo 'time() found.' >&4
17842                 val="$define"
17843                 rp="What is the type returned by time() on this system?"
17844                 set time_t timetype long stdio.h sys/types.h
17845                 eval $typedef_ask
17846     else
17847                 echo 'time() not found, hope that will do.' >&4
17848                 val="$undef"
17849                 timetype='int';
17850     fi
17851     set d_time
17852     eval $setvar
17853 fi
17854
17855 : see if this is a sys/times.h system
17856 set sys/times.h i_systimes
17857 eval $inhdr
17858
17859 : see if times exists
17860 echo " "
17861 if set times val -f d_times; eval $csym; $val; then
17862         echo 'times() found.' >&4
17863         d_times="$define"
17864         inc=''
17865         case "$i_systimes" in
17866         "$define") inc='sys/times.h';;
17867         esac
17868         rp="What is the type returned by times() on this system?"
17869         set clock_t clocktype long stdio.h sys/types.h $inc
17870         eval $typedef_ask
17871 else
17872         echo 'times() NOT found, hope that will do.' >&4
17873         d_times="$undef"
17874         clocktype='int'
17875 fi
17876
17877 : see if tmpnam_r exists
17878 set tmpnam_r d_tmpnam_r
17879 eval $inlibc
17880 case "$d_tmpnam_r" in
17881 "$define")
17882         hdrs="$i_systypes sys/types.h define stdio.h "
17883         case "$d_tmpnam_r_proto:$usethreads" in
17884         ":define")      d_tmpnam_r_proto=define
17885                 set d_tmpnam_r_proto tmpnam_r $hdrs
17886                 eval $hasproto ;;
17887         *)      ;;
17888         esac
17889         case "$d_tmpnam_r_proto" in
17890         define)
17891         case "$tmpnam_r_proto" in
17892         ''|0) try='char* tmpnam_r(char*);'
17893         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17894         esac
17895         case "$tmpnam_r_proto" in
17896         ''|0)   d_tmpnam_r=undef
17897                 tmpnam_r_proto=0
17898                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17899         * )     case "$tmpnam_r_proto" in
17900                 REENTRANT_PROTO*) ;;
17901                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17902                 esac
17903                 echo "Prototype: $try" ;;
17904         esac
17905         ;;
17906         *)      case "$usethreads" in
17907                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17908                 esac
17909                 d_tmpnam_r=undef
17910                 tmpnam_r_proto=0
17911                 ;;
17912         esac
17913         ;;
17914 *)      tmpnam_r_proto=0
17915         ;;
17916 esac
17917
17918 : see if truncate exists
17919 set truncate d_truncate
17920 eval $inlibc
17921
17922 : see if ttyname_r exists
17923 set ttyname_r d_ttyname_r
17924 eval $inlibc
17925 case "$d_ttyname_r" in
17926 "$define")
17927         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17928         case "$d_ttyname_r_proto:$usethreads" in
17929         ":define")      d_ttyname_r_proto=define
17930                 set d_ttyname_r_proto ttyname_r $hdrs
17931                 eval $hasproto ;;
17932         *)      ;;
17933         esac
17934         case "$d_ttyname_r_proto" in
17935         define)
17936         case "$ttyname_r_proto" in
17937         ''|0) try='int ttyname_r(int, char*, size_t);'
17938         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17939         esac
17940         case "$ttyname_r_proto" in
17941         ''|0) try='int ttyname_r(int, char*, int);'
17942         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17943         esac
17944         case "$ttyname_r_proto" in
17945         ''|0) try='char* ttyname_r(int, char*, int);'
17946         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17947         esac
17948         case "$ttyname_r_proto" in
17949         ''|0)   d_ttyname_r=undef
17950                 ttyname_r_proto=0
17951                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17952         * )     case "$ttyname_r_proto" in
17953                 REENTRANT_PROTO*) ;;
17954                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17955                 esac
17956                 echo "Prototype: $try" ;;
17957         esac
17958         ;;
17959         *)      case "$usethreads" in
17960                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17961                 esac
17962                 d_ttyname_r=undef
17963                 ttyname_r_proto=0
17964                 ;;
17965         esac
17966         ;;
17967 *)      ttyname_r_proto=0
17968         ;;
17969 esac
17970
17971 : see if tzname[] exists
17972 echo " "
17973 if set tzname val -a d_tzname; eval $csym; $val; then
17974         val="$define"
17975         echo 'tzname[] found.' >&4
17976 else
17977         val="$undef"
17978         echo 'tzname[] NOT found.' >&4
17979 fi
17980 set d_tzname
17981 eval $setvar
17982
17983 case "$osname" in
17984 next|rhapsody|darwin) multiarch="$define" ;;
17985 esac
17986 case "$multiarch" in
17987 ''|[nN]*) multiarch="$undef" ;;
17988 esac
17989
17990 : check for ordering of bytes in a UV
17991 echo " "
17992 case "$usecrosscompile$multiarch" in
17993 *$define*)
17994         $cat <<EOM
17995 You seem to be either cross-compiling or doing a multiarchitecture build,
17996 skipping the byteorder check.
17997
17998 EOM
17999         byteorder='ffff'
18000         ;;
18001 *)
18002         case "$byteorder" in
18003         '')
18004                 $cat <<'EOM'
18005 In the following, larger digits indicate more significance.  A big-endian
18006 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18007 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18008 machines may have weird orders like 3412.  A Cray will report 87654321,
18009 an Alpha will report 12345678. If the test program works the default is
18010 probably right.
18011 I'm now running the test program...
18012 EOM
18013                 $cat >try.c <<EOCP
18014 #include <stdio.h>
18015 #$i_stdlib I_STDLIB
18016 #ifdef I_STDLIB
18017 #include <stdlib.h>
18018 #endif
18019 #include <sys/types.h>
18020 typedef $uvtype UV;
18021 int main()
18022 {
18023         int i;
18024         union {
18025                 UV l;
18026                 char c[$uvsize];
18027         } u;
18028
18029         if ($uvsize > 4)
18030                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18031         else
18032                 u.l = (UV)0x04030201;
18033         for (i = 0; i < $uvsize; i++)
18034                 printf("%c", u.c[i]+'0');
18035         printf("\n");
18036         exit(0);
18037 }
18038 EOCP
18039                 xxx_prompt=y
18040                 set try
18041                 if eval $compile && $run ./try > /dev/null; then
18042                         dflt=`$run ./try`
18043                         case "$dflt" in
18044                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18045                                 echo "(The test program ran ok.)"
18046                                 echo "byteorder=$dflt"
18047                                 xxx_prompt=n
18048                         ;;
18049                         ????|????????) echo "(The test program ran ok.)" ;;
18050                         *) echo "(The test program didn't run right for some reason.)" ;;
18051                         esac
18052                 else
18053                         dflt='4321'
18054                         cat <<'EOM'
18055 (I can't seem to compile the test program.  Guessing big-endian...)
18056 EOM
18057                 fi
18058                 case "$xxx_prompt" in
18059                 y)
18060                         rp="What is the order of bytes in $uvtype?"
18061                         . ./myread
18062                         byteorder="$ans"
18063                         ;;
18064                 *)      byteorder=$dflt
18065                         ;;
18066                 esac
18067                 ;;
18068         esac
18069         $rm_try
18070         ;;
18071 esac
18072
18073 $cat <<EOM
18074
18075 Checking to see whether you can access character data unalignedly...
18076 EOM
18077 case "$d_u32align" in
18078 '')   $cat >try.c <<EOCP
18079 #include <stdio.h>
18080 #$i_stdlib I_STDLIB
18081 #ifdef I_STDLIB
18082 #include <stdlib.h>
18083 #endif
18084 #define U32 $u32type
18085 #define BYTEORDER 0x$byteorder
18086 #define U8 $u8type
18087 #include <signal.h>
18088 #ifdef SIGBUS
18089 $signal_t bletch(int s) { exit(4); }
18090 #endif
18091 int main() {
18092 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18093     U8 buf[8];
18094     U32 *up;
18095     int i;
18096
18097     if (sizeof(U32) != 4) {
18098         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18099         exit(1);
18100     }
18101
18102     fflush(stdout);
18103
18104 #ifdef SIGBUS
18105     signal(SIGBUS, bletch);
18106 #endif
18107
18108     buf[0] = 0;
18109     buf[1] = 0;
18110     buf[2] = 0;
18111     buf[3] = 1;
18112     buf[4] = 0;
18113     buf[5] = 0;
18114     buf[6] = 0;
18115     buf[7] = 1;
18116
18117     for (i = 0; i < 4; i++) {
18118         up = (U32*)(buf + i);
18119         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18120                (*up == 1 << (8*(3-i)))  /* little-endian */
18121               )
18122            )
18123         {
18124             printf("read failed (%x)\n", *up);
18125             exit(2);
18126         }
18127     }
18128
18129     /* write test */
18130     for (i = 0; i < 4; i++) {
18131         up = (U32*)(buf + i);
18132         *up = 0xBeef;
18133         if (*up != 0xBeef) {
18134             printf("write failed (%x)\n", *up);
18135             exit(3);
18136         }
18137     }
18138
18139     exit(0);
18140 #else
18141     printf("1\n");
18142     exit(1);
18143 #endif
18144     return 0;
18145 }
18146 EOCP
18147 set try
18148 if eval $compile_ok; then
18149         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18150         $run ./try 2>&1 >/dev/null
18151         case "$?" in
18152         0)      cat >&4 <<EOM
18153 You can access character data pretty unalignedly.
18154 EOM
18155                 d_u32align="$undef"
18156                 ;;
18157         *)      cat >&4 <<EOM
18158 It seems that you must access character data in an aligned manner.
18159 EOM
18160                 d_u32align="$define"
18161                 ;;
18162         esac
18163 else
18164         rp='Can you access character data at unaligned addresses?'
18165         dflt='n'
18166         . ./myread
18167         case "$ans" in
18168         [yY]*)  d_u32align="$undef"  ;;
18169         *)      d_u32align="$define" ;;
18170         esac
18171 fi
18172 $rm_try
18173 ;;
18174 esac
18175
18176 : see if ualarm exists
18177 set ualarm d_ualarm
18178 eval $inlibc
18179
18180 : see if umask exists
18181 set umask d_umask
18182 eval $inlibc
18183
18184 : see if unordered exists
18185 set unordered d_unordered
18186 eval $inlibc
18187
18188 : see if unsetenv exists
18189 set unsetenv d_unsetenv
18190 eval $inlibc
18191
18192 : see if usleep exists
18193 set usleep d_usleep
18194 eval $inlibc
18195
18196 : see if prototype for usleep is available
18197 echo " "
18198 set d_usleepproto usleep $i_unistd unistd.h
18199 eval $hasproto
18200
18201 : see if ustat exists
18202 set ustat d_ustat
18203 eval $inlibc
18204
18205 : see if closedir exists
18206 set closedir d_closedir
18207 eval $inlibc
18208
18209 case "$d_closedir" in
18210 "$define")
18211         echo " "
18212         echo "Checking whether closedir() returns a status..." >&4
18213         cat > try.c <<EOM
18214 #$i_dirent I_DIRENT             /**/
18215 #$i_sysdir I_SYS_DIR            /**/
18216 #$i_sysndir I_SYS_NDIR          /**/
18217 #$i_systypes I_SYS_TYPES        /**/
18218
18219 #if defined(I_SYS_TYPES)
18220 #include <sys/types.h>
18221 #endif
18222 #if defined(I_DIRENT)
18223 #include <dirent.h>
18224 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18225 #include <sys/dir.h>
18226 #endif
18227 #else
18228 #ifdef I_SYS_NDIR
18229 #include <sys/ndir.h>
18230 #else
18231 #ifdef I_SYS_DIR
18232 #ifdef hp9000s500
18233 #include <ndir.h>       /* may be wrong in the future */
18234 #else
18235 #include <sys/dir.h>
18236 #endif
18237 #endif
18238 #endif
18239 #endif
18240 int main() { return closedir(opendir(".")); }
18241 EOM
18242         set try
18243         if eval $compile_ok; then
18244                 if $run ./try > /dev/null 2>&1 ; then
18245                         echo "Yes, it does."
18246                         val="$undef"
18247                 else
18248                         echo "No, it doesn't."
18249                         val="$define"
18250                 fi
18251         else
18252                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18253                 val="$define"
18254         fi
18255         ;;
18256 *)
18257         val="$undef";
18258         ;;
18259 esac
18260 set d_void_closedir
18261 eval $setvar
18262 $rm_try
18263
18264 : see if there is a wait4
18265 set wait4 d_wait4
18266 eval $inlibc
18267
18268 : see if waitpid exists
18269 set waitpid d_waitpid
18270 eval $inlibc
18271
18272 : see if wcstombs exists
18273 set wcstombs d_wcstombs
18274 eval $inlibc
18275
18276 : see if wctomb exists
18277 set wctomb d_wctomb
18278 eval $inlibc
18279
18280 : see if writev exists
18281 set writev d_writev
18282 eval $inlibc
18283
18284 : preserve RCS keywords in files with variable substitution, grrr
18285 Date='$Date'
18286 Id='$Id'
18287 Log='$Log'
18288 RCSfile='$RCSfile'
18289 Revision='$Revision'
18290
18291 : check for alignment requirements
18292 echo " "
18293 case "$usecrosscompile$multiarch" in
18294 *$define*)
18295         $cat <<EOM
18296 You seem to be either cross-compiling or doing a multiarchitecture build,
18297 skipping the memory alignment check.
18298
18299 EOM
18300         case "$alignbytes" in
18301         '') alignbytes=8 ;;
18302         esac
18303         ;;
18304 *)
18305         case "$alignbytes" in
18306         '') echo "Checking alignment constraints..." >&4
18307                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18308                         $cat >try.c <<'EOCP'
18309 typedef long double NV;
18310 EOCP
18311                 else
18312                         $cat >try.c <<'EOCP'
18313 typedef double NV;
18314 EOCP
18315                 fi
18316                 $cat >>try.c <<'EOCP'
18317 #include <stdio.h>
18318 struct foobar {
18319         char foo;
18320         NV bar;
18321 } try_algn;
18322 int main()
18323 {
18324     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18325     return(0);
18326 }
18327 EOCP
18328                 set try
18329                 if eval $compile_ok; then
18330                         dflt=`$run ./try`
18331                 else
18332                         dflt='8'
18333                         echo "(I can't seem to compile the test program...)"
18334                 fi
18335                 ;;
18336         *) dflt="$alignbytes"
18337                 ;;
18338         esac
18339         rp="Doubles must be aligned on a how-many-byte boundary?"
18340         . ./myread
18341         alignbytes="$ans"
18342         $rm_try
18343         ;;
18344 esac
18345
18346
18347 : set the base revision
18348 baserev=5.0
18349
18350 : how do we concatenate cpp tokens here?
18351 echo " "
18352 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18353 $cat >cpp_stuff.c <<'EOCP'
18354 #define RCAT(a,b)a/**/b
18355 #define ACAT(a,b)a ## b
18356 RCAT(Rei,ser)
18357 ACAT(Cir,cus)
18358 EOCP
18359 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18360 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18361         echo "Oh!  Smells like ANSI's been here." >&4
18362         echo "We can catify or stringify, separately or together!"
18363         cpp_stuff=42
18364 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18365         echo "Ah, yes!  The good old days!" >&4
18366         echo "However, in the good old days we don't know how to stringify and"
18367         echo "catify at the same time."
18368         cpp_stuff=1
18369 else
18370         $cat >&4 <<EOM
18371 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18372 You're going to have to edit the values of CAT[2-5] in config.h...
18373 EOM
18374         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18375 fi
18376 $rm -f cpp_stuff.*
18377
18378 : see if this is a db.h system
18379 set db.h i_db
18380 eval $inhdr
18381
18382 case "$i_db" in
18383 $define)
18384         : Check db version.
18385         echo " "
18386         echo "Checking Berkeley DB version ..." >&4
18387         $cat >try.c <<EOCP
18388 #$d_const HASCONST
18389 #ifndef HASCONST
18390 #define const
18391 #endif
18392 #include <sys/types.h>
18393 #include <stdio.h>
18394 #$i_stdlib I_STDLIB
18395 #ifdef I_STDLIB
18396 #include <stdlib.h>
18397 #endif
18398 #include <db.h>
18399 int main(int argc, char *argv[])
18400 {
18401 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18402     int Major, Minor, Patch ;
18403     unsigned long Version ;
18404     (void)db_version(&Major, &Minor, &Patch) ;
18405     if (argc == 2) {
18406         printf("%d %d %d %d %d %d\n",
18407                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18408                Major, Minor, Patch);
18409         exit(0);
18410     }
18411     printf("You have Berkeley DB Version 2 or greater.\n");
18412
18413     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18414                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18415     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18416                 Major, Minor, Patch) ;
18417
18418     /* check that db.h & libdb are compatible */
18419     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18420         printf("db.h and libdb are incompatible.\n") ;
18421         exit(3);
18422     }
18423
18424     printf("db.h and libdb are compatible.\n") ;
18425
18426     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18427                 + DB_VERSION_PATCH ;
18428
18429     /* needs to be >= 2.3.4 */
18430     if (Version < 2003004) {
18431     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18432         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18433         exit(2);
18434     }
18435
18436     exit(0);
18437 #else
18438 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18439     if (argc == 2) {
18440         printf("1 0 0\n");
18441         exit(0);
18442     }
18443     printf("You have Berkeley DB Version 1.\n");
18444     exit(0);    /* DB version < 2: the coast is clear. */
18445 #else
18446     exit(1);    /* <db.h> not Berkeley DB? */
18447 #endif
18448 #endif
18449 }
18450 EOCP
18451         set try
18452         if eval $compile_ok && $run ./try; then
18453                 echo 'Looks OK.' >&4
18454                 set `$run ./try 1`
18455                 db_version_major=$1
18456                 db_version_minor=$2
18457                 db_version_patch=$3
18458         else
18459                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18460                 i_db=$undef
18461                 case " $libs " in
18462                 *"-ldb "*)
18463                         : Remove db from list of libraries to use
18464                         echo "Removing unusable -ldb from library list" >&4
18465                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18466                         shift
18467                         libs="$*"
18468                         echo "libs = $libs" >&4
18469                         ;;
18470                 esac
18471         fi
18472         $rm_try
18473         ;;
18474 esac
18475
18476 case "$i_db" in
18477 define)
18478         : Check the return type needed for hash
18479         echo " "
18480         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18481         $cat >try.c <<EOCP
18482 #$d_const HASCONST
18483 #ifndef HASCONST
18484 #define const
18485 #endif
18486 #include <sys/types.h>
18487 #include <db.h>
18488
18489 #ifndef DB_VERSION_MAJOR
18490 u_int32_t hash_cb (ptr, size)
18491 const void *ptr;
18492 size_t size;
18493 {
18494 }
18495 HASHINFO info;
18496 int main()
18497 {
18498         info.hash = hash_cb;
18499 }
18500 #endif
18501 EOCP
18502         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18503                 if $contains warning try.out >>/dev/null 2>&1 ; then
18504                         db_hashtype='int'
18505                 else
18506                         db_hashtype='u_int32_t'
18507                 fi
18508         else
18509                 : XXX Maybe we should just give up here.
18510                 db_hashtype=u_int32_t
18511                 $cat try.out >&4
18512                 echo "Help:  I can't seem to compile the db test program." >&4
18513                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18514         fi
18515         $rm_try
18516         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18517         ;;
18518 *)      db_hashtype=u_int32_t
18519         ;;
18520 esac
18521 case "$i_db" in
18522 define)
18523         : Check the return type needed for prefix
18524         echo " "
18525         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18526         cat >try.c <<EOCP
18527 #$d_const HASCONST
18528 #ifndef HASCONST
18529 #define const
18530 #endif
18531 #include <sys/types.h>
18532 #include <db.h>
18533
18534 #ifndef DB_VERSION_MAJOR
18535 size_t prefix_cb (key1, key2)
18536 const DBT *key1;
18537 const DBT *key2;
18538 {
18539 }
18540 BTREEINFO info;
18541 int main()
18542 {
18543         info.prefix = prefix_cb;
18544 }
18545 #endif
18546 EOCP
18547         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18548                 if $contains warning try.out >>/dev/null 2>&1 ; then
18549                         db_prefixtype='int'
18550                 else
18551                         db_prefixtype='size_t'
18552                 fi
18553         else
18554                 db_prefixtype='size_t'
18555                 : XXX Maybe we should just give up here.
18556                 $cat try.out >&4
18557                 echo "Help:  I can't seem to compile the db test program." >&4
18558                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18559         fi
18560         $rm_try
18561         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18562         ;;
18563 *)      db_prefixtype='size_t'
18564         ;;
18565 esac
18566
18567 : How can we generate normalized random numbers ?
18568 echo " "
18569 echo "Looking for a random number function..." >&4
18570 case "$randfunc" in
18571 '')
18572         if set drand48 val -f; eval $csym; $val; then
18573                 dflt="drand48"
18574                 echo "Good, found drand48()." >&4
18575         elif set random val -f; eval $csym; $val; then
18576                 dflt="random"
18577                 echo "OK, found random()." >&4
18578         else
18579                 dflt="rand"
18580                 echo "Yick, looks like I have to use rand()." >&4
18581         fi
18582         echo " "
18583         ;;
18584 *)
18585         dflt="$randfunc"
18586         ;;
18587 esac
18588 cont=true
18589
18590 case "$ccflags" in
18591 *-Dmy_rand=*|*-Dmy_srand=*)
18592         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18593         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18594         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18595         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18596         ;;
18597 esac
18598
18599 while $test "$cont"; do
18600         rp="Use which function to generate random numbers?"
18601         . ./myread
18602         if $test "$ans" = "$dflt"; then
18603                 : null
18604         else
18605                 randbits=''
18606         fi
18607         randfunc="$ans"
18608         if set $ans val -f; eval $csym; $val; then
18609                 cont=''
18610         else
18611                 dflt=y
18612                 rp="I cannot find function $ans. Use that name anyway?"
18613                 . ./myread
18614                 dflt=rand
18615                 case "$ans" in
18616                         [yY]*) cont='';;
18617                 esac
18618         fi
18619         case "$cont" in
18620         '')
18621                 case "$randfunc" in
18622                 drand48)
18623                         drand01="drand48()"
18624                         seedfunc="srand48"
18625                         randbits=48
18626                         randseedtype=long
18627                         ;;
18628                 rand|random)
18629                         case "$randbits" in
18630                         '')
18631 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18632                                 $cat >try.c <<EOCP
18633 #$i_unistd I_UNISTD
18634 #$i_stdlib I_STDLIB
18635 #include <stdio.h>
18636 #ifdef I_UNISTD
18637 #  include <unistd.h>
18638 #endif
18639 #ifdef I_STDLIB
18640 #  include <stdlib.h>
18641 #endif
18642 int main()
18643 {
18644         register int i;
18645         register unsigned long tmp;
18646         register unsigned long max = 0L;
18647
18648         for (i = 1000; i; i--) {
18649                 tmp = (unsigned long) $randfunc();
18650                 if (tmp > max) max = tmp;
18651         }
18652         for (i = 0; max; i++)
18653                 max /= 2;
18654         printf("%d\n",i);
18655 }
18656 EOCP
18657                                 set try
18658                                 if eval $compile_ok; then
18659                                         dflt=`try`
18660                                 else
18661                                         dflt='?'
18662                                         echo "(I can't seem to compile the test program...)"
18663                                 fi
18664                                 ;;
18665                         *)
18666                                 dflt="$randbits"
18667                                 ;;
18668                         esac
18669                         rp="How many bits does your $randfunc() function produce?"
18670                         . ./myread
18671                         randbits="$ans"
18672                         $rm_try
18673                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18674                         seedfunc="s$randfunc"
18675                         randseedtype=unsigned
18676                         ;;
18677                 *)
18678                         dflt="31"
18679                         rp="How many bits does your $randfunc() function produce?"
18680                         . ./myread
18681                         randbits="$ans"
18682                         seedfunc="s$randfunc"
18683                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18684                         if set $seedfunc val -f; eval $csym; $val; then
18685                                 echo "(Using $seedfunc() to seed random generator)"
18686                         else
18687                                 echo "(Warning: no $seedfunc() to seed random generator)"
18688                                 seedfunc=rand
18689                         fi
18690                         randseedtype=unsigned
18691                         ;;
18692                 esac
18693                 ;;
18694         esac
18695 done
18696
18697 echo " "
18698 echo "Determining whether or not we are on an EBCDIC system..." >&4
18699 $cat >try.c <<'EOM'
18700 int main()
18701 {
18702   if ('M'==0xd4) return 0;
18703   return 1;
18704 }
18705 EOM
18706
18707 val=$undef
18708 set try
18709 if eval $compile_ok; then
18710         if $run ./try; then
18711                 echo "You seem to speak EBCDIC." >&4
18712                 val="$define"
18713         else
18714                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18715         fi
18716 else
18717         echo "I'm unable to compile the test program." >&4
18718         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18719 fi
18720 $rm_try
18721 set ebcdic
18722 eval $setvar
18723
18724 echo " "
18725 $cat >&4 <<EOM
18726 Checking how to flush all pending stdio output...
18727 EOM
18728 # I only know how to find the first 32 possibly open files on SunOS.
18729 # See also hints/sunos_4_1.sh and util.c  --AD
18730 case "$osname" in
18731 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18732 esac
18733 $cat >>try.c <<EOCP
18734 #include <stdio.h>
18735 #$i_stdlib I_STDLIB
18736 #ifdef I_STDLIB
18737 #include <stdlib.h>
18738 #endif
18739 #$i_unistd I_UNISTD
18740 #ifdef I_UNISTD
18741 # include <unistd.h>
18742 #endif
18743 #$d_sysconf HAS_SYSCONF
18744 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18745 #ifdef HAS_STDIO_STREAM_ARRAY
18746 # define STDIO_STREAM_ARRAY $stdio_stream_array
18747 #endif
18748 int main() {
18749   FILE* p;
18750   unlink("try.out");
18751   p = fopen("try.out", "w");
18752 #ifdef TRY_FPUTC
18753   fputc('x', p);
18754 #else
18755 # ifdef TRY_FPRINTF
18756   fprintf(p, "x");
18757 # endif
18758 #endif
18759 #ifdef TRY_FFLUSH_NULL
18760   fflush(NULL);
18761 #endif
18762 #ifdef TRY_FFLUSH_ALL
18763   {
18764     long open_max = -1;
18765 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18766     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18767 # else
18768 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18769     open_max = sysconf(_SC_OPEN_MAX);
18770 #  else
18771 #   ifdef FOPEN_MAX
18772     open_max = FOPEN_MAX;
18773 #   else
18774 #    ifdef OPEN_MAX
18775     open_max = OPEN_MAX;
18776 #    else
18777 #     ifdef _NFILE
18778     open_max = _NFILE;
18779 #     endif
18780 #    endif
18781 #   endif
18782 #  endif
18783 # endif
18784 # ifdef HAS_STDIO_STREAM_ARRAY
18785     if (open_max > 0) {
18786       long i;
18787       for (i = 0; i < open_max; i++)
18788             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18789                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18790                 STDIO_STREAM_ARRAY[i]._flag)
18791                 fflush(&STDIO_STREAM_ARRAY[i]);
18792     }
18793   }
18794 # endif
18795 #endif
18796   _exit(42);
18797 }
18798 EOCP
18799 : first we have to find out how _not_ to flush
18800 $to try.c
18801 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18802     output=''
18803     set try -DTRY_FPUTC
18804     if eval $compile; then
18805             $run ./try 2>/dev/null
18806             code="$?"
18807             $from try.out
18808             if $test ! -s try.out -a "X$code" = X42; then
18809                 output=-DTRY_FPUTC
18810             fi
18811     fi
18812     case "$output" in
18813     '')
18814             set try -DTRY_FPRINTF
18815             if eval $compile; then
18816                     $run ./try 2>/dev/null
18817                     code="$?"
18818                     $from try.out
18819                     if $test ! -s try.out -a "X$code" = X42; then
18820                         output=-DTRY_FPRINTF
18821                     fi
18822             fi
18823         ;;
18824     esac
18825 fi
18826 : check for fflush NULL behaviour
18827 case "$fflushNULL" in
18828 '')     set try -DTRY_FFLUSH_NULL $output
18829         if eval $compile; then
18830                 $run ./try 2>/dev/null
18831                 code="$?"
18832                 $from try.out
18833                 if $test -s try.out -a "X$code" = X42; then
18834                         fflushNULL="`$cat try.out`"
18835                 else
18836                         if $test "X$code" != X42; then
18837                                 $cat >&4 <<EOM
18838 (If this test failed, don't worry, we'll try another method shortly.)
18839 EOM
18840                         fi
18841                 fi
18842         fi
18843         $rm_try
18844         case "$fflushNULL" in
18845         x)      $cat >&4 <<EOM
18846 Your fflush(NULL) works okay for output streams.
18847 Let's see if it clobbers input pipes...
18848 EOM
18849 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18850 # bug that improperly flushes the input end of pipes.  So we avoid the
18851 # autoflush on fork/system/exec support for now. :-(
18852 $cat >tryp.c <<EOCP
18853 #include <stdio.h>
18854 int
18855 main(int argc, char **argv)
18856 {
18857     char buf[1024];
18858     int i;
18859     char *bp = buf;
18860     while (1) {
18861         while ((i = getc(stdin)) != -1
18862                && (*bp++ = i) != '\n'
18863                && bp < &buf[1024])
18864         /* DO NOTHING */ ;
18865         *bp = '\0';
18866         fprintf(stdout, "%s", buf);
18867         fflush(NULL);
18868         if (i == -1)
18869             return 0;
18870         bp = buf;
18871     }
18872 }
18873 EOCP
18874                 fflushNULL="$define"
18875                 set tryp
18876                 if eval $compile; then
18877                     $rm -f tryp.out
18878                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18879                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18880                        $cat >&4 <<EOM
18881 fflush(NULL) seems to behave okay with input streams.
18882 EOM
18883                         fflushNULL="$define"
18884                     else
18885                         $cat >&4 <<EOM
18886 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18887 EOM
18888                         fflushNULL="$undef"
18889                     fi
18890                 fi
18891                 $rm -f core tryp.c tryp.core core.tryp.*
18892                 ;;
18893         '')     $cat >&4 <<EOM
18894 Your fflush(NULL) isn't working (contrary to ANSI C).
18895 EOM
18896                 fflushNULL="$undef"
18897                 ;;
18898         *)      $cat >&4 <<EOM
18899 Cannot figure out whether your fflush(NULL) works or not.
18900 I'm assuming it doesn't (contrary to ANSI C).
18901 EOM
18902                 fflushNULL="$undef"
18903                 ;;
18904         esac
18905         ;;
18906 $define|true|[yY]*)
18907         fflushNULL="$define"
18908         ;;
18909 *)
18910         fflushNULL="$undef"
18911         ;;
18912 esac
18913 : check explicit looping only if NULL did not work, and if the pipe
18914 : bug does not show up on an explicit flush too
18915 case "$fflushNULL" in
18916 "$undef")
18917         $cat >tryp.c <<EOCP
18918 #include <stdio.h>
18919 int
18920 main(int argc, char **argv)
18921 {
18922     char buf[1024];
18923     int i;
18924     char *bp = buf;
18925     while (1) {
18926         while ((i = getc(stdin)) != -1
18927                && (*bp++ = i) != '\n'
18928                && bp < &buf[1024])
18929         /* DO NOTHING */ ;
18930         *bp = '\0';
18931         fprintf(stdout, "%s", buf);
18932         fflush(stdin);
18933         if (i == -1)
18934             return 0;
18935         bp = buf;
18936     }
18937 }
18938 EOCP
18939         set tryp
18940         if eval $compile; then
18941             $rm -f tryp.out
18942             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18943             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18944                $cat >&4 <<EOM
18945 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18946 EOM
18947                 : now check for fflushall behaviour
18948                 case "$fflushall" in
18949                 '')     set try -DTRY_FFLUSH_ALL $output
18950                         if eval $compile; then
18951                                 $cat >&4 <<EOM
18952 (Now testing the other method--but note that this also may fail.)
18953 EOM
18954                                 $run ./try 2>/dev/null
18955                                 code=$?
18956                                 $from try.out
18957                                 if $test -s try.out -a "X$code" = X42; then
18958                                         fflushall="`$cat try.out`"
18959                                 fi
18960                         fi
18961                         $rm_try
18962                         case "$fflushall" in
18963                         x)      $cat >&4 <<EOM
18964 Whew. Flushing explicitly all the stdio streams works.
18965 EOM
18966                                 fflushall="$define"
18967                                 ;;
18968                         '')     $cat >&4 <<EOM
18969 Sigh. Flushing explicitly all the stdio streams doesn't work.
18970 EOM
18971                                 fflushall="$undef"
18972                                 ;;
18973                         *)      $cat >&4 <<EOM
18974 Cannot figure out whether flushing stdio streams explicitly works or not.
18975 I'm assuming it doesn't.
18976 EOM
18977                                 fflushall="$undef"
18978                                 ;;
18979                         esac
18980                         ;;
18981                 "$define"|true|[yY]*)
18982                         fflushall="$define"
18983                         ;;
18984                 *)
18985                         fflushall="$undef"
18986                         ;;
18987                 esac
18988             else
18989                 $cat >&4 <<EOM
18990 All is futile.  Even fflush(stdin) clobbers input pipes!
18991 EOM
18992                 fflushall="$undef"
18993             fi
18994         else
18995             fflushall="$undef"
18996         fi
18997         $rm -f core tryp.c tryp.core core.tryp.*
18998         ;;
18999 *)      fflushall="$undef"
19000         ;;
19001 esac
19002
19003 case "$fflushNULL$fflushall" in
19004 undefundef)
19005         $cat <<EOM
19006 OK, I give up.  I cannot figure out how to flush pending stdio output.
19007 We won't be flushing handles at all before fork/exec/popen.
19008 EOM
19009         ;;
19010 esac
19011 $rm_try
19012
19013 : Store the full pathname to the ar program for use in the C program
19014 : Respect a hint or command line value for full_ar.
19015 case "$full_ar" in
19016 '') full_ar=$ar ;;
19017 esac
19018
19019 : Store the full pathname to the sed program for use in the C program
19020 full_sed=$sed
19021
19022 : see what type gids are declared as in the kernel
19023 echo " "
19024 echo "Looking for the type for group ids returned by getgid()."
19025 set gid_t gidtype xxx stdio.h sys/types.h
19026 eval $typedef
19027 case "$gidtype" in
19028 xxx)
19029         xxx=`./findhdr sys/user.h`
19030         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19031         case $1 in
19032         unsigned) dflt="$1 $2" ;;
19033         *) dflt="$1" ;;
19034         esac
19035         ;;
19036 *) dflt="$gidtype";;
19037 esac
19038 case "$gidtype" in
19039 gid_t) echo "gid_t found." ;;
19040 *)      rp="What is the type for group ids returned by getgid()?"
19041         . ./myread
19042         gidtype="$ans"
19043         ;;
19044 esac
19045
19046 echo " "
19047 case "$gidtype" in
19048 *_t) zzz="$gidtype"     ;;
19049 *)   zzz="gid"          ;;
19050 esac
19051 echo "Checking the size of $zzz..." >&4 
19052 cat > try.c <<EOCP
19053 #include <sys/types.h>
19054 #include <stdio.h>
19055 #$i_stdlib I_STDLIB
19056 #ifdef I_STDLIB
19057 #include <stdlib.h>
19058 #endif
19059 int main() {
19060     printf("%d\n", (int)sizeof($gidtype));
19061     exit(0);
19062 }
19063 EOCP
19064 set try
19065 if eval $compile_ok; then
19066         yyy=`$run ./try`
19067         case "$yyy" in
19068         '')     gidsize=4
19069                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19070                 ;;
19071         *)      gidsize=$yyy
19072                 echo "Your $zzz is $gidsize bytes long."
19073                 ;;
19074         esac
19075 else
19076         gidsize=4
19077         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19078 fi
19079
19080
19081 echo " "
19082 case "$gidtype" in
19083 *_t) zzz="$gidtype"     ;;
19084 *)   zzz="gid"          ;;
19085 esac
19086 echo "Checking the sign of $zzz..." >&4 
19087 cat > try.c <<EOCP
19088 #include <sys/types.h>
19089 #include <stdio.h>
19090 int main() {
19091         $gidtype foo = -1;
19092         if (foo < 0)
19093                 printf("-1\n");
19094         else
19095                 printf("1\n");
19096 }
19097 EOCP
19098 set try
19099 if eval $compile; then
19100         yyy=`$run ./try`
19101         case "$yyy" in
19102         '')     gidsign=1
19103                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19104                 ;;
19105         *)      gidsign=$yyy
19106                 case "$gidsign" in
19107                  1) echo "Your $zzz is unsigned." ;;
19108                 -1) echo "Your $zzz is signed."   ;;
19109                 esac
19110                 ;;
19111         esac
19112 else
19113         gidsign=1
19114         echo "(I can't compile the test program--guessing unsigned.)" >&4
19115 fi
19116
19117
19118 echo " "
19119
19120 if $test X"$quadtype" != X; then
19121
19122 echo "Checking how to print 64-bit integers..." >&4
19123
19124 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19125         $cat >try.c <<'EOCP'
19126 #include <sys/types.h>
19127 #include <stdio.h>
19128 int main() {
19129   int q = 12345678901;
19130   printf("%ld\n", q);
19131 }
19132 EOCP
19133         set try
19134         if eval $compile; then
19135                 yyy=`$run ./try`
19136                 case "$yyy" in
19137                 12345678901)
19138                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19139                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19140                         echo "We will use %d."
19141                         ;;
19142                 esac
19143         fi
19144 fi
19145
19146 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19147         $cat >try.c <<'EOCP'
19148 #include <sys/types.h>
19149 #include <stdio.h>
19150 int main() {
19151   long q = 12345678901;
19152   printf("%ld\n", q);
19153 }
19154 EOCP
19155         set try
19156         if eval $compile; then
19157                 yyy=`$run ./try`
19158                 case "$yyy" in
19159                 12345678901)
19160                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19161                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19162                         echo "We will use %ld."
19163                         ;;
19164                 esac
19165         fi
19166 fi
19167
19168 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19169         $cat >try.c <<'EOCP'
19170 #include <sys/types.h>
19171 #include <inttypes.h>
19172 #include <stdio.h>
19173 int main() {
19174   int64_t q = 12345678901;
19175   printf("%" PRId64 "\n", q);
19176 }
19177 EOCP
19178         set try
19179         if eval $compile; then
19180                 yyy=`$run ./try`
19181                 case "$yyy" in
19182                 12345678901)
19183                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19184                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19185                         echo "We will use the C9X style."
19186                         ;;
19187                 esac
19188         fi
19189 fi
19190
19191 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19192         $cat >try.c <<EOCP
19193 #include <sys/types.h>
19194 #include <stdio.h>
19195 int main() {
19196   $quadtype q = 12345678901;
19197   printf("%Ld\n", q);
19198 }
19199 EOCP
19200         set try
19201         if eval $compile; then
19202                 yyy=`$run ./try`
19203                 case "$yyy" in
19204                 12345678901)
19205                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19206                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19207                         echo "We will use %Ld."
19208                         ;;
19209                 esac
19210         fi
19211 fi
19212
19213 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19214         $cat >try.c <<'EOCP'
19215 #include <sys/types.h>
19216 #include <stdio.h>
19217 int main() {
19218   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19219   printf("%lld\n", q);
19220 }
19221 EOCP
19222         set try
19223         if eval $compile; then
19224                 yyy=`$run ./try`
19225                 case "$yyy" in
19226                 12345678901)
19227                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19228                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19229                         echo "We will use the %lld style."
19230                         ;;
19231                 esac
19232         fi
19233 fi
19234
19235 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19236         $cat >try.c <<EOCP
19237 #include <sys/types.h>
19238 #include <stdio.h>
19239 int main() {
19240   $quadtype q = 12345678901;
19241   printf("%qd\n", q);
19242 }
19243 EOCP
19244         set try
19245         if eval $compile; then
19246                 yyy=`$run ./try`
19247                 case "$yyy" in
19248                 12345678901)
19249                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19250                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19251                         echo "We will use %qd."
19252                         ;;
19253                 esac
19254         fi
19255 fi
19256
19257 if $test X"$sPRId64" = X; then
19258         echo "Cannot figure out how to print 64-bit integers." >&4
19259 fi
19260 $rm_try
19261
19262 fi
19263
19264 case "$sPRId64" in
19265 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19266         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19267         ;;
19268 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19269         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19270         ;;
19271 esac
19272
19273
19274 echo " "
19275 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19276
19277 if $test X"$ivsize" = X8; then
19278         ivdformat="$sPRId64"
19279         uvuformat="$sPRIu64"
19280         uvoformat="$sPRIo64"
19281         uvxformat="$sPRIx64"
19282         uvXUformat="$sPRIXU64"
19283 else
19284         if $test X"$ivsize" = X"$longsize"; then
19285                 ivdformat='"ld"'
19286                 uvuformat='"lu"'
19287                 uvoformat='"lo"'
19288                 uvxformat='"lx"'
19289                 uvXUformat='"lX"'
19290         else
19291                 if $test X"$ivsize" = X"$intsize"; then
19292                         ivdformat='"d"'
19293                         uvuformat='"u"'
19294                         uvoformat='"o"'
19295                         uvxformat='"x"'
19296                         uvXUformat='"X"'
19297                 else
19298                         : far out
19299                         if $test X"$ivsize" = X"$shortsize"; then
19300                                 ivdformat='"hd"'
19301                                 uvuformat='"hu"'
19302                                 uvoformat='"ho"'
19303                                 uvxformat='"hx"'
19304                                 uvXUformat='"hX"'
19305                         fi
19306                 fi
19307         fi
19308 fi
19309
19310 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19311         nveformat="$sPRIeldbl"
19312         nvfformat="$sPRIfldbl"
19313         nvgformat="$sPRIgldbl"
19314         nvEUformat="$sPRIEUldbl"
19315         nvFUformat="$sPRIFUldbl"
19316         nvGUformat="$sPRIGUldbl"
19317 else
19318         nveformat='"e"'
19319         nvfformat='"f"'
19320         nvgformat='"g"'
19321         nvEUformat='"E"'
19322         nvFUformat='"F"'
19323         nvGUformat='"G"'
19324 fi
19325
19326 case "$ivdformat" in
19327 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19328     exit 1
19329     ;;
19330 esac
19331
19332
19333 echo " "
19334 $echo "Checking the format string to be used for gids..." >&4
19335
19336 case "$gidsign" in
19337 -1)     if $test X"$gidsize" = X"$ivsize"; then
19338                 gidformat="$ivdformat"
19339         else
19340                 if $test X"$gidsize" = X"$longsize"; then
19341                         gidformat='"ld"'
19342                 else
19343                         if $test X"$gidsize" = X"$intsize"; then
19344                                 gidformat='"d"'
19345                         else
19346                                 if $test X"$gidsize" = X"$shortsize"; then
19347                                         gidformat='"hd"'
19348                                 fi
19349                         fi
19350                 fi
19351         fi
19352         ;;
19353 *)      if $test X"$gidsize" = X"$uvsize"; then
19354                 gidformat="$uvuformat"
19355         else
19356                 if $test X"$gidsize" = X"$longsize"; then
19357                         gidformat='"lu"'
19358                 else
19359                         if $test X"$gidsize" = X"$intsize"; then
19360                                 gidformat='"u"'
19361                         else
19362                                 if $test X"$gidsize" = X"$shortsize"; then
19363                                         gidformat='"hu"'
19364                                 fi
19365                         fi
19366                 fi
19367         fi
19368         ;;
19369 esac
19370
19371 : see if getgroups exists
19372 set getgroups d_getgrps
19373 eval $inlibc
19374
19375 : see if setgroups exists
19376 set setgroups d_setgrps
19377 eval $inlibc
19378
19379
19380 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19381 echo " "
19382 case "$d_getgrps$d_setgrps" in
19383 *define*)
19384         case "$groupstype" in
19385         '') dflt="$gidtype" ;;
19386         *)  dflt="$groupstype" ;;
19387         esac
19388         $cat <<EOM
19389 What type of pointer is the second argument to getgroups() and setgroups()?
19390 Usually this is the same as group ids, $gidtype, but not always.
19391
19392 EOM
19393         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19394         . ./myread
19395         groupstype="$ans"
19396         ;;
19397 *)  groupstype="$gidtype";;
19398 esac
19399
19400
19401 if $test $patchlevel -lt 9; then
19402 : MAD is not available in 5.8.x or earlier.
19403     ans=n;
19404 else
19405     case "$mad" in
19406     $define|true|[yY]*) dflt='y' ;;
19407     *)                  dflt='n' ;;
19408     esac
19409     cat <<EOM
19410
19411 Would you like to build with Misc Attribute Decoration? This is development
19412 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19413 overhead on the interpreter.
19414
19415 If this doesn't make any sense to you, just accept the default '$dflt'.
19416 EOM
19417     rp='Build Perl with MAD?'
19418     . ./myread
19419 fi
19420 case "$ans" in
19421 y|Y)    val="$define"
19422         madlyh='madly.h madly.act madly.tab'
19423         madlysrc='madly.c'
19424         madlyobj="madly$_o" ;;
19425 *)      val="$undef"
19426         madlyh=''
19427         madlysrc=''
19428         madlyobj='' ;;
19429 esac
19430 set mad
19431 eval $setvar
19432
19433 echo " "
19434 echo "Checking if your $make program sets \$(MAKE)..." >&4
19435 case "$make_set_make" in
19436 '')
19437         $sed 's/^X //' > testmake.mak << 'EOF'
19438 Xall:
19439 X       @echo 'maketemp="$(MAKE)"'
19440 EOF
19441         case "`$make -f testmake.mak 2>/dev/null`" in
19442         *maketemp=*) make_set_make='#' ;;
19443         *)      make_set_make="MAKE=$make" ;;
19444         esac
19445         $rm -f testmake.mak
19446         ;;
19447 esac
19448 case "$make_set_make" in
19449 '#') echo "Yup, it does.";;
19450 *) echo "Nope, it doesn't.";;
19451 esac
19452
19453 : see what type is used for mode_t
19454 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19455 set mode_t modetype int stdio.h sys/types.h
19456 eval $typedef_ask
19457
19458 : see if we need va_copy
19459 echo " "
19460 case "$i_stdarg" in
19461 "$define")
19462         $cat >try.c <<EOCP
19463 #include <stdarg.h>
19464 #include <stdio.h>
19465 #$i_stdlib I_STDLIB
19466 #ifdef I_STDLIB
19467 #include <stdlib.h>
19468 #endif
19469 #include <signal.h>
19470
19471 int
19472 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19473 {
19474   return vfprintf(f, fmt, *valp);
19475 }
19476
19477 int
19478 myvfprintf(FILE *f, const  char *fmt, va_list val)
19479 {
19480   return ivfprintf(f, fmt, &val);
19481 }
19482
19483 int
19484 myprintf(char *fmt, ...)
19485 {
19486   va_list val;
19487   va_start(val, fmt);
19488   return myvfprintf(stdout, fmt, val);
19489 }
19490
19491 int
19492 main(int ac, char **av)
19493 {
19494   signal(SIGSEGV, exit);
19495
19496   myprintf("%s%cs all right, then\n", "that", '\'');
19497   exit(0);
19498 }
19499 EOCP
19500         set try
19501         if eval $compile && $run ./try 2>&1 >/dev/null; then
19502                 case "`$run ./try`" in
19503                 "that's all right, then")
19504                         okay=yes
19505                         ;;
19506                 esac
19507         fi
19508         case "$okay" in
19509         yes)    echo "It seems that you don't need va_copy()." >&4
19510                 need_va_copy="$undef"
19511                 ;;
19512         *)      echo "It seems that va_copy() or similar will be needed." >&4
19513                 need_va_copy="$define"
19514                 ;;
19515         esac
19516         $rm_try
19517         ;;
19518 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19519         ;;
19520 esac
19521
19522 : see what type is used for size_t
19523 rp="What is the type used for the length parameter for string functions?"
19524 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19525 eval $typedef_ask
19526
19527 : check for type of arguments to gethostbyaddr. 
19528 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19529         case "$d_gethbyaddr" in
19530         $define)
19531                 $cat <<EOM
19532
19533 Checking to see what type of arguments are accepted by gethostbyaddr().
19534 EOM
19535                 hdrs="$define sys/types.h
19536                         $d_socket sys/socket.h 
19537                         $i_niin netinet/in.h 
19538                         $i_netdb netdb.h
19539                         $i_unistd unistd.h"
19540                 : The first arg can 'char *' or 'void *'
19541                 : The second arg is some of integral type
19542                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19543                         for yyy in size_t long int; do
19544                                 case "$netdb_host_type" in
19545                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19546                                         if ./protochk "$try" $hdrs; then
19547                                                 echo "Your system accepts $xxx for the first arg."
19548                                                 echo "...and $yyy for the second arg."
19549                                                 netdb_host_type="$xxx"
19550                                                 netdb_hlen_type="$yyy"
19551                                         fi
19552                                         ;;
19553                                 esac
19554                         done
19555                 done
19556                 : In case none of those worked, prompt the user.
19557                 case "$netdb_host_type" in
19558                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19559                         dflt='char *'
19560                         . ./myread
19561                         netdb_host_type=$ans
19562                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19563                         dflt="$sizetype"
19564                         . ./myread
19565                         netdb_hlen_type=$ans
19566                         ;;
19567                 esac
19568                 ;;
19569         *)      : no gethostbyaddr, so pick harmless defaults
19570                 netdb_host_type='char *'
19571                 netdb_hlen_type="$sizetype"
19572                 ;;
19573         esac
19574         # Remove the "const" if needed. -- but then we'll have a 
19575         # prototype clash!
19576         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19577 fi
19578
19579 : check for type of argument to gethostbyname. 
19580 if test "X$netdb_name_type" = X ; then
19581         case "$d_gethbyname" in
19582         $define)
19583                 $cat <<EOM
19584
19585 Checking to see what type of argument is accepted by gethostbyname().
19586 EOM
19587                 hdrs="$define sys/types.h
19588                         $d_socket sys/socket.h 
19589                         $i_niin netinet/in.h 
19590                         $i_netdb netdb.h
19591                         $i_unistd unistd.h"
19592                 for xxx in "const char *" "char *"; do
19593                         case "$netdb_name_type" in
19594                         '')     try="extern struct hostent *gethostbyname($xxx);"
19595                                 if ./protochk "$try" $hdrs; then
19596                                         echo "Your system accepts $xxx."
19597                                         netdb_name_type="$xxx"
19598                                 fi
19599                                 ;;
19600                         esac
19601                 done
19602                 : In case none of those worked, prompt the user.
19603                 case "$netdb_name_type" in
19604                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19605                         dflt='char *'
19606                         . ./myread
19607                         netdb_name_type=$ans
19608                         ;;
19609                 esac
19610                 ;;
19611         *)      : no gethostbyname, so pick harmless default
19612                 netdb_name_type='char *'
19613                 ;;
19614         esac
19615 fi
19616
19617 : check for type of 1st argument to getnetbyaddr. 
19618 if test "X$netdb_net_type" = X ; then
19619         case "$d_getnbyaddr" in
19620         $define)
19621                 $cat <<EOM
19622
19623 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19624 EOM
19625                 hdrs="$define sys/types.h
19626                         $d_socket sys/socket.h 
19627                         $i_niin netinet/in.h 
19628                         $i_netdb netdb.h
19629                         $i_unistd unistd.h"
19630                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19631                         case "$netdb_net_type" in
19632                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19633                                 if ./protochk "$try" $hdrs; then
19634                                         echo "Your system accepts $xxx."
19635                                         netdb_net_type="$xxx"
19636                                 fi
19637                                 ;;
19638                         esac
19639                 done
19640                 : In case none of those worked, prompt the user.
19641                 case "$netdb_net_type" in
19642                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19643                         dflt='long'
19644                         . ./myread
19645                         netdb_net_type=$ans
19646                         ;;
19647                 esac
19648                 ;;
19649         *)      : no getnetbyaddr, so pick harmless default
19650                 netdb_net_type='long'
19651                 ;;
19652         esac
19653 fi
19654 : locate the preferred pager for this system
19655 fn=f/
19656 case "$pager" in
19657 '')
19658         dflt=''
19659         case "$pg" in
19660         /*) dflt=$pg;;
19661         [a-zA-Z]:/*) dflt=$pg;;
19662         esac
19663         case "$more" in
19664         /*) dflt=$more;;
19665         [a-zA-Z]:/*) dflt=$more;;
19666         esac
19667         case "$less" in
19668         /*) dflt=$less;;
19669         [a-zA-Z]:/*) dflt=$less;;
19670         esac
19671         case "$dflt" in
19672         '') dflt=/usr/ucb/more;;
19673         esac
19674         ;;
19675 *)      dflt="$pager"
19676         : Instruct ./getfile to trust the hinted or previous pager value,
19677         : even if it does not begin with a slash.  For example, on os2,
19678         : pager might be cmd /c more.  See comments in UU/getfile.
19679         fn="f/($pager)"
19680         ;;
19681 esac
19682 echo " "
19683 rp='What pager is used on your system?'
19684 . ./getfile
19685 pager="$ans"
19686
19687 : see what type pids are declared as in the kernel
19688 rp="What is the type of process ids on this system?"
19689 set pid_t pidtype int stdio.h sys/types.h
19690 eval $typedef_ask
19691
19692 : see if ar generates random libraries by itself
19693 echo " "
19694 echo "Checking how to generate random libraries on your machine..." >&4
19695 echo 'int bar1() { return bar2(); }' > bar1.c
19696 echo 'int bar2() { return 2; }' > bar2.c
19697 $cat > foo.c <<EOP
19698 #$i_stdlib I_STDLIB
19699 #ifdef I_STDLIB
19700 #include <stdlib.h>
19701 #endif
19702 int main() { printf("%d\n", bar1()); exit(0); }
19703 EOP
19704 $cc $ccflags -c bar1.c >/dev/null 2>&1
19705 $cc $ccflags -c bar2.c >/dev/null 2>&1
19706 $cc $ccflags -c foo.c >/dev/null 2>&1
19707 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19708 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19709         $run ./foobar >/dev/null 2>&1; then
19710         echo "$ar appears to generate random libraries itself."
19711         orderlib=false
19712         if [ "X$ranlib" = "X" ]; then
19713             ranlib=":"
19714         fi
19715 elif $ar s bar$_a >/dev/null 2>&1 &&
19716         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19717         $run ./foobar >/dev/null 2>&1; then
19718                 echo "a table of contents needs to be added with '$ar s'."
19719                 orderlib=false
19720                 ranlib="$ar s"
19721 elif $ar ts bar$_a >/dev/null 2>&1 &&
19722         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19723         $run ./foobar >/dev/null 2>&1; then
19724                 echo "a table of contents needs to be added with '$ar ts'."
19725                 orderlib=false
19726                 ranlib="$ar ts"
19727 else
19728         case "$ranlib" in
19729         :) ranlib='';;
19730         '')
19731                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19732                 $test -f $ranlib || ranlib=''
19733                 ;;
19734         esac
19735         if $test -n "$ranlib"; then
19736                 echo "your system has '$ranlib'; we'll use that."
19737                 orderlib=false
19738         else
19739                 echo "your system doesn't seem to support random libraries"
19740                 echo "so we'll use lorder and tsort to order the libraries."
19741                 orderlib=true
19742                 ranlib=":"
19743         fi
19744 fi
19745 $rm -f foo* bar*
19746
19747 : check for type of arguments to select. 
19748 case "$selecttype" in
19749 '') case "$d_select" in
19750         $define)
19751                 echo " "
19752                 $cat <<EOM
19753 Checking to see what type of arguments are accepted by select().
19754 EOM
19755                 hdrs="$define sys/types.h
19756                         $i_systime sys/time.h 
19757                         $i_sysselct sys/select.h
19758                         $d_socket sys/socket.h"
19759                 : The first arg can be int, unsigned, or size_t
19760                 : The last arg may or may not be 'const'
19761                 val=''
19762                 : void pointer has been seen but using that
19763                 : breaks the selectminbits test
19764                 for xxx in 'fd_set *' 'int *'; do
19765                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19766                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19767                                         case "$val" in
19768                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19769                                                 if ./protochk "$try" $hdrs; then
19770                                                         echo "Your system accepts $xxx."
19771                                                         val="$xxx"
19772                                                 fi
19773                                                 ;;
19774                                         esac
19775                                 done
19776                         done
19777                 done
19778                 case "$val" in
19779                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19780                         case "$d_fd_set" in
19781                                 $define) dflt="fd_set *" ;;
19782                                 *)              dflt="int *" ;;
19783                         esac
19784                         . ./myread
19785                         val=$ans
19786                         ;;
19787                 esac
19788                 selecttype="$val"
19789                 ;;
19790         *)      : no select, so pick a harmless default
19791                 selecttype='int *'
19792                 ;;
19793         esac
19794         ;;
19795 esac
19796
19797 : check for the select 'width'
19798 case "$selectminbits" in
19799 '') safebits=`expr $ptrsize \* 8`
19800     case "$d_select" in
19801         $define)
19802                 $cat <<EOM
19803
19804 Checking to see on how many bits at a time your select() operates...
19805 EOM
19806                 $cat >try.c <<EOCP
19807 #include <sys/types.h>
19808 #$i_time I_TIME
19809 #$i_systime I_SYS_TIME
19810 #$i_systimek I_SYS_TIME_KERNEL
19811 #ifdef I_TIME
19812 #   include <time.h>
19813 #endif
19814 #ifdef I_SYS_TIME
19815 #   ifdef I_SYS_TIME_KERNEL
19816 #       define KERNEL
19817 #   endif
19818 #   include <sys/time.h>
19819 #   ifdef I_SYS_TIME_KERNEL
19820 #       undef KERNEL
19821 #   endif
19822 #endif
19823 #$i_sysselct I_SYS_SELECT
19824 #ifdef I_SYS_SELECT
19825 #include <sys/select.h>
19826 #endif
19827 #$d_socket HAS_SOCKET
19828 #ifdef HAS_SOCKET
19829 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19830 #endif
19831 #include <stdio.h>
19832 #$i_stdlib I_STDLIB
19833 #ifdef I_STDLIB
19834 #include <stdlib.h>
19835 #endif
19836 $selecttype b;
19837 #define S sizeof(*(b))
19838 #define MINBITS 64
19839 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19840 #define NBITS  (NBYTES * 8)
19841 int main() {
19842     char *s = (char *)malloc(NBYTES);
19843     struct timeval t;
19844     int i;
19845     FILE* fp;
19846     int fd;
19847
19848     if (!s)
19849         exit(1);
19850     fclose(stdin);
19851     fp = fopen("try.c", "r");
19852     if (fp == 0)
19853       exit(2);
19854     fd = fileno(fp);
19855     if (fd < 0)
19856       exit(3);
19857     b = ($selecttype)s;
19858     for (i = 0; i < NBITS; i++)
19859         FD_SET(i, b);
19860     t.tv_sec  = 0;
19861     t.tv_usec = 0;
19862     select(fd + 1, b, 0, 0, &t);
19863     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19864     free(s);
19865     printf("%d\n", i + 1);
19866     return 0;
19867 }
19868 EOCP
19869                 set try
19870                 if eval $compile_ok; then
19871                         selectminbits=`$run ./try`
19872                         case "$selectminbits" in
19873                         '')     cat >&4 <<EOM
19874 Cannot figure out on how many bits at a time your select() operates.
19875 I'll play safe and guess it is $safebits bits.
19876 EOM
19877                                 selectminbits=$safebits
19878                                 bits="$safebits bits"
19879                                 ;;
19880                         1)      bits="1 bit" ;;
19881                         *)      bits="$selectminbits bits" ;;
19882                         esac
19883                         echo "Your select() operates on $bits at a time." >&4
19884                 else
19885                         rp='What is the minimum number of bits your select() operates on?'
19886                         case "$byteorder" in
19887                         12345678)       dflt=64 ;;
19888                         1234)           dflt=32 ;;
19889                         *)              dflt=1  ;;
19890                         esac
19891                         . ./myread
19892                         val=$ans
19893                         selectminbits="$val"
19894                 fi
19895                 $rm_try
19896                 ;;
19897         *)      : no select, so pick a harmless default
19898                 selectminbits=$safebits
19899                 ;;
19900         esac
19901         ;;
19902 esac
19903
19904 : Trace out the files included by signal.h, then look for SIGxxx names.
19905 : Remove SIGARRAYSIZE used by HPUX.
19906 : Remove SIGSTKSIZE used by Linux.
19907 : Remove SIGSTKSZ used by Posix.
19908 : Remove SIGTYP void lines used by OS2.
19909 : Some cpps, like os390, dont give the file name anywhere
19910 if [ "X$fieldn" = X ]; then
19911         : Just make some guesses.  We check them later.
19912         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19913 else
19914         xxx=`echo '#include <signal.h>' |
19915         $cppstdin $cppminus $cppflags 2>/dev/null |
19916         $grep '^[       ]*#.*include' | 
19917         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19918 fi
19919 : Check this list of files to be sure we have parsed the cpp output ok.
19920 : This will also avoid potentially non-existent files, such 
19921 : as ../foo/bar.h
19922 xxxfiles=''
19923 for xx in $xxx /dev/null ; do
19924         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19925 done
19926 : If we have found no files, at least try signal.h
19927 case "$xxxfiles" in
19928 '')     xxxfiles=`./findhdr signal.h` ;;
19929 esac
19930 xxx=`awk '
19931 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19932         print substr($2, 4, 20)
19933 }
19934 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19935         print substr($3, 4, 20)
19936 }' $xxxfiles`
19937 : Append some common names just in case the awk scan failed.
19938 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19939 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19940 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19941 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19942 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19943
19944 : generate a few handy files for later
19945 $cat > signal.c <<EOCP
19946 #include <sys/types.h>
19947 #include <signal.h>
19948 #$i_stdlib I_STDLIB
19949 #ifdef I_STDLIB
19950 #include <stdlib.h>
19951 #endif
19952 #include <stdio.h>
19953 int main() {
19954
19955 /* Strange style to avoid deeply-nested #if/#else/#endif */
19956 #ifndef NSIG
19957 #  ifdef _NSIG
19958 #    define NSIG (_NSIG)
19959 #  endif
19960 #endif
19961
19962 #ifndef NSIG
19963 #  ifdef SIGMAX
19964 #    define NSIG (SIGMAX+1)
19965 #  endif
19966 #endif
19967
19968 #ifndef NSIG
19969 #  ifdef SIG_MAX
19970 #    define NSIG (SIG_MAX+1)
19971 #  endif
19972 #endif
19973
19974 #ifndef NSIG
19975 #  ifdef _SIG_MAX
19976 #    define NSIG (_SIG_MAX+1)
19977 #  endif
19978 #endif
19979
19980 #ifndef NSIG
19981 #  ifdef MAXSIG
19982 #    define NSIG (MAXSIG+1)
19983 #  endif
19984 #endif
19985
19986 #ifndef NSIG
19987 #  ifdef MAX_SIG
19988 #    define NSIG (MAX_SIG+1)
19989 #  endif
19990 #endif
19991
19992 #ifndef NSIG
19993 #  ifdef SIGARRAYSIZE
19994 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19995 #  endif
19996 #endif
19997
19998 #ifndef NSIG
19999 #  ifdef _sys_nsig
20000 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20001 #  endif
20002 #endif
20003
20004 /* Default to some arbitrary number that's big enough to get most
20005    of the common signals.
20006 */
20007 #ifndef NSIG
20008 #    define NSIG 50
20009 #endif
20010
20011 printf("NSIG %d\n", NSIG);
20012
20013 #ifndef JUST_NSIG
20014
20015 EOCP
20016
20017 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20018 {
20019         printf "#ifdef SIG"; printf $1; printf "\n"
20020         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20021         printf $1; printf ");\n"
20022         printf "#endif\n"
20023 }
20024 END {
20025         printf "#endif /* JUST_NSIG */\n";
20026         printf "exit(0);\n}\n";
20027 }
20028 ' >>signal.c
20029 $cat >signal.awk <<'EOP'
20030 BEGIN { ndups = 0 }
20031 $1 ~ /^NSIG$/ { nsig = $2 }
20032 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20033     if ($2 > maxsig) { maxsig = $2 }
20034     if (sig_name[$2]) {
20035         dup_name[ndups] = $1
20036         dup_num[ndups] = $2
20037         ndups++ 
20038     }
20039     else {
20040         sig_name[$2] = $1
20041         sig_num[$2] = $2
20042     }
20043 }
20044 END { 
20045     if (nsig == 0) {
20046         nsig = maxsig + 1
20047     }
20048     printf("NSIG %d\n", nsig);
20049     for (n = 1; n < nsig; n++) {
20050         if (sig_name[n]) {
20051             printf("%s %d\n", sig_name[n], sig_num[n])
20052         }
20053         else {
20054             printf("NUM%d %d\n", n, n) 
20055         }
20056     }
20057     for (n = 0; n < ndups; n++) {
20058         printf("%s %d\n", dup_name[n], dup_num[n])
20059     }
20060 }
20061 EOP
20062 $cat >signal_cmd <<EOS
20063 $startsh
20064 if $test -s signal.lst; then
20065     echo "Using your existing signal.lst file"
20066         exit 0
20067 fi
20068 xxx="$xxx"
20069 EOS
20070 $cat >>signal_cmd <<'EOS'
20071
20072 set signal
20073 if eval $compile_ok; then
20074         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
20075 else
20076         echo "(I can't seem be able to compile the whole test program)" >&4
20077         echo "(I'll try it in little pieces.)" >&4
20078         set signal -DJUST_NSIG
20079         if eval $compile_ok; then
20080                 $run ./signal$_exe > signal.nsg
20081                 $cat signal.nsg
20082         else
20083                 echo "I can't seem to figure out how many signals you have." >&4
20084                 echo "Guessing 50." >&4
20085                 echo 'NSIG 50' > signal.nsg
20086         fi
20087         : Now look at all the signal names, one at a time.
20088         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20089                 $cat > signal.c <<EOCP
20090 #include <sys/types.h>
20091 #include <signal.h>
20092 #include <stdio.h>
20093 int main() {
20094 printf("$xx %d\n", SIG${xx});
20095 return 0;
20096 }
20097 EOCP
20098                 set signal
20099                 if eval $compile; then
20100                         echo "SIG${xx} found."
20101                         $run ./signal$_exe  >> signal.ls1
20102                 else
20103                         echo "SIG${xx} NOT found."
20104                 fi
20105         done
20106         if $test -s signal.ls1; then
20107                 $cat signal.nsg signal.ls1 |
20108                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20109         fi
20110
20111 fi
20112 if $test -s signal.lst; then
20113         :
20114 else
20115         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20116         echo 'kill -l' >signal
20117         set X `csh -f <signal`
20118         $rm -f signal
20119         shift
20120         case $# in
20121         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20122         esac
20123         echo $@ | $tr ' ' $trnl | \
20124             $awk '{ printf "%s %d\n", $1, ++s; }
20125                   END { printf "NSIG %d\n", ++s }' >signal.lst
20126 fi
20127 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20128 EOS
20129 chmod a+x signal_cmd
20130 $eunicefix signal_cmd
20131
20132 : generate list of signal names
20133 echo " "
20134 case "$sig_name_init" in
20135 '') doinit=yes ;;
20136 *)  case "$sig_num_init" in
20137     ''|*,*) doinit=yes ;;
20138     esac ;;
20139 esac
20140 case "$doinit" in
20141 yes)
20142         echo "Generating a list of signal names and numbers..." >&4
20143         . ./signal_cmd
20144         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20145         sig_name=`$awk 'BEGIN { printf "ZERO " }
20146                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20147         sig_num=`$awk  'BEGIN { printf "0 " }
20148                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20149         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20150                              !/^NSIG/   { printf "\"%s\", ", $1 }
20151                              END        { printf "0\n" }' signal.lst`
20152         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20153                              !/^NSIG/   { printf "%d, ", $2}
20154                              END        { printf "0\n"}' signal.lst`
20155         ;;
20156 esac
20157 echo "The following $sig_count signals are available:"
20158 echo " "
20159 echo $sig_name | $awk \
20160 'BEGIN { linelen = 0 }
20161 {
20162         for (i = 1; i <= NF; i++) {
20163                 name = "SIG" $i " "
20164                 linelen = linelen + length(name)
20165                 if (linelen > 70) {
20166                         printf "\n"
20167                         linelen = length(name)
20168                 }
20169                 printf "%s", name
20170         }
20171         printf "\n"
20172 }'
20173 sig_size=`echo $sig_name | awk '{print NF}'`
20174 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
20175
20176 echo " "
20177 case "$sizetype" in
20178 *_t) zzz="$sizetype"    ;;
20179 *)   zzz="filesize"     ;;
20180 esac
20181 echo "Checking the size of $zzz..." >&4 
20182 cat > try.c <<EOCP
20183 #include <sys/types.h>
20184 #include <stdio.h>
20185 #$i_stdlib I_STDLIB
20186 #ifdef I_STDLIB
20187 #include <stdlib.h>
20188 #endif
20189 int main() {
20190     printf("%d\n", (int)sizeof($sizetype));
20191     exit(0);
20192 }
20193 EOCP
20194 set try
20195 if eval $compile_ok; then
20196         yyy=`$run ./try`
20197         case "$yyy" in
20198         '')     sizesize=4
20199                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20200                 ;;
20201         *)      sizesize=$yyy
20202                 echo "Your $zzz size is $sizesize bytes."
20203                 ;;
20204         esac
20205 else
20206         sizesize=4
20207         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20208 fi
20209
20210
20211 : check for socklen_t
20212 echo " "
20213 echo "Checking to see if you have socklen_t..." >&4
20214 $cat >try.c <<EOCP
20215 #include <sys/types.h>
20216 #$d_socket HAS_SOCKET
20217 #ifdef HAS_SOCKET
20218 #include <sys/socket.h>
20219 #endif
20220 int main() { socklen_t x = 16; }
20221 EOCP
20222 set try
20223 if eval $compile; then
20224         val="$define"
20225         echo "You have socklen_t."
20226 else
20227         val="$undef"
20228         echo "You do not have socklen_t."
20229         case "$sizetype" in
20230         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20231         esac
20232 fi
20233 $rm_try
20234 set d_socklen_t
20235 eval $setvar
20236
20237 : see if this is a socks.h system
20238 set socks.h i_socks
20239 eval $inhdr
20240
20241 : check for type of the size argument to socket calls
20242 case "$d_socket" in
20243 "$define")
20244         $cat <<EOM
20245
20246 Checking to see what type is the last argument of accept().
20247 EOM
20248         yyy=''
20249         case "$d_socklen_t" in
20250         "$define") yyy="$yyy socklen_t"
20251         esac
20252         yyy="$yyy $sizetype int long unsigned"
20253         for xxx in $yyy; do
20254                 case "$socksizetype" in
20255                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20256                         case "$usesocks" in
20257                         "$define")
20258                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20259                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20260                                         socksizetype="$xxx"
20261                                 fi
20262                                 ;;
20263                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20264                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20265                                         socksizetype="$xxx"
20266                                 fi
20267                                 ;;
20268                         esac
20269                         ;;
20270                 esac
20271         done
20272 : In case none of those worked, prompt the user.
20273         case "$socksizetype" in
20274         '')     rp='What is the type for socket address structure sizes?'
20275                 dflt='int'
20276                 . ./myread
20277                 socksizetype=$ans
20278                 ;;
20279         esac
20280         ;;
20281 *)      : no sockets, so pick relatively harmless default
20282         socksizetype='int'
20283         ;;
20284 esac
20285
20286 : see what type is used for signed size_t
20287 set ssize_t ssizetype int stdio.h sys/types.h
20288 eval $typedef
20289 dflt="$ssizetype"
20290 $cat > try.c <<EOM
20291 #include <stdio.h>
20292 #$i_stdlib I_STDLIB
20293 #ifdef I_STDLIB
20294 #include <stdlib.h>
20295 #endif
20296 #include <sys/types.h>
20297 #define Size_t $sizetype
20298 #define SSize_t $dflt
20299 int main()
20300 {
20301         if (sizeof(Size_t) == sizeof(SSize_t))
20302                 printf("$dflt\n");
20303         else if (sizeof(Size_t) == sizeof(int))
20304                 printf("int\n");
20305         else
20306                 printf("long\n");
20307         exit(0);
20308 }
20309 EOM
20310 echo " "
20311 set try
20312 if eval $compile_ok && $run ./try > /dev/null; then
20313         ssizetype=`$run ./try`
20314         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20315 else
20316         $cat >&4 <<EOM
20317 Help! I can't compile and run the ssize_t test program: please enlighten me!
20318 (This is probably a misconfiguration in your system or libraries, and
20319 you really ought to fix it.  Still, I'll try anyway.)
20320
20321 I need a type that is the same size as $sizetype, but is guaranteed to
20322 be signed.  Common values are ssize_t, int and long.
20323
20324 EOM
20325         rp="What signed type is the same size as $sizetype?"
20326         . ./myread
20327         ssizetype="$ans"
20328 fi
20329 $rm_try
20330
20331 : see what type of char stdio uses.
20332 echo " "
20333 echo '#include <stdio.h>' > stdio.c
20334 $cppstdin $cppminus < stdio.c > stdioh
20335 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20336         echo "Your stdio uses unsigned chars." >&4
20337         stdchar="unsigned char"
20338 else
20339         echo "Your stdio uses signed chars." >&4
20340         stdchar="char"
20341 fi
20342 $rm -f stdio.* stdioh
20343
20344 : see what type uids are declared as in the kernel
20345 echo " "
20346 echo "Looking for the type for user ids returned by getuid()."
20347 set uid_t uidtype xxx stdio.h sys/types.h
20348 eval $typedef
20349 case "$uidtype" in
20350 xxx)
20351         xxx=`./findhdr sys/user.h`
20352         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20353         case $1 in
20354         unsigned) dflt="$1 $2" ;;
20355         *) dflt="$1" ;;
20356         esac
20357         ;;
20358 *) dflt="$uidtype";;
20359 esac
20360 case "$uidtype" in
20361 uid_t)  echo "uid_t found." ;;
20362 *)      rp="What is the type for user ids returned by getuid()?"
20363         . ./myread
20364         uidtype="$ans"
20365         ;;
20366 esac
20367
20368 echo " "
20369 case "$uidtype" in
20370 *_t) zzz="$uidtype"     ;;
20371 *)   zzz="uid"          ;;
20372 esac
20373 echo "Checking the size of $zzz..." >&4 
20374 cat > try.c <<EOCP
20375 #include <sys/types.h>
20376 #include <stdio.h>
20377 #$i_stdlib I_STDLIB
20378 #ifdef I_STDLIB
20379 #include <stdlib.h>
20380 #endif
20381 int main() {
20382     printf("%d\n", (int)sizeof($uidtype));
20383     exit(0);
20384 }
20385 EOCP
20386 set try
20387 if eval $compile_ok; then
20388         yyy=`$run ./try`
20389         case "$yyy" in
20390         '')     uidsize=4
20391                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20392                 ;;
20393         *)      uidsize=$yyy
20394                 echo "Your $zzz is $uidsize bytes long."
20395                 ;;
20396         esac
20397 else
20398         uidsize=4
20399         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20400 fi
20401
20402 echo " "
20403 case "$uidtype" in
20404 *_t) zzz="$uidtype"     ;;
20405 *)   zzz="uid"          ;;
20406 esac
20407 echo "Checking the sign of $zzz..." >&4
20408 cat > try.c <<EOCP
20409 #include <sys/types.h>
20410 #include <stdio.h>
20411 int main() {
20412         $uidtype foo = -1;
20413         if (foo < 0)
20414                 printf("-1\n");
20415         else
20416                 printf("1\n");
20417 }
20418 EOCP
20419 set try
20420 if eval $compile; then
20421         yyy=`$run ./try`
20422         case "$yyy" in
20423         '')     uidsign=1
20424                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20425                 ;;
20426         *)      uidsign=$yyy
20427                 case "$uidsign" in
20428                  1) echo "Your $zzz is unsigned." ;;
20429                 -1) echo "Your $zzz is signed."   ;;
20430                 esac
20431                 ;;
20432         esac
20433 else
20434         uidsign=1
20435         echo "(I can't compile the test program--guessing unsigned.)" >&4
20436 fi
20437
20438
20439
20440 echo " "
20441 $echo "Checking the format string to be used for uids..." >&4
20442
20443 case "$uidsign" in
20444 -1)     if $test X"$uidsize" = X"$ivsize"; then
20445                 uidformat="$ivdformat"
20446         else
20447                 if $test X"$uidsize" = X"$longsize"; then
20448                         uidformat='"ld"'
20449                 else
20450                         if $test X"$uidsize" = X"$intsize"; then
20451                                 uidformat='"d"'
20452                         else
20453                                 if $test X"$uidsize" = X"$shortsize"; then
20454                                         uidformat='"hd"'
20455                                 fi
20456                         fi
20457                 fi
20458         fi
20459         ;;
20460 *)      if $test X"$uidsize" = X"$uvsize"; then
20461                 uidformat="$uvuformat"
20462         else
20463                 if $test X"$uidsize" = X"$longsize"; then
20464                         uidformat='"lu"'
20465                 else
20466                         if $test X"$uidsize" = X"$intsize"; then
20467                                 uidformat='"u"'
20468                         else
20469                                 if $test X"$uidsize" = X"$shortsize"; then
20470                                         uidformat='"hu"'
20471                                 fi
20472                         fi
20473                 fi
20474         fi
20475         ;;
20476 esac
20477
20478
20479 case "$usesitecustomize" in
20480     $define|true|[Yy]*)
20481         usesitecustomize="$define"
20482         ;;
20483     *)
20484         usesitecustomize="$undef"
20485         ;;
20486     esac
20487
20488 : determine compiler compiler
20489 case "$yacc" in
20490 '')
20491         dflt=yacc;;
20492 *)
20493         dflt="$yacc";;
20494 esac
20495 echo " "
20496 comp='yacc'
20497 if $test -f "$byacc$_exe"; then
20498         dflt="$byacc"
20499         comp="byacc or $comp"
20500 fi
20501 if $test -f "$bison$_exe"; then
20502         comp="$comp or bison -y"
20503 fi
20504 rp="Which compiler compiler ($comp) shall I use?"
20505 . ./myread
20506 yacc="$ans"
20507 case "$yacc" in
20508 *bis*)
20509         case "$yacc" in
20510         *-y*) ;;
20511         *)
20512                 yacc="$yacc -y"
20513                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20514                 ;;
20515         esac
20516         ;;
20517 esac
20518
20519 : see if this is a fp.h system
20520 set fp.h i_fp
20521 eval $inhdr
20522
20523 : see if this is a fp_class.h system
20524 set fp_class.h i_fp_class
20525 eval $inhdr
20526
20527 : see if gdbm.h is available
20528 set gdbm.h t_gdbm
20529 eval $inhdr
20530 case "$t_gdbm" in
20531 $define)
20532         : see if gdbm_open exists
20533         set gdbm_open d_gdbm_open
20534         eval $inlibc
20535         case "$d_gdbm_open" in
20536         $undef)
20537                 t_gdbm="$undef"
20538                 echo "We won't be including <gdbm.h>"
20539                 ;;
20540         esac
20541         ;;
20542 esac
20543 val="$t_gdbm"
20544 set i_gdbm
20545 eval $setvar
20546
20547 : see if this is a ieeefp.h system
20548 case "$i_ieeefp" in
20549 '' ) set ieeefp.h i_ieeefp
20550      eval $inhdr
20551      ;;
20552 esac
20553
20554 : see if this is a libutil.h system
20555 set libutil.h i_libutil
20556 eval $inhdr
20557
20558 : see if mach cthreads are available
20559 if test "X$usethreads" = "X$define"; then
20560         set mach/cthreads.h i_machcthr
20561         eval $inhdr
20562 else
20563         i_machcthr="$undef"
20564 fi
20565
20566
20567
20568 : see if this is a mntent.h system
20569 set mntent.h i_mntent
20570 eval $inhdr
20571
20572 : see if ndbm.h is available
20573 set ndbm.h t_ndbm
20574 eval $inhdr
20575
20576 case "$t_ndbm" in
20577 $undef)
20578     # Some Linux distributions such as RedHat 7.1 put the
20579     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20580     if $test -f /usr/include/gdbm/ndbm.h; then
20581         echo '<gdbm/ndbm.h> found.'
20582         ccflags="$ccflags -I/usr/include/gdbm"
20583         cppflags="$cppflags -I/usr/include/gdbm"
20584         t_ndbm=$define
20585     fi
20586     ;;
20587 esac
20588
20589 case "$t_ndbm" in
20590 $define)
20591         : see if dbm_open exists
20592         set dbm_open d_dbm_open
20593         eval $inlibc
20594         case "$d_dbm_open" in
20595         $undef)
20596                 t_ndbm="$undef"
20597                 echo "We won't be including <ndbm.h>"
20598                 ;;
20599         esac
20600         ;;
20601 esac
20602 val="$t_ndbm"
20603 set i_ndbm
20604 eval $setvar
20605
20606 : see if net/errno.h is available
20607 val=''
20608 set net/errno.h val
20609 eval $inhdr
20610
20611 : Unfortunately, it causes problems on some systems.  Arrgh.
20612 case "$val" in
20613 $define)
20614         cat > try.c <<'EOM'
20615 #include <stdio.h>
20616 #include <errno.h>
20617 #include <net/errno.h>
20618 int func()
20619 {
20620         return ENOTSOCK;
20621 }
20622 EOM
20623         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20624                 echo "We'll be including <net/errno.h>." >&4
20625         else
20626                 echo "We won't be including <net/errno.h>." >&4
20627                 val="$undef"
20628         fi
20629         $rm_try
20630         ;;
20631 esac
20632 set i_neterrno
20633 eval $setvar
20634
20635 : see if netinet/tcp.h is available
20636 set netinet/tcp.h i_netinettcp
20637 eval $inhdr
20638
20639 : see if this is a poll.h system
20640 set poll.h i_poll
20641 eval $inhdr
20642
20643 : see if this is a prot.h system
20644 set prot.h i_prot
20645 eval $inhdr
20646
20647 echo " "
20648 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20649 $cat <<'EOSH' > Cppsym.know
20650 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20651 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20652 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20653 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20654 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20655 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20656 bull c cadmus clipper CMU COFF COMPILER_VERSION
20657 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20658 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20659 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20660 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20661 GLIBC GLIBC_MINOR
20662 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20663 H3050R H3050RX hbullx20 hcx host_mips
20664 hp200 hp300 hp700 HP700 hp800 hp9000
20665 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20666 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20667 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20668 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20669 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20670 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20671 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20672 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20673 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20674 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20675 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20676 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20677 MATH_HAS_NO_SIDE_EFFECTS
20678 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20679 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20680 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20681 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20682 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20683 NetBSD news1500 news1700 news1800 news1900 news3700
20684 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20685 ns32016 ns32332 ns32k nsc32000
20686 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20687 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20688 pc532 pdp11 PGC PIC plexus PORTAR posix
20689 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20690 POSIX_C_SOURCE POSIX_SOURCE POWER
20691 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
20692 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20693 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20694 sony sony_news sonyrisc sparc sparclite spectrum
20695 stardent stdc STDC_EXT stratos sun sun3 sun386
20696 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20697 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20698 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20699 sysV68 sysV88 Tek4132 Tek4300 titan
20700 TM3200 TM5400 TM5600
20701 tower tower32 tower32_200 tower32_600 tower32_700
20702 tower32_800 tower32_850 tss
20703 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20704 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20705 unix UNIX95 UNIX99 unixpc unos
20706 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20707 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20708 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20709 USGr4 USGr4_2
20710 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20711 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20712 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20713 z8000
20714 EOSH
20715 # Maybe put other stuff here too.
20716 cat <<EOSH >>Cppsym.know
20717 $osname
20718 EOSH
20719 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20720 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20721 $cat Cppsym.know > Cppsym.c
20722 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20723 $rm -f Cppsym.a Cppsym.b Cppsym.c
20724 cat <<EOSH > Cppsym
20725 $startsh
20726 if $test \$# -gt 0; then
20727     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20728     if $test -s Cppsym.got; then
20729         $rm -f Cppsym.got
20730         exit 0
20731     fi
20732     $rm -f Cppsym.got
20733     exit 1
20734 else
20735     $tr " " "$trnl" | ./Cppsym.try
20736     exit 0
20737 fi
20738 EOSH
20739 chmod +x Cppsym
20740 $eunicefix Cppsym
20741 cat <<EOSH > Cppsym.try
20742 $startsh
20743 cat <<'EOCP' > try.c
20744 #include <stdio.h>
20745 #if cpp_stuff == 1
20746 #define STRINGIFY(a)    "a"
20747 #endif
20748 #if cpp_stuff == 42
20749 #define StGiFy(a)  #a
20750 #define STRINGIFY(a)    StGiFy(a)
20751 #endif
20752 #if $cpp_stuff != 1 && $cpp_stuff != 42
20753 #   include "Bletch: How does this C preprocessor stringify macros?"
20754 #endif
20755 int main() {
20756 EOCP
20757 $awk \\
20758 EOSH
20759 cat <<'EOSH' >> Cppsym.try
20760 'length($1) > 0 {
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     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20765 }'       >> try.c
20766 echo 'return 0;}' >> try.c
20767 EOSH
20768 cat <<EOSH >> Cppsym.try
20769 ccflags="$ccflags"
20770 case "$osname-$gccversion" in
20771 irix-) ccflags="\$ccflags -woff 1178" ;;
20772 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20773 esac
20774 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20775 EOSH
20776 chmod +x Cppsym.try
20777 $eunicefix Cppsym.try
20778 ./Cppsym < Cppsym.know > Cppsym.true
20779 : Add in any linux cpp "predefined macros":
20780 case "$osname::$gccversion" in
20781   *linux*::*.*)
20782     tHdrH=_tmpHdr
20783     rm -f $tHdrH'.h' $tHdrH
20784     touch $tHdrH'.h'
20785     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20786        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20787        if [ -s $tHdrH'_cppsym.real' ]; then
20788           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20789        fi
20790     fi
20791     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20792   ;;
20793 esac
20794 : now check the C compiler for additional symbols
20795 postprocess_cc_v=''
20796 case "$osname" in
20797 aix) postprocess_cc_v="|$tr , ' '" ;;
20798 esac
20799 $cat >ccsym <<EOS
20800 $startsh
20801 $cat >tmp.c <<EOF
20802 extern int foo;
20803 EOF
20804 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20805 do
20806         case "\$i" in
20807         -D*) echo "\$i" | $sed 's/^-D//';;
20808         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20809         esac
20810 done
20811 $rm_try
20812 EOS
20813 postprocess_cc_v=''
20814 chmod +x ccsym
20815 $eunicefix ccsym
20816 ./ccsym > ccsym1.raw
20817 if $test -s ccsym1.raw; then
20818        $sort ccsym1.raw | $uniq >ccsym.raw
20819 else
20820        mv ccsym1.raw ccsym.raw
20821 fi
20822
20823 $awk '/\=/ { print $0; next }
20824         { print $0"=1" }' ccsym.raw >ccsym.list
20825 $comm -13 Cppsym.true ccsym.list >ccsym.own
20826 $comm -12 Cppsym.true ccsym.list >ccsym.com
20827 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20828 also=''
20829 if $test -z ccsym.raw; then
20830         echo "Your C compiler doesn't seem to define any symbols!" >&4
20831         echo " "
20832         echo "However, your C preprocessor defines the following symbols:"
20833         $cat Cppsym.true
20834         ccsymbols=''
20835         cppsymbols=`$cat Cppsym.true`
20836         cppsymbols=`echo $cppsymbols`
20837         cppccsymbols="$cppsymbols"
20838 else
20839         if $test -s ccsym.com; then
20840                 echo "Your C compiler and pre-processor define these symbols:"
20841                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20842                 also='also '
20843                 symbols='ones'
20844                 cppccsymbols=`$cat ccsym.com`
20845                 cppccsymbols=`echo $cppccsymbols`
20846                 $test "$silent" || sleep 1
20847         fi
20848         if $test -s ccsym.cpp; then
20849                 $test "$also" && echo " "
20850                 echo "Your C pre-processor ${also}defines the following symbols:"
20851                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20852                 also='further '
20853                 cppsymbols=`$cat ccsym.cpp`
20854                 cppsymbols=`echo $cppsymbols`
20855                 $test "$silent" || sleep 1
20856         fi
20857         if $test -s ccsym.own; then
20858                 $test "$also" && echo " "
20859                 echo "Your C compiler ${also}defines the following cpp symbols:"
20860                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20861                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20862                 ccsymbols=`$cat ccsym.own`
20863                 ccsymbols=`echo $ccsymbols`
20864                 $test "$silent" || sleep 1
20865         fi
20866 fi
20867
20868 : see if this is a termio system
20869 val="$undef"
20870 val2="$undef"
20871 val3="$undef"
20872 if $test `./findhdr termios.h`; then
20873         set tcsetattr i_termios
20874         eval $inlibc
20875         val3="$i_termios"
20876 fi
20877 echo " "
20878 case "$val3" in
20879 "$define") echo "You have POSIX termios.h... good!" >&4;;
20880 *) if ./Cppsym pyr; then
20881                 case "`/bin/universe`" in
20882                 ucb) if $test `./findhdr sgtty.h`; then
20883                                 val2="$define"
20884                                 echo "<sgtty.h> found." >&4
20885                         else
20886                                 echo "System is pyramid with BSD universe."
20887                                 echo "<sgtty.h> not found--you could have problems." >&4
20888                         fi;;
20889                 *) if $test `./findhdr termio.h`; then
20890                                 val="$define"
20891                                 echo "<termio.h> found." >&4
20892                         else
20893                                 echo "System is pyramid with USG universe."
20894                                 echo "<termio.h> not found--you could have problems." >&4
20895                         fi;;
20896                 esac
20897         elif ./usg; then
20898                 if $test `./findhdr termio.h`; then
20899                         echo "<termio.h> found." >&4
20900                         val="$define"
20901                 elif $test `./findhdr sgtty.h`; then
20902                         echo "<sgtty.h> found." >&4
20903                         val2="$define"
20904                 else
20905 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20906                 fi
20907         else
20908                 if $test `./findhdr sgtty.h`; then
20909                         echo "<sgtty.h> found." >&4
20910                         val2="$define"
20911                 elif $test `./findhdr termio.h`; then
20912                         echo "<termio.h> found." >&4
20913                         val="$define"
20914                 else
20915 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20916                 fi
20917         fi;;
20918 esac
20919 set i_termio; eval $setvar
20920 val=$val2; set i_sgtty; eval $setvar
20921 val=$val3; set i_termios; eval $setvar
20922
20923 : see if stddef is available
20924 set stddef.h i_stddef
20925 eval $inhdr
20926
20927 : see if assert.h is available
20928 set assert.h i_assert
20929 eval $inhdr
20930
20931 : see if sys/access.h is available
20932 set sys/access.h i_sysaccess
20933 eval $inhdr
20934
20935 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20936 set sys/filio.h i_sysfilio
20937 eval $inhdr
20938 echo " "
20939 if $test `./findhdr sys/ioctl.h`; then
20940         val="$define"
20941         echo '<sys/ioctl.h> found.' >&4
20942 else
20943         val="$undef"
20944         if $test $i_sysfilio = "$define"; then
20945             echo '<sys/ioctl.h> NOT found.' >&4
20946         else
20947                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20948                 $test $i_termio = "$define" && xxx="termio.h"
20949                 $test $i_termios = "$define" && xxx="termios.h"
20950 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20951         fi
20952 fi
20953 set i_sysioctl
20954 eval $setvar
20955
20956 : see if socket ioctl defs are in sys/sockio.h
20957 echo " "
20958 xxx=`./findhdr sys/sockio.h`
20959 if $test "$xxx"; then
20960         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20961                 val="$define"
20962                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20963         else
20964                 val="$undef"
20965                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20966         fi
20967 else
20968         val="$undef"
20969         $cat <<EOM
20970 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20971 EOM
20972 fi
20973 set i_syssockio
20974 eval $setvar
20975
20976
20977 : see if this is a syslog.h system
20978 set syslog.h i_syslog
20979 eval $inhdr
20980
20981
20982 : see if this is a sys/mode.h system
20983 set sys/mode.h i_sysmode
20984 eval $inhdr
20985
20986 : see if sys/resource.h has to be included
20987 set sys/resource.h i_sysresrc
20988 eval $inhdr
20989
20990 : see if sys/security.h is available
20991 set sys/security.h i_syssecrt
20992 eval $inhdr
20993
20994 : see if this is a sys/statvfs.h system
20995 set sys/statvfs.h i_sysstatvfs
20996 eval $inhdr
20997
20998 : see if this is a sys/un.h system
20999 set sys/un.h i_sysun
21000 eval $inhdr
21001
21002
21003 : see if this is a sys/utsname.h system
21004 set sys/utsname.h i_sysutsname
21005 eval $inhdr
21006
21007 : see if this is a syswait system
21008 set sys/wait.h i_syswait
21009 eval $inhdr
21010
21011 : see if this is a ustat.h system
21012 set ustat.h i_ustat
21013 eval $inhdr
21014
21015 : see if this is an utime system
21016 set utime.h i_utime
21017 eval $inhdr
21018
21019 : see if this is a values.h system
21020 set values.h i_values
21021 eval $inhdr
21022
21023 : see if this is a vfork system
21024 case "$d_vfork" in
21025 "$define")
21026         set vfork.h i_vfork
21027         eval $inhdr
21028         ;;
21029 *)
21030         i_vfork="$undef"
21031         ;;
21032 esac
21033
21034 echo " "
21035 echo "Looking for extensions..." >&4
21036 : If we are using the old config.sh, known_extensions may contain
21037 : old or inaccurate or duplicate values.
21038 known_extensions=''
21039 nonxs_extensions=''
21040 : We do not use find because it might not be available.
21041 : We do not just use MANIFEST because the user may have dropped
21042 : some additional extensions into the source tree and expect them
21043 : to be built.
21044
21045 : Function to recursively find available extensions, ignoring DynaLoader
21046 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21047 find_extensions='
21048     for xxx in *; do
21049         case "$xxx" in
21050             DynaLoader|dynaload) ;;
21051             *)
21052             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21053                 known_extensions="$known_extensions $1$xxx";
21054             elif $test -f $xxx/Makefile.PL; then
21055                 nonxs_extensions="$nonxs_extensions $1$xxx";
21056             else
21057                 if $test -d $xxx -a $# -lt 10; then
21058                     set $1$xxx/ $*;
21059                     cd "$xxx";
21060                     eval $find_extensions;
21061                     cd ..;
21062                     shift;
21063                 fi;
21064             fi
21065             ;;
21066         esac;
21067     done'
21068 tdir=`pwd`
21069 cd "$rsrc/ext"
21070 set X
21071 shift
21072 eval $find_extensions
21073 # Special case:  Add in modules that nest beyond the first level.
21074 # Currently threads/shared and Hash/Util/FieldHash, since they are
21075 # not picked up by the recursive find above (and adding in general
21076 # recursive finding breaks SDBM_File/sdbm).
21077 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21078 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21079 set X $known_extensions
21080 shift
21081 known_extensions="$*"
21082 set X $nonxs_extensions
21083 shift
21084 nonxs_extensions="$*"
21085 cd "$tdir"
21086
21087 : Now see which are supported on this system.
21088 avail_ext=''
21089 for xxx in $known_extensions ; do
21090         case "$xxx" in
21091         DB_File|db_file)
21092                 case "$i_db" in
21093                 $define) avail_ext="$avail_ext $xxx" ;;
21094                 esac
21095                 ;;
21096         GDBM_File|gdbm_fil)
21097                 case "$i_gdbm" in
21098                 $define) avail_ext="$avail_ext $xxx" ;;
21099                 esac
21100                 ;;
21101         I18N/Langinfo|i18n_lan)
21102                 case "$i_langinfo$d_nl_langinfo" in
21103                 $define$define) avail_ext="$avail_ext $xxx" ;;
21104                 esac
21105                 ;;
21106         IPC/SysV|ipc/sysv)
21107                 : XXX Do we need a useipcsysv variable here
21108                 case "${d_msg}${d_sem}${d_shm}" in
21109                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21110                 esac
21111                 ;;
21112         NDBM_File|ndbm_fil)
21113                 case "$i_ndbm" in
21114                 $define)
21115                     case "$osname-$use64bitint" in
21116                     hpux-define)
21117                         case "$libs" in
21118                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21119                         esac
21120                         ;;
21121                     *) avail_ext="$avail_ext $xxx" ;;
21122                     esac
21123                     ;;
21124                 esac
21125                 ;;
21126         ODBM_File|odbm_fil)
21127                 case "${i_dbm}${i_rpcsvcdbm}" in
21128                 *"${define}"*)
21129                     case "$d_cplusplus" in
21130                     define) ;; # delete as a function name will not work
21131                     *)  case "$osname-$use64bitint" in
21132                         hpux-define)
21133                             case "$libs" in
21134                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21135                             esac
21136                             ;;
21137                         *) avail_ext="$avail_ext $xxx" ;;
21138                         esac
21139                         ;;
21140                     esac
21141                     ;;
21142                 esac
21143                 ;;
21144         Opcode|opcode)
21145                 case "$useopcode" in
21146                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21147                 esac
21148                 ;;
21149         POSIX|posix)
21150                 case "$useposix" in
21151                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21152                 esac
21153                 ;;
21154         Socket|socket)
21155                 case "$d_socket" in
21156                 true|$define|y)
21157                     case "$osname" in
21158                     beos) ;; # not unless BONE
21159                     *) avail_ext="$avail_ext $xxx" ;;
21160                     esac
21161                     ;;
21162                 esac
21163                 ;;
21164         Sys/Syslog|sys/syslog)
21165                 : XXX syslog requires socket
21166                 case "$d_socket" in
21167                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21168                 esac
21169                 ;;
21170         Thread|thread)
21171                 case "$usethreads" in
21172                 true|$define|y)
21173                         case "$use5005threads" in
21174                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21175                         esac
21176                 esac
21177                 ;;
21178         threads|threads/shared)
21179                 # threads and threads::shared are special cases.
21180                 # To stop people from asking "Perl 5.8.0 was supposed
21181                 # to have this new fancy threads implementation but my
21182                 # perl doesn't have it" and from people trying to
21183                 # (re)install the threads module using CPAN.pm and
21184                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21185                 # the threads.pm and threads/shared.pm will always be
21186                 # there, croaking informatively ("you need to rebuild
21187                 # all of Perl with threads, sorry") when threads haven't
21188                 # been compiled in.
21189                 # --jhi
21190                 avail_ext="$avail_ext $xxx"
21191                 ;;
21192         Win32*)
21193                 case "$osname" in
21194                 cygwin) avail_ext="$avail_ext $xxx" ;;
21195                 esac
21196                 ;;
21197         XS/APItest|xs/apitest)
21198                 # This is just for testing.  Skip it unless we have dynamic loading.
21199
21200                 case "$usedl" in
21201                 $define) avail_ext="$avail_ext $xxx" ;;
21202                 esac
21203                 ;;
21204         XS/Typemap|xs/typemap)
21205                 # This is just for testing.  Skip it unless we have dynamic loading.
21206                 case "$usedl" in
21207                 $define) avail_ext="$avail_ext $xxx" ;;
21208                 esac
21209                 ;;
21210         *)      avail_ext="$avail_ext $xxx"
21211                 ;;
21212         esac
21213 done
21214
21215 set X $avail_ext
21216 shift
21217 avail_ext="$*"
21218
21219 case "$onlyextensions" in
21220 '') ;;
21221 *)  keepextensions=''
21222     echo "You have requested that only certains extensions be included..." >&4
21223     for i in $onlyextensions; do
21224         case " $avail_ext " in
21225         *" $i "*)
21226             echo "Keeping extension $i."
21227             keepextensions="$keepextensions $i"
21228             ;;
21229         *) echo "Ignoring extension $i." ;;
21230         esac
21231     done
21232     avail_ext="$keepextensions"
21233     ;;
21234 esac
21235
21236 case "$noextensions" in
21237 '') ;;
21238 *)  keepextensions=''
21239     echo "You have requested that certain extensions be ignored..." >&4
21240     for i in $avail_ext; do
21241         case " $noextensions " in
21242         *" $i "*) echo "Ignoring extension $i." ;;
21243         *) echo "Keeping extension $i.";
21244            keepextensions="$keepextensions $i"
21245            ;;
21246         esac
21247     done
21248     avail_ext="$keepextensions"
21249     ;;
21250 esac
21251
21252 : Now see which nonxs extensions are supported on this system.
21253 : For now assume all are.
21254 nonxs_ext=''
21255 for xxx in $nonxs_extensions ; do
21256         case "$xxx" in
21257         *)      nonxs_ext="$nonxs_ext $xxx"
21258                 ;;
21259         esac
21260 done
21261
21262 set X $nonxs_ext
21263 shift
21264 nonxs_ext="$*"
21265
21266 case $usedl in
21267 $define)
21268         $cat <<EOM
21269 A number of extensions are supplied with $package.  You may choose to
21270 compile these extensions for dynamic loading (the default), compile
21271 them into the $package executable (static loading), or not include
21272 them at all.  Answer "none" to include no extensions.
21273 Note that DynaLoader is always built and need not be mentioned here.
21274
21275 EOM
21276         case "$dynamic_ext" in
21277         '')
21278                 : Exclude those listed in static_ext
21279                 dflt=''
21280                 for xxx in $avail_ext; do
21281                         case " $static_ext " in
21282                         *" $xxx "*) ;;
21283                         *) dflt="$dflt $xxx" ;;
21284                         esac
21285                 done
21286                 set X $dflt
21287                 shift
21288                 dflt="$*"
21289                 ;;
21290         *)      dflt="$dynamic_ext"
21291                 # Perhaps we are reusing an old out-of-date config.sh.
21292                 case "$hint" in
21293                 previous)
21294                         if test X"$dynamic_ext" != X"$avail_ext"; then
21295                                 $cat <<EOM
21296 NOTICE:  Your previous config.sh list may be incorrect.
21297 The extensions now available to you are
21298         ${avail_ext}
21299 but the default list from your previous config.sh is
21300         ${dynamic_ext}
21301
21302 EOM
21303                         fi
21304                         ;;
21305                 esac
21306                 ;;
21307         esac
21308         case "$dflt" in
21309         '')     dflt=none;;
21310         esac
21311         rp="What extensions do you wish to load dynamically?"
21312         . ./myread
21313         case "$ans" in
21314         none) dynamic_ext=' ' ;;
21315         *) dynamic_ext="$ans" ;;
21316         esac
21317
21318         case "$static_ext" in
21319         '')
21320                 : Exclude those already listed in dynamic linking
21321                 dflt=''
21322                 for xxx in $avail_ext; do
21323                         case " $dynamic_ext " in
21324                         *" $xxx "*) ;;
21325                         *) dflt="$dflt $xxx" ;;
21326                         esac
21327                 done
21328                 set X $dflt
21329                 shift
21330                 dflt="$*"
21331                 ;;
21332         *)  dflt="$static_ext"
21333                 ;;
21334         esac
21335
21336         case "$dflt" in
21337         '')     dflt=none;;
21338         esac
21339         rp="What extensions do you wish to load statically?"
21340         . ./myread
21341         case "$ans" in
21342         none) static_ext=' ' ;;
21343         *) static_ext="$ans" ;;
21344         esac
21345         ;;
21346 *)
21347         $cat <<EOM
21348 A number of extensions are supplied with $package.  Answer "none"
21349 to include no extensions.
21350 Note that DynaLoader is always built and need not be mentioned here.
21351
21352 EOM
21353         case "$static_ext" in
21354         '') dflt="$avail_ext" ;;
21355         *)      dflt="$static_ext"
21356                 # Perhaps we are reusing an old out-of-date config.sh.
21357                 case "$hint" in
21358                 previous)
21359                         if test X"$static_ext" != X"$avail_ext"; then
21360                                 $cat <<EOM
21361 NOTICE:  Your previous config.sh list may be incorrect.
21362 The extensions now available to you are
21363         ${avail_ext}
21364 but the default list from your previous config.sh is
21365         ${static_ext}
21366
21367 EOM
21368                         fi
21369                         ;;
21370                 esac
21371                 ;;
21372         esac
21373         : Exclude those that are not xs extensions
21374         case "$dflt" in
21375         '')     dflt=none;;
21376         esac
21377         rp="What extensions do you wish to include?"
21378         . ./myread
21379         case "$ans" in
21380         none) static_ext=' ' ;;
21381         *) static_ext="$ans" ;;
21382         esac
21383         ;;
21384 esac
21385 #
21386 # Encode is a special case.  If we are building Encode as a static
21387 # extension, we need to explicitly list its subextensions as well.
21388 # For other nested extensions, this is handled automatically by
21389 # the appropriate Makefile.PL.
21390 case " $static_ext " in
21391         *" Encode "*) # Add the subextensions of Encode
21392         cd "$rsrc/ext"
21393         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21394                 static_ext="$static_ext Encode/$xxx"
21395         done
21396         cd "$tdir"
21397         ;;
21398 esac
21399
21400 set X $dynamic_ext $static_ext $nonxs_ext
21401 shift
21402 extensions="$*"
21403
21404 # Sanity check:  We require an extension suitable for use with
21405 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21406 # should show up as failures in the test suite, but it's helpful to
21407 # catch them now.) The 'extensions' list is normally sorted
21408 # alphabetically, so we need to accept either
21409 #    DB_File ... Fcntl ... IO  ....
21410 # or something like
21411 #    Fcntl ... NDBM_File ... IO  ....
21412 case " $extensions"  in
21413 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21414 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21415 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21416 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21417    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21418    ;;
21419 esac
21420
21421 : Remove libraries needed only for extensions
21422 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21423 : The exception is SunOS 4.x, which needs them.
21424 case "${osname}X${osvers}" in
21425 sunos*X4*)
21426     perllibs="$libs"
21427     ;;
21428 *) case "$usedl" in
21429     $define|true|[yY]*)
21430             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21431             shift
21432             perllibs="$*"
21433             ;;
21434     *)  perllibs="$libs"
21435             ;;
21436     esac
21437     ;;
21438 esac
21439
21440 : Remove build directory name from cppstdin so it can be used from
21441 : either the present location or the final installed location.
21442 echo " "
21443 : Get out of the UU directory to get correct path name.
21444 cd ..
21445 case "$cppstdin" in
21446 `pwd`/cppstdin)
21447         echo "Stripping down cppstdin path name"
21448         cppstdin=cppstdin
21449         ;;
21450 esac
21451 cd UU
21452
21453 : end of configuration questions
21454 echo " "
21455 echo "End of configuration questions."
21456 echo " "
21457
21458 : back to where it started
21459 if test -d ../UU; then
21460         cd ..
21461 fi
21462
21463 : configuration may be patched via a 'config.arch' file
21464 if $test -f config.arch; then
21465         echo "I see a config.arch file, loading it."
21466         . ./config.arch
21467 fi
21468
21469 : configuration may be patched via a 'config.over' file
21470 if $test -f config.over; then
21471         echo " "
21472         dflt=y
21473         rp='I see a config.over file.  Do you wish to load it?'
21474         . UU/myread
21475         case "$ans" in
21476         n*) echo "OK, I'll ignore it.";;
21477         *)      . ./config.over
21478                 echo "Configuration override changes have been loaded."
21479                 ;;
21480         esac
21481 fi
21482
21483 : in case they want portability, strip down executable paths
21484 case "$d_portable" in
21485 "$define")
21486         echo " "
21487         echo "Stripping down executable paths..." >&4
21488         for file in $loclist $trylist; do
21489                 eval temp=\$$file
21490                 eval $file=`basename $temp`
21491         done
21492         ;;
21493 esac
21494
21495 : create config.sh file
21496 echo " "
21497 echo "Creating config.sh..." >&4
21498 $spitshell <<EOT >config.sh
21499 $startsh
21500 #
21501 # This file was produced by running the Configure script. It holds all the
21502 # definitions figured out by Configure. Should you modify one of these values,
21503 # do not forget to propagate your changes by running "Configure -der". You may
21504 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21505 #
21506
21507 # Package name      : $package
21508 # Source directory  : $src
21509 # Configuration time: $cf_time
21510 # Configured by     : $cf_by
21511 # Target system     : $myuname
21512
21513 Author='$Author'
21514 Date='$Date'
21515 Header='$Header'
21516 Id='$Id'
21517 Locker='$Locker'
21518 Log='$Log'
21519 Mcc='$Mcc'
21520 RCSfile='$RCSfile'
21521 Revision='$Revision'
21522 Source='$Source'
21523 State='$State'
21524 _a='$_a'
21525 _exe='$_exe'
21526 _o='$_o'
21527 afs='$afs'
21528 afsroot='$afsroot'
21529 alignbytes='$alignbytes'
21530 ansi2knr='$ansi2knr'
21531 aphostname='$aphostname'
21532 api_revision='$api_revision'
21533 api_subversion='$api_subversion'
21534 api_version='$api_version'
21535 api_versionstring='$api_versionstring'
21536 ar='$ar'
21537 archlib='$archlib'
21538 archlibexp='$archlibexp'
21539 archname64='$archname64'
21540 archname='$archname'
21541 archobjs='$archobjs'
21542 asctime_r_proto='$asctime_r_proto'
21543 awk='$awk'
21544 baserev='$baserev'
21545 bash='$bash'
21546 bin='$bin'
21547 binexp='$binexp'
21548 bison='$bison'
21549 byacc='$byacc'
21550 byteorder='$byteorder'
21551 c='$c'
21552 castflags='$castflags'
21553 cat='$cat'
21554 cc='$cc'
21555 cccdlflags='$cccdlflags'
21556 ccdlflags='$ccdlflags'
21557 ccflags='$ccflags'
21558 ccflags_uselargefiles='$ccflags_uselargefiles'
21559 ccname='$ccname'
21560 ccsymbols='$ccsymbols'
21561 ccversion='$ccversion'
21562 cf_by='$cf_by'
21563 cf_email='$cf_email'
21564 cf_time='$cf_time'
21565 chgrp='$chgrp'
21566 chmod='$chmod'
21567 chown='$chown'
21568 clocktype='$clocktype'
21569 comm='$comm'
21570 compress='$compress'
21571 contains='$contains'
21572 cp='$cp'
21573 cpio='$cpio'
21574 cpp='$cpp'
21575 cpp_stuff='$cpp_stuff'
21576 cppccsymbols='$cppccsymbols'
21577 cppflags='$cppflags'
21578 cpplast='$cpplast'
21579 cppminus='$cppminus'
21580 cpprun='$cpprun'
21581 cppstdin='$cppstdin'
21582 cppsymbols='$cppsymbols'
21583 crypt_r_proto='$crypt_r_proto'
21584 cryptlib='$cryptlib'
21585 csh='$csh'
21586 ctermid_r_proto='$ctermid_r_proto'
21587 ctime_r_proto='$ctime_r_proto'
21588 d_Gconvert='$d_Gconvert'
21589 d_PRIEUldbl='$d_PRIEUldbl'
21590 d_PRIFUldbl='$d_PRIFUldbl'
21591 d_PRIGUldbl='$d_PRIGUldbl'
21592 d_PRIXU64='$d_PRIXU64'
21593 d_PRId64='$d_PRId64'
21594 d_PRIeldbl='$d_PRIeldbl'
21595 d_PRIfldbl='$d_PRIfldbl'
21596 d_PRIgldbl='$d_PRIgldbl'
21597 d_PRIi64='$d_PRIi64'
21598 d_PRIo64='$d_PRIo64'
21599 d_PRIu64='$d_PRIu64'
21600 d_PRIx64='$d_PRIx64'
21601 d_SCNfldbl='$d_SCNfldbl'
21602 d__fwalk='$d__fwalk'
21603 d_access='$d_access'
21604 d_accessx='$d_accessx'
21605 d_aintl='$d_aintl'
21606 d_alarm='$d_alarm'
21607 d_archlib='$d_archlib'
21608 d_asctime_r='$d_asctime_r'
21609 d_atolf='$d_atolf'
21610 d_atoll='$d_atoll'
21611 d_attribute_format='$d_attribute_format'
21612 d_attribute_malloc='$d_attribute_malloc'
21613 d_attribute_nonnull='$d_attribute_nonnull'
21614 d_attribute_noreturn='$d_attribute_noreturn'
21615 d_attribute_pure='$d_attribute_pure'
21616 d_attribute_unused='$d_attribute_unused'
21617 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21618 d_bcmp='$d_bcmp'
21619 d_bcopy='$d_bcopy'
21620 d_bsd='$d_bsd'
21621 d_bsdgetpgrp='$d_bsdgetpgrp'
21622 d_bsdsetpgrp='$d_bsdsetpgrp'
21623 d_builtin_choose_expr='$d_builtin_choose_expr'
21624 d_builtin_expect='$d_builtin_expect'
21625 d_bzero='$d_bzero'
21626 d_c99_variadic_macros='$d_c99_variadic_macros'
21627 d_casti32='$d_casti32'
21628 d_castneg='$d_castneg'
21629 d_charvspr='$d_charvspr'
21630 d_chown='$d_chown'
21631 d_chroot='$d_chroot'
21632 d_chsize='$d_chsize'
21633 d_class='$d_class'
21634 d_clearenv='$d_clearenv'
21635 d_closedir='$d_closedir'
21636 d_cmsghdr_s='$d_cmsghdr_s'
21637 d_const='$d_const'
21638 d_copysignl='$d_copysignl'
21639 d_cplusplus='$d_cplusplus'
21640 d_crypt='$d_crypt'
21641 d_crypt_r='$d_crypt_r'
21642 d_csh='$d_csh'
21643 d_ctermid='$d_ctermid'
21644 d_ctermid_r='$d_ctermid_r'
21645 d_ctime_r='$d_ctime_r'
21646 d_cuserid='$d_cuserid'
21647 d_dbl_dig='$d_dbl_dig'
21648 d_dbminitproto='$d_dbminitproto'
21649 d_difftime='$d_difftime'
21650 d_dir_dd_fd='$d_dir_dd_fd'
21651 d_dirfd='$d_dirfd'
21652 d_dirnamlen='$d_dirnamlen'
21653 d_dlerror='$d_dlerror'
21654 d_dlopen='$d_dlopen'
21655 d_dlsymun='$d_dlsymun'
21656 d_dosuid='$d_dosuid'
21657 d_drand48_r='$d_drand48_r'
21658 d_drand48proto='$d_drand48proto'
21659 d_dup2='$d_dup2'
21660 d_eaccess='$d_eaccess'
21661 d_endgrent='$d_endgrent'
21662 d_endgrent_r='$d_endgrent_r'
21663 d_endhent='$d_endhent'
21664 d_endhostent_r='$d_endhostent_r'
21665 d_endnent='$d_endnent'
21666 d_endnetent_r='$d_endnetent_r'
21667 d_endpent='$d_endpent'
21668 d_endprotoent_r='$d_endprotoent_r'
21669 d_endpwent='$d_endpwent'
21670 d_endpwent_r='$d_endpwent_r'
21671 d_endsent='$d_endsent'
21672 d_endservent_r='$d_endservent_r'
21673 d_eofnblk='$d_eofnblk'
21674 d_eunice='$d_eunice'
21675 d_faststdio='$d_faststdio'
21676 d_fchdir='$d_fchdir'
21677 d_fchmod='$d_fchmod'
21678 d_fchown='$d_fchown'
21679 d_fcntl='$d_fcntl'
21680 d_fcntl_can_lock='$d_fcntl_can_lock'
21681 d_fd_macros='$d_fd_macros'
21682 d_fd_set='$d_fd_set'
21683 d_fds_bits='$d_fds_bits'
21684 d_fgetpos='$d_fgetpos'
21685 d_finite='$d_finite'
21686 d_finitel='$d_finitel'
21687 d_flexfnam='$d_flexfnam'
21688 d_flock='$d_flock'
21689 d_flockproto='$d_flockproto'
21690 d_fork='$d_fork'
21691 d_fp_class='$d_fp_class'
21692 d_fpathconf='$d_fpathconf'
21693 d_fpclass='$d_fpclass'
21694 d_fpclassify='$d_fpclassify'
21695 d_fpclassl='$d_fpclassl'
21696 d_fpos64_t='$d_fpos64_t'
21697 d_frexpl='$d_frexpl'
21698 d_fs_data_s='$d_fs_data_s'
21699 d_fseeko='$d_fseeko'
21700 d_fsetpos='$d_fsetpos'
21701 d_fstatfs='$d_fstatfs'
21702 d_fstatvfs='$d_fstatvfs'
21703 d_fsync='$d_fsync'
21704 d_ftello='$d_ftello'
21705 d_ftime='$d_ftime'
21706 d_futimes='$d_futimes'
21707 d_getcwd='$d_getcwd'
21708 d_getespwnam='$d_getespwnam'
21709 d_getfsstat='$d_getfsstat'
21710 d_getgrent='$d_getgrent'
21711 d_getgrent_r='$d_getgrent_r'
21712 d_getgrgid_r='$d_getgrgid_r'
21713 d_getgrnam_r='$d_getgrnam_r'
21714 d_getgrps='$d_getgrps'
21715 d_gethbyaddr='$d_gethbyaddr'
21716 d_gethbyname='$d_gethbyname'
21717 d_gethent='$d_gethent'
21718 d_gethname='$d_gethname'
21719 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21720 d_gethostbyname_r='$d_gethostbyname_r'
21721 d_gethostent_r='$d_gethostent_r'
21722 d_gethostprotos='$d_gethostprotos'
21723 d_getitimer='$d_getitimer'
21724 d_getlogin='$d_getlogin'
21725 d_getlogin_r='$d_getlogin_r'
21726 d_getmnt='$d_getmnt'
21727 d_getmntent='$d_getmntent'
21728 d_getnbyaddr='$d_getnbyaddr'
21729 d_getnbyname='$d_getnbyname'
21730 d_getnent='$d_getnent'
21731 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21732 d_getnetbyname_r='$d_getnetbyname_r'
21733 d_getnetent_r='$d_getnetent_r'
21734 d_getnetprotos='$d_getnetprotos'
21735 d_getpagsz='$d_getpagsz'
21736 d_getpbyname='$d_getpbyname'
21737 d_getpbynumber='$d_getpbynumber'
21738 d_getpent='$d_getpent'
21739 d_getpgid='$d_getpgid'
21740 d_getpgrp2='$d_getpgrp2'
21741 d_getpgrp='$d_getpgrp'
21742 d_getppid='$d_getppid'
21743 d_getprior='$d_getprior'
21744 d_getprotobyname_r='$d_getprotobyname_r'
21745 d_getprotobynumber_r='$d_getprotobynumber_r'
21746 d_getprotoent_r='$d_getprotoent_r'
21747 d_getprotoprotos='$d_getprotoprotos'
21748 d_getprpwnam='$d_getprpwnam'
21749 d_getpwent='$d_getpwent'
21750 d_getpwent_r='$d_getpwent_r'
21751 d_getpwnam_r='$d_getpwnam_r'
21752 d_getpwuid_r='$d_getpwuid_r'
21753 d_getsbyname='$d_getsbyname'
21754 d_getsbyport='$d_getsbyport'
21755 d_getsent='$d_getsent'
21756 d_getservbyname_r='$d_getservbyname_r'
21757 d_getservbyport_r='$d_getservbyport_r'
21758 d_getservent_r='$d_getservent_r'
21759 d_getservprotos='$d_getservprotos'
21760 d_getspnam='$d_getspnam'
21761 d_getspnam_r='$d_getspnam_r'
21762 d_gettimeod='$d_gettimeod'
21763 d_gmtime_r='$d_gmtime_r'
21764 d_gnulibc='$d_gnulibc'
21765 d_grpasswd='$d_grpasswd'
21766 d_hasmntopt='$d_hasmntopt'
21767 d_htonl='$d_htonl'
21768 d_ilogbl='$d_ilogbl'
21769 d_inc_version_list='$d_inc_version_list'
21770 d_index='$d_index'
21771 d_inetaton='$d_inetaton'
21772 d_int64_t='$d_int64_t'
21773 d_isascii='$d_isascii'
21774 d_isfinite='$d_isfinite'
21775 d_isinf='$d_isinf'
21776 d_isnan='$d_isnan'
21777 d_isnanl='$d_isnanl'
21778 d_killpg='$d_killpg'
21779 d_lchown='$d_lchown'
21780 d_ldbl_dig='$d_ldbl_dig'
21781 d_libm_lib_version='$d_libm_lib_version'
21782 d_link='$d_link'
21783 d_localtime_r='$d_localtime_r'
21784 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21785 d_locconv='$d_locconv'
21786 d_lockf='$d_lockf'
21787 d_longdbl='$d_longdbl'
21788 d_longlong='$d_longlong'
21789 d_lseekproto='$d_lseekproto'
21790 d_lstat='$d_lstat'
21791 d_madvise='$d_madvise'
21792 d_malloc_good_size='$d_malloc_good_size'
21793 d_malloc_size='$d_malloc_size'
21794 d_mblen='$d_mblen'
21795 d_mbstowcs='$d_mbstowcs'
21796 d_mbtowc='$d_mbtowc'
21797 d_memchr='$d_memchr'
21798 d_memcmp='$d_memcmp'
21799 d_memcpy='$d_memcpy'
21800 d_memmove='$d_memmove'
21801 d_memset='$d_memset'
21802 d_mkdir='$d_mkdir'
21803 d_mkdtemp='$d_mkdtemp'
21804 d_mkfifo='$d_mkfifo'
21805 d_mkstemp='$d_mkstemp'
21806 d_mkstemps='$d_mkstemps'
21807 d_mktime='$d_mktime'
21808 d_mmap='$d_mmap'
21809 d_modfl='$d_modfl'
21810 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21811 d_modflproto='$d_modflproto'
21812 d_mprotect='$d_mprotect'
21813 d_msg='$d_msg'
21814 d_msg_ctrunc='$d_msg_ctrunc'
21815 d_msg_dontroute='$d_msg_dontroute'
21816 d_msg_oob='$d_msg_oob'
21817 d_msg_peek='$d_msg_peek'
21818 d_msg_proxy='$d_msg_proxy'
21819 d_msgctl='$d_msgctl'
21820 d_msgget='$d_msgget'
21821 d_msghdr_s='$d_msghdr_s'
21822 d_msgrcv='$d_msgrcv'
21823 d_msgsnd='$d_msgsnd'
21824 d_msync='$d_msync'
21825 d_munmap='$d_munmap'
21826 d_mymalloc='$d_mymalloc'
21827 d_nice='$d_nice'
21828 d_nl_langinfo='$d_nl_langinfo'
21829 d_nv_preserves_uv='$d_nv_preserves_uv'
21830 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21831 d_off64_t='$d_off64_t'
21832 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21833 d_oldpthreads='$d_oldpthreads'
21834 d_oldsock='$d_oldsock'
21835 d_open3='$d_open3'
21836 d_pathconf='$d_pathconf'
21837 d_pause='$d_pause'
21838 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21839 d_phostname='$d_phostname'
21840 d_pipe='$d_pipe'
21841 d_poll='$d_poll'
21842 d_portable='$d_portable'
21843 d_printf_format_null='$d_printf_format_null'
21844 d_procselfexe='$d_procselfexe'
21845 d_pseudofork='$d_pseudofork'
21846 d_pthread_atfork='$d_pthread_atfork'
21847 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21848 d_pthread_yield='$d_pthread_yield'
21849 d_pwage='$d_pwage'
21850 d_pwchange='$d_pwchange'
21851 d_pwclass='$d_pwclass'
21852 d_pwcomment='$d_pwcomment'
21853 d_pwexpire='$d_pwexpire'
21854 d_pwgecos='$d_pwgecos'
21855 d_pwpasswd='$d_pwpasswd'
21856 d_pwquota='$d_pwquota'
21857 d_qgcvt='$d_qgcvt'
21858 d_quad='$d_quad'
21859 d_random_r='$d_random_r'
21860 d_readdir64_r='$d_readdir64_r'
21861 d_readdir='$d_readdir'
21862 d_readdir_r='$d_readdir_r'
21863 d_readlink='$d_readlink'
21864 d_readv='$d_readv'
21865 d_recvmsg='$d_recvmsg'
21866 d_rename='$d_rename'
21867 d_rewinddir='$d_rewinddir'
21868 d_rmdir='$d_rmdir'
21869 d_safebcpy='$d_safebcpy'
21870 d_safemcpy='$d_safemcpy'
21871 d_sanemcmp='$d_sanemcmp'
21872 d_sbrkproto='$d_sbrkproto'
21873 d_scalbnl='$d_scalbnl'
21874 d_sched_yield='$d_sched_yield'
21875 d_scm_rights='$d_scm_rights'
21876 d_seekdir='$d_seekdir'
21877 d_select='$d_select'
21878 d_sem='$d_sem'
21879 d_semctl='$d_semctl'
21880 d_semctl_semid_ds='$d_semctl_semid_ds'
21881 d_semctl_semun='$d_semctl_semun'
21882 d_semget='$d_semget'
21883 d_semop='$d_semop'
21884 d_sendmsg='$d_sendmsg'
21885 d_setegid='$d_setegid'
21886 d_seteuid='$d_seteuid'
21887 d_setgrent='$d_setgrent'
21888 d_setgrent_r='$d_setgrent_r'
21889 d_setgrps='$d_setgrps'
21890 d_sethent='$d_sethent'
21891 d_sethostent_r='$d_sethostent_r'
21892 d_setitimer='$d_setitimer'
21893 d_setlinebuf='$d_setlinebuf'
21894 d_setlocale='$d_setlocale'
21895 d_setlocale_r='$d_setlocale_r'
21896 d_setnent='$d_setnent'
21897 d_setnetent_r='$d_setnetent_r'
21898 d_setpent='$d_setpent'
21899 d_setpgid='$d_setpgid'
21900 d_setpgrp2='$d_setpgrp2'
21901 d_setpgrp='$d_setpgrp'
21902 d_setprior='$d_setprior'
21903 d_setproctitle='$d_setproctitle'
21904 d_setprotoent_r='$d_setprotoent_r'
21905 d_setpwent='$d_setpwent'
21906 d_setpwent_r='$d_setpwent_r'
21907 d_setregid='$d_setregid'
21908 d_setresgid='$d_setresgid'
21909 d_setresuid='$d_setresuid'
21910 d_setreuid='$d_setreuid'
21911 d_setrgid='$d_setrgid'
21912 d_setruid='$d_setruid'
21913 d_setsent='$d_setsent'
21914 d_setservent_r='$d_setservent_r'
21915 d_setsid='$d_setsid'
21916 d_setvbuf='$d_setvbuf'
21917 d_sfio='$d_sfio'
21918 d_shm='$d_shm'
21919 d_shmat='$d_shmat'
21920 d_shmatprototype='$d_shmatprototype'
21921 d_shmctl='$d_shmctl'
21922 d_shmdt='$d_shmdt'
21923 d_shmget='$d_shmget'
21924 d_sigaction='$d_sigaction'
21925 d_signbit='$d_signbit'
21926 d_sigprocmask='$d_sigprocmask'
21927 d_sigsetjmp='$d_sigsetjmp'
21928 d_sitearch='$d_sitearch'
21929 d_snprintf='$d_snprintf'
21930 d_sockatmark='$d_sockatmark'
21931 d_sockatmarkproto='$d_sockatmarkproto'
21932 d_socket='$d_socket'
21933 d_socklen_t='$d_socklen_t'
21934 d_sockpair='$d_sockpair'
21935 d_socks5_init='$d_socks5_init'
21936 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21937 d_sqrtl='$d_sqrtl'
21938 d_srand48_r='$d_srand48_r'
21939 d_srandom_r='$d_srandom_r'
21940 d_sresgproto='$d_sresgproto'
21941 d_sresuproto='$d_sresuproto'
21942 d_statblks='$d_statblks'
21943 d_statfs_f_flags='$d_statfs_f_flags'
21944 d_statfs_s='$d_statfs_s'
21945 d_statvfs='$d_statvfs'
21946 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21947 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21948 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21949 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21950 d_stdio_stream_array='$d_stdio_stream_array'
21951 d_stdiobase='$d_stdiobase'
21952 d_stdstdio='$d_stdstdio'
21953 d_strchr='$d_strchr'
21954 d_strcoll='$d_strcoll'
21955 d_strctcpy='$d_strctcpy'
21956 d_strerrm='$d_strerrm'
21957 d_strerror='$d_strerror'
21958 d_strerror_r='$d_strerror_r'
21959 d_strftime='$d_strftime'
21960 d_strlcat='$d_strlcat'
21961 d_strlcpy='$d_strlcpy'
21962 d_strtod='$d_strtod'
21963 d_strtol='$d_strtol'
21964 d_strtold='$d_strtold'
21965 d_strtoll='$d_strtoll'
21966 d_strtoq='$d_strtoq'
21967 d_strtoul='$d_strtoul'
21968 d_strtoull='$d_strtoull'
21969 d_strtouq='$d_strtouq'
21970 d_strxfrm='$d_strxfrm'
21971 d_suidsafe='$d_suidsafe'
21972 d_symlink='$d_symlink'
21973 d_syscall='$d_syscall'
21974 d_syscallproto='$d_syscallproto'
21975 d_sysconf='$d_sysconf'
21976 d_sysernlst='$d_sysernlst'
21977 d_syserrlst='$d_syserrlst'
21978 d_system='$d_system'
21979 d_tcgetpgrp='$d_tcgetpgrp'
21980 d_tcsetpgrp='$d_tcsetpgrp'
21981 d_telldir='$d_telldir'
21982 d_telldirproto='$d_telldirproto'
21983 d_time='$d_time'
21984 d_times='$d_times'
21985 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21986 d_tm_tm_zone='$d_tm_tm_zone'
21987 d_tmpnam_r='$d_tmpnam_r'
21988 d_truncate='$d_truncate'
21989 d_ttyname_r='$d_ttyname_r'
21990 d_tzname='$d_tzname'
21991 d_u32align='$d_u32align'
21992 d_ualarm='$d_ualarm'
21993 d_umask='$d_umask'
21994 d_uname='$d_uname'
21995 d_union_semun='$d_union_semun'
21996 d_unordered='$d_unordered'
21997 d_unsetenv='$d_unsetenv'
21998 d_usleep='$d_usleep'
21999 d_usleepproto='$d_usleepproto'
22000 d_ustat='$d_ustat'
22001 d_vendorarch='$d_vendorarch'
22002 d_vendorbin='$d_vendorbin'
22003 d_vendorlib='$d_vendorlib'
22004 d_vendorscript='$d_vendorscript'
22005 d_vfork='$d_vfork'
22006 d_void_closedir='$d_void_closedir'
22007 d_voidsig='$d_voidsig'
22008 d_voidtty='$d_voidtty'
22009 d_volatile='$d_volatile'
22010 d_vprintf='$d_vprintf'
22011 d_vsnprintf='$d_vsnprintf'
22012 d_wait4='$d_wait4'
22013 d_waitpid='$d_waitpid'
22014 d_wcstombs='$d_wcstombs'
22015 d_wctomb='$d_wctomb'
22016 d_writev='$d_writev'
22017 d_xenix='$d_xenix'
22018 date='$date'
22019 db_hashtype='$db_hashtype'
22020 db_prefixtype='$db_prefixtype'
22021 db_version_major='$db_version_major'
22022 db_version_minor='$db_version_minor'
22023 db_version_patch='$db_version_patch'
22024 defvoidused='$defvoidused'
22025 direntrytype='$direntrytype'
22026 dlext='$dlext'
22027 dlsrc='$dlsrc'
22028 doublesize='$doublesize'
22029 drand01='$drand01'
22030 drand48_r_proto='$drand48_r_proto'
22031 dynamic_ext='$dynamic_ext'
22032 eagain='$eagain'
22033 ebcdic='$ebcdic'
22034 echo='$echo'
22035 egrep='$egrep'
22036 emacs='$emacs'
22037 endgrent_r_proto='$endgrent_r_proto'
22038 endhostent_r_proto='$endhostent_r_proto'
22039 endnetent_r_proto='$endnetent_r_proto'
22040 endprotoent_r_proto='$endprotoent_r_proto'
22041 endpwent_r_proto='$endpwent_r_proto'
22042 endservent_r_proto='$endservent_r_proto'
22043 eunicefix='$eunicefix'
22044 exe_ext='$exe_ext'
22045 expr='$expr'
22046 extensions='$extensions'
22047 extras='$extras'
22048 fflushNULL='$fflushNULL'
22049 fflushall='$fflushall'
22050 find='$find'
22051 firstmakefile='$firstmakefile'
22052 flex='$flex'
22053 fpossize='$fpossize'
22054 fpostype='$fpostype'
22055 freetype='$freetype'
22056 from='$from'
22057 full_ar='$full_ar'
22058 full_csh='$full_csh'
22059 full_sed='$full_sed'
22060 gccansipedantic='$gccansipedantic'
22061 gccosandvers='$gccosandvers'
22062 gccversion='$gccversion'
22063 getgrent_r_proto='$getgrent_r_proto'
22064 getgrgid_r_proto='$getgrgid_r_proto'
22065 getgrnam_r_proto='$getgrnam_r_proto'
22066 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22067 gethostbyname_r_proto='$gethostbyname_r_proto'
22068 gethostent_r_proto='$gethostent_r_proto'
22069 getlogin_r_proto='$getlogin_r_proto'
22070 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22071 getnetbyname_r_proto='$getnetbyname_r_proto'
22072 getnetent_r_proto='$getnetent_r_proto'
22073 getprotobyname_r_proto='$getprotobyname_r_proto'
22074 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22075 getprotoent_r_proto='$getprotoent_r_proto'
22076 getpwent_r_proto='$getpwent_r_proto'
22077 getpwnam_r_proto='$getpwnam_r_proto'
22078 getpwuid_r_proto='$getpwuid_r_proto'
22079 getservbyname_r_proto='$getservbyname_r_proto'
22080 getservbyport_r_proto='$getservbyport_r_proto'
22081 getservent_r_proto='$getservent_r_proto'
22082 getspnam_r_proto='$getspnam_r_proto'
22083 gidformat='$gidformat'
22084 gidsign='$gidsign'
22085 gidsize='$gidsize'
22086 gidtype='$gidtype'
22087 glibpth='$glibpth'
22088 gmake='$gmake'
22089 gmtime_r_proto='$gmtime_r_proto'
22090 gnulibc_version='$gnulibc_version'
22091 grep='$grep'
22092 groupcat='$groupcat'
22093 groupstype='$groupstype'
22094 gzip='$gzip'
22095 h_fcntl='$h_fcntl'
22096 h_sysfile='$h_sysfile'
22097 hint='$hint'
22098 hostcat='$hostcat'
22099 html1dir='$html1dir'
22100 html1direxp='$html1direxp'
22101 html3dir='$html3dir'
22102 html3direxp='$html3direxp'
22103 i16size='$i16size'
22104 i16type='$i16type'
22105 i32size='$i32size'
22106 i32type='$i32type'
22107 i64size='$i64size'
22108 i64type='$i64type'
22109 i8size='$i8size'
22110 i8type='$i8type'
22111 i_arpainet='$i_arpainet'
22112 i_assert='$i_assert'
22113 i_bsdioctl='$i_bsdioctl'
22114 i_crypt='$i_crypt'
22115 i_db='$i_db'
22116 i_dbm='$i_dbm'
22117 i_dirent='$i_dirent'
22118 i_dld='$i_dld'
22119 i_dlfcn='$i_dlfcn'
22120 i_fcntl='$i_fcntl'
22121 i_float='$i_float'
22122 i_fp='$i_fp'
22123 i_fp_class='$i_fp_class'
22124 i_gdbm='$i_gdbm'
22125 i_grp='$i_grp'
22126 i_ieeefp='$i_ieeefp'
22127 i_inttypes='$i_inttypes'
22128 i_langinfo='$i_langinfo'
22129 i_libutil='$i_libutil'
22130 i_limits='$i_limits'
22131 i_locale='$i_locale'
22132 i_machcthr='$i_machcthr'
22133 i_malloc='$i_malloc'
22134 i_math='$i_math'
22135 i_memory='$i_memory'
22136 i_mntent='$i_mntent'
22137 i_ndbm='$i_ndbm'
22138 i_netdb='$i_netdb'
22139 i_neterrno='$i_neterrno'
22140 i_netinettcp='$i_netinettcp'
22141 i_niin='$i_niin'
22142 i_poll='$i_poll'
22143 i_prot='$i_prot'
22144 i_pthread='$i_pthread'
22145 i_pwd='$i_pwd'
22146 i_rpcsvcdbm='$i_rpcsvcdbm'
22147 i_sfio='$i_sfio'
22148 i_sgtty='$i_sgtty'
22149 i_shadow='$i_shadow'
22150 i_socks='$i_socks'
22151 i_stdarg='$i_stdarg'
22152 i_stddef='$i_stddef'
22153 i_stdlib='$i_stdlib'
22154 i_string='$i_string'
22155 i_sunmath='$i_sunmath'
22156 i_sysaccess='$i_sysaccess'
22157 i_sysdir='$i_sysdir'
22158 i_sysfile='$i_sysfile'
22159 i_sysfilio='$i_sysfilio'
22160 i_sysin='$i_sysin'
22161 i_sysioctl='$i_sysioctl'
22162 i_syslog='$i_syslog'
22163 i_sysmman='$i_sysmman'
22164 i_sysmode='$i_sysmode'
22165 i_sysmount='$i_sysmount'
22166 i_sysndir='$i_sysndir'
22167 i_sysparam='$i_sysparam'
22168 i_sysresrc='$i_sysresrc'
22169 i_syssecrt='$i_syssecrt'
22170 i_sysselct='$i_sysselct'
22171 i_syssockio='$i_syssockio'
22172 i_sysstat='$i_sysstat'
22173 i_sysstatfs='$i_sysstatfs'
22174 i_sysstatvfs='$i_sysstatvfs'
22175 i_systime='$i_systime'
22176 i_systimek='$i_systimek'
22177 i_systimes='$i_systimes'
22178 i_systypes='$i_systypes'
22179 i_sysuio='$i_sysuio'
22180 i_sysun='$i_sysun'
22181 i_sysutsname='$i_sysutsname'
22182 i_sysvfs='$i_sysvfs'
22183 i_syswait='$i_syswait'
22184 i_termio='$i_termio'
22185 i_termios='$i_termios'
22186 i_time='$i_time'
22187 i_unistd='$i_unistd'
22188 i_ustat='$i_ustat'
22189 i_utime='$i_utime'
22190 i_values='$i_values'
22191 i_varargs='$i_varargs'
22192 i_varhdr='$i_varhdr'
22193 i_vfork='$i_vfork'
22194 ignore_versioned_solibs='$ignore_versioned_solibs'
22195 inc_version_list='$inc_version_list'
22196 inc_version_list_init='$inc_version_list_init'
22197 incpath='$incpath'
22198 inews='$inews'
22199 initialinstalllocation='$initialinstalllocation'
22200 installarchlib='$installarchlib'
22201 installbin='$installbin'
22202 installhtml1dir='$installhtml1dir'
22203 installhtml3dir='$installhtml3dir'
22204 installman1dir='$installman1dir'
22205 installman3dir='$installman3dir'
22206 installprefix='$installprefix'
22207 installprefixexp='$installprefixexp'
22208 installprivlib='$installprivlib'
22209 installscript='$installscript'
22210 installsitearch='$installsitearch'
22211 installsitebin='$installsitebin'
22212 installsitehtml1dir='$installsitehtml1dir'
22213 installsitehtml3dir='$installsitehtml3dir'
22214 installsitelib='$installsitelib'
22215 installsiteman1dir='$installsiteman1dir'
22216 installsiteman3dir='$installsiteman3dir'
22217 installsitescript='$installsitescript'
22218 installstyle='$installstyle'
22219 installusrbinperl='$installusrbinperl'
22220 installvendorarch='$installvendorarch'
22221 installvendorbin='$installvendorbin'
22222 installvendorhtml1dir='$installvendorhtml1dir'
22223 installvendorhtml3dir='$installvendorhtml3dir'
22224 installvendorlib='$installvendorlib'
22225 installvendorman1dir='$installvendorman1dir'
22226 installvendorman3dir='$installvendorman3dir'
22227 installvendorscript='$installvendorscript'
22228 intsize='$intsize'
22229 issymlink='$issymlink'
22230 ivdformat='$ivdformat'
22231 ivsize='$ivsize'
22232 ivtype='$ivtype'
22233 known_extensions='$known_extensions'
22234 ksh='$ksh'
22235 ld='$ld'
22236 lddlflags='$lddlflags'
22237 ldflags='$ldflags'
22238 ldflags_uselargefiles='$ldflags_uselargefiles'
22239 ldlibpthname='$ldlibpthname'
22240 less='$less'
22241 lib_ext='$lib_ext'
22242 libc='$libc'
22243 libperl='$libperl'
22244 libpth='$libpth'
22245 libs='$libs'
22246 libsdirs='$libsdirs'
22247 libsfiles='$libsfiles'
22248 libsfound='$libsfound'
22249 libspath='$libspath'
22250 libswanted='$libswanted'
22251 libswanted_uselargefiles='$libswanted_uselargefiles'
22252 line='$line'
22253 lint='$lint'
22254 lkflags='$lkflags'
22255 ln='$ln'
22256 lns='$lns'
22257 localtime_r_proto='$localtime_r_proto'
22258 locincpth='$locincpth'
22259 loclibpth='$loclibpth'
22260 longdblsize='$longdblsize'
22261 longlongsize='$longlongsize'
22262 longsize='$longsize'
22263 lp='$lp'
22264 lpr='$lpr'
22265 ls='$ls'
22266 lseeksize='$lseeksize'
22267 lseektype='$lseektype'
22268 mad='$mad'
22269 madlyh='$madlyh'
22270 madlyobj='$madlyobj'
22271 madlysrc='$madlysrc'
22272 mail='$mail'
22273 mailx='$mailx'
22274 make='$make'
22275 make_set_make='$make_set_make'
22276 mallocobj='$mallocobj'
22277 mallocsrc='$mallocsrc'
22278 malloctype='$malloctype'
22279 man1dir='$man1dir'
22280 man1direxp='$man1direxp'
22281 man1ext='$man1ext'
22282 man3dir='$man3dir'
22283 man3direxp='$man3direxp'
22284 man3ext='$man3ext'
22285 mips_type='$mips_type'
22286 mistrustnm='$mistrustnm'
22287 mkdir='$mkdir'
22288 mmaptype='$mmaptype'
22289 modetype='$modetype'
22290 more='$more'
22291 multiarch='$multiarch'
22292 mv='$mv'
22293 myarchname='$myarchname'
22294 mydomain='$mydomain'
22295 myhostname='$myhostname'
22296 myuname='$myuname'
22297 n='$n'
22298 need_va_copy='$need_va_copy'
22299 netdb_hlen_type='$netdb_hlen_type'
22300 netdb_host_type='$netdb_host_type'
22301 netdb_name_type='$netdb_name_type'
22302 netdb_net_type='$netdb_net_type'
22303 nm='$nm'
22304 nm_opt='$nm_opt'
22305 nm_so_opt='$nm_so_opt'
22306 nonxs_ext='$nonxs_ext'
22307 nroff='$nroff'
22308 nvEUformat='$nvEUformat'
22309 nvFUformat='$nvFUformat'
22310 nvGUformat='$nvGUformat'
22311 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22312 nveformat='$nveformat'
22313 nvfformat='$nvfformat'
22314 nvgformat='$nvgformat'
22315 nvsize='$nvsize'
22316 nvtype='$nvtype'
22317 o_nonblock='$o_nonblock'
22318 obj_ext='$obj_ext'
22319 old_pthread_create_joinable='$old_pthread_create_joinable'
22320 optimize='$optimize'
22321 orderlib='$orderlib'
22322 osname='$osname'
22323 osvers='$osvers'
22324 otherlibdirs='$otherlibdirs'
22325 package='$package'
22326 pager='$pager'
22327 passcat='$passcat'
22328 patchlevel='$patchlevel'
22329 path_sep='$path_sep'
22330 perl5='$perl5'
22331 perl='$perl'
22332 perl_patchlevel='$perl_patchlevel'
22333 perladmin='$perladmin'
22334 perllibs='$perllibs'
22335 perlpath='$perlpath'
22336 pg='$pg'
22337 phostname='$phostname'
22338 pidtype='$pidtype'
22339 plibpth='$plibpth'
22340 pmake='$pmake'
22341 pr='$pr'
22342 prefix='$prefix'
22343 prefixexp='$prefixexp'
22344 privlib='$privlib'
22345 privlibexp='$privlibexp'
22346 procselfexe='$procselfexe'
22347 prototype='$prototype'
22348 ptrsize='$ptrsize'
22349 quadkind='$quadkind'
22350 quadtype='$quadtype'
22351 randbits='$randbits'
22352 randfunc='$randfunc'
22353 random_r_proto='$random_r_proto'
22354 randseedtype='$randseedtype'
22355 ranlib='$ranlib'
22356 rd_nodata='$rd_nodata'
22357 readdir64_r_proto='$readdir64_r_proto'
22358 readdir_r_proto='$readdir_r_proto'
22359 revision='$revision'
22360 rm='$rm'
22361 rm_try='$rm_try'
22362 rmail='$rmail'
22363 run='$run'
22364 runnm='$runnm'
22365 sPRIEUldbl='$sPRIEUldbl'
22366 sPRIFUldbl='$sPRIFUldbl'
22367 sPRIGUldbl='$sPRIGUldbl'
22368 sPRIXU64='$sPRIXU64'
22369 sPRId64='$sPRId64'
22370 sPRIeldbl='$sPRIeldbl'
22371 sPRIfldbl='$sPRIfldbl'
22372 sPRIgldbl='$sPRIgldbl'
22373 sPRIi64='$sPRIi64'
22374 sPRIo64='$sPRIo64'
22375 sPRIu64='$sPRIu64'
22376 sPRIx64='$sPRIx64'
22377 sSCNfldbl='$sSCNfldbl'
22378 sched_yield='$sched_yield'
22379 scriptdir='$scriptdir'
22380 scriptdirexp='$scriptdirexp'
22381 sed='$sed'
22382 seedfunc='$seedfunc'
22383 selectminbits='$selectminbits'
22384 selecttype='$selecttype'
22385 sendmail='$sendmail'
22386 setgrent_r_proto='$setgrent_r_proto'
22387 sethostent_r_proto='$sethostent_r_proto'
22388 setlocale_r_proto='$setlocale_r_proto'
22389 setnetent_r_proto='$setnetent_r_proto'
22390 setprotoent_r_proto='$setprotoent_r_proto'
22391 setpwent_r_proto='$setpwent_r_proto'
22392 setservent_r_proto='$setservent_r_proto'
22393 sh='$sh'
22394 shar='$shar'
22395 sharpbang='$sharpbang'
22396 shmattype='$shmattype'
22397 shortsize='$shortsize'
22398 shrpenv='$shrpenv'
22399 shsharp='$shsharp'
22400 sig_count='$sig_count'
22401 sig_name='$sig_name'
22402 sig_name_init='$sig_name_init'
22403 sig_num='$sig_num'
22404 sig_num_init='$sig_num_init'
22405 sig_size='$sig_size'
22406 signal_t='$signal_t'
22407 sitearch='$sitearch'
22408 sitearchexp='$sitearchexp'
22409 sitebin='$sitebin'
22410 sitebinexp='$sitebinexp'
22411 sitehtml1dir='$sitehtml1dir'
22412 sitehtml1direxp='$sitehtml1direxp'
22413 sitehtml3dir='$sitehtml3dir'
22414 sitehtml3direxp='$sitehtml3direxp'
22415 sitelib='$sitelib'
22416 sitelib_stem='$sitelib_stem'
22417 sitelibexp='$sitelibexp'
22418 siteman1dir='$siteman1dir'
22419 siteman1direxp='$siteman1direxp'
22420 siteman3dir='$siteman3dir'
22421 siteman3direxp='$siteman3direxp'
22422 siteprefix='$siteprefix'
22423 siteprefixexp='$siteprefixexp'
22424 sitescript='$sitescript'
22425 sitescriptexp='$sitescriptexp'
22426 sizesize='$sizesize'
22427 sizetype='$sizetype'
22428 sleep='$sleep'
22429 smail='$smail'
22430 so='$so'
22431 sockethdr='$sockethdr'
22432 socketlib='$socketlib'
22433 socksizetype='$socksizetype'
22434 sort='$sort'
22435 spackage='$spackage'
22436 spitshell='$spitshell'
22437 srand48_r_proto='$srand48_r_proto'
22438 srandom_r_proto='$srandom_r_proto'
22439 src='$src'
22440 ssizetype='$ssizetype'
22441 startperl='$startperl'
22442 startsh='$startsh'
22443 static_ext='$static_ext'
22444 stdchar='$stdchar'
22445 stdio_base='$stdio_base'
22446 stdio_bufsiz='$stdio_bufsiz'
22447 stdio_cnt='$stdio_cnt'
22448 stdio_filbuf='$stdio_filbuf'
22449 stdio_ptr='$stdio_ptr'
22450 stdio_stream_array='$stdio_stream_array'
22451 strerror_r_proto='$strerror_r_proto'
22452 strings='$strings'
22453 submit='$submit'
22454 subversion='$subversion'
22455 sysman='$sysman'
22456 tail='$tail'
22457 tar='$tar'
22458 targetarch='$targetarch'
22459 tbl='$tbl'
22460 tee='$tee'
22461 test='$test'
22462 timeincl='$timeincl'
22463 timetype='$timetype'
22464 tmpnam_r_proto='$tmpnam_r_proto'
22465 to='$to'
22466 touch='$touch'
22467 tr='$tr'
22468 trnl='$trnl'
22469 troff='$troff'
22470 ttyname_r_proto='$ttyname_r_proto'
22471 u16size='$u16size'
22472 u16type='$u16type'
22473 u32size='$u32size'
22474 u32type='$u32type'
22475 u64size='$u64size'
22476 u64type='$u64type'
22477 u8size='$u8size'
22478 u8type='$u8type'
22479 uidformat='$uidformat'
22480 uidsign='$uidsign'
22481 uidsize='$uidsize'
22482 uidtype='$uidtype'
22483 uname='$uname'
22484 uniq='$uniq'
22485 uquadtype='$uquadtype'
22486 use5005threads='$use5005threads'
22487 use64bitall='$use64bitall'
22488 use64bitint='$use64bitint'
22489 usecrosscompile='$usecrosscompile'
22490 usedl='$usedl'
22491 usefaststdio='$usefaststdio'
22492 useithreads='$useithreads'
22493 uselargefiles='$uselargefiles'
22494 uselongdouble='$uselongdouble'
22495 usemallocwrap='$usemallocwrap'
22496 usemorebits='$usemorebits'
22497 usemultiplicity='$usemultiplicity'
22498 usemymalloc='$usemymalloc'
22499 usenm='$usenm'
22500 useopcode='$useopcode'
22501 useperlio='$useperlio'
22502 useposix='$useposix'
22503 usereentrant='$usereentrant'
22504 userelocatableinc='$userelocatableinc'
22505 usesfio='$usesfio'
22506 useshrplib='$useshrplib'
22507 usesitecustomize='$usesitecustomize'
22508 usesocks='$usesocks'
22509 usethreads='$usethreads'
22510 usevendorprefix='$usevendorprefix'
22511 usevfork='$usevfork'
22512 usrinc='$usrinc'
22513 uuname='$uuname'
22514 uvXUformat='$uvXUformat'
22515 uvoformat='$uvoformat'
22516 uvsize='$uvsize'
22517 uvtype='$uvtype'
22518 uvuformat='$uvuformat'
22519 uvxformat='$uvxformat'
22520 vendorarch='$vendorarch'
22521 vendorarchexp='$vendorarchexp'
22522 vendorbin='$vendorbin'
22523 vendorbinexp='$vendorbinexp'
22524 vendorhtml1dir='$vendorhtml1dir'
22525 vendorhtml1direxp='$vendorhtml1direxp'
22526 vendorhtml3dir='$vendorhtml3dir'
22527 vendorhtml3direxp='$vendorhtml3direxp'
22528 vendorlib='$vendorlib'
22529 vendorlib_stem='$vendorlib_stem'
22530 vendorlibexp='$vendorlibexp'
22531 vendorman1dir='$vendorman1dir'
22532 vendorman1direxp='$vendorman1direxp'
22533 vendorman3dir='$vendorman3dir'
22534 vendorman3direxp='$vendorman3direxp'
22535 vendorprefix='$vendorprefix'
22536 vendorprefixexp='$vendorprefixexp'
22537 vendorscript='$vendorscript'
22538 vendorscriptexp='$vendorscriptexp'
22539 version='$version'
22540 version_patchlevel_string='$version_patchlevel_string'
22541 versiononly='$versiononly'
22542 vi='$vi'
22543 voidflags='$voidflags'
22544 xlibpth='$xlibpth'
22545 yacc='$yacc'
22546 yaccflags='$yaccflags'
22547 zcat='$zcat'
22548 zip='$zip'
22549 EOT
22550
22551 : Add in command line options if available
22552 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22553
22554 : add special variables
22555 $test -f $src/patchlevel.h && \
22556 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22557 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22558 echo "PERL_CONFIG_SH=true" >>config.sh
22559
22560 : propagate old symbols
22561 if $test -f UU/config.sh; then
22562         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22563         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22564         $sort | $uniq -u >UU/oldsyms
22565         set X `cat UU/oldsyms`
22566         shift
22567         case $# in
22568         0) ;;
22569         *)
22570                 cat <<EOM
22571 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22572 EOM
22573                 echo "# Variables propagated from previous config.sh file." >>config.sh
22574                 for sym in `cat UU/oldsyms`; do
22575                         echo "    Propagating $hint variable "'$'"$sym..."
22576                         eval 'tmp="$'"${sym}"'"'
22577                         echo "$tmp" | \
22578                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22579                 done
22580                 ;;
22581         esac
22582 fi
22583
22584 : Finish up by extracting the .SH files
22585 case "$alldone" in
22586 exit)
22587         $rm -rf UU
22588         echo "Extraction done."
22589         exit 0
22590         ;;
22591 cont)
22592         ;;
22593 '')
22594         dflt=''
22595         nostick=true
22596         $cat <<EOM
22597
22598 If you'd like to make any changes to the config.sh file before I begin
22599 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22600
22601 EOM
22602         rp="Press return or use a shell escape to edit config.sh:"
22603         . UU/myread
22604         nostick=''
22605         case "$ans" in
22606         '') ;;
22607         *) : in case they cannot read
22608                 sh 1>&4 -c "$ans";;
22609         esac
22610         ;;
22611 esac
22612
22613 : if this fails, just run all the .SH files by hand
22614 . ./config.sh
22615
22616 echo " "
22617 exec 1>&4
22618 pwd=`pwd`
22619 . ./UU/extract
22620 cd "$pwd"
22621
22622 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22623         dflt=y
22624         case "$silent" in
22625         true) ;;
22626         *)
22627                 $cat <<EOM
22628
22629 Now you need to generate make dependencies by running "$make depend".
22630 You might prefer to run it in background: "$make depend > makedepend.out &"
22631 It can take a while, so you might not want to run it right now.
22632
22633 EOM
22634                 ;;
22635         esac
22636         rp="Run $make depend now?"
22637         . UU/myread
22638         case "$ans" in
22639         y*)
22640                 $make depend && echo "Now you must run '$make'."
22641                 ;;
22642         *)
22643                 echo "You must run '$make depend' then '$make'."
22644                 ;;
22645         esac
22646 elif test -f [Mm]akefile; then
22647         echo " "
22648         echo "Now you must run a $make."
22649 else
22650         echo "Configure done."
22651 fi
22652
22653 if $test -f Policy.sh; then
22654     $cat <<EOM
22655
22656 If you compile $package on a different machine or from a different object
22657 directory, copy the Policy.sh file from this object directory to the
22658 new one before you run Configure -- this will help you with most of
22659 the policy defaults.
22660
22661 EOM
22662 fi
22663 if $test -f config.msg; then
22664     echo "Hmm.  I also noted the following information while running:"
22665     echo " "
22666     $cat config.msg >&4
22667     $rm -f config.msg
22668 fi
22669 $rm -f kit*isdone ark*isdone
22670 $rm -rf UU
22671
22672 : End of Configure
22673