This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix typo - s/was/what/ is to be ignored
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
18 #
19 #
20 # Though this script was generated by metaconfig, it is OK to send
21 # patches against it. It's up to the Configure pumpkin to backport
22 # the patch to the metaunits if it is accepted.
23 # See Porting/pumpkin.pod for more information on metaconfig.
24 #
25
26 # $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
27 #
28 # Generated on Tue Feb 10 17:34:27 CET 2009 [metaconfig 3.5 PL0]
29 # (with additional metaconfig patches by perlbug@perl.org)
30
31 cat >c1$$ <<EOF
32 ARGGGHHHH!!!!!
33
34 SCO csh still thinks true is false.  Write to SCO today and tell them that next
35 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
36
37 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
38 we'd have to do is go in and swap the && and || tokens, wherever they are.)
39
40 [End of diatribe. We now return you to your regularly scheduled programming...]
41 EOF
42 cat >c2$$ <<EOF
43
44 OOPS!  You naughty creature!  You didn't run Configure with sh!
45 I will attempt to remedy the situation by running sh for you...
46 EOF
47
48 true || cat c1$$ c2$$
49 true || exec sh $0 $argv:q
50
51 (exit $?0) || cat c2$$
52 (exit $?0) || exec sh $0 $argv:q
53 rm -f c1$$ c2$$
54
55 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
56         cat >&4 <<EOF
57 ***
58 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
59 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
60 *** Please read the README.plan9 for further instructions.
61 *** Cannot continue, aborting.
62 ***
63 EOF
64         exit 1
65 fi
66
67 if test ! -c /dev/null ; then
68         cat >&4 <<EOF
69 ***
70 *** I'm sorry, but /dev/null appears to be a file rather than a device.
71 *** Please consult your operating sytem's notes for making a device
72 *** in /dev.
73 *** Cannot continue, aborting.
74 ***
75 EOF
76         exit 1
77 fi
78
79 : compute my invocation name
80 me=$0
81 case "$0" in
82 */*)
83         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
84         test "$me" || me=$0
85         ;;
86 esac
87
88 : Proper separator for the PATH environment variable
89 p_=:
90 : On OS/2 this directory should exist if this is not floppy only system ":-]"
91 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
92         if test -n "$OS2_SHELL"; then
93                 p_=\;
94                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
95                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
96                 is_os2=yes
97         elif test -n "$DJGPP"; then
98                 case "X${MACHTYPE:-nonesuchmach}" in
99                 *cygwin) ;;
100                 *) p_=\; ;;
101                 esac
102         fi
103 fi
104
105 : Proper PATH setting
106 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
107 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
108 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
109 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
110 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
111 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
112 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
113 paths="$paths /sbin /usr/sbin /usr/libexec"
114 paths="$paths /system/gnu_library/bin"
115
116 for p in $paths
117 do
118         case "$p_$PATH$p_" in
119         *$p_$p$p_*) ;;
120         *) test -d $p && PATH=$PATH$p_$p ;;
121         esac
122 done
123
124 PATH=.$p_$PATH
125 export PATH
126
127 : shall we be using ksh?
128 inksh=''
129 needksh=''
130 avoidksh=''
131 newsh=/bin/ksh
132 changesh=''
133 if (PATH=.; alias -x) >/dev/null 2>&1; then
134                 inksh=true
135 fi
136 if test -f /hp-ux -a -f /bin/ksh; then
137         needksh='to avoid sh bug in "here document" expansion'
138 fi
139 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
140         if test X`/usr/bin/uname -v` = X4; then
141                 avoidksh="to avoid AIX 4's /bin/sh"
142                 newsh=/usr/bin/bsh
143         fi
144 fi
145 if test -f /osf_boot -a -f /usr/sbin/setld; then
146         if test X`/usr/bin/uname -s` = XOSF1; then
147                 avoidksh="to avoid Digital UNIX' ksh"
148                 newsh=/bin/sh
149                 unset BIN_SH
150         fi
151 fi
152 case "$inksh/$needksh" in
153 /[a-z]*)
154                 ENV=''
155                 changesh=true
156                 reason="$needksh"
157         ;;
158 esac
159 case "$inksh/$avoidksh" in
160 true/[a-z]*)
161         changesh=true
162         reason="$avoidksh"
163         ;;
164 esac
165 case "$inksh/$needksh-$avoidksh-" in
166 true/--)
167                 cat <<EOM
168 (I see you are using the Korn shell.  Some ksh's blow up on $me,
169 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
170 EOM
171         ;;
172 esac
173 case "$changesh" in
174 true)
175         export newsh
176         echo "(Feeding myself to $newsh $reason.)"
177         case "$0" in
178         Configure|*/Configure) exec $newsh $0 "$@";;
179         *) exec $newsh Configure "$@";;
180         esac
181         ;;
182 esac
183 test -x "${newsh}" || unset newsh
184
185 : if needed, set CDPATH to a harmless value that is not chatty
186 : avoid bash 2.02 problems with empty CDPATH.
187 case "$CDPATH" in
188 '')     ;;
189 *)      case "$SHELL" in
190         *bash*) CDPATH='.' ;;
191         *) CDPATH='' ;;
192         esac
193         ;;
194 esac
195
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 extern_C=''
211 mistrustnm=''
212 usedevel=''
213 perllibs=''
214 dynamic_ext=''
215 extensions=''
216 known_extensions=''
217 nonxs_ext=''
218 static_ext=''
219 useopcode=''
220 useposix=''
221 extras=''
222 d_bsd=''
223 d_eunice=''
224 d_xenix=''
225 eunicefix=''
226 ar=''
227 awk=''
228 bash=''
229 bison=''
230 byacc=''
231 cat=''
232 chgrp=''
233 chmod=''
234 chown=''
235 comm=''
236 compress=''
237 cp=''
238 cpio=''
239 cpp=''
240 csh=''
241 date=''
242 echo=''
243 egrep=''
244 emacs=''
245 expr=''
246 find=''
247 flex=''
248 gmake=''
249 grep=''
250 gzip=''
251 inews=''
252 ksh=''
253 less=''
254 line=''
255 lint=''
256 ln=''
257 lp=''
258 lpr=''
259 ls=''
260 mail=''
261 mailx=''
262 make=''
263 mkdir=''
264 more=''
265 mv=''
266 nm=''
267 nroff=''
268 perl=''
269 pg=''
270 pmake=''
271 pr=''
272 rm=''
273 rmail=''
274 sed=''
275 sendmail=''
276 shar=''
277 sleep=''
278 smail=''
279 sort=''
280 submit=''
281 tail=''
282 tar=''
283 tbl=''
284 tee=''
285 test=''
286 touch=''
287 tr=''
288 troff=''
289 uname=''
290 uniq=''
291 uuname=''
292 vi=''
293 zcat=''
294 zip=''
295 full_ar=''
296 full_sed=''
297 libswanted=''
298 hint=''
299 myuname=''
300 osname=''
301 osvers=''
302 Author=''
303 Date=''
304 Header=''
305 Id=''
306 Locker=''
307 Log=''
308 RCSfile=''
309 Revision=''
310 Source=''
311 State=''
312 _a=''
313 _exe=''
314 _o=''
315 archobjs=''
316 exe_ext=''
317 firstmakefile=''
318 lib_ext=''
319 obj_ext=''
320 path_sep=''
321 rm_try=''
322 afs=''
323 afsroot=''
324 alignbytes=''
325 ansi2knr=''
326 archlib=''
327 archlibexp=''
328 d_archlib=''
329 installarchlib=''
330 archname=''
331 myarchname=''
332 d_atolf=''
333 d_atoll=''
334 baserev=''
335 bin=''
336 binexp=''
337 initialinstalllocation=''
338 installbin=''
339 userelocatableinc=''
340 byteorder=''
341 cc=''
342 ccflags=''
343 cppflags=''
344 ldflags=''
345 lkflags=''
346 locincpth=''
347 optimize=''
348 cf_email=''
349 cf_by=''
350 cf_time=''
351 contains=''
352 cpp_stuff=''
353 cpplast=''
354 cppminus=''
355 cpprun=''
356 cppstdin=''
357 d__fwalk=''
358 d_access=''
359 d_accessx=''
360 d_aintl=''
361 d_alarm=''
362 asctime_r_proto=''
363 d_asctime_r=''
364 d_attribute_deprecated=''
365 d_attribute_format=''
366 d_attribute_malloc=''
367 d_attribute_nonnull=''
368 d_attribute_noreturn=''
369 d_attribute_pure=''
370 d_attribute_unused=''
371 d_attribute_warn_unused_result=''
372 d_printf_format_null=''
373 d_bcmp=''
374 d_bcopy=''
375 d_builtin_choose_expr=''
376 d_builtin_expect=''
377 d_bzero=''
378 d_c99_variadic_macros=''
379 d_casti32=''
380 castflags=''
381 d_castneg=''
382 d_chown=''
383 d_chroot=''
384 d_chsize=''
385 d_class=''
386 d_clearenv=''
387 d_closedir=''
388 d_void_closedir=''
389 d_cmsghdr_s=''
390 d_const=''
391 d_copysignl=''
392 d_cplusplus=''
393 cryptlib=''
394 d_crypt=''
395 crypt_r_proto=''
396 d_crypt_r=''
397 d_csh=''
398 full_csh=''
399 d_ctermid=''
400 ctermid_r_proto=''
401 d_ctermid_r=''
402 ctime_r_proto=''
403 d_ctime_r=''
404 d_cuserid=''
405 d_dbl_dig=''
406 d_dbminitproto=''
407 d_difftime=''
408 d_dir_dd_fd=''
409 d_dirfd=''
410 d_dlerror=''
411 d_dlopen=''
412 d_dlsymun=''
413 d_dosuid=''
414 d_suidsafe=''
415 d_drand48_r=''
416 drand48_r_proto=''
417 d_drand48proto=''
418 d_dup2=''
419 d_eaccess=''
420 d_endgrent=''
421 d_endgrent_r=''
422 endgrent_r_proto=''
423 d_endhent=''
424 d_endhostent_r=''
425 endhostent_r_proto=''
426 d_endnent=''
427 d_endnetent_r=''
428 endnetent_r_proto=''
429 d_endpent=''
430 d_endprotoent_r=''
431 endprotoent_r_proto=''
432 d_endpwent=''
433 d_endpwent_r=''
434 endpwent_r_proto=''
435 d_endsent=''
436 d_endservent_r=''
437 endservent_r_proto=''
438 d_faststdio=''
439 d_fchdir=''
440 d_fchmod=''
441 d_fchown=''
442 d_fcntl=''
443 d_fcntl_can_lock=''
444 d_fd_macros=''
445 d_fd_set=''
446 d_fds_bits=''
447 d_fgetpos=''
448 d_finite=''
449 d_finitel=''
450 d_flexfnam=''
451 d_flock=''
452 d_flockproto=''
453 d_fork=''
454 d_fp_class=''
455 d_fpclass=''
456 d_fpclassify=''
457 d_fpclassl=''
458 d_fpos64_t=''
459 d_frexpl=''
460 d_fs_data_s=''
461 d_fseeko=''
462 d_fsetpos=''
463 d_fstatfs=''
464 d_fsync=''
465 d_ftello=''
466 d_ftime=''
467 d_gettimeod=''
468 d_futimes=''
469 d_Gconvert=''
470 d_getcwd=''
471 d_getespwnam=''
472 d_getfsstat=''
473 d_getgrent=''
474 d_getgrent_r=''
475 getgrent_r_proto=''
476 d_getgrgid_r=''
477 getgrgid_r_proto=''
478 d_getgrnam_r=''
479 getgrnam_r_proto=''
480 d_getgrps=''
481 d_gethbyaddr=''
482 d_gethbyname=''
483 d_gethent=''
484 aphostname=''
485 d_gethname=''
486 d_phostname=''
487 d_uname=''
488 d_gethostbyaddr_r=''
489 gethostbyaddr_r_proto=''
490 d_gethostbyname_r=''
491 gethostbyname_r_proto=''
492 d_gethostent_r=''
493 gethostent_r_proto=''
494 d_gethostprotos=''
495 d_getitimer=''
496 d_getlogin=''
497 d_getlogin_r=''
498 getlogin_r_proto=''
499 d_getmnt=''
500 d_getmntent=''
501 d_getnbyaddr=''
502 d_getnbyname=''
503 d_getnent=''
504 d_getnetbyaddr_r=''
505 getnetbyaddr_r_proto=''
506 d_getnetbyname_r=''
507 getnetbyname_r_proto=''
508 d_getnetent_r=''
509 getnetent_r_proto=''
510 d_getnetprotos=''
511 d_getpagsz=''
512 d_getpent=''
513 d_getpgid=''
514 d_getpgrp2=''
515 d_bsdgetpgrp=''
516 d_getpgrp=''
517 d_getppid=''
518 d_getprior=''
519 d_getpbyname=''
520 d_getpbynumber=''
521 d_getprotobyname_r=''
522 getprotobyname_r_proto=''
523 d_getprotobynumber_r=''
524 getprotobynumber_r_proto=''
525 d_getprotoent_r=''
526 getprotoent_r_proto=''
527 d_getprotoprotos=''
528 d_getprpwnam=''
529 d_getpwent=''
530 d_getpwent_r=''
531 getpwent_r_proto=''
532 d_getpwnam_r=''
533 getpwnam_r_proto=''
534 d_getpwuid_r=''
535 getpwuid_r_proto=''
536 d_getsent=''
537 d_getservbyname_r=''
538 getservbyname_r_proto=''
539 d_getservbyport_r=''
540 getservbyport_r_proto=''
541 d_getservent_r=''
542 getservent_r_proto=''
543 d_getservprotos=''
544 d_getspnam=''
545 d_getspnam_r=''
546 getspnam_r_proto=''
547 d_getsbyname=''
548 d_getsbyport=''
549 d_gmtime_r=''
550 gmtime_r_proto=''
551 d_gnulibc=''
552 gnulibc_version=''
553 d_hasmntopt=''
554 d_htonl=''
555 d_ilogbl=''
556 d_inetaton=''
557 d_int64_t=''
558 d_isascii=''
559 d_isfinite=''
560 d_isinf=''
561 d_isnan=''
562 d_isnanl=''
563 d_killpg=''
564 d_lchown=''
565 d_ldbl_dig=''
566 d_libm_lib_version=''
567 d_link=''
568 d_localtime_r=''
569 d_localtime_r_needs_tzset=''
570 localtime_r_proto=''
571 d_locconv=''
572 d_lockf=''
573 d_longdbl=''
574 longdblsize=''
575 d_longlong=''
576 longlongsize=''
577 d_lseekproto=''
578 d_lstat=''
579 d_madvise=''
580 d_malloc_good_size=''
581 d_malloc_size=''
582 d_mblen=''
583 d_mbstowcs=''
584 d_mbtowc=''
585 d_memchr=''
586 d_memcmp=''
587 d_memcpy=''
588 d_memmove=''
589 d_memset=''
590 d_mkdir=''
591 d_mkdtemp=''
592 d_mkfifo=''
593 d_mkstemp=''
594 d_mkstemps=''
595 d_mktime=''
596 d_mmap=''
597 mmaptype=''
598 d_modfl=''
599 d_modfl_pow32_bug=''
600 d_modflproto=''
601 d_mprotect=''
602 d_msg=''
603 d_msgctl=''
604 d_msgget=''
605 d_msghdr_s=''
606 d_msgrcv=''
607 d_msgsnd=''
608 d_msync=''
609 d_munmap=''
610 d_nice=''
611 d_nl_langinfo=''
612 d_off64_t=''
613 d_open3=''
614 d_fpathconf=''
615 d_pathconf=''
616 d_pause=''
617 d_pipe=''
618 d_poll=''
619 d_portable=''
620 d_procselfexe=''
621 procselfexe=''
622 d_old_pthread_create_joinable=''
623 old_pthread_create_joinable=''
624 d_pthread_atfork=''
625 d_pthread_attr_setscope=''
626 d_pthread_yield=''
627 d_sched_yield=''
628 sched_yield=''
629 d_qgcvt=''
630 d_random_r=''
631 random_r_proto=''
632 d_readdir64_r=''
633 readdir64_r_proto=''
634 d_readdir=''
635 d_rewinddir=''
636 d_seekdir=''
637 d_telldir=''
638 d_readdir_r=''
639 readdir_r_proto=''
640 d_readlink=''
641 d_readv=''
642 d_recvmsg=''
643 d_rename=''
644 d_rmdir=''
645 d_safebcpy=''
646 d_safemcpy=''
647 d_sanemcmp=''
648 d_sbrkproto=''
649 d_scalbnl=''
650 d_select=''
651 d_sem=''
652 d_semctl=''
653 d_semget=''
654 d_semop=''
655 d_sendmsg=''
656 d_setegid=''
657 d_seteuid=''
658 d_setgrent=''
659 d_setgrent_r=''
660 setgrent_r_proto=''
661 d_setgrps=''
662 d_sethent=''
663 d_sethostent_r=''
664 sethostent_r_proto=''
665 d_setitimer=''
666 d_setlinebuf=''
667 d_setlocale=''
668 d_setlocale_r=''
669 setlocale_r_proto=''
670 d_setnent=''
671 d_setnetent_r=''
672 setnetent_r_proto=''
673 d_setpent=''
674 d_setpgid=''
675 d_setpgrp2=''
676 d_bsdsetpgrp=''
677 d_setpgrp=''
678 d_setprior=''
679 d_setproctitle=''
680 d_setprotoent_r=''
681 setprotoent_r_proto=''
682 d_setpwent=''
683 d_setpwent_r=''
684 setpwent_r_proto=''
685 d_setregid=''
686 d_setresgid=''
687 d_setresuid=''
688 d_setreuid=''
689 d_setrgid=''
690 d_setruid=''
691 d_setsent=''
692 d_setservent_r=''
693 setservent_r_proto=''
694 d_setsid=''
695 d_setvbuf=''
696 d_sfio=''
697 usesfio=''
698 d_shm=''
699 d_shmat=''
700 d_shmatprototype=''
701 shmattype=''
702 d_shmctl=''
703 d_shmdt=''
704 d_shmget=''
705 d_sigaction=''
706 d_signbit=''
707 d_sigprocmask=''
708 d_sigsetjmp=''
709 usesitecustomize=''
710 d_snprintf=''
711 d_vsnprintf=''
712 d_sockatmark=''
713 d_sockatmarkproto=''
714 d_msg_ctrunc=''
715 d_msg_dontroute=''
716 d_msg_oob=''
717 d_msg_peek=''
718 d_msg_proxy=''
719 d_oldsock=''
720 d_scm_rights=''
721 d_socket=''
722 d_sockpair=''
723 sockethdr=''
724 socketlib=''
725 d_socklen_t=''
726 d_socks5_init=''
727 d_sprintf_returns_strlen=''
728 d_sqrtl=''
729 d_srand48_r=''
730 srand48_r_proto=''
731 d_srandom_r=''
732 srandom_r_proto=''
733 d_sresgproto=''
734 d_sresuproto=''
735 d_statblks=''
736 d_statfs_f_flags=''
737 d_statfs_s=''
738 d_fstatvfs=''
739 d_statvfs=''
740 d_stdio_cnt_lval=''
741 d_stdio_ptr_lval=''
742 d_stdio_ptr_lval_nochange_cnt=''
743 d_stdio_ptr_lval_sets_cnt=''
744 d_stdiobase=''
745 d_stdstdio=''
746 stdio_base=''
747 stdio_bufsiz=''
748 stdio_cnt=''
749 stdio_filbuf=''
750 stdio_ptr=''
751 d_index=''
752 d_strchr=''
753 d_strcoll=''
754 d_strctcpy=''
755 d_strerrm=''
756 d_strerror=''
757 d_sysernlst=''
758 d_syserrlst=''
759 d_strerror_r=''
760 strerror_r_proto=''
761 d_strftime=''
762 d_strlcat=''
763 d_strlcpy=''
764 d_strtod=''
765 d_strtol=''
766 d_strtold=''
767 d_strtoll=''
768 d_strtoq=''
769 d_strtoul=''
770 d_strtoull=''
771 d_strtouq=''
772 d_strxfrm=''
773 d_symlink=''
774 d_syscall=''
775 d_syscallproto=''
776 d_sysconf=''
777 d_system=''
778 d_tcgetpgrp=''
779 d_tcsetpgrp=''
780 d_telldirproto=''
781 d_time=''
782 timetype=''
783 d_asctime64=''
784 d_ctime64=''
785 d_difftime64=''
786 d_gmtime64=''
787 d_localtime64=''
788 d_mktime64=''
789 d_timegm=''
790 clocktype=''
791 d_times=''
792 d_tmpnam_r=''
793 tmpnam_r_proto=''
794 d_truncate=''
795 d_ttyname_r=''
796 ttyname_r_proto=''
797 d_tzname=''
798 d_u32align=''
799 d_ualarm=''
800 d_umask=''
801 d_semctl_semid_ds=''
802 d_semctl_semun=''
803 d_union_semun=''
804 d_unordered=''
805 d_unsetenv=''
806 d_usleep=''
807 d_usleepproto=''
808 d_ustat=''
809 d_pseudofork=''
810 d_vfork=''
811 usevfork=''
812 d_voidsig=''
813 signal_t=''
814 d_volatile=''
815 d_charvspr=''
816 d_vprintf=''
817 d_wait4=''
818 d_waitpid=''
819 d_wcstombs=''
820 d_wctomb=''
821 d_writev=''
822 dlext=''
823 cccdlflags=''
824 ccdlflags=''
825 dlsrc=''
826 ld=''
827 lddlflags=''
828 usedl=''
829 doublesize=''
830 ebcdic=''
831 fflushNULL=''
832 fflushall=''
833 fpossize=''
834 fpostype=''
835 gccansipedantic=''
836 gccosandvers=''
837 gccversion=''
838 gidformat=''
839 gidsign=''
840 gidsize=''
841 gidtype=''
842 groupstype=''
843 h_fcntl=''
844 h_sysfile=''
845 html1dir=''
846 html1direxp=''
847 installhtml1dir=''
848 html3dir=''
849 html3direxp=''
850 installhtml3dir=''
851 i_arpainet=''
852 i_assert=''
853 i_crypt=''
854 db_hashtype=''
855 db_prefixtype=''
856 db_version_major=''
857 db_version_minor=''
858 db_version_patch=''
859 i_db=''
860 i_dbm=''
861 i_rpcsvcdbm=''
862 d_dirnamlen=''
863 direntrytype=''
864 i_dirent=''
865 i_dld=''
866 i_dlfcn=''
867 i_fcntl=''
868 i_float=''
869 i_fp=''
870 i_fp_class=''
871 i_gdbm=''
872 d_grpasswd=''
873 i_grp=''
874 i_ieeefp=''
875 i_inttypes=''
876 i_langinfo=''
877 i_libutil=''
878 i_limits=''
879 i_locale=''
880 i_machcthr=''
881 i_malloc=''
882 i_mallocmalloc=''
883 i_math=''
884 i_memory=''
885 i_mntent=''
886 d_gdbm_ndbm_h_uses_prototypes=''
887 d_gdbmndbm_h_uses_prototypes=''
888 d_ndbm=''
889 d_ndbm_h_uses_prototypes=''
890 i_gdbm_ndbm=''
891 i_gdbmndbm=''
892 i_ndbm=''
893 i_netdb=''
894 i_neterrno=''
895 i_netinettcp=''
896 i_niin=''
897 i_sysin=''
898 i_poll=''
899 i_prot=''
900 i_pthread=''
901 d_pwage=''
902 d_pwchange=''
903 d_pwclass=''
904 d_pwcomment=''
905 d_pwexpire=''
906 d_pwgecos=''
907 d_pwpasswd=''
908 d_pwquota=''
909 i_pwd=''
910 i_sfio=''
911 i_shadow=''
912 i_socks=''
913 i_stddef=''
914 i_stdlib=''
915 i_string=''
916 strings=''
917 i_sunmath=''
918 i_sysaccess=''
919 i_sysdir=''
920 i_sysfile=''
921 d_voidtty=''
922 i_bsdioctl=''
923 i_sysfilio=''
924 i_sysioctl=''
925 i_syssockio=''
926 i_syslog=''
927 i_sysmman=''
928 i_sysmode=''
929 i_sysmount=''
930 i_sysndir=''
931 i_sysparam=''
932 i_syspoll=''
933 i_sysresrc=''
934 i_syssecrt=''
935 i_sysselct=''
936 i_sysstat=''
937 i_sysstatfs=''
938 i_sysstatvfs=''
939 i_systimes=''
940 i_systypes=''
941 i_sysuio=''
942 i_sysun=''
943 i_sysutsname=''
944 i_sysvfs=''
945 i_syswait=''
946 i_sgtty=''
947 i_termio=''
948 i_termios=''
949 d_tm_tm_gmtoff=''
950 d_tm_tm_zone=''
951 i_systime=''
952 i_systimek=''
953 i_time=''
954 timeincl=''
955 i_unistd=''
956 i_ustat=''
957 i_utime=''
958 i_values=''
959 i_stdarg=''
960 i_varargs=''
961 i_varhdr=''
962 i_vfork=''
963 d_inc_version_list=''
964 inc_version_list=''
965 inc_version_list_init=''
966 installprefix=''
967 installprefixexp=''
968 installstyle=''
969 installusrbinperl=''
970 intsize=''
971 longsize=''
972 shortsize=''
973 issymlink=''
974 libc=''
975 ldlibpthname=''
976 libperl=''
977 shrpenv=''
978 useshrplib=''
979 glibpth=''
980 libpth=''
981 loclibpth=''
982 plibpth=''
983 xlibpth=''
984 ignore_versioned_solibs=''
985 libs=''
986 libsdirs=''
987 libsfiles=''
988 libsfound=''
989 libspath=''
990 lns=''
991 d_PRIEUldbl=''
992 d_PRIFUldbl=''
993 d_PRIGUldbl=''
994 d_PRIeldbl=''
995 d_PRIfldbl=''
996 d_PRIgldbl=''
997 d_SCNfldbl=''
998 sPRIEUldbl=''
999 sPRIFUldbl=''
1000 sPRIGUldbl=''
1001 sPRIeldbl=''
1002 sPRIfldbl=''
1003 sPRIgldbl=''
1004 sSCNfldbl=''
1005 lseeksize=''
1006 lseektype=''
1007 mad=''
1008 madlyh=''
1009 madlyobj=''
1010 madlysrc=''
1011 make_set_make=''
1012 d_mymalloc=''
1013 freetype=''
1014 mallocobj=''
1015 mallocsrc=''
1016 malloctype=''
1017 usemallocwrap=''
1018 usemymalloc=''
1019 installman1dir=''
1020 man1dir=''
1021 man1direxp=''
1022 man1ext=''
1023 installman3dir=''
1024 man3dir=''
1025 man3direxp=''
1026 man3ext=''
1027 modetype=''
1028 multiarch=''
1029 mydomain=''
1030 myhostname=''
1031 phostname=''
1032 c=''
1033 n=''
1034 d_eofnblk=''
1035 eagain=''
1036 o_nonblock=''
1037 rd_nodata=''
1038 need_va_copy=''
1039 netdb_hlen_type=''
1040 netdb_host_type=''
1041 netdb_name_type=''
1042 netdb_net_type=''
1043 groupcat=''
1044 hostcat=''
1045 passcat=''
1046 orderlib=''
1047 ranlib=''
1048 d_perl_otherlibdirs=''
1049 otherlibdirs=''
1050 package=''
1051 spackage=''
1052 pager=''
1053 api_revision=''
1054 api_subversion=''
1055 api_version=''
1056 api_versionstring=''
1057 patchlevel=''
1058 perl_patchlevel=''
1059 revision=''
1060 subversion=''
1061 version=''
1062 version_patchlevel_string=''
1063 perl5=''
1064 perladmin=''
1065 perlpath=''
1066 d_nv_preserves_uv=''
1067 d_nv_zero_is_allbits_zero=''
1068 i16size=''
1069 i16type=''
1070 i32size=''
1071 i32type=''
1072 i64size=''
1073 i64type=''
1074 i8size=''
1075 i8type=''
1076 ivsize=''
1077 ivtype=''
1078 nv_overflows_integers_at=''
1079 nv_preserves_uv_bits=''
1080 nvsize=''
1081 nvtype=''
1082 u16size=''
1083 u16type=''
1084 u32size=''
1085 u32type=''
1086 u64size=''
1087 u64type=''
1088 u8size=''
1089 u8type=''
1090 uvsize=''
1091 uvtype=''
1092 ivdformat=''
1093 nvEUformat=''
1094 nvFUformat=''
1095 nvGUformat=''
1096 nveformat=''
1097 nvfformat=''
1098 nvgformat=''
1099 uvXUformat=''
1100 uvoformat=''
1101 uvuformat=''
1102 uvxformat=''
1103 pidtype=''
1104 prefix=''
1105 prefixexp=''
1106 installprivlib=''
1107 privlib=''
1108 privlibexp=''
1109 prototype=''
1110 ptrsize=''
1111 d_PRIXU64=''
1112 d_PRId64=''
1113 d_PRIi64=''
1114 d_PRIo64=''
1115 d_PRIu64=''
1116 d_PRIx64=''
1117 sPRIXU64=''
1118 sPRId64=''
1119 sPRIi64=''
1120 sPRIo64=''
1121 sPRIu64=''
1122 sPRIx64=''
1123 d_quad=''
1124 quadkind=''
1125 quadtype=''
1126 uquadtype=''
1127 drand01=''
1128 randbits=''
1129 randfunc=''
1130 randseedtype=''
1131 seedfunc=''
1132 installscript=''
1133 scriptdir=''
1134 scriptdirexp=''
1135 selectminbits=''
1136 selecttype=''
1137 sh=''
1138 sig_count=''
1139 sig_name=''
1140 sig_name_init=''
1141 sig_num=''
1142 sig_num_init=''
1143 sig_size=''
1144 d_sitearch=''
1145 installsitearch=''
1146 sitearch=''
1147 sitearchexp=''
1148 installsitebin=''
1149 sitebin=''
1150 sitebinexp=''
1151 installsitehtml1dir=''
1152 sitehtml1dir=''
1153 sitehtml1direxp=''
1154 installsitehtml3dir=''
1155 sitehtml3dir=''
1156 sitehtml3direxp=''
1157 installsitelib=''
1158 sitelib=''
1159 sitelib_stem=''
1160 sitelibexp=''
1161 installsiteman1dir=''
1162 siteman1dir=''
1163 siteman1direxp=''
1164 installsiteman3dir=''
1165 siteman3dir=''
1166 siteman3direxp=''
1167 siteprefix=''
1168 siteprefixexp=''
1169 installsitescript=''
1170 sitescript=''
1171 sitescriptexp=''
1172 sizesize=''
1173 sizetype=''
1174 so=''
1175 socksizetype=''
1176 sharpbang=''
1177 shsharp=''
1178 spitshell=''
1179 src=''
1180 ssizetype=''
1181 startperl=''
1182 startsh=''
1183 stdchar=''
1184 d_stdio_stream_array=''
1185 stdio_stream_array=''
1186 sysman=''
1187 sGMTIME_max=''
1188 sGMTIME_min=''
1189 sLOCALTIME_max=''
1190 sLOCALTIME_min=''
1191 trnl=''
1192 uidformat=''
1193 uidsign=''
1194 uidsize=''
1195 uidtype=''
1196 archname64=''
1197 use64bitall=''
1198 use64bitint=''
1199 dtrace=''
1200 usedtrace=''
1201 usefaststdio=''
1202 ccflags_uselargefiles=''
1203 ldflags_uselargefiles=''
1204 libswanted_uselargefiles=''
1205 uselargefiles=''
1206 uselongdouble=''
1207 usemorebits=''
1208 usemultiplicity=''
1209 nm_opt=''
1210 nm_so_opt=''
1211 runnm=''
1212 usenm=''
1213 useperlio=''
1214 usesocks=''
1215 d_oldpthreads=''
1216 use5005threads=''
1217 useithreads=''
1218 usereentrant=''
1219 usethreads=''
1220 incpath=''
1221 mips_type=''
1222 usrinc=''
1223 d_vendorarch=''
1224 installvendorarch=''
1225 vendorarch=''
1226 vendorarchexp=''
1227 d_vendorbin=''
1228 installvendorbin=''
1229 vendorbin=''
1230 vendorbinexp=''
1231 installvendorhtml1dir=''
1232 vendorhtml1dir=''
1233 vendorhtml1direxp=''
1234 installvendorhtml3dir=''
1235 vendorhtml3dir=''
1236 vendorhtml3direxp=''
1237 d_vendorlib=''
1238 installvendorlib=''
1239 vendorlib=''
1240 vendorlib_stem=''
1241 vendorlibexp=''
1242 installvendorman1dir=''
1243 vendorman1dir=''
1244 vendorman1direxp=''
1245 installvendorman3dir=''
1246 vendorman3dir=''
1247 vendorman3direxp=''
1248 usevendorprefix=''
1249 vendorprefix=''
1250 vendorprefixexp=''
1251 d_vendorscript=''
1252 installvendorscript=''
1253 vendorscript=''
1254 vendorscriptexp=''
1255 versiononly=''
1256 defvoidused=''
1257 voidflags=''
1258 yacc=''
1259 yaccflags=''
1260 CONFIG=''
1261
1262 : Detect odd OSs
1263 define='define'
1264 undef='undef'
1265 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1266 rmlist=''
1267
1268 : We must find out about Eunice early
1269 eunicefix=':'
1270 if test -f /etc/unixtovms; then
1271         eunicefix=/etc/unixtovms
1272 fi
1273 if test -f /etc/unixtovms.exe; then
1274         eunicefix=/etc/unixtovms.exe
1275 fi
1276
1277 : Set executable suffix now -- needed before hints available
1278 if test -f "/libs/version.library"; then
1279 : Amiga OS
1280     _exe=""
1281 elif test -f "/system/gnu_library/bin/ar.pm"; then
1282 : Stratus VOS
1283     _exe=".pm"
1284 elif test -n "$DJGPP"; then
1285 : DOS DJGPP
1286     _exe=".exe"
1287 elif test -d c:/. -o -n "$is_os2" ; then
1288 : OS/2 or cygwin
1289     _exe=".exe"
1290 fi
1291
1292 groupstype=''
1293 i_whoami=''
1294 : Trailing extension.  Override this in a hint file, if needed.
1295 : Extra object files, if any, needed on this platform.
1296 archobjs=''
1297 archname=''
1298 libnames=''
1299 : change the next line if compiling for Xenix/286 on Xenix/386
1300 xlibpth='/usr/lib/386 /lib/386'
1301 : Possible local library directories to search.
1302 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1303 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1304
1305 : general looking path for locating libraries
1306 glibpth="/lib /usr/lib $xlibpth"
1307 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1308 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1309 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1310 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1311
1312 : Private path used by Configure to find libraries.  Its value
1313 : is prepended to libpth. This variable takes care of special
1314 : machines, like the mips.  Usually, it should be empty.
1315 plibpth=''
1316
1317 : default library list
1318 libswanted=''
1319 : some systems want to use only the non-versioned libso:s
1320 ignore_versioned_solibs=''
1321 : set usethreads on the Configure command line to enable threads.
1322 usereentrant='undef'
1323 : full support for void wanted by default
1324 defvoidused=15
1325
1326 : Possible local include directories to search.
1327 : Set locincpth to "" in a hint file to defeat local include searches.
1328 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1329 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1330 :
1331 : no include file wanted by default
1332 inclwanted=''
1333
1334 : Enable -DEBUGGING and -DDEBUGGING from the command line
1335 EBUGGING=''
1336 DEBUGGING=old
1337
1338 ccname=''
1339 ccversion=''
1340 perllibs=''
1341 : set useposix=false in your hint file to disable the POSIX extension.
1342 useposix=true
1343 : set useopcode=false in your hint file to disable the Opcode extension.
1344 useopcode=true
1345 archname64=''
1346 ccflags_uselargefiles=''
1347 ldflags_uselargefiles=''
1348 libswanted_uselargefiles=''
1349 : set usemultiplicity on the Configure command line to enable multiplicity.
1350 : set usesocks on the Configure command line to enable socks.
1351 : List of libraries we want.
1352 : If anyone needs extra -lxxx, put those in a hint file.
1353 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1354 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1355 : We probably want to search /usr/shlib before most other libraries.
1356 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1357 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1358 glibpth="/usr/shlib $glibpth"
1359 : Do not use vfork unless overridden by a hint file.
1360 usevfork=false
1361
1362 : Find the basic shell for Bourne shell scripts
1363 case "$sh" in
1364 '')
1365         case "$SYSTYPE" in
1366         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1367         *) xxx='/bin/sh';;
1368         esac
1369         if test -f "$xxx"; then
1370                 sh="$xxx"
1371         else
1372                 : Build up a list and do a single loop so we can 'break' out.
1373                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1374                 for xxx in sh bash ksh pdksh ash; do
1375                         for p in $pth; do
1376                                 try="$try ${p}/${xxx}"
1377                         done
1378                 done
1379                 for xxx in $try; do
1380                         if test -f "$xxx"; then
1381                                 sh="$xxx";
1382                                 break
1383                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1384                                 sh="$xxx";
1385                                 break
1386                         elif test -f "$xxx.exe"; then
1387                                 sh="$xxx";
1388                                 break
1389                         fi
1390                 done
1391         fi
1392         ;;
1393 esac
1394
1395 case "$sh" in
1396 '')     cat >&2 <<EOM
1397 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1398
1399 Usually it's in /bin/sh.  How did you even get this far?
1400 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1401 we'll try to straighten this all out.
1402 EOM
1403         exit 1
1404         ;;
1405 esac
1406
1407 : see if sh knows # comments
1408 if `$sh -c '#' >/dev/null 2>&1`; then
1409         shsharp=true
1410         spitshell=cat
1411         xcat=/bin/cat
1412         test -f $xcat$_exe || xcat=/usr/bin/cat
1413         if test ! -f $xcat$_exe; then
1414                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1415                         if test -f $p/cat$_exe; then
1416                                 xcat=$p/cat
1417                                 break
1418                         fi
1419                 done
1420                 if test ! -f $xcat$_exe; then
1421                         echo "Can't find cat anywhere!"
1422                         exit 1
1423                 fi
1424         fi
1425         echo "#!$xcat" >sharp
1426         $eunicefix sharp
1427         chmod +x sharp
1428         ./sharp > today 2>/dev/null
1429         if test -s today; then
1430                 sharpbang='#!'
1431         else
1432                 echo "#! $xcat" > sharp
1433                 $eunicefix sharp
1434                 chmod +x sharp
1435                 ./sharp > today 2>/dev/null
1436                 if test -s today; then
1437                         sharpbang='#! '
1438                 else
1439                         sharpbang=': use '
1440                 fi
1441         fi
1442 else
1443         echo " "
1444         echo "Your $sh doesn't grok # comments--I will strip them later on."
1445         shsharp=false
1446         cd ..
1447         echo "exec grep -v '^[  ]*#'" >spitshell
1448         chmod +x spitshell
1449         $eunicefix spitshell
1450         spitshell=`pwd`/spitshell
1451         cd UU
1452         echo "I presume that if # doesn't work, #! won't work either!"
1453         sharpbang=': use '
1454 fi
1455 rm -f sharp today
1456
1457 : figure out how to guarantee sh startup
1458 case "$startsh" in
1459 '') startsh=${sharpbang}${sh} ;;
1460 *)
1461 esac
1462 cat >sharp <<EOSS
1463 $startsh
1464 set abc
1465 test "$?abc" != 1
1466 EOSS
1467
1468 chmod +x sharp
1469 $eunicefix sharp
1470 if ./sharp; then
1471         : echo "Yup, it does."
1472 else
1473         echo "Hmm... '$startsh' does not guarantee sh startup..."
1474         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1475 fi
1476 rm -f sharp
1477
1478 : Save command line options in file UU/cmdline.opt for later use in
1479 : generating config.sh.
1480 cat > cmdline.opt <<EOSH
1481 : Configure command line arguments.
1482 config_arg0='$0'
1483 config_args='$*'
1484 config_argc=$#
1485 EOSH
1486 argn=1
1487 args_exp=''
1488 args_sep=''
1489 for arg in "$@"; do
1490         cat >>cmdline.opt <<EOSH
1491 config_arg$argn='$arg'
1492 EOSH
1493         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1494 $arg
1495 EOC
1496         arg_exp=`cat cmdl.opt`
1497         args_exp="$args_exp$args_sep'$arg_exp'"
1498         argn=`expr $argn + 1`
1499         args_sep=' '
1500 done
1501 rm -f cmdl.opt
1502
1503 : produce awk script to parse command line options
1504 cat >options.awk <<'EOF'
1505 BEGIN {
1506         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1507
1508         len = length(optstr);
1509         for (i = 1; i <= len; i++) {
1510                 c = substr(optstr, i, 1);
1511                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1512                 if (a == ":") {
1513                         arg[c] = 1;
1514                         i++;
1515                 }
1516                 opt[c] = 1;
1517         }
1518 }
1519 {
1520         expect = 0;
1521         str = $0;
1522         if (substr(str, 1, 1) != "-") {
1523                 printf("'%s'\n", str);
1524                 next;
1525         }
1526         len = length($0);
1527         for (i = 2; i <= len; i++) {
1528                 c = substr(str, i, 1);
1529                 if (!opt[c]) {
1530                         printf("-%s\n", substr(str, i));
1531                         next;
1532                 }
1533                 printf("-%s\n", c);
1534                 if (arg[c]) {
1535                         if (i < len)
1536                                 printf("'%s'\n", substr(str, i + 1));
1537                         else
1538                                 expect = 1;
1539                         next;
1540                 }
1541         }
1542 }
1543 END {
1544         if (expect)
1545                 print "?";
1546 }
1547 EOF
1548
1549 : process the command line options
1550 set X `for arg in "$@"; do echo "X$arg"; done |
1551         sed -e s/X// | awk -f options.awk`
1552 eval "set $*"
1553 shift
1554 rm -f options.awk
1555
1556 : set up default values
1557 fastread=''
1558 reuseval=false
1559 config_sh=''
1560 alldone=''
1561 error=''
1562 silent=''
1563 extractsh=''
1564 override=''
1565 knowitall=''
1566 rm -f optdef.sh posthint.sh
1567 cat >optdef.sh <<EOS
1568 $startsh
1569 EOS
1570
1571
1572 : option parsing
1573 while test $# -gt 0; do
1574         case "$1" in
1575         -d) shift; fastread=yes;;
1576         -e) shift; alldone=cont;;
1577         -f)
1578                 shift
1579                 cd ..
1580                 if test -r "$1"; then
1581                         config_sh="$1"
1582                 else
1583                         echo "$me: cannot read config file $1." >&2
1584                         error=true
1585                 fi
1586                 cd UU
1587                 shift;;
1588         --help|\
1589         -h) shift; error=true;;
1590         -r) shift; reuseval=true;;
1591         -s) shift; silent=true; realsilent=true;;
1592         -E) shift; alldone=exit;;
1593         -K) shift; knowitall=true;;
1594         -O) shift; override=true;;
1595         -S) shift; silent=true; extractsh=true;;
1596         -D)
1597                 shift
1598                 case "$1" in
1599                 *=)
1600                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1601                         echo "$me: ignoring -D $1" >&2
1602                         ;;
1603                 *=*) echo "$1" | \
1604                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1605                 *) echo "$1='define'" >> optdef.sh;;
1606                 esac
1607                 shift
1608                 ;;
1609         -U)
1610                 shift
1611                 case "$1" in
1612                 *=) echo "$1" >> optdef.sh;;
1613                 *=*)
1614                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1615                         echo "$me: ignoring -U $1" >&2
1616                         ;;
1617                 *) echo "$1='undef'" >> optdef.sh;;
1618                 esac
1619                 shift
1620                 ;;
1621         -A)
1622             shift
1623             xxx=''
1624             yyy="$1"
1625             zzz=''
1626             uuu=undef
1627             case "$yyy" in
1628             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1629                  case "$zzz" in
1630                  *:*) zzz='' ;;
1631                  *)   xxx=append
1632                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1633                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1634                  esac
1635                  ;;
1636             esac
1637             case "$xxx" in
1638             '')  case "$yyy" in
1639                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1640                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1641                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1642                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1643                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1644                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1645                  esac
1646                  ;;
1647             esac
1648             case "$xxx" in
1649             append)
1650                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1651             clear)
1652                 echo "$yyy=''"                  >> posthint.sh ;;
1653             define)
1654                 case "$zzz" in
1655                 '') zzz=define ;;
1656                 esac
1657                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1658             eval)
1659                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1660             prepend)
1661                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1662             undef)
1663                 case "$zzz" in
1664                 '') zzz="$uuu" ;;
1665                 esac
1666                 echo "$yyy=$zzz"                >> posthint.sh ;;
1667             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1668             esac
1669             shift
1670             ;;
1671         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1672             exit 0;;
1673         --) break;;
1674         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1675         *) break;;
1676         esac
1677 done
1678
1679 case "$error" in
1680 true)
1681         cat >&2 <<EOM
1682 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1683                  [-U symbol] [-U symbol=] [-A command:symbol...]
1684   -d : use defaults for all answers.
1685   -e : go on without questioning past the production of config.sh.
1686   -f : specify an alternate default configuration file.
1687   -h : print this help message and exit (with an error status).
1688   -r : reuse C symbols value if possible (skips costly nm extraction).
1689   -s : silent mode, only echoes questions and essential information.
1690   -D : define symbol to have some value:
1691          -D symbol         symbol gets the value 'define'
1692          -D symbol=value   symbol gets the value 'value'
1693        common used examples (see INSTALL for more info):
1694          -Duse64bitint            use 64bit integers
1695          -Duse64bitall            use 64bit integers and pointers
1696          -Dusethreads             use thread support
1697          -Dinc_version_list=none  do not include older perl trees in @INC
1698          -DEBUGGING=none          DEBUGGING options
1699          -Dcc=gcc                 choose your compiler
1700          -Dprefix=/opt/perl5      choose your destination
1701   -E : stop at the end of questions, after having produced config.sh.
1702   -K : do not use unless you know what you are doing.
1703   -O : let -D and -U override definitions from loaded configuration file.
1704   -S : perform variable substitutions on all .SH files (can mix with -f)
1705   -U : undefine symbol:
1706          -U symbol    symbol gets the value 'undef'
1707          -U symbol=   symbol gets completely empty
1708        e.g.:  -Uversiononly
1709   -A : manipulate symbol after the platform specific hints have been applied:
1710          -A append:symbol=value   append value to symbol
1711          -A symbol=value          like append:, but with a separating space
1712          -A define:symbol=value   define symbol to have value
1713          -A clear:symbol          define symbol to be ''
1714          -A define:symbol         define symbol to be 'define'
1715          -A eval:symbol=value     define symbol to be eval of value
1716          -A prepend:symbol=value  prepend value to symbol
1717          -A undef:symbol          define symbol to be 'undef'
1718          -A undef:symbol=         define symbol to be ''
1719        e.g.:  -A prepend:libswanted='cl pthread '
1720               -A ccflags=-DSOME_MACRO
1721   -V : print version number and exit (with a zero status).
1722 EOM
1723         exit 1
1724         ;;
1725 esac
1726
1727 : Sanity checks
1728 case "$fastread$alldone" in
1729 yescont|yesexit) ;;
1730 *)
1731         case "$extractsh" in
1732         true) ;;
1733         *)
1734                 if test ! -t 0; then
1735                         echo "Say 'sh Configure', not 'sh <Configure'"
1736                         exit 1
1737                 fi
1738                 ;;
1739         esac
1740         ;;
1741 esac
1742
1743 exec 4>&1
1744 case "$silent" in
1745 true) exec 1>/dev/null;;
1746 esac
1747
1748 : run the defines and the undefines, if any, but leave the file out there...
1749 touch optdef.sh
1750 . ./optdef.sh
1751 : create the posthint manipulation script and leave the file out there...
1752 touch posthint.sh
1753
1754 : set package name
1755 package='perl5'
1756 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1757 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1758 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1759 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1760 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1761 esac
1762
1763 : Some greps do not return status, grrr.
1764 echo "grimblepritz" >grimble
1765 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1766         contains=contains
1767 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1768         contains=grep
1769 else
1770         contains=contains
1771 fi
1772 rm -f grimble
1773 : the following should work in any shell
1774 case "$contains" in
1775 contains*)
1776         echo " "
1777         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1778         cat >contains <<'EOSS'
1779 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1780 EOSS
1781 chmod +x contains
1782 esac
1783
1784 : Find the path to the source tree
1785 case "$src" in
1786 '') case "$0" in
1787     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1788          case "$src" in
1789          /*)    ;;
1790          .)     ;;
1791          *)     src=`cd ../$src && pwd` ;;
1792          esac
1793          ;;
1794     *)   src='.';;
1795     esac;;
1796 esac
1797 case "$src" in
1798 '')     src=/
1799         rsrc=/
1800         ;;
1801 /*)     rsrc="$src";;
1802 *)      rsrc="../$src";;
1803 esac
1804 if test -f $rsrc/Configure && \
1805         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1806 then
1807    : found it, so we are ok.
1808 else
1809         rsrc=''
1810         for src in . .. ../.. ../../.. ../../../..; do
1811                 if test -f ../$src/Configure && \
1812                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1813                 then
1814                         rsrc=../$src
1815                         break
1816                 fi
1817         done
1818 fi
1819 case "$rsrc" in
1820 '')
1821         cat <<EOM >&4
1822
1823 Sorry, I can't seem to locate the source dir for $package.  Please start
1824 Configure with an explicit path -- i.e. /some/path/Configure.
1825
1826 EOM
1827         exit 1
1828         ;;
1829 ../.)   rsrc='..';;
1830 *)
1831         echo " "
1832         echo "Sources for $package found in \"$src\"." >&4
1833         ;;
1834 esac
1835
1836 : script used to extract .SH files with variable substitutions
1837 cat >extract <<'EOS'
1838 PERL_CONFIG_SH=true
1839 echo "Doing variable substitutions on .SH files..."
1840 if test -f MANIFEST; then
1841         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1842 else
1843         echo "(Looking for .SH files under the source directory.)"
1844         set x `(cd "$src"; find . -name "*.SH" -print)`
1845 fi
1846 shift
1847 case $# in
1848 0) set x `(cd "$src"; echo *.SH)`; shift;;
1849 esac
1850 if test ! -f "$src/$1"; then
1851         shift
1852 fi
1853 mkdir_p='
1854 name=$1;
1855 create="";
1856 while test $name; do
1857         if test ! -d "$name"; then
1858                 create="$name $create";
1859                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1860                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1861         else
1862                 name="";
1863         fi;
1864 done;
1865 for file in $create; do
1866         mkdir $file;
1867 done
1868 '
1869 for file in $*; do
1870         case "$src" in
1871         ".")
1872                 case "$file" in
1873                 */*)
1874                         dir=`expr X$file : 'X\(.*\)/'`
1875                         file=`expr X$file : 'X.*/\(.*\)'`
1876                         (cd "$dir" && . ./$file)
1877                         ;;
1878                 *)
1879                         . ./$file
1880                         ;;
1881                 esac
1882                 ;;
1883         *)
1884                 case "$file" in
1885                 */*)
1886                         dir=`expr X$file : 'X\(.*\)/'`
1887                         file=`expr X$file : 'X.*/\(.*\)'`
1888                         (set x $dir; shift; eval $mkdir_p)
1889                         sh <"$src/$dir/$file"
1890                         ;;
1891                 *)
1892                         sh <"$src/$file"
1893                         ;;
1894                 esac
1895                 ;;
1896         esac
1897 done
1898 if test -f "$src/config_h.SH"; then
1899         if test ! -f config.h; then
1900         : oops, they left it out of MANIFEST, probably, so do it anyway.
1901         . "$src/config_h.SH"
1902         fi
1903 fi
1904 EOS
1905
1906 : extract files and exit if asked to do so
1907 case "$extractsh" in
1908 true)
1909         case "$realsilent" in
1910         true) ;;
1911         *) exec 1>&4;;
1912         esac
1913         case "$config_sh" in
1914         '') config_sh='config.sh';;
1915         esac
1916         echo " "
1917         echo "Fetching answers from $config_sh..."
1918         cd ..
1919         . $config_sh
1920         test "$override" && . ./optdef.sh
1921         echo " "
1922         . UU/extract
1923         rm -rf UU
1924         echo "Extraction done."
1925         exit 0
1926         ;;
1927 esac
1928
1929 : Eunice requires " " instead of "", can you believe it
1930 echo " "
1931 : Here we go...
1932 echo "Beginning of configuration questions for $package."
1933
1934 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1935
1936 : first determine how to suppress newline on echo command
1937 echo " "
1938 echo "Checking echo to see how to suppress newlines..."
1939 (echo "hi there\c" ; echo " ") >.echotmp
1940 if $contains c .echotmp >/dev/null 2>&1 ; then
1941         echo "...using -n."
1942         n='-n'
1943         c=''
1944 else
1945         cat <<'EOM'
1946 ...using \c
1947 EOM
1948         n=''
1949         c='\c'
1950 fi
1951 echo $n "The star should be here-->$c"
1952 echo '*'
1953 rm -f .echotmp
1954
1955 : Now test for existence of everything in MANIFEST
1956 echo " "
1957 if test -f "$rsrc/MANIFEST"; then
1958         echo "First let's make sure your kit is complete.  Checking..." >&4
1959         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1960                 (split -l 50 2>/dev/null || split -50)
1961         rm -f missing
1962         tmppwd=`pwd`
1963         for filelist in x??; do
1964                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1965                         >/dev/null 2>>"$tmppwd/missing")
1966         done
1967         if test -s missing; then
1968                 cat missing >&4
1969                 cat >&4 <<'EOM'
1970
1971 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1972
1973 You have the option of continuing the configuration process, despite the
1974 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1975 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1976 and contact the author (perlbug@perl.org).
1977
1978 EOM
1979                 echo $n "Continue? [n] $c" >&4
1980                 read ans
1981                 case "$ans" in
1982                 y*)
1983                         echo "Continuing..." >&4
1984                         rm -f missing
1985                         ;;
1986                 *)
1987                         echo "ABORTING..." >&4
1988                         kill $$
1989                         ;;
1990                 esac
1991         else
1992                 echo "Looks good..."
1993         fi
1994 else
1995         echo "There is no MANIFEST file.  I hope your kit is complete !"
1996 fi
1997 rm -f missing x??
1998
1999 : Find the appropriate value for a newline for tr
2000 echo " "
2001 if test -n "$DJGPP"; then
2002        trnl='\012'
2003 fi
2004 if test X"$trnl" = X; then
2005         case "`echo foo|tr '\n' x 2>/dev/null`" in
2006         foox) trnl='\n' ;;
2007         esac
2008 fi
2009 if test X"$trnl" = X; then
2010         case "`echo foo|tr '\012' x 2>/dev/null`" in
2011         foox) trnl='\012' ;;
2012         esac
2013 fi
2014 if test X"$trnl" = X; then
2015        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2016        fooxy) trnl='\n\r' ;;
2017        esac
2018 fi
2019 if test X"$trnl" = X; then
2020         cat <<EOM >&2
2021
2022 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2023
2024 EOM
2025         exit 1
2026 fi
2027
2028 : compute the number of columns on the terminal for proper question formatting
2029 case "$COLUMNS" in
2030 '') COLUMNS='80';;
2031 esac
2032
2033 : set up the echo used in my read
2034 myecho="case \"\$xxxm\" in
2035 '') echo $n \"\$rp $c\" >&4;;
2036 *) case \"\$rp\" in
2037         '') echo $n \"[\$xxxm] $c\";;
2038         *)
2039                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2040                         echo \"\$rp\" >&4
2041                         echo $n \"[\$xxxm] $c\" >&4
2042                 else
2043                         echo $n \"\$rp [\$xxxm] $c\" >&4
2044                 fi
2045                 ;;
2046         esac;;
2047 esac"
2048
2049 : now set up to do reads with possible shell escape and default assignment
2050 cat <<EOSC >myread
2051 $startsh
2052 xxxm=\$dflt
2053 $myecho
2054 ans='!'
2055 case "\$fastread" in
2056 yes) case "\$dflt" in
2057         '') ;;
2058         *) ans='';
2059                 case "\$silent-\$rp" in
2060                 true-) ;;
2061                 *) echo " " >&4;;
2062                 esac;;
2063         esac;;
2064 *) case "\$silent" in
2065         true) case "\$rp" in
2066                 '') ans='';;
2067                 esac;;
2068         esac;;
2069 esac
2070 while expr "X\$ans" : "X!" >/dev/null; do
2071         read answ
2072         set x \$xxxm
2073         shift
2074         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2075         case  "\$answ" in
2076         "!")
2077                 sh 1>&4
2078                 echo " "
2079                 $myecho
2080                 ;;
2081         !*)
2082                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2083                 shift
2084                 sh 1>&4 -c "\$*"
2085                 echo " "
2086                 $myecho
2087                 ;;
2088         "\$ans")
2089                 case "\$ans" in
2090                 \\&*)
2091                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2092                         shift
2093                         case "\$1" in
2094                         -d)
2095                                 fastread=yes
2096                                 echo "(OK, I'll run with -d after this question.)" >&4
2097                                 ;;
2098                         -*)
2099                                 echo "*** Sorry, \$1 not supported yet." >&4
2100                                 ;;
2101                         esac
2102                         $myecho
2103                         ans=!
2104                         ;;
2105                 esac;;
2106         *)
2107                 case "\$aok" in
2108                 y)
2109                         echo "*** Substitution done -- please confirm."
2110                         xxxm="\$ans"
2111                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2112                         xxxm="\$ans"
2113                         ans=!
2114                         ;;
2115                 *)
2116                         echo "*** Error -- try again."
2117                         ans=!
2118                         ;;
2119                 esac
2120                 $myecho
2121                 ;;
2122         esac
2123         case "\$ans\$xxxm\$nostick" in
2124         '')
2125                 ans=!
2126                 $myecho
2127                 ;;
2128         esac
2129 done
2130 case "\$ans" in
2131 '') ans="\$xxxm";;
2132 esac
2133 EOSC
2134
2135 : create .config dir to save info across Configure sessions
2136 test -d ../.config || mkdir ../.config
2137 cat >../.config/README <<EOF
2138 This directory created by Configure to save information that should
2139 persist across sessions for $package.
2140
2141 You may safely delete it if you wish.
2142 EOF
2143
2144 : See if we are using a devel version and want that
2145 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2146 case "$usedevel" in
2147 $define|true|[yY]*)
2148     usedevel="$define" ;;
2149 *) case "$xversion" in
2150    *[13579])
2151         cat >&4 <<EOH
2152 *** WHOA THERE!!! ***
2153
2154     This is an UNSTABLE DEVELOPMENT release.
2155     The version of this $package distribution is $xversion, that is, odd,
2156     (as opposed to even) and that signifies a development release.
2157     If you want a maintenance release, you want an even-numbered version.
2158
2159     Do ***NOT*** install this into production use.
2160     Data corruption and crashes are possible.
2161
2162     It is most seriously suggested that you do not continue any further
2163     unless you want to help in developing and debugging Perl.
2164
2165     If you *still* want to build perl, you can answer 'y' now,
2166     or pass -Dusedevel to Configure.
2167
2168 EOH
2169         rp='Do you really want to continue?'
2170         dflt='n'
2171         . ./myread
2172         case "$ans" in
2173         [yY]) echo >&4 "Okay, continuing."
2174               usedevel="$define" ;;
2175         *) echo >&4 "Okay, bye."
2176            exit 1
2177            ;;
2178         esac
2179         ;;
2180     esac
2181     usedevel="$undef"
2182     ;;
2183 esac
2184 case "$usedevel" in
2185 $define|true|[yY]*)
2186         case "$versiononly" in
2187         '') versiononly="$define" ;;
2188         esac
2189         case "$installusrbinperl" in
2190         '') installusrbinperl="$undef" ;;
2191         esac
2192         ;;
2193 esac
2194
2195 : general instructions
2196 needman=true
2197 firsttime=true
2198 user=`(logname) 2>/dev/null`
2199 case "$user" in
2200 '') user=`whoami 2>&1`;;
2201 esac
2202 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2203         firsttime=false
2204         echo " "
2205         rp='Would you like to see the instructions?'
2206         dflt=n
2207         . ./myread
2208         case "$ans" in
2209         [yY]*) ;;
2210         *) needman=false;;
2211         esac
2212 fi
2213 if $needman; then
2214         cat <<EOH
2215
2216 This installation shell script will examine your system and ask you questions
2217 to determine how the perl5 package should be installed. If you get
2218 stuck on a question, you may use a ! shell escape to start a subshell or
2219 execute a command.  Many of the questions will have default answers in square
2220 brackets; typing carriage return will give you the default.
2221
2222 On some of the questions which ask for file or directory names you are allowed
2223 to use the ~name construct to specify the login directory belonging to "name",
2224 even if you don't have a shell which knows about that.  Questions where this is
2225 allowed will be marked "(~name ok)".
2226
2227 EOH
2228         rp=''
2229         dflt='Type carriage return to continue'
2230         . ./myread
2231         cat <<'EOH'
2232
2233 The prompter used in this script allows you to use shell variables and
2234 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2235 in the default answer, as if the default line was a set of arguments given to a
2236 script shell.  This means you may also use $* to repeat the whole default line,
2237 so you do not have to re-type everything to add something to the default.
2238
2239 Everytime there is a substitution, you will have to confirm.  If there is an
2240 error (e.g. an unmatched backtick), the default answer will remain unchanged
2241 and you will be prompted again.
2242
2243 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2244 the questions and use the computed defaults (or the previous answers if there
2245 was already a config.sh file). Type 'Configure -h' for a list of options.
2246 You may also start interactively and then answer '& -d' at any prompt to turn
2247 on the non-interactive behaviour for the remainder of the execution.
2248
2249 EOH
2250         . ./myread
2251         cat <<EOH
2252
2253 Much effort has been expended to ensure that this shell script will run on any
2254 Unix system.  If despite that it blows up on yours, your best bet is to edit
2255 Configure and run it again.  If you can't run Configure for some reason,
2256 you'll have to generate a config.sh file by hand.  Whatever problems you
2257 have, let me (perlbug@perl.org) know how I blew it.
2258
2259 This installation script affects things in two ways:
2260
2261 1) it may do direct variable substitutions on some of the files included
2262    in this kit.
2263 2) it builds a config.h file for inclusion in C programs.  You may edit
2264    any of these files as the need arises after running this script.
2265
2266 If you make a mistake on a question, there is no easy way to back up to it
2267 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2268 files.  Configure will offer to let you do this before it runs the SH files.
2269
2270 EOH
2271         dflt='Type carriage return to continue'
2272         . ./myread
2273         case "$firsttime" in
2274         true) echo $user >>../.config/instruct;;
2275         esac
2276 fi
2277
2278 : find out where common programs are
2279 echo " "
2280 echo "Locating common programs..." >&4
2281 cat <<EOSC >loc
2282 $startsh
2283 case \$# in
2284 0) exit 1;;
2285 esac
2286 thing=\$1
2287 shift
2288 dflt=\$1
2289 shift
2290 for dir in \$*; do
2291         case "\$thing" in
2292         .)
2293         if test -d \$dir/\$thing; then
2294                 echo \$dir
2295                 exit 0
2296         fi
2297         ;;
2298         *)
2299         for thisthing in \$dir/\$thing; do
2300                 : just loop through to pick last item
2301         done
2302         if test -f \$thisthing; then
2303                 echo \$thisthing
2304                 exit 0
2305         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2306                 echo \$thisthing
2307                 exit 0
2308         elif test -f \$dir/\$thing.exe; then
2309                 if test -n "$DJGPP"; then
2310                         echo \$dir/\$thing.exe
2311                 elif test "$eunicefix" != ":"; then
2312                         : on Eunice apparently
2313                         echo \$dir/\$thing
2314                 fi
2315                 exit 0
2316         fi
2317         ;;
2318         esac
2319 done
2320 echo \$dflt
2321 exit 1
2322 EOSC
2323 chmod +x loc
2324 $eunicefix loc
2325 loclist="
2326 awk
2327 cat
2328 chmod
2329 comm
2330 cp
2331 echo
2332 expr
2333 grep
2334 ls
2335 mkdir
2336 rm
2337 sed
2338 sort
2339 touch
2340 tr
2341 uniq
2342 "
2343 trylist="
2344 ar
2345 bison
2346 byacc
2347 cpp
2348 csh
2349 date
2350 egrep
2351 gmake
2352 gzip
2353 less
2354 ln
2355 make
2356 more
2357 nm
2358 nroff
2359 pg
2360 test
2361 uname
2362 zip
2363 "
2364 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2365 pth="$pth /lib /usr/lib"
2366 for file in $loclist; do
2367         eval xxx=\$$file
2368         case "$xxx" in
2369         /*|?:[\\/]*)
2370                 if test -f "$xxx"; then
2371                         : ok
2372                 else
2373                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2374                         xxx=`./loc $file $file $pth`
2375                 fi
2376                 ;;
2377         '') xxx=`./loc $file $file $pth`;;
2378         *) xxx=`./loc $xxx $xxx $pth`;;
2379         esac
2380         eval $file=$xxx$_exe
2381         eval _$file=$xxx
2382         case "$xxx" in
2383         /*)
2384                 echo $file is in $xxx.
2385                 ;;
2386         ?:[\\/]*)
2387                 echo $file is in $xxx.
2388                 ;;
2389         *)
2390                 echo "I don't know where '$file' is, and my life depends on it." >&4
2391                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2392                 exit 1
2393                 ;;
2394         esac
2395 done
2396 echo " "
2397 echo "Don't worry if any of the following aren't found..."
2398 say=offhand
2399 for file in $trylist; do
2400         eval xxx=\$$file
2401         case "$xxx" in
2402         /*|?:[\\/]*)
2403                 if test -f "$xxx"; then
2404                         : ok
2405                 else
2406                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2407                         xxx=`./loc $file $file $pth`
2408                 fi
2409                 ;;
2410         '') xxx=`./loc $file $file $pth`;;
2411         *) xxx=`./loc $xxx $xxx $pth`;;
2412         esac
2413         eval $file=$xxx$_exe
2414         eval _$file=$xxx
2415         case "$xxx" in
2416         /*)
2417                 echo $file is in $xxx.
2418                 ;;
2419         ?:[\\/]*)
2420                 echo $file is in $xxx.
2421                 ;;
2422         *)
2423                 echo "I don't see $file out there, $say."
2424                 say=either
2425                 ;;
2426         esac
2427 done
2428 case "$egrep" in
2429 egrep)
2430         echo "Substituting grep for egrep."
2431         egrep=$grep
2432         _egrep=$grep
2433         ;;
2434 esac
2435 case "$ln" in
2436 ln)
2437         echo "Substituting cp for ln."
2438         ln=$cp
2439         _ln=$cp
2440         ;;
2441 esac
2442 case "$make" in
2443 make)
2444         case "$gmake" in
2445         gmake)
2446         echo "I can't find make or gmake, and my life depends on it." >&4
2447         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2448         exit 1
2449         ;;
2450         esac
2451         ;;
2452 esac
2453 case "$gmake" in
2454 gmake)  ;;
2455 *)      # We can't have osname yet.
2456         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2457                 # Assume that gmake, if found, is definitely GNU make
2458                 # and prefer it over the system make.
2459                 echo "Substituting gmake for make."
2460                 make=$gmake
2461                 _make=$gmake
2462         fi
2463         ;;
2464 esac
2465 case "$test" in
2466 test)
2467         echo "Hopefully test is built into your sh."
2468         ;;
2469 *)
2470         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2471                 echo "Using the test built into your sh."
2472                 test=test
2473                 _test=test
2474         fi
2475         ;;
2476 esac
2477 case "$echo" in
2478 echo)
2479         echo "Hopefully echo is built into your sh."
2480         ;;
2481 '') ;;
2482 *)
2483         echo " "
2484 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2485         $echo $n "hi there$c" >foo1
2486         echo $n "hi there$c" >foo2
2487         if cmp foo1 foo2 >/dev/null 2>&1; then
2488                 echo "They are compatible.  In fact, they may be identical."
2489         else
2490                 case "$n" in
2491                 '-n') n='' c='\c';;
2492                 *) n='-n' c='';;
2493                 esac
2494                 cat <<FOO
2495 They are not compatible!  You are probably running ksh on a non-USG system.
2496 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2497 have echo built in and we may have to run some Bourne shell scripts.  That
2498 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2499
2500 FOO
2501                 $echo $n "The star should be here-->$c"
2502                 $echo "*"
2503         fi
2504         $rm -f foo1 foo2
2505         ;;
2506 esac
2507
2508 # This question was auctioned at YAPC::Europe-2007 in Vienna
2509 # I never promised you could answer it. I only auctioned the question.
2510 cat <<FOO
2511 The following message is sponsored by
2512
2513   Dresden.pm<--The stars should be here.
2514
2515 Dear Perl user, system administrator or package
2516 maintainer, the Perl community sends greetings to
2517 you. Do you (emblematical) greet back [Y/n]? n
2518
2519 FOO
2520
2521 : Check what type of C compiler we use
2522 cat <<EOS >trygcc
2523 $startsh
2524 EOS
2525 cat <<'EOSC' >>trygcc
2526 case "$cc" in
2527 '') ;;
2528 *)  $rm -f try try.*
2529     $cat >try.c <<EOM
2530 int main(int argc, char *argv[]) {
2531   return 0;
2532 }
2533 EOM
2534     if $cc -o try $ccflags $ldflags try.c; then
2535        :
2536     else
2537         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2538         despair=yes
2539         trygcc=yes
2540         case "$cc" in
2541         *gcc*) trygcc=no ;;
2542         esac
2543         # Skip this test because it gives a false match on output like:
2544         #    ./trygcc: line 23: cc: command not found
2545         # case "`$cc -v -c try.c 2>&1`" in
2546         # *gcc*) trygcc=no ;;
2547         # esac
2548         if $test X"$trygcc" = Xyes; then
2549             if gcc -o try -c try.c; then
2550                 echo " "
2551                 echo "You seem to have a working gcc, though." >&4
2552                 # Switching compilers may undo the work of hints files.
2553                 # The most common problem is -D_REENTRANT for threads.
2554                 # This heuristic catches that case, but gets false positives
2555                 # if -Dusethreads was not actually specified.  Better to
2556                 # bail out here with a useful message than fail 
2557                 # mysteriously later. Should we perhaps just try to
2558                 # re-invoke Configure -Dcc=gcc config_args ?
2559                 if $test -f usethreads.cbu; then
2560                         $cat >&4 <<EOM 
2561
2562 *** However, any setting of the C compiler flags (e.g. for thread support)
2563 *** will be lost.  It may be necessary for you to restart Configure and
2564 *** add -Dcc=gcc to your Configure command line.
2565
2566 EOM
2567                         rp="Would you like to go ahead and try gcc anyway?"
2568                         dflt=n
2569                 else
2570                         rp="Would you like to use it?"
2571                         dflt=y
2572                 fi
2573                 if $test -f myread; then
2574                     . ./myread
2575                 else
2576                     if $test -f UU/myread; then
2577                         . ./UU/myread
2578                     else
2579                         echo "Cannot find myread, sorry.  Aborting." >&2
2580                         exit 1
2581                     fi
2582                 fi  
2583                 case "$ans" in
2584                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2585                 esac
2586             fi
2587         fi
2588     fi
2589     $rm -f try try.*
2590     ;;
2591 esac
2592 EOSC
2593
2594 cat <<EOS >checkcc
2595 $startsh
2596 EOS
2597 cat <<'EOSC' >>checkcc
2598 case "$cc" in        
2599 '') ;;
2600 *)  $rm -f try try.*              
2601     $cat >try.c <<EOM
2602 int main(int argc, char *argv[]) {
2603   return 0;
2604 }
2605 EOM
2606     if $cc -o try $ccflags $ldflags try.c; then
2607        :
2608     else
2609         if $test X"$despair" = Xyes; then
2610            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2611         fi
2612         $cat >&4 <<EOM         
2613 You need to find a working C compiler.
2614 Either (purchase and) install the C compiler supplied by your OS vendor,
2615 or for a free C compiler try http://gcc.gnu.org/
2616 I cannot continue any further, aborting.
2617 EOM
2618         exit 1
2619     fi
2620     $rm -f try try.*
2621     ;;
2622 esac
2623 EOSC
2624
2625 : determine whether symbolic links are supported
2626 echo " "
2627 $touch blurfl
2628 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2629         echo "Symbolic links are supported." >&4
2630         lns="$ln -s"
2631 else
2632         echo "Symbolic links are NOT supported." >&4
2633         lns="$ln"
2634 fi
2635 $rm -f blurfl sym
2636
2637 : determine whether symbolic links are supported
2638 echo " "
2639 case "$lns" in
2640 *"ln"*" -s")
2641         echo "Checking how to test for symbolic links..." >&4
2642         $lns blurfl sym
2643         if $test "X$issymlink" = X; then
2644                 case "$newsh" in
2645                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2646                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2647                 esac
2648                 if test $? = 0; then
2649                         issymlink="test -h"
2650                 else
2651                         echo "Your builtin 'test -h' may be broken." >&4
2652                         case "$test" in
2653                         /*)     ;;
2654                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2655                                 for p in $pth
2656                                 do
2657                                         if test -f "$p/$test"; then
2658                                                 test="$p/$test"
2659                                                 break
2660                                         fi
2661                                 done
2662                                 ;;
2663                         esac
2664                         case "$test" in
2665                         /*)
2666                                 echo "Trying external '$test -h'." >&4
2667                                 issymlink="$test -h"
2668                                 if $test ! -h sym >/dev/null 2>&1; then
2669                                         echo "External '$test -h' is broken, too." >&4
2670                                         issymlink=''
2671                                 fi
2672                                 ;;
2673                         *)      issymlink='' ;;
2674                         esac
2675                 fi              
2676         fi
2677         if $test "X$issymlink" = X; then
2678                 if $test -L sym 2>/dev/null; then
2679                         issymlink="$test -L"
2680                         echo "The builtin '$test -L' worked." >&4
2681                 fi
2682         fi
2683         if $test "X$issymlink" != X; then
2684                 echo "You can test for symbolic links with '$issymlink'." >&4
2685         else
2686                 echo "I do not know how you can test for symbolic links." >&4
2687         fi
2688         $rm -f blurfl sym
2689         ;;
2690 *)      echo "No symbolic links, so not testing for their testing..." >&4
2691         ;;
2692 esac
2693 echo " "
2694
2695 : Make symlinks util
2696 case "$mksymlinks" in
2697 $define|true|[yY]*)
2698         case "$src" in
2699         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2700                 exit 1
2701                 ;;
2702         *)      case "$lns:$issymlink" in
2703                 *"ln"*" -s:"*"test -"?)
2704                         echo "Creating the symbolic links..." >&4
2705                         echo "(First creating the subdirectories...)" >&4
2706                         cd ..
2707                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2708                                 read directory
2709                                 test -z "$directory" && break
2710                                 mkdir -p $directory
2711                         done
2712                         # Sanity check 1.
2713                         if test ! -d t/base; then
2714                                 echo "Failed to create the subdirectories.  Aborting." >&4
2715                                 exit 1
2716                         fi
2717                         echo "(Then creating the symlinks...)" >&4
2718                         awk '{print $1}' $src/MANIFEST | while true; do
2719                                 read filename
2720                                 test -z "$filename" && break
2721                                 if test -f $filename; then
2722                                         if $issymlink $filename; then
2723                                                 rm -f $filename
2724                                         fi
2725                                 fi
2726                                 if test -f $filename; then
2727                                         echo "$filename already exists, not symlinking."
2728                                 else
2729                                         ln -s $src/$filename $filename
2730                                 fi
2731                         done
2732                         # Sanity check 2.
2733                         if test ! -f t/base/lex.t; then
2734                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2735                                 exit 1
2736                         fi
2737                         cd UU
2738                         ;;
2739                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2740                         ;;
2741                 esac
2742                 ;;
2743         esac
2744         ;;
2745 esac
2746
2747 : Check for Cross-Compilation
2748 case "$usecrosscompile" in
2749 $define|true|[yY]*)
2750         $echo "Cross-compiling..."
2751         croak=''
2752         case "$cc" in
2753         *-*-gcc) # A cross-compiling gcc, probably.
2754             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2755             ar=$targetarch-ar
2756             # leave out ld, choosing it is more complex
2757             nm=$targetarch-nm
2758             ranlib=$targetarch-ranlib
2759             $echo 'extern int foo;' > try.c
2760             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2761             shift
2762             if $test $# -gt 0; then
2763                 incpth="$incpth $*"
2764                 incpth="`$echo $incpth|$sed 's/^ //'`"
2765                 echo "Guessing incpth '$incpth'." >&4
2766                 for i in $*; do
2767                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2768                     if $test -d $j; then
2769                         libpth="$libpth $j"
2770                     fi
2771                 done   
2772                 libpth="`$echo $libpth|$sed 's/^ //'`"
2773                 echo "Guessing libpth '$libpth'." >&4
2774             fi
2775             $rm -f try.c
2776             ;;
2777         esac
2778         case "$targetarch" in
2779         '') echo "Targetarch not defined." >&4; croak=y ;;
2780         *)  echo "Using targetarch $targetarch." >&4 ;;
2781         esac
2782         case "$incpth" in
2783         '') echo "Incpth not defined." >&4; croak=y ;;
2784         *)  echo "Using incpth '$incpth'." >&4 ;;
2785         esac
2786         case "$libpth" in
2787         '') echo "Libpth not defined." >&4; croak=y ;;
2788         *)  echo "Using libpth '$libpth'." >&4 ;;
2789         esac
2790         case "$usrinc" in
2791         '') for i in $incpth; do
2792                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2793                     usrinc=$i
2794                     echo "Guessing usrinc $usrinc." >&4
2795                     break
2796                 fi
2797             done
2798             case "$usrinc" in
2799             '') echo "Usrinc not defined." >&4; croak=y ;;
2800             esac
2801             ;;
2802         *)  echo "Using usrinc $usrinc." >&4 ;;
2803         esac
2804         case "$targethost" in
2805         '') echo "Targethost not defined." >&4; croak=y ;;
2806         *)  echo "Using targethost $targethost." >&4
2807         esac
2808         locincpth=' '
2809         loclibpth=' '
2810         case "$croak" in
2811         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2812         esac
2813         case "$src" in
2814         /*) run=$src/Cross/run
2815             targetmkdir=$src/Cross/mkdir
2816             to=$src/Cross/to
2817             from=$src/Cross/from
2818             ;;
2819         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2820             run=$pwd/Cross/run
2821             targetmkdir=$pwd/Cross/mkdir
2822             to=$pwd/Cross/to
2823             from=$pwd/Cross/from
2824             ;;
2825         esac
2826         case "$targetrun" in
2827         '') targetrun=ssh ;;
2828         esac
2829         case "$targetto" in
2830         '') targetto=scp ;;
2831         esac
2832         case "$targetfrom" in
2833         '') targetfrom=scp ;;
2834         esac
2835         run=$run-$targetrun
2836         to=$to-$targetto
2837         from=$from-$targetfrom
2838         case "$targetdir" in
2839         '')  targetdir=/tmp
2840              echo "Guessing targetdir $targetdir." >&4
2841              ;;
2842         esac
2843         case "$targetuser" in
2844         '')  targetuser=root
2845              echo "Guessing targetuser $targetuser." >&4
2846              ;;
2847         esac
2848         case "$targetfrom" in
2849         scp)    q=-q ;;
2850         *)      q='' ;;
2851         esac
2852         case "$targetrun" in
2853         ssh|rsh)
2854             cat >$run <<EOF
2855 #!/bin/sh
2856 case "\$1" in
2857 -cwd)
2858   shift
2859   cwd=\$1
2860   shift
2861   ;;
2862 esac
2863 case "\$cwd" in
2864 '') cwd=$targetdir ;;
2865 esac
2866 exe=\$1
2867 shift
2868 if $test ! -f \$exe.xok; then
2869   $to \$exe
2870   $touch \$exe.xok
2871 fi
2872 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2873 EOF
2874             ;;
2875         *)  echo "Unknown targetrun '$targetrun'" >&4
2876             exit 1
2877             ;;
2878         esac
2879         case "$targetmkdir" in
2880         */Cross/mkdir)
2881             cat >$targetmkdir <<EOF
2882 #!/bin/sh
2883 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2884 EOF
2885             $chmod a+rx $targetmkdir
2886             ;;
2887         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2888             exit 1
2889             ;;
2890         esac
2891         case "$targetto" in
2892         scp|rcp)
2893             cat >$to <<EOF
2894 #!/bin/sh
2895 for f in \$@
2896 do
2897   case "\$f" in
2898   /*)
2899     $targetmkdir \`dirname \$f\`
2900     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2901     ;;
2902   *)
2903     $targetmkdir $targetdir/\`dirname \$f\`
2904     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2905     ;;
2906   esac
2907 done
2908 exit 0
2909 EOF
2910             ;;
2911         cp) cat >$to <<EOF
2912 #!/bin/sh
2913 for f in \$@
2914 do
2915   case "\$f" in
2916   /*)
2917     $mkdir -p $targetdir/\`dirname \$f\`
2918     $cp \$f $targetdir/\$f || exit 1
2919     ;;
2920   *)
2921     $targetmkdir $targetdir/\`dirname \$f\`
2922     $cp \$f $targetdir/\$f || exit 1
2923     ;;
2924   esac
2925 done
2926 exit 0
2927 EOF
2928             ;;
2929         *)  echo "Unknown targetto '$targetto'" >&4
2930             exit 1
2931             ;;
2932         esac
2933         case "$targetfrom" in
2934         scp|rcp)
2935           cat >$from <<EOF
2936 #!/bin/sh
2937 for f in \$@
2938 do
2939   $rm -f \$f
2940   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2941 done
2942 exit 0
2943 EOF
2944             ;;
2945         cp) cat >$from <<EOF
2946 #!/bin/sh
2947 for f in \$@
2948 do
2949   $rm -f \$f
2950   cp $targetdir/\$f . || exit 1
2951 done
2952 exit 0
2953 EOF
2954             ;;
2955         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2956             exit 1
2957             ;;
2958         esac
2959         if $test ! -f $run; then
2960             echo "Target 'run' script '$run' not found." >&4
2961         else
2962             $chmod a+rx $run
2963         fi
2964         if $test ! -f $to; then
2965             echo "Target 'to' script '$to' not found." >&4
2966         else
2967             $chmod a+rx $to
2968         fi
2969         if $test ! -f $from; then
2970             echo "Target 'from' script '$from' not found." >&4
2971         else
2972             $chmod a+rx $from
2973         fi
2974         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2975             exit 1
2976         fi
2977         cat >&4 <<EOF
2978 Using '$run' for remote execution,
2979 and '$from' and '$to'
2980 for remote file transfer.
2981 EOF
2982         ;;
2983 *)      run=''
2984         to=:
2985         from=:
2986         usecrosscompile='undef'
2987         targetarch=''
2988         ;;
2989 esac
2990
2991 : see whether [:lower:] and [:upper:] are supported character classes
2992 echo " "
2993 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2994 ABYZ)
2995         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2996         up='[:upper:]'
2997         low='[:lower:]'
2998         ;;
2999 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3000         # (0xd9 and 0xe2), therefore that is a nice testing point.
3001         if test "X$up" = X -o "X$low" = X; then
3002             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3003             rs) up='[A-Z]'
3004                 low='[a-z]'
3005                 ;;
3006             esac
3007         fi
3008         if test "X$up" = X -o "X$low" = X; then
3009             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3010             rs) up='A-Z'
3011                 low='a-z'
3012                 ;;
3013             esac
3014         fi
3015         if test "X$up" = X -o "X$low" = X; then
3016             case "`echo RS | od -x 2>/dev/null`" in
3017             *D9E2*|*d9e2*)
3018                 echo "Hey, this might be EBCDIC." >&4
3019                 if test "X$up" = X -o "X$low" = X; then
3020                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3021                     rs) up='[A-IJ-RS-Z]'
3022                         low='[a-ij-rs-z]'
3023                         ;;
3024                     esac
3025                 fi
3026                 if test "X$up" = X -o "X$low" = X; then
3027                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3028                     rs) up='A-IJ-RS-Z'
3029                         low='a-ij-rs-z'
3030                         ;;
3031                     esac
3032                 fi
3033                 ;;
3034             esac
3035         fi
3036 esac
3037 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3038 rs)
3039     echo "Using $up and $low to convert case." >&4
3040     ;;
3041 *)
3042     echo "I don't know how to translate letters from upper to lower case." >&4
3043     echo "Your tr is not acting any way I know of." >&4
3044     exit 1
3045     ;;
3046 esac
3047 : set up the translation script tr, must be called with ./tr of course
3048 cat >tr <<EOSC
3049 $startsh
3050 case "\$1\$2" in
3051 '[A-Z][a-z]') exec $tr '$up' '$low';;
3052 '[a-z][A-Z]') exec $tr '$low' '$up';;
3053 esac
3054 exec $tr "\$@"
3055 EOSC
3056 chmod +x tr
3057 $eunicefix tr
3058
3059 : Try to determine whether config.sh was made on this system
3060 case "$config_sh" in
3061 '')
3062 myuname=`$uname -a 2>/dev/null`
3063 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3064 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3065 # because the A-Z/a-z are not consecutive.
3066 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3067         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3068 newmyuname="$myuname"
3069 dflt=n
3070 case "$knowitall" in
3071 '')
3072         if test -f ../config.sh; then
3073                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3074                         eval "`grep myuname= ../config.sh`"
3075                 fi
3076                 if test "X$myuname" = "X$newmyuname"; then
3077                         dflt=y
3078                 fi
3079         fi
3080         ;;
3081 *) dflt=y;;
3082 esac
3083
3084 : Get old answers from old config file if Configure was run on the
3085 : same system, otherwise use the hints.
3086 hint=default
3087 cd ..
3088 if test -f config.sh; then
3089         echo " "
3090         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3091         . UU/myread
3092         case "$ans" in
3093         n*|N*) echo "OK, I'll ignore it."
3094                 mv config.sh config.sh.old
3095                 myuname="$newmyuname"
3096                 ;;
3097         *)  echo "Fetching default answers from your old config.sh file..." >&4
3098                 tmp_n="$n"
3099                 tmp_c="$c"
3100                 tmp_sh="$sh"
3101                 . ./config.sh
3102                 cp config.sh UU
3103                 n="$tmp_n"
3104                 c="$tmp_c"
3105                 : Older versions did not always set $sh.  Catch re-use of such
3106                 : an old config.sh.
3107                 case "$sh" in
3108                 '') sh="$tmp_sh" ;;
3109                 esac
3110                 hint=previous
3111                 ;;
3112         esac
3113 fi
3114 . ./UU/checkcc
3115 if test ! -f config.sh; then
3116         $cat <<EOM
3117
3118 First time through, eh?  I have some defaults handy for some systems
3119 that need some extra help getting the Configure answers right:
3120
3121 EOM
3122         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3123         dflt=''
3124         : Half the following guesses are probably wrong... If you have better
3125         : tests or hints, please send them to perlbug@perl.org
3126         : The metaconfig authors would also appreciate a copy...
3127         $test -f /irix && osname=irix
3128         $test -f /xenix && osname=sco_xenix
3129         $test -f /dynix && osname=dynix
3130         $test -f /dnix && osname=dnix
3131         $test -f /lynx.os && osname=lynxos
3132         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3133         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3134         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3135         $test -f /bin/mips && /bin/mips && osname=mips
3136         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3137                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3138         $test -d /usr/apollo/bin && osname=apollo
3139         $test -f /etc/saf/_sactab && osname=svr4
3140         $test -d /usr/include/minix && osname=minix
3141         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3142         if $test -d /MachTen -o -d /MachTen_Folder; then
3143                 osname=machten
3144                 if $test -x /sbin/version; then
3145                         osvers=`/sbin/version | $awk '{print $2}' |
3146                         $sed -e 's/[A-Za-z]$//'`
3147                 elif $test -x /usr/etc/version; then
3148                         osvers=`/usr/etc/version | $awk '{print $2}' |
3149                         $sed -e 's/[A-Za-z]$//'`
3150                 else
3151                         osvers="$2.$3"
3152                 fi
3153         fi
3154
3155         $test -f /sys/posix.dll &&
3156                 $test -f /usr/bin/what &&
3157                 set X `/usr/bin/what /sys/posix.dll` &&
3158                 $test "$3" = UWIN &&
3159                 osname=uwin &&
3160                 osvers="$5"
3161
3162         if $test -f $uname; then
3163                 set X $myuname
3164                 shift
3165
3166                 case "$5" in
3167                 fps*) osname=fps ;;
3168                 mips*)
3169                         case "$4" in
3170                         umips) osname=umips ;;
3171                         *) osname=mips ;;
3172                         esac;;
3173                 [23]100) osname=mips ;;
3174                 next*) osname=next ;;
3175                 i386*)
3176                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3177                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3178                                 osname='sco'
3179                                 osvers=$tmp
3180                         elif $test -f /etc/kconfig; then
3181                                 osname=isc
3182                                 if test "$lns" = "$ln -s"; then
3183                                         osvers=4
3184                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3185                                         osvers=3
3186                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3187                                         osvers=2
3188                                 fi
3189                         fi
3190                         tmp=''
3191                         ;;
3192                 pc*)
3193                         if test -n "$DJGPP"; then
3194                                 osname=dos
3195                                 osvers=djgpp
3196                         fi
3197                         ;;
3198                 esac
3199
3200                 case "$1" in
3201                 aix) osname=aix
3202                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3203                         case "$tmp" in
3204                         # oslevel can fail with:
3205                         # oslevel: Unable to acquire lock.
3206                         *not\ found) osvers="$4"."$3" ;;
3207                         '<3240'|'<>3240') osvers=3.2.0 ;;
3208                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3209                         '=3250'|'>3250') osvers=3.2.5 ;;
3210                         *) osvers=$tmp;;
3211                         esac
3212                         ;;
3213                 bsd386) osname=bsd386
3214                         osvers=`$uname -r`
3215                         ;;
3216                 cygwin*) osname=cygwin
3217                         osvers="$3"
3218                         ;;
3219                 *dc.osx) osname=dcosx
3220                         osvers="$3"
3221                         ;;
3222                 dnix) osname=dnix
3223                         osvers="$3"
3224                         ;;
3225                 domainos) osname=apollo
3226                         osvers="$3"
3227                         ;;
3228                 dgux)   osname=dgux
3229                         osvers="$3"
3230                         ;;
3231                 dragonfly) osname=dragonfly
3232                         osvers="$3"
3233                         ;;
3234                 dynixptx*) osname=dynixptx
3235                         osvers=`echo "$4"|sed 's/^v//'`
3236                         ;;
3237                 freebsd) osname=freebsd
3238                         osvers="$3" ;;
3239                 genix)  osname=genix ;;
3240                 gnu)    osname=gnu
3241                         osvers="$3" ;;
3242                 hp*)    osname=hpux
3243                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3244                         ;;
3245                 irix*)  osname=irix
3246                         case "$3" in
3247                         4*) osvers=4 ;;
3248                         5*) osvers=5 ;;
3249                         *)      osvers="$3" ;;
3250                         esac
3251                         ;;
3252                 linux)  osname=linux
3253                         case "$3" in
3254                         *)      osvers="$3" ;;
3255                         esac
3256                         ;;
3257                 MiNT)   osname=mint
3258                         ;;
3259                 netbsd*) osname=netbsd
3260                         osvers="$3"
3261                         ;;
3262                 news-os) osvers="$3"
3263                         case "$3" in
3264                         4*) osname=newsos4 ;;
3265                         *) osname=newsos ;;
3266                         esac
3267                         ;;
3268                 next*) osname=next ;;
3269                 nonstop-ux) osname=nonstopux ;;
3270                 openbsd) osname=openbsd
3271                         osvers="$3"
3272                         ;;
3273                 os2)    osname=os2
3274                         osvers="$4"
3275                         ;;
3276                 POSIX-BC | posix-bc ) osname=posix-bc
3277                         osvers="$3"
3278                         ;;
3279                 powerux | power_ux | powermax_os | powermaxos | \
3280                 powerunix | power_unix) osname=powerux
3281                         osvers="$3"
3282                         ;;
3283                 qnx) osname=qnx
3284                         osvers="$4"
3285                         ;;
3286                 solaris) osname=solaris
3287                         case "$3" in
3288                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3289                         *)      osvers="$3" ;;
3290                         esac
3291                         ;;
3292                 sunos) osname=sunos
3293                         case "$3" in
3294                         5*) osname=solaris
3295                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3296                         *)      osvers="$3" ;;
3297                         esac
3298                         ;;
3299                 titanos) osname=titanos
3300                         case "$3" in
3301                         1*) osvers=1 ;;
3302                         2*) osvers=2 ;;
3303                         3*) osvers=3 ;;
3304                         4*) osvers=4 ;;
3305                         *)      osvers="$3" ;;
3306                         esac
3307                         ;;
3308                 ultrix) osname=ultrix
3309                         osvers="$3"
3310                         ;;
3311                 osf1|mls+)      case "$5" in
3312                                 alpha)
3313                                         osname=dec_osf
3314                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3315                                         case "$osvers" in
3316                                         [1-9].[0-9]*) ;;
3317                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3318                                         esac
3319                                         ;;
3320                         hp*)    osname=hp_osf1  ;;
3321                         mips)   osname=mips_osf1 ;;
3322                         esac
3323                         ;;
3324                 # UnixWare 7.1.2 is known as Open UNIX 8
3325                 openunix|unixware) osname=svr5
3326                         osvers="$4"
3327                         ;;
3328                 uts)    osname=uts
3329                         osvers="$3"
3330                         ;;
3331                 vos) osvers="$3"
3332                         ;;
3333                 $2) case "$osname" in
3334                         *isc*) ;;
3335                         *freebsd*) ;;
3336                         svr*)
3337                                 : svr4.x or possibly later
3338                                 case "svr$3" in
3339                                 ${osname}*)
3340                                         osname=svr$3
3341                                         osvers=$4
3342                                         ;;
3343                                 esac
3344                                 case "$osname" in
3345                                 svr4.0)
3346                                         : Check for ESIX
3347                                         if test -f /stand/boot ; then
3348                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3349                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3350                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3351                                                         if test -n "$isesix"; then
3352                                                                 osname=esix4
3353                                                         fi
3354                                                 fi
3355                                         fi
3356                                         ;;
3357                                 esac
3358                                 ;;
3359                         *)      if test -f /etc/systemid; then
3360                                         osname=sco
3361                                         set `echo $3 | $sed 's/\./ /g'` $4
3362                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3363                                                 osvers=$1.$2.$3
3364                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3365                                                 osvers=$1.$2
3366                                         elif $test -f $src/hints/sco_$1.sh; then
3367                                                 osvers=$1
3368                                         fi
3369                                 else
3370                                         case "$osname" in
3371                                         '') : Still unknown.  Probably a generic Sys V.
3372                                                 osname="sysv"
3373                                                 osvers="$3"
3374                                                 ;;
3375                                         esac
3376                                 fi
3377                                 ;;
3378                         esac
3379                         ;;
3380                 *)      case "$osname" in
3381                         '') : Still unknown.  Probably a generic BSD.
3382                                 osname="$1"
3383                                 osvers="$3"
3384                                 ;;
3385                         esac
3386                         ;;
3387                 esac
3388         else
3389                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3390                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3391                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3392                                 osname=news_os
3393                         fi
3394                         $rm -f UU/kernel.what
3395                 elif test -d c:/. -o -n "$is_os2" ; then
3396                         set X $myuname
3397                         osname=os2
3398                         osvers="$5"
3399                 fi
3400         fi
3401
3402         case "$targetarch" in
3403         '') ;;
3404         *)  hostarch=$osname
3405             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3406             osvers=''
3407             ;;
3408         esac
3409
3410         : Now look for a hint file osname_osvers, unless one has been
3411         : specified already.
3412         case "$hintfile" in
3413         ''|' ')
3414                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3415                 : Also try without trailing minor version numbers.
3416                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3417                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3418                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3419                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3420                 case "$file" in
3421                 '') dflt=none ;;
3422                 *)  case "$osvers" in
3423                         '') dflt=$file
3424                                 ;;
3425                         *)  if $test -f $src/hints/$file.sh ; then
3426                                         dflt=$file
3427                                 elif $test -f $src/hints/$xfile.sh ; then
3428                                         dflt=$xfile
3429                                 elif $test -f $src/hints/$xxfile.sh ; then
3430                                         dflt=$xxfile
3431                                 elif $test -f $src/hints/$xxxfile.sh ; then
3432                                         dflt=$xxxfile
3433                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3434                                         dflt=$xxxxfile
3435                                 elif $test -f "$src/hints/${osname}.sh" ; then
3436                                         dflt="${osname}"
3437                                 else
3438                                         dflt=none
3439                                 fi
3440                                 ;;
3441                         esac
3442                         ;;
3443                 esac
3444                 if $test -f Policy.sh ; then
3445                         case "$dflt" in
3446                         *Policy*) ;;
3447                         none) dflt="Policy" ;;
3448                         *) dflt="Policy $dflt" ;;
3449                         esac
3450                 fi
3451                 ;;
3452         *)
3453                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3454                 ;;
3455         esac
3456
3457         if $test -f Policy.sh ; then
3458                 $cat <<EOM
3459
3460 There's also a Policy hint file available, which should make the
3461 site-specific (policy) questions easier to answer.
3462 EOM
3463
3464         fi
3465
3466         $cat <<EOM
3467
3468 You may give one or more space-separated answers, or "none" if appropriate.
3469 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3470 previous run of Configure, you may specify it as well as or instead of
3471 OS-specific hints.  If hints are provided for your OS, you should use them:
3472 although Perl can probably be built without hints on many platforms, using
3473 hints often improve performance and may enable features that Configure can't
3474 set up on its own. If there are no hints that match your OS, specify "none";
3475 DO NOT give a wrong version or a wrong OS.
3476
3477 EOM
3478
3479         rp="Which of these apply, if any?"
3480         . UU/myread
3481         tans=$ans
3482         for file in $tans; do
3483                 if $test X$file = XPolicy -a -f Policy.sh; then
3484                         . Policy.sh
3485                         $cat Policy.sh >> UU/config.sh
3486                 elif $test -f $src/hints/$file.sh; then
3487                         . $src/hints/$file.sh
3488                         $cat $src/hints/$file.sh >> UU/config.sh
3489                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3490                         : nothing
3491                 else
3492                         : Give one chance to correct a possible typo.
3493                         echo "$file.sh does not exist"
3494                         dflt=$file
3495                         rp="hint to use instead?"
3496                         . UU/myread
3497                         for file in $ans; do
3498                                 if $test -f "$src/hints/$file.sh"; then
3499                                         . $src/hints/$file.sh
3500                                         $cat $src/hints/$file.sh >> UU/config.sh
3501                                 elif $test X$ans = X -o X$ans = Xnone ; then
3502                                         : nothing
3503                                 else
3504                                         echo "$file.sh does not exist -- ignored."
3505                                 fi
3506                         done
3507                 fi
3508         done
3509
3510         hint=recommended
3511         : Remember our hint file for later.
3512         if $test -f "$src/hints/$file.sh" ; then
3513                 hintfile="$file"
3514         else
3515                 hintfile=''
3516         fi
3517 fi
3518 cd UU
3519 ;;
3520 *)
3521         echo " "
3522         echo "Fetching default answers from $config_sh..." >&4
3523         tmp_n="$n"
3524         tmp_c="$c"
3525         cd ..
3526         cp $config_sh config.sh 2>/dev/null
3527         chmod +w config.sh
3528         . ./config.sh
3529         cd UU
3530         cp ../config.sh .
3531         n="$tmp_n"
3532         c="$tmp_c"
3533         hint=previous
3534         ;;
3535 esac
3536 test "$override" && . ./optdef.sh
3537
3538 : Restore computed paths
3539 for file in $loclist $trylist; do
3540         eval $file="\$_$file"
3541 done
3542
3543 cat << EOM
3544
3545 Configure uses the operating system name and version to set some defaults.
3546 The default value is probably right if the name rings a bell. Otherwise,
3547 since spelling matters for me, either accept the default or answer "none"
3548 to leave it blank.
3549
3550 EOM
3551 case "$osname" in
3552         ''|' ')
3553                 case "$hintfile" in
3554                 ''|' '|none) dflt=none ;;
3555                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3556                 esac
3557                 ;;
3558         *) dflt="$osname" ;;
3559 esac
3560 rp="Operating system name?"
3561 . ./myread
3562 case "$ans" in
3563 none)  osname='' ;;
3564 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3565 esac
3566 echo " "
3567 case "$osvers" in
3568         ''|' ')
3569                 case "$hintfile" in
3570                 ''|' '|none) dflt=none ;;
3571                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3572                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3573                         case "$dflt" in
3574                         ''|' ') dflt=none ;;
3575                         esac
3576                         ;;
3577                 esac
3578                 ;;
3579         *) dflt="$osvers" ;;
3580 esac
3581 rp="Operating system version?"
3582 . ./myread
3583 case "$ans" in
3584 none)  osvers='' ;;
3585 *) osvers="$ans" ;;
3586 esac
3587
3588
3589 . ./posthint.sh
3590
3591 : who configured the system
3592 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3593 case "$cf_by" in
3594 "")
3595         cf_by=`(logname) 2>/dev/null`
3596         case "$cf_by" in
3597         "")
3598                 cf_by=`(whoami) 2>/dev/null`
3599                 case "$cf_by" in
3600                 "") cf_by=unknown ;;
3601                 esac ;;
3602         esac ;;
3603 esac
3604
3605 : decide how portable to be.  Allow command line overrides.
3606 case "$d_portable" in
3607 "$undef") ;;
3608 *)      d_portable="$define" ;;
3609 esac
3610
3611 : set up shell script to do ~ expansion
3612 cat >filexp <<EOSS
3613 $startsh
3614 : expand filename
3615 case "\$1" in
3616  \~/*|\~)
3617         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3618         ;;
3619  \~*)
3620         if $test -f /bin/csh; then
3621                 /bin/csh -f -c "glob \$1"
3622                 failed=\$?
3623                 echo ""
3624                 exit \$failed
3625         else
3626                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3627                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3628                 if $test ! -d "\$dir"; then
3629                         me=\`basename \$0\`
3630                         echo "\$me: can't locate home directory for: \$name" >&2
3631                         exit 1
3632                 fi
3633                 case "\$1" in
3634                 */*)
3635                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3636                         ;;
3637                 *)
3638                         echo \$dir
3639                         ;;
3640                 esac
3641         fi
3642         ;;
3643 *)
3644         echo \$1
3645         ;;
3646 esac
3647 EOSS
3648 chmod +x filexp
3649 $eunicefix filexp
3650
3651 : now set up to get a file name
3652 cat <<EOS >getfile
3653 $startsh
3654 EOS
3655 cat <<'EOSC' >>getfile
3656 tilde=''
3657 fullpath=''
3658 already=''
3659 skip=''
3660 none_ok=''
3661 exp_file=''
3662 nopath_ok=''
3663 orig_rp="$rp"
3664 orig_dflt="$dflt"
3665 case "$gfpth" in
3666 '') gfpth='.' ;;
3667 esac
3668
3669 case "$fn" in
3670 *\(*)
3671         : getfile will accept an answer from the comma-separated list
3672         : enclosed in parentheses even if it does not meet other criteria.
3673         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3674         fn=`echo $fn | sed 's/(.*)//'`
3675         ;;
3676 esac
3677
3678 case "$fn" in
3679 *:*)
3680         loc_file=`expr $fn : '.*:\(.*\)'`
3681         fn=`expr $fn : '\(.*\):.*'`
3682         ;;
3683 esac
3684
3685 case "$fn" in
3686 *~*) tilde=true;;
3687 esac
3688 case "$fn" in
3689 */*) fullpath=true;;
3690 esac
3691 case "$fn" in
3692 *+*) skip=true;;
3693 esac
3694 case "$fn" in
3695 *n*) none_ok=true;;
3696 esac
3697 case "$fn" in
3698 *e*) exp_file=true;;
3699 esac
3700 case "$fn" in
3701 *p*) nopath_ok=true;;
3702 esac
3703
3704 case "$fn" in
3705 *f*) type='File';;
3706 *d*) type='Directory';;
3707 *l*) type='Locate';;
3708 esac
3709
3710 what="$type"
3711 case "$what" in
3712 Locate) what='File';;
3713 esac
3714
3715 case "$exp_file" in
3716 '')
3717         case "$d_portable" in
3718         "$define") ;;
3719         *) exp_file=true;;
3720         esac
3721         ;;
3722 esac
3723
3724 cd ..
3725 while test "$type"; do
3726         redo=''
3727         rp="$orig_rp"
3728         dflt="$orig_dflt"
3729         case "$tilde" in
3730         true) rp="$rp (~name ok)";;
3731         esac
3732         . UU/myread
3733         if test -f UU/getfile.ok && \
3734                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3735         then
3736                 value="$ans"
3737                 ansexp="$ans"
3738                 break
3739         fi
3740         case "$ans" in
3741         none)
3742                 value=''
3743                 ansexp=''
3744                 case "$none_ok" in
3745                 true) type='';;
3746                 esac
3747                 ;;
3748         *)
3749                 case "$tilde" in
3750                 '') value="$ans"
3751                         ansexp="$ans";;
3752                 *)
3753                         value=`UU/filexp $ans`
3754                         case $? in
3755                         0)
3756                                 if test "$ans" != "$value"; then
3757                                         echo "(That expands to $value on this system.)"
3758                                 fi
3759                                 ;;
3760                         *) value="$ans";;
3761                         esac
3762                         ansexp="$value"
3763                         case "$exp_file" in
3764                         '') value="$ans";;
3765                         esac
3766                         ;;
3767                 esac
3768                 case "$fullpath" in
3769                 true)
3770                         case "$ansexp" in
3771                         /*) value="$ansexp" ;;
3772                         [a-zA-Z]:/*) value="$ansexp" ;;
3773                         *)
3774                                 redo=true
3775                                 case "$already" in
3776                                 true)
3777                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3778                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3779                                         ;;
3780                                 *)
3781                                 echo "Please give a full path name, starting with slash." >&4
3782                                         case "$tilde" in
3783                                         true)
3784                                 echo "Note that using ~name is ok provided it expands well." >&4
3785                                                 already=true
3786                                                 ;;
3787                                         esac
3788                                 esac
3789                                 ;;
3790                         esac
3791                         ;;
3792                 esac
3793                 case "$redo" in
3794                 '')
3795                         case "$type" in
3796                         File)
3797                                 for fp in $gfpth; do
3798                                         if test "X$fp" = X.; then
3799                                             pf="$ansexp"
3800                                         else    
3801                                             pf="$fp/$ansexp"
3802                                         fi
3803                                         if test -f "$pf"; then
3804                                                 type=''
3805                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3806                                         then
3807                                                 echo "($value is not a plain file, but that's ok.)"
3808                                                 type=''
3809                                         fi
3810                                         if test X"$type" = X; then
3811                                             value="$pf"
3812                                             break
3813                                         fi
3814                                 done
3815                                 ;;
3816                         Directory)
3817                                 for fp in $gfpth; do
3818                                         if test "X$fp" = X.; then
3819                                             dir="$ans"
3820                                             direxp="$ansexp"
3821                                         else    
3822                                             dir="$fp/$ansexp"
3823                                             direxp="$fp/$ansexp"
3824                                         fi
3825                                         if test -d "$direxp"; then
3826                                                 type=''
3827                                                 value="$dir"
3828                                                 break
3829                                         fi
3830                                 done
3831                                 ;;
3832                         Locate)
3833                                 if test -d "$ansexp"; then
3834                                         echo "(Looking for $loc_file in directory $value.)"
3835                                         value="$value/$loc_file"
3836                                         ansexp="$ansexp/$loc_file"
3837                                 fi
3838                                 if test -f "$ansexp"; then
3839                                         type=''
3840                                 fi
3841                                 case "$nopath_ok" in
3842                                 true)   case "$value" in
3843                                         */*) ;;
3844                                         *)      echo "Assuming $value will be in people's path."
3845                                                 type=''
3846                                                 ;;
3847                                         esac
3848                                         ;;
3849                                 esac
3850                                 ;;
3851                         esac
3852
3853                         case "$skip" in
3854                         true) type='';
3855                         esac
3856
3857                         case "$type" in
3858                         '') ;;
3859                         *)
3860                                 if test "$fastread" = yes; then
3861                                         dflt=y
3862                                 else
3863                                         dflt=n
3864                                 fi
3865                                 rp="$what $value doesn't exist.  Use that name anyway?"
3866                                 . UU/myread
3867                                 dflt=''
3868                                 case "$ans" in
3869                                 y*) type='';;
3870                                 *) echo " ";;
3871                                 esac
3872                                 ;;
3873                         esac
3874                         ;;
3875                 esac
3876                 ;;
3877         esac
3878 done
3879 cd UU
3880 ans="$value"
3881 rp="$orig_rp"
3882 dflt="$orig_dflt"
3883 rm -f getfile.ok
3884 test "X$gfpthkeep" != Xy && gfpth=""
3885 EOSC
3886
3887 : determine root of directory hierarchy where package will be installed.
3888 case "$prefix" in
3889 '')
3890         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3891         ;;
3892 *?/)
3893         dflt=`echo "$prefix" | sed 's/.$//'`
3894         ;;
3895 *)
3896         dflt="$prefix"
3897         ;;
3898 esac
3899 $cat <<EOM
3900
3901 By default, $package will be installed in $dflt/bin, manual pages
3902 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3903 installation directories. Typically this is something like /usr/local.
3904 If you wish to have binaries under /usr/bin but other parts of the
3905 installation under /usr/local, that's ok: you will be prompted
3906 separately for each of the installation directories, the prefix being
3907 only used to set the defaults.
3908
3909 EOM
3910 fn=d~
3911 rp='Installation prefix to use?'
3912 . ./getfile
3913 oldprefix=''
3914 case "$prefix" in
3915 '') ;;
3916 *)
3917         case "$ans" in
3918         "$prefix") ;;
3919         *) oldprefix="$prefix";;
3920         esac
3921         ;;
3922 esac
3923 prefix="$ans"
3924 prefixexp="$ansexp"
3925
3926 : allow them to override the AFS root
3927 case "$afsroot" in
3928 '')     afsroot=/afs ;;
3929 *)      afsroot=$afsroot ;;
3930 esac
3931
3932 : is AFS running?
3933 echo " "
3934 case "$afs" in
3935 $define|true)   afs=true ;;
3936 $undef|false)   afs=false ;;
3937 *)      if $test -d $afsroot; then
3938                 afs=true
3939         else
3940                 afs=false
3941         fi
3942         ;;
3943 esac
3944 if $afs; then
3945         echo "AFS may be running... I'll be extra cautious then..." >&4
3946 else
3947         echo "AFS does not seem to be running..." >&4
3948 fi
3949
3950 : determine installation prefix for where package is to be installed.
3951 if $afs; then 
3952 $cat <<EOM
3953
3954 Since you are running AFS, I need to distinguish the directory in which
3955 files will reside from the directory in which they are installed (and from
3956 which they are presumably copied to the former directory by occult means).
3957
3958 EOM
3959         case "$installprefix" in
3960         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3961         *) dflt="$installprefix";;
3962         esac
3963 else
3964 $cat <<EOM
3965
3966 In some special cases, particularly when building $package for distribution,
3967 it is convenient to distinguish the directory in which files should be
3968 installed from the directory ($prefix) in which they will
3969 eventually reside.  For most users, these two directories are the same.
3970
3971 EOM
3972         case "$installprefix" in
3973         '') dflt=$prefix ;;
3974         *) dflt=$installprefix;;
3975         esac
3976 fi
3977 fn=d~
3978 rp='What installation prefix should I use for installing files?'
3979 . ./getfile
3980 installprefix="$ans"
3981 installprefixexp="$ansexp"
3982
3983 : Perform the prefixexp/installprefixexp correction if necessary
3984 cat <<EOS >installprefix
3985 $startsh
3986 EOS
3987 cat <<'EOSC' >>installprefix
3988 : Change installation prefix, if necessary.
3989 if $test X"$prefix" != X"$installprefix"; then
3990     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3991 else
3992     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3993 fi
3994 EOSC
3995 chmod +x installprefix
3996 $eunicefix installprefix
3997
3998 : Set variables such as privlib and privlibexp from the output of ./getfile
3999 : performing the prefixexp/installprefixexp correction if necessary.
4000 cat <<EOS >setprefixvar
4001 $startsh
4002 EOS
4003 cat <<'EOSC' >>setprefixvar
4004 eval "${prefixvar}=\"\$ans\""
4005 eval "${prefixvar}exp=\"\$ansexp\""
4006 . ./installprefix
4007 EOSC
4008 chmod +x setprefixvar
4009 $eunicefix setprefixvar
4010
4011 : set up the script used to warn in case of inconsistency
4012 cat <<EOS >whoa
4013 $startsh
4014 EOS
4015 cat <<'EOSC' >>whoa
4016 dflt=y
4017 case "$hint" in
4018     recommended)
4019         case "$hintfile" in
4020         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4021                 ;;
4022         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4023                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4024                 ;;
4025         esac
4026         ;;
4027     *)  echo " "
4028         echo "*** WHOA THERE!!! ***" >&4
4029         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4030         ;;
4031 esac
4032 rp="    Keep the $hint value?"
4033 . ./myread
4034 case "$ans" in
4035 y) td=$was; tu=$was;;
4036 esac
4037 EOSC
4038
4039 : function used to set '$1' to '$val'
4040 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4041 case "$val$was" in
4042 $define$undef) . ./whoa; eval "$var=\$td";;
4043 $undef$define) . ./whoa; eval "$var=\$tu";;
4044 *) eval "$var=$val";;
4045 esac'
4046
4047 : Check is we will use socks
4048 case "$usesocks" in
4049 $define|true|[yY]*)     dflt='y';;
4050 *) dflt='n';;
4051 esac
4052 cat <<EOM
4053
4054 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4055 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4056 to use the PerlIO abstraction layer, this will be implicitly selected.
4057
4058 If this doesn't make any sense to you, just accept the default '$dflt'.
4059 EOM
4060 rp='Build Perl for SOCKS?'
4061 . ./myread
4062 case "$ans" in
4063 y|Y)    val="$define" ;;
4064 *)      val="$undef" ;;
4065 esac
4066 set usesocks
4067 eval $setvar
4068
4069 case "$usesocks" in
4070 $define|true|[yY]*) useperlio="$define";;
4071 esac
4072
4073 : Check if we want perlio
4074 case "$useperlio" in
4075 $define|true|[yY]*|'')  dflt='y';;
4076 *) dflt='n';;
4077 esac
4078 cat <<EOM
4079
4080 Previous version of $package used the standard IO mechanisms as
4081 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4082 alternate IO mechanisms via the PerlIO abstraction layer, but the
4083 stdio mechanism is still available if needed.  The abstraction layer
4084 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4085 Using PerlIO with sfio may cause problems with some extension modules.
4086
4087 If this doesn't make any sense to you, just accept the default '$dflt'.
4088 EOM
4089 rp='Use the PerlIO abstraction layer?'
4090 . ./myread
4091 case "$ans" in
4092 y|Y)
4093         val="$define"
4094         ;;
4095 *)
4096         echo "Ok, doing things the stdio way."
4097         val="$undef"
4098         ;;
4099 esac
4100 set useperlio
4101 eval $setvar
4102
4103 case "$usesocks" in
4104 $define|true|[yY]*)
4105         case "$useperlio" in
4106         $define|true|[yY]*) ;;
4107         *)      cat >&4 <<EOM
4108
4109 You are using the SOCKS proxy protocol library which means that you
4110 should also use the PerlIO layer.  You may be headed for trouble.
4111
4112 EOM
4113                 ;;
4114         esac
4115         ;;
4116 esac
4117
4118 : get the patchlevel
4119 echo " "
4120 echo "Getting the current patchlevel..." >&4
4121 if $test -r $rsrc/patchlevel.h;then
4122         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4123         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4124         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4125         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4126         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4127         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4128         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4129 else
4130         revision=0
4131         patchlevel=0
4132         subversion=0
4133         api_revision=0
4134         api_version=0
4135         api_subversion=0
4136         perl_patchlevel=0
4137         $echo "(You do not have patchlevel.h.  Eek.)"
4138 fi
4139 if $test -r $rsrc/.patch ; then
4140         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4141                 perl_patchlevel=`cat $rsrc/.patch`
4142         fi
4143 fi
4144 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4145 version_patchlevel_string="version $patchlevel subversion $subversion"
4146 case "$perl_patchlevel" in
4147 0|'') ;;
4148 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4149     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4150     ;;
4151 esac
4152
4153 $echo "(You have $package $version_patchlevel_string.)"
4154
4155 case "$osname" in
4156 dos|vms)
4157         : XXX Should be a Configure test for double-dots in filenames.
4158         version=`echo $revision $patchlevel $subversion | \
4159                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4160         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4161                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4162         ;;
4163 *)
4164         version=`echo $revision $patchlevel $subversion | \
4165                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4166         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4167                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4168         ;;
4169 esac
4170 : Special case the 5.005_xx maintenance series, which used 5.005
4171 : without any subversion label as a subdirectory in $sitelib
4172 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4173         api_versionstring='5.005'
4174 fi
4175
4176 : Do we want threads support and if so, what type
4177 case "$usethreads" in
4178 $define|true|[yY]*)     dflt='y';;
4179 *)     # Catch case where user specified ithreads or 5005threads but
4180        # forgot -Dusethreads (A.D. 4/2002)
4181        case "$useithreads$use5005threads" in
4182        *$define*)
4183                 case "$useperlio" in
4184                 "$define")      dflt='y' ;;
4185                 *)              dflt='n' ;;
4186                 esac
4187                 ;;
4188        *)       dflt='n';;
4189        esac
4190        ;;
4191 esac
4192 cat <<EOM
4193
4194 Perl can be built to take advantage of threads on some systems.
4195 To do so, Configure can be run with -Dusethreads.
4196
4197 Note that Perl built with threading support runs slightly slower
4198 and uses more memory than plain Perl. The current implementation
4199 is believed to be stable, but it is fairly new, and so should be
4200 treated with caution.
4201
4202 If this doesn't make any sense to you, just accept the default '$dflt'.
4203 EOM
4204 rp='Build a threading Perl?'
4205 . ./myread
4206 case "$ans" in
4207 y|Y)    val="$define" ;;
4208 *)      val="$undef" ;;
4209 esac
4210 set usethreads
4211 eval $setvar
4212
4213 if $test $patchlevel -lt 9; then
4214     case "$usethreads" in
4215     $define)
4216         $cat <<EOM
4217
4218 Since release 5.6, Perl has had two different threading implementations,
4219 the newer interpreter-based version (ithreads) with one interpreter per
4220 thread, and the older 5.005 version (5005threads).
4221 The 5005threads version is effectively unmaintained and will probably be
4222 removed in Perl 5.10, so there should be no need to build a Perl using it
4223 unless needed for backwards compatibility with some existing 5.005threads
4224 code.
4225
4226 EOM
4227         : Default to ithreads unless overridden on command line or with
4228         : old config.sh
4229         dflt='y'
4230         case "$use5005threads" in
4231                 $define|true|[yY]*) dflt='n';;
4232         esac
4233         case "$useithreads" in
4234                 $undef|false|[nN]*) dflt='n';;
4235         esac
4236         rp='Use the newer interpreter-based ithreads?'
4237         . ./myread
4238         case "$ans" in
4239         y|Y)    val="$define" ;;
4240         *)      val="$undef" ;;
4241         esac
4242         set useithreads
4243         eval $setvar
4244         : Now set use5005threads to the opposite value.
4245         case "$useithreads" in
4246         $define) val="$undef" ;;
4247         *) val="$define" ;;
4248         esac
4249         set use5005threads
4250         eval $setvar
4251         ;;
4252     *)
4253         useithreads="$undef"
4254         use5005threads="$undef"
4255         ;;
4256     esac
4257
4258     case "$useithreads$use5005threads" in
4259     "$define$define")
4260         $cat >&4 <<EOM
4261
4262 You cannot have both the ithreads and the 5.005 threads enabled
4263 at the same time.  Disabling the 5.005 threads since they are
4264 much less stable than the ithreads.
4265
4266 EOM
4267         use5005threads="$undef"
4268         ;;
4269     esac
4270
4271 else
4272 : perl-5.9.x and later
4273
4274     if test X"$usethreads" = "X$define"; then
4275         case "$use5005threads" in
4276             $define|true|[yY]*)
4277                 $cat >&4 <<EOM
4278
4279 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4280
4281 EOM
4282             ;;
4283         esac
4284     fi
4285
4286     use5005threads="$undef"
4287     useithreads="$usethreads"
4288 fi
4289
4290 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4291         cat >&4 <<EOF
4292 ***
4293 *** To build with ithreads you must also use the PerlIO layer.
4294 *** Cannot continue, aborting.
4295 ***
4296 EOF
4297         exit 1
4298 fi
4299
4300 case "$d_oldpthreads" in
4301 '')     : Configure tests would be welcome here.  For now, assume undef.
4302         val="$undef" ;;
4303 *)      val="$d_oldpthreads" ;;
4304 esac
4305 set d_oldpthreads
4306 eval $setvar
4307
4308
4309 : Look for a hint-file generated 'call-back-unit'.  If the
4310 : user has specified that a threading perl is to be built,
4311 : we may need to set or change some other defaults.
4312 if $test -f usethreads.cbu; then
4313     echo "Your platform has some specific hints regarding threaded builds, using them..."
4314     . ./usethreads.cbu
4315 else
4316     case "$usethreads" in
4317         "$define"|true|[yY]*)
4318                 $cat <<EOM
4319 (Your platform does not have any specific hints for threaded builds.
4320  Assuming POSIX threads, then.)
4321 EOM
4322         ;;
4323     esac
4324 fi
4325
4326 : Check if multiplicity is required
4327 cat <<EOM
4328
4329 Perl can be built so that multiple Perl interpreters can coexist
4330 within the same Perl executable.
4331 EOM
4332
4333 case "$useithreads" in
4334 $define)
4335         cat <<EOM
4336 This multiple interpreter support is required for interpreter-based threads.
4337 EOM
4338         val="$define"
4339         ;;
4340 *)      case "$usemultiplicity" in
4341         $define|true|[yY]*)     dflt='y';;
4342         *) dflt='n';;
4343         esac
4344         echo " "
4345         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4346         rp='Build Perl for multiplicity?'
4347         . ./myread
4348         case "$ans" in
4349         y|Y)    val="$define" ;;
4350         *)      val="$undef" ;;
4351         esac
4352         ;;
4353 esac
4354 set usemultiplicity
4355 eval $setvar
4356
4357 : Check if morebits is requested
4358 case "$usemorebits" in
4359 "$define"|true|[yY]*)
4360         use64bitint="$define"
4361         uselongdouble="$define"
4362         usemorebits="$define"
4363         ;;
4364 *)      usemorebits="$undef"
4365         ;;
4366 esac
4367
4368 : Determine the C compiler to be used
4369 echo " "
4370 case "$cc" in
4371 '') dflt=cc;;
4372 *) dflt="$cc";;
4373 esac
4374 rp="Use which C compiler?"
4375 . ./myread
4376 cc="$ans"
4377
4378 : See whether they have no cc but they do have gcc
4379 . ./trygcc
4380 if $test -f cc.cbu; then
4381     . ./cc.cbu
4382 fi
4383 . ./checkcc
4384
4385 : make some quick guesses about what we are up against
4386 echo " "
4387 $echo $n "Hmm...  $c"
4388 echo exit 1 >bsd
4389 echo exit 1 >usg
4390 echo exit 1 >v7
4391 echo exit 1 >osf1
4392 echo exit 1 >eunice
4393 echo exit 1 >xenix
4394 echo exit 1 >venix
4395 echo exit 1 >os2
4396 d_bsd="$undef"
4397 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4398 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4399 then
4400         echo "Looks kind of like an OSF/1 system, but we'll see..."
4401         echo exit 0 >osf1
4402 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4403         xxx=`./loc addbib blurfl $pth`
4404         if $test -f $xxx; then
4405         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4406                 echo exit 0 >bsd
4407                 echo exit 0 >usg
4408         else
4409                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4410                         echo "Looks kind of like an extended USG system, but we'll see..."
4411                 else
4412                         echo "Looks kind of like a USG system, but we'll see..."
4413                 fi
4414                 echo exit 0 >usg
4415         fi
4416 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4417         echo "Looks kind of like a BSD system, but we'll see..."
4418         d_bsd="$define"
4419         echo exit 0 >bsd
4420 else
4421         echo "Looks kind of like a Version 7 system, but we'll see..."
4422         echo exit 0 >v7
4423 fi
4424 case "$eunicefix" in
4425 *unixtovms*)
4426         $cat <<'EOI'
4427 There is, however, a strange, musty smell in the air that reminds me of
4428 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4429 EOI
4430         echo exit 0 >eunice
4431         d_eunice="$define"
4432 : it so happens the Eunice I know will not run shell scripts in Unix format
4433         ;;
4434 *)
4435         echo " "
4436         echo "Congratulations.  You aren't running Eunice."
4437         d_eunice="$undef"
4438         ;;
4439 esac
4440 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4441 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4442 : semicolon as a patch separator
4443 case "$p_" in
4444 :) ;;
4445 *)
4446         $cat <<'EOI'
4447 I have the feeling something is not exactly right, however...don't tell me...
4448 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4449 (Or you may be running DOS with DJGPP.)
4450 EOI
4451         echo exit 0 >os2
4452         ;;
4453 esac
4454 if test -f /xenix; then
4455         echo "Actually, this looks more like a XENIX system..."
4456         echo exit 0 >xenix
4457         d_xenix="$define"
4458 else
4459         echo " "
4460         echo "It's not Xenix..."
4461         d_xenix="$undef"
4462 fi
4463 chmod +x xenix
4464 $eunicefix xenix
4465 if test -f /venix; then
4466         echo "Actually, this looks more like a VENIX system..."
4467         echo exit 0 >venix
4468 else
4469         echo " "
4470         if ./xenix; then
4471                 : null
4472         else
4473                 echo "Nor is it Venix..."
4474         fi
4475 fi
4476 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4477 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4478 $rm -f foo
4479
4480 : Check if we are using GNU gcc and what its version is
4481 echo " "
4482 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4483 $cat >try.c <<EOM
4484 #include <stdio.h>
4485 int main() {
4486 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4487 #ifdef __VERSION__
4488         printf("%s\n", __VERSION__);
4489 #else
4490         printf("%s\n", "1");
4491 #endif
4492 #endif
4493         return(0);
4494 }
4495 EOM
4496 if $cc -o try $ccflags $ldflags try.c; then
4497         gccversion=`$run ./try`
4498         case "$gccversion" in
4499         '') echo "You are not using GNU cc." ;;
4500         *)  echo "You are using GNU cc $gccversion."
4501             ccname=gcc
4502             ;;
4503         esac
4504 else
4505         echo " "
4506         echo "*** WHOA THERE!!! ***" >&4
4507         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4508         case "$knowitall" in
4509         '')
4510         echo "    You'd better start hunting for one and let me know about it." >&4
4511                 exit 1
4512                 ;;
4513         esac
4514 fi
4515 $rm -f try try.*
4516 case "$gccversion" in
4517 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4518 esac
4519 case "$gccversion" in
4520 '') gccosandvers='' ;;
4521 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4522    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4523    gccshortvers=''
4524    case "$gccosandvers" in
4525    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4526    $osname$osvers) ;; # looking good
4527    $osname*) cat <<EOM >&4
4528
4529 *** WHOA THERE!!! ***
4530
4531     Your gcc has not been compiled for the exact release of
4532     your operating system ($gccosandvers versus $osname$osvers).
4533
4534     In general it is a good idea to keep gcc synchronized with
4535     the operating system because otherwise serious problems
4536     may ensue when trying to compile software, like Perl.
4537
4538     I'm trying to be optimistic here, though, and will continue.
4539     If later during the configuration and build icky compilation
4540     problems appear (headerfile conflicts being the most common
4541     manifestation), I suggest reinstalling the gcc to match
4542     your operating system release.
4543
4544 EOM
4545       ;;
4546    *) gccosandvers='' ;; # failed to parse, better be silent
4547    esac
4548    ;;
4549 esac
4550 case "$ccname" in
4551 '') ccname="$cc" ;;
4552 esac
4553
4554 # gcc 3.* complain about adding -Idirectories that they already know about,
4555 # so we will take those off from locincpth.
4556 case "$gccversion" in
4557 3*)
4558     echo "main(){}">try.c
4559     for incdir in $locincpth; do
4560        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4561              grep '^c[cp]p*[01]: warning: changing search order '`
4562        if test "X$warn" != X; then
4563            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4564        fi
4565     done
4566     $rm -f try try.*
4567 esac
4568
4569 : What should the include directory be ?
4570 echo " "
4571 $echo $n "Hmm...  $c"
4572 dflt='/usr/include'
4573 incpath=''
4574 mips_type=''
4575 if $test -f /bin/mips && /bin/mips; then
4576         echo "Looks like a MIPS system..."
4577         $cat >usr.c <<'EOCP'
4578 #ifdef SYSTYPE_BSD43
4579 /bsd43
4580 #endif
4581 EOCP
4582         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4583                 dflt='/bsd43/usr/include'
4584                 incpath='/bsd43'
4585                 mips_type='BSD 4.3'
4586         else
4587                 mips_type='System V'
4588         fi
4589         $rm -f usr.c usr.out
4590         echo "and you're compiling with the $mips_type compiler and libraries."
4591         xxx_prompt=y
4592         echo "exit 0" >mips
4593 else
4594         echo "Doesn't look like a MIPS system."
4595         xxx_prompt=n
4596         echo "exit 1" >mips
4597 fi
4598 chmod +x mips
4599 $eunicefix mips
4600 case "$usrinc" in
4601 '') ;;
4602 *) dflt="$usrinc";;
4603 esac
4604 case "$xxx_prompt" in
4605 y)      fn=d/
4606         echo " "
4607         rp='Where are the include files you want to use?'
4608         . ./getfile
4609         usrinc="$ans"
4610         ;;
4611 *)      usrinc="$dflt"
4612         ;;
4613 esac
4614
4615 : see how we invoke the C preprocessor
4616 echo " "
4617 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4618 cat <<'EOT' >testcpp.c
4619 #define ABC abc
4620 #define XYZ xyz
4621 ABC.XYZ
4622 EOT
4623 cd ..
4624 if test ! -f cppstdin; then
4625         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4626                 # AIX cc -E doesn't show the absolute headerfile
4627                 # locations but we'll cheat by using the -M flag.
4628                 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
4629         else
4630                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4631         fi
4632 else
4633         echo "Keeping your $hint cppstdin wrapper."
4634 fi
4635 chmod 755 cppstdin
4636 wrapper=`pwd`/cppstdin
4637 ok='false'
4638 cd UU
4639
4640 if $test "X$cppstdin" != "X" && \
4641         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4642         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4643 then
4644         echo "You used to use $cppstdin $cppminus so we'll use that again."
4645         case "$cpprun" in
4646         '') echo "But let's see if we can live without a wrapper..." ;;
4647         *)
4648                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4649                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4650                 then
4651                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4652                         ok='true'
4653                 else
4654                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4655                 fi
4656                 ;;
4657         esac
4658 else
4659         case "$cppstdin" in
4660         '') ;;
4661         *)
4662                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4663                 ;;
4664         esac
4665 fi
4666
4667 if $ok; then
4668         : nothing
4669 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4670         $cc -E <testcpp.c >testcpp.out 2>&1; \
4671         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4672         echo "Yup, it does."
4673         x_cpp="$cc -E"
4674         x_minus='';
4675 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4676         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4677         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4678         echo "Yup, it does."
4679         x_cpp="$cc -E"
4680         x_minus='-';
4681 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4682         $cc -P <testcpp.c >testcpp.out 2>&1; \
4683         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4684         echo "Yipee, that works!"
4685         x_cpp="$cc -P"
4686         x_minus='';
4687 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4688         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4689         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4690         echo "At long last!"
4691         x_cpp="$cc -P"
4692         x_minus='-';
4693 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4694         $cpp <testcpp.c >testcpp.out 2>&1; \
4695         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4696         echo "It works!"
4697         x_cpp="$cpp"
4698         x_minus='';
4699 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4700         $cpp - <testcpp.c >testcpp.out 2>&1; \
4701         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4702         echo "Hooray, it works!  I was beginning to wonder."
4703         x_cpp="$cpp"
4704         x_minus='-';
4705 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4706         $wrapper <testcpp.c >testcpp.out 2>&1; \
4707         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4708         x_cpp="$wrapper"
4709         x_minus=''
4710         echo "Eureka!"
4711 else
4712         dflt=''
4713         rp="No dice.  I can't find a C preprocessor.  Name one:"
4714         . ./myread
4715         x_cpp="$ans"
4716         x_minus=''
4717         $x_cpp <testcpp.c >testcpp.out 2>&1
4718         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4719                 echo "OK, that will do." >&4
4720         else
4721 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4722                 exit 1
4723         fi
4724 fi
4725
4726 case "$ok" in
4727 false)
4728         cppstdin="$x_cpp"
4729         cppminus="$x_minus"
4730         cpprun="$x_cpp"
4731         cpplast="$x_minus"
4732         set X $x_cpp
4733         shift
4734         case "$1" in
4735         "$cpp")
4736                 echo "Perhaps can we force $cc -E using a wrapper..."
4737                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4738                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4739                 then
4740                         echo "Yup, we can."
4741                         cppstdin="$wrapper"
4742                         cppminus='';
4743                 else
4744                         echo "Nope, we'll have to live without it..."
4745                 fi
4746                 ;;
4747         esac
4748         case "$cpprun" in
4749         "$wrapper")
4750                 cpprun=''
4751                 cpplast=''
4752                 ;;
4753         esac
4754         ;;
4755 esac
4756
4757 case "$cppstdin" in
4758 "$wrapper"|'cppstdin') ;;
4759 *) $rm -f $wrapper;;
4760 esac
4761 $rm -f testcpp.c testcpp.out
4762
4763 : Set private lib path
4764 case "$plibpth" in
4765 '') if ./mips; then
4766                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4767         fi;;
4768 esac
4769 case "$libpth" in
4770 ' ') dlist='';;
4771 '') dlist="$loclibpth $plibpth $glibpth";;
4772 *) dlist="$libpth";;
4773 esac
4774
4775 : Now check and see which directories actually exist, avoiding duplicates
4776 libpth=''
4777 for xxx in $dlist
4778 do
4779     if $test -d $xxx; then
4780                 case " $libpth " in
4781                 *" $xxx "*) ;;
4782                 *) libpth="$libpth $xxx";;
4783                 esac
4784     fi
4785 done
4786 $cat <<'EOM'
4787
4788 Some systems have incompatible or broken versions of libraries.  Among
4789 the directories listed in the question below, please remove any you
4790 know not to be holding relevant libraries, and add any that are needed.
4791 Say "none" for none.
4792
4793 EOM
4794 case "$libpth" in
4795 '') dflt='none';;
4796 *)
4797         set X $libpth
4798         shift
4799         dflt=${1+"$@"}
4800         ;;
4801 esac
4802 rp="Directories to use for library searches?"
4803 . ./myread
4804 case "$ans" in
4805 none) libpth=' ';;
4806 *) libpth="$ans";;
4807 esac
4808
4809 : compute shared library extension
4810 case "$so" in
4811 '')
4812         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4813                 dflt='sl'
4814         else
4815                 dflt='so'
4816         fi
4817         ;;
4818 *) dflt="$so";;
4819 esac
4820 $cat <<EOM
4821
4822 On some systems, shared libraries may be available.  Answer 'none' if
4823 you want to suppress searching of shared libraries for the remainder
4824 of this configuration.
4825
4826 EOM
4827 rp='What is the file extension used for shared libraries?'
4828 . ./myread
4829 so="$ans"
4830
4831 : Define several unixisms.
4832 : Hints files or command line option can be used to override them.
4833 : The convoluted testing is in case hints files set either the old
4834 : or the new name.
4835 case "$_exe" in
4836 '')     case "$exe_ext" in
4837         '')     ;;
4838         *)      _exe="$exe_ext" ;;
4839         esac
4840         ;;
4841 esac
4842 case "$_a" in
4843 '')     case "$lib_ext" in
4844     '') _a='.a';;
4845         *)      _a="$lib_ext" ;;
4846         esac
4847         ;;
4848 esac
4849 case "$_o" in
4850 '') case "$obj_ext" in
4851         '')     _o='.o';;
4852         *)      _o="$obj_ext";;
4853         esac
4854         ;;
4855 esac
4856 case "$p_" in
4857 '') case "$path_sep" in
4858         '')     p_=':';;
4859         *)      p_="$path_sep";;
4860         esac
4861         ;;
4862 esac
4863 exe_ext=$_exe
4864 lib_ext=$_a
4865 obj_ext=$_o
4866 path_sep=$p_
4867
4868 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4869
4870 : Which makefile gets called first.  This is used by make depend.
4871 case "$firstmakefile" in
4872 '') firstmakefile='makefile';;
4873 esac
4874
4875 : Check for uselongdouble support
4876 case "$ccflags" in
4877 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4878 esac
4879
4880 case "$uselongdouble" in
4881 $define|true|[yY]*)     dflt='y';;
4882 *) dflt='n';;
4883 esac
4884 cat <<EOM
4885
4886 Perl can be built to take advantage of long doubles which
4887 (if available) may give more accuracy and range for floating point numbers.
4888
4889 If this doesn't make any sense to you, just accept the default '$dflt'.
4890 EOM
4891 rp='Try to use long doubles if available?'
4892 . ./myread
4893 case "$ans" in
4894 y|Y)    val="$define"   ;;
4895 *)      val="$undef"    ;;
4896 esac
4897 set uselongdouble
4898 eval $setvar
4899
4900 case "$uselongdouble" in
4901 true|[yY]*) uselongdouble="$define" ;;
4902 esac
4903
4904 : Look for a hint-file generated 'call-back-unit'.  If the
4905 : user has specified that long doubles should be used,
4906 : we may need to set or change some other defaults.
4907 if $test -f uselongdouble.cbu; then
4908     echo "Your platform has some specific hints regarding long doubles, using them..."
4909     . ./uselongdouble.cbu
4910 else
4911     case "$uselongdouble" in
4912         $define)
4913                 $cat <<EOM
4914 (Your platform does not have any specific hints for long doubles.)
4915 EOM
4916         ;;
4917     esac
4918 fi
4919
4920 : Looking for optional libraries
4921 echo " "
4922 echo "Checking for optional libraries..." >&4
4923 case "$libs" in
4924 ' '|'') dflt='';;
4925 *) dflt="$libs";;
4926 esac
4927 case "$libswanted" in
4928 '') libswanted='c_s';;
4929 esac
4930 case "$usesocks" in
4931 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4932 esac
4933 libsfound=''
4934 libsfiles=''
4935 libsdirs=''
4936 libspath=''
4937 for thisdir in $libpth $xlibpth; do
4938   test -d $thisdir && libspath="$libspath $thisdir"
4939 done
4940 for thislib in $libswanted; do
4941         for thisdir in $libspath; do
4942             xxx=''
4943             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4944                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4945                 $test -f "$xxx" && eval $libscheck
4946                 $test -f "$xxx" && libstyle=shared
4947             fi
4948             if test ! -f "$xxx"; then
4949                 xxx=$thisdir/lib$thislib.$so
4950                 $test -f "$xxx" && eval $libscheck
4951                 $test -f "$xxx" && libstyle=shared
4952             fi
4953             if test ! -f "$xxx"; then
4954                 xxx=$thisdir/lib$thislib$_a
4955                 $test -f "$xxx" && eval $libscheck
4956                 $test -f "$xxx" && libstyle=static
4957             fi
4958             if test ! -f "$xxx"; then
4959                 xxx=$thisdir/$thislib$_a
4960                 $test -f "$xxx" && eval $libscheck
4961                 $test -f "$xxx" && libstyle=static
4962             fi
4963             if test ! -f "$xxx"; then
4964                 xxx=$thisdir/lib${thislib}_s$_a
4965                 $test -f "$xxx" && eval $libscheck
4966                 $test -f "$xxx" && libstyle=static
4967                 $test -f "$xxx" && thislib=${thislib}_s
4968             fi
4969             if test ! -f "$xxx"; then
4970                 xxx=$thisdir/Slib$thislib$_a
4971                 $test -f "$xxx" && eval $libscheck
4972                 $test -f "$xxx" && libstyle=static
4973             fi
4974             if $test -f "$xxx"; then
4975                 case "$libstyle" in
4976                 shared) echo "Found -l$thislib (shared)." ;;
4977                 static) echo "Found -l$thislib." ;;
4978                 *)      echo "Found -l$thislib ($libstyle)." ;;
4979                 esac
4980                 case " $dflt " in
4981                 *"-l$thislib "*);;
4982                 *) dflt="$dflt -l$thislib"
4983                    libsfound="$libsfound $xxx"
4984                    yyy=`basename $xxx`
4985                    libsfiles="$libsfiles $yyy"
4986                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4987                    case " $libsdirs " in
4988                    *" $yyy "*) ;;
4989                    *) libsdirs="$libsdirs $yyy" ;;
4990                    esac
4991                    ;;
4992                 esac
4993                 break
4994             fi
4995         done
4996         if $test ! -f "$xxx"; then
4997             echo "No -l$thislib."
4998         fi
4999 done
5000 set X $dflt
5001 shift
5002 dflt="$*"
5003 case "$libs" in
5004 '') dflt="$dflt";;
5005 *) dflt="$libs";;
5006 esac
5007 case "$dflt" in
5008 ' '|'') dflt='none';;
5009 esac
5010
5011 $cat <<EOM
5012
5013 In order to compile $package on your machine, a number of libraries
5014 are usually needed.  Include any other special libraries here as well.
5015 Say "none" for none.  The default list is almost always right.
5016 EOM
5017
5018 echo " "
5019 rp="What libraries to use?"
5020 . ./myread
5021 case "$ans" in
5022 none) libs=' ';;
5023 *) libs="$ans";;
5024 esac
5025
5026 : determine optimization, if desired, or use for debug flag also
5027 case "$optimize" in
5028 ' '|$undef) dflt='none';;
5029 '') dflt='-O';;
5030 *) dflt="$optimize";;
5031 esac
5032 $cat <<EOH
5033
5034 By default, $package compiles with the -O flag to use the optimizer.
5035 Alternately, you might want to use the symbolic debugger, which uses
5036 the -g flag (on traditional Unix systems).  Either flag can be
5037 specified here.  To use neither flag, specify the word "none".
5038
5039 EOH
5040 rp="What optimizer/debugger flag should be used?"
5041 . ./myread
5042 optimize="$ans"
5043 case "$optimize" in
5044 'none') optimize=" ";;
5045 esac
5046
5047 : Check what DEBUGGING is required from the command line
5048 : -DEBUGGING      or -DDEBUGGING or
5049 : -DEBUGGING=both                       = -g + -DDEBUGGING
5050 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5051 : -DEBUGGING=none or -UDEBUGGING        =
5052 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5053 case "$EBUGGING" in
5054 '')     ;;
5055 *)      DEBUGGING=$EBUGGING ;;
5056 esac
5057
5058 case "$DEBUGGING" in
5059 -g|both|$define)
5060     case "$optimize" in
5061         *-g*) ;;
5062         *)    optimize="$optimize -g" ;;
5063     esac ;;
5064 none|$undef)
5065     case "$optimize" in
5066         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5067                 shift
5068                 optimize="$*"
5069                 ;;
5070     esac ;;
5071 esac
5072
5073 dflt=''
5074 case "$DEBUGGING" in
5075 both|$define) dflt='-DDEBUGGING'
5076 esac
5077
5078 : argument order is deliberate, as the flag will start with - which set could
5079 : think is an option
5080 checkccflag='check=$1; flag=$2; callback=$3;
5081 echo " ";
5082 echo "Checking if your compiler accepts $flag" 2>&1;
5083 echo "int main(void) { return 0; }" > gcctest.c;
5084 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5085     echo "Yes, it does." 2>&1;
5086     if $test -s gcctest.out ; then
5087         echo "But your platform does not like it:";
5088         cat gcctest.out;
5089     else
5090         case "$ccflags" in
5091         *$check*)
5092             echo "Leaving current flags $ccflags alone." 2>&1
5093             ;;
5094         *) dflt="$dflt $flag";
5095             eval $callback
5096             ;;
5097         esac
5098     fi
5099 else
5100     echo "Nope, it does not, but that is ok." 2>&1;
5101 fi
5102 '
5103
5104 : We will not override a previous value, but we might want to
5105 : augment a hint file
5106 case "$hint" in
5107 default|recommended)
5108         case "$gccversion" in
5109         1*) dflt="$dflt -fpcc-struct-return" ;;
5110         esac
5111         case "$optimize:$DEBUGGING" in
5112         *-g*:old) dflt="$dflt -DDEBUGGING";;
5113         esac
5114         case "$gccversion" in
5115         2*) if $test -d /etc/conf/kconfig.d &&
5116                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5117                 then
5118                         # Interactive Systems (ISC) POSIX mode.
5119                         dflt="$dflt -posix"
5120                 fi
5121                 ;;
5122         esac
5123         case "$gccversion" in
5124         1*) ;;
5125         2.[0-8]*) ;;
5126         ?*)     set strict-aliasing -fno-strict-aliasing
5127                 eval $checkccflag
5128                 ;;
5129         esac
5130         # For gcc, adding -pipe speeds up compilations for some, but apparently
5131         # some assemblers can't read from stdin.  (It also slows down compilations
5132         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5133         case "$gccversion" in
5134         ?*)     set pipe -pipe
5135                 eval $checkccflag
5136                 ;;
5137         esac
5138
5139         # on x86_64 (at least) we require an extra library (libssp) in the
5140         # link command line. This library is not named, so I infer that it is
5141         # an implementation detail that may change. Hence the safest approach
5142         # is to add the flag to the flags passed to the compiler at link time,
5143         # as that way the compiler can do the right implementation dependant
5144         # thing. (NWC)
5145         case "$gccversion" in
5146         ?*)     set stack-protector -fstack-protector
5147                 eval $checkccflag
5148                 ;;
5149         esac
5150         ;;
5151 esac
5152
5153 case "$mips_type" in
5154 *BSD*|'') inclwanted="$locincpth $usrinc";;
5155 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5156 esac
5157 for thisincl in $inclwanted; do
5158         if $test -d $thisincl; then
5159                 if $test x$thisincl != x$usrinc; then
5160                         case "$dflt" in
5161                         *" -I$thisincl "*);;
5162                         *) dflt="$dflt -I$thisincl ";;
5163                         esac
5164                 fi
5165         fi
5166 done
5167
5168 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5169         xxx=true;
5170 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5171         xxx=true;
5172 else
5173         xxx=false;
5174 fi;
5175 if $xxx; then
5176         case "$dflt" in
5177         *$2*);;
5178         *) dflt="$dflt -D$2";;
5179         esac;
5180 fi'
5181
5182 set signal.h LANGUAGE_C; eval $inctest
5183
5184 case "$usesocks" in
5185 $define)
5186         ccflags="$ccflags -DSOCKS"
5187         ;;
5188 esac
5189
5190 case "$hint" in
5191 default|recommended) dflt="$ccflags $dflt" ;;
5192 *) dflt="$ccflags";;
5193 esac
5194
5195 case "$dflt" in
5196 ''|' ') dflt=none;;
5197 esac
5198
5199 $cat <<EOH
5200
5201 Your C compiler may want other flags.  For this question you should include
5202 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5203 but you should NOT include libraries or ld flags like -lwhatever.  If you
5204 want $package to honor its debug switch, you should include -DDEBUGGING here.
5205 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5206
5207 To use no flags, specify the word "none".
5208
5209 EOH
5210 set X $dflt
5211 shift
5212 dflt=${1+"$@"}
5213 rp="Any additional cc flags?"
5214 . ./myread
5215 case "$ans" in
5216 none) ccflags='';;
5217 *) ccflags="$ans";;
5218 esac
5219
5220 : the following weeds options from ccflags that are of no interest to cpp
5221 case "$cppflags" in
5222 '') cppflags="$ccflags" ;;
5223 *)  cppflags="$cppflags $ccflags" ;;
5224 esac
5225 case "$gccversion" in
5226 1*) cppflags="$cppflags -D__GNUC__"
5227 esac
5228 case "$mips_type" in
5229 '');;
5230 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5231 esac
5232 case "$cppflags" in
5233 '');;
5234 *)
5235         echo " "
5236         echo "Let me guess what the preprocessor flags are..." >&4
5237         set X $cppflags
5238         shift
5239         cppflags=''
5240         $cat >cpp.c <<'EOM'
5241 #define BLURFL foo
5242
5243 BLURFL xx LFRULB
5244 EOM
5245         previous=''
5246         for flag in $*
5247         do
5248                 case "$flag" in
5249                 -*) ftry="$flag";;
5250                 *) ftry="$previous $flag";;
5251                 esac
5252                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5253                         >cpp1.out 2>/dev/null && \
5254                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5255                         >cpp2.out 2>/dev/null && \
5256                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5257                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5258                 then
5259                         cppflags="$cppflags $ftry"
5260                         previous=''
5261                 else
5262                         previous="$flag"
5263                 fi
5264         done
5265         set X $cppflags
5266         shift
5267         cppflags=${1+"$@"}
5268         case "$cppflags" in
5269         *-*)  echo "They appear to be: $cppflags";;
5270         esac
5271         $rm -f cpp.c cpp?.out
5272         ;;
5273 esac
5274
5275 : flags used in final linking phase
5276 case "$ldflags" in
5277 '') if ./venix; then
5278                 dflt='-i -z'
5279         else
5280                 dflt=''
5281         fi
5282         case "$ccflags" in
5283         *-posix*) dflt="$dflt -posix" ;;
5284         esac
5285         ;;
5286 *) dflt="$ldflags";;
5287 esac
5288 # See note above about -fstack-protector
5289 case "$ccflags" in
5290 *-fstack-protector*) 
5291         case "$dflt" in
5292         *-fstack-protector*) ;; # Don't add it again
5293         *) dflt="$dflt -fstack-protector" ;; 
5294         esac
5295         ;;
5296 esac
5297
5298 : Try to guess additional flags to pick up local libraries.
5299 for thislibdir in $libpth; do
5300         case " $loclibpth " in
5301         *" $thislibdir "*)
5302                 case "$dflt " in
5303                 *"-L$thislibdir "*) ;;
5304                 *)  dflt="$dflt -L$thislibdir" ;;
5305                 esac
5306                 ;;
5307         esac
5308 done
5309
5310 case "$dflt" in
5311 '') dflt='none' ;;
5312 esac
5313
5314 $cat <<EOH
5315
5316 Your C linker may need flags.  For this question you should
5317 include -L/whatever and any other flags used by the C linker, but you
5318 should NOT include libraries like -lwhatever.
5319
5320 Make sure you include the appropriate -L/path flags if your C linker
5321 does not normally search all of the directories you specified above,
5322 namely
5323         $libpth
5324 To use no flags, specify the word "none".
5325
5326 EOH
5327
5328 rp="Any additional ld flags (NOT including libraries)?"
5329 . ./myread
5330 case "$ans" in
5331 none) ldflags='';;
5332 *) ldflags="$ans";;
5333 esac
5334 rmlist="$rmlist pdp11"
5335
5336 : coherency check
5337 echo " "
5338 echo "Checking your choice of C compiler and flags for coherency..." >&4
5339 $cat > try.c <<'EOF'
5340 #include <stdio.h>
5341 int main() { printf("Ok\n"); return(0); }
5342 EOF
5343 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5344 shift
5345 $cat >try.msg <<'EOM'
5346 I've tried to compile and run the following simple program:
5347
5348 EOM
5349 $cat try.c >> try.msg
5350
5351 $cat >> try.msg <<EOM
5352
5353 I used the command:
5354
5355         $*
5356         $run ./try
5357
5358 and I got the following output:
5359
5360 EOM
5361 dflt=y
5362 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5363         if $sh -c "$run ./try " >>try.msg 2>&1; then
5364                 xxx=`$run ./try`
5365                 case "$xxx" in
5366                 "Ok") dflt=n ;;
5367                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5368                         case " $libs " in
5369                         *" -lsfio "*)
5370                                 cat >> try.msg <<'EOQS'
5371 If $libs contains -lsfio, and sfio is mis-configured, then it
5372 sometimes (apparently) runs and exits with a 0 status, but with no
5373 output!  It may have to do with sfio's use of _exit vs. exit.
5374
5375 EOQS
5376                                 rp="You have a big problem.  Shall I abort Configure"
5377                                 dflt=y
5378                                 ;;
5379                         esac
5380                         ;;
5381                 esac
5382         else
5383                 echo "The program compiled OK, but exited with status $?." >>try.msg
5384                 rp="You have a problem.  Shall I abort Configure"
5385                 dflt=y
5386         fi
5387 else
5388         echo "I can't compile the test program." >>try.msg
5389         rp="You have a BIG problem.  Shall I abort Configure"
5390         dflt=y
5391 fi
5392 case "$dflt" in
5393 y)
5394         $cat try.msg >&4
5395         case "$knowitall" in
5396         '')
5397                 echo "(The supplied flags or libraries might be incorrect.)"
5398                 ;;
5399         *) dflt=n;;
5400         esac
5401         echo " "
5402         . ./myread
5403         case "$ans" in
5404         n*|N*) ;;
5405         *)      echo "Ok.  Stopping Configure." >&4
5406                 exit 1
5407                 ;;
5408         esac
5409         ;;
5410 n) echo "OK, that should do.";;
5411 esac
5412 $rm_try gcctest gcctest.out
5413
5414 : define a shorthand compile call
5415 compile='
5416 mc_file=$1;
5417 shift;
5418 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5419 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5420 exit 1;
5421 fi;
5422 esac;
5423 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5424 : define a shorthand compile call for compilations that should be ok.
5425 compile_ok='
5426 mc_file=$1;
5427 shift;
5428 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5429
5430 : determine filename position in cpp output
5431 echo " "
5432 echo "Computing filename position in cpp output for #include directives..." >&4
5433 case "$osname" in
5434 vos) testaccess=-e ;;
5435 *)   testaccess=-r ;;
5436 esac
5437 echo '#include <stdio.h>' > foo.c
5438 $cat >fieldn <<EOF
5439 $startsh
5440 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5441 $grep '^[       ]*#.*stdio\.h' | \
5442 while read cline; do
5443         pos=1
5444         set \$cline
5445         while $test \$# -gt 0; do
5446                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5447                         echo "\$pos"
5448                         exit 0
5449                 fi
5450                 shift
5451                 pos=\`expr \$pos + 1\`
5452         done
5453 done
5454 EOF
5455 chmod +x fieldn
5456 fieldn=`./fieldn`
5457 $rm -f foo.c fieldn
5458 case $fieldn in
5459 '') pos='???';;
5460 1) pos=first;;
5461 2) pos=second;;
5462 3) pos=third;;
5463 *) pos="${fieldn}th";;
5464 esac
5465 echo "Your cpp writes the filename in the $pos field of the line."
5466
5467 case "$osname" in
5468 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5469 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5470 *)   cppfilter='' ;;
5471 esac
5472 : locate header file
5473 $cat >findhdr <<EOF
5474 $startsh
5475 wanted=\$1
5476 name=''
5477 for usrincdir in $usrinc
5478 do
5479         if test -f \$usrincdir/\$wanted; then
5480                 echo "\$usrincdir/\$wanted"
5481                 exit 0
5482         fi
5483 done
5484 awkprg='{ print \$$fieldn }'
5485 echo "#include <\$wanted>" > foo\$\$.c
5486 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5487 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5488 while read cline; do
5489         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5490         case "\$name" in
5491         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5492         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5493         *) exit 2;;
5494         esac;
5495 done;
5496 #
5497 # status = 0: grep returned 0 lines, case statement not executed
5498 # status = 1: headerfile found
5499 # status = 2: while loop executed, no headerfile found
5500 #
5501 status=\$?
5502 $rm -f foo\$\$.c;
5503 if test \$status -eq 1; then
5504         exit 0;
5505 fi
5506 exit 1
5507 EOF
5508 chmod +x findhdr
5509
5510 : define an alternate in-header-list? function
5511 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5512 cont=true; xxf="echo \"<\$1> found.\" >&4";
5513 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5514 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5515 esac;
5516 case $# in 4) instead=instead;; *) instead="at last";; esac;
5517 while $test "$cont"; do
5518         xxx=`./findhdr $1`
5519         var=$2; eval "was=\$$2";
5520         if $test "$xxx" && $test -r "$xxx";
5521         then eval $xxf;
5522         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5523                 cont="";
5524         else eval $xxnf;
5525         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5526         set $yyy; shift; shift; yyy=$@;
5527         case $# in 0) cont="";;
5528         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5529                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5530         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5531                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5532         esac;
5533 done;
5534 while $test "$yyy";
5535 do set $yyy; var=$2; eval "was=\$$2";
5536         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5537         set $yyy; shift; shift; yyy=$@;
5538 done'
5539
5540 : see if stdlib is available
5541 set stdlib.h i_stdlib
5542 eval $inhdr
5543
5544 : check for lengths of integral types
5545 echo " "
5546 case "$intsize" in
5547 '')
5548         echo "Checking to see how big your integers are..." >&4
5549         $cat >try.c <<EOCP
5550 #include <stdio.h>
5551 #$i_stdlib I_STDLIB
5552 #ifdef I_STDLIB
5553 #include <stdlib.h>
5554 #endif
5555 int main()
5556 {
5557         printf("intsize=%d;\n", (int)sizeof(int));
5558         printf("longsize=%d;\n", (int)sizeof(long));
5559         printf("shortsize=%d;\n", (int)sizeof(short));
5560         exit(0);
5561 }
5562 EOCP
5563         set try
5564         if eval $compile_ok && $run ./try > /dev/null; then
5565                 eval `$run ./try`
5566                 echo "Your integers are $intsize bytes long."
5567                 echo "Your long integers are $longsize bytes long."
5568                 echo "Your short integers are $shortsize bytes long."
5569         else
5570                 $cat >&4 <<EOM
5571 !
5572 Help! I can't compile and run the intsize test program: please enlighten me!
5573 (This is probably a misconfiguration in your system or libraries, and
5574 you really ought to fix it.  Still, I'll try anyway.)
5575 !
5576 EOM
5577                 dflt=4
5578                 rp="What is the size of an integer (in bytes)?"
5579                 . ./myread
5580                 intsize="$ans"
5581                 dflt=$intsize
5582                 rp="What is the size of a long integer (in bytes)?"
5583                 . ./myread
5584                 longsize="$ans"
5585                 dflt=2
5586                 rp="What is the size of a short integer (in bytes)?"
5587                 . ./myread
5588                 shortsize="$ans"
5589         fi
5590         ;;
5591 esac
5592 $rm_try
5593
5594 : check for long long
5595 echo " "
5596 echo "Checking to see if you have long long..." >&4
5597 echo 'int main() { long long x = 7; return 0; }' > try.c
5598 set try
5599 if eval $compile; then
5600         val="$define"
5601         echo "You have long long."
5602 else
5603         val="$undef"
5604         echo "You do not have long long."
5605 fi
5606 $rm_try
5607 set d_longlong
5608 eval $setvar
5609
5610 : check for length of long long
5611 case "${d_longlong}${longlongsize}" in
5612 $define)
5613         echo " "
5614         echo "Checking to see how big your long longs are..." >&4
5615         $cat >try.c <<'EOCP'
5616 #include <stdio.h>
5617 int main()
5618 {
5619     printf("%d\n", (int)sizeof(long long));
5620     return(0);
5621 }
5622 EOCP
5623         set try
5624         if eval $compile_ok; then
5625                 longlongsize=`$run ./try`
5626                 echo "Your long longs are $longlongsize bytes long."
5627         else
5628                 dflt='8'
5629                 echo " "
5630                 echo "(I can't seem to compile the test program.  Guessing...)"
5631                 rp="What is the size of a long long (in bytes)?"
5632                 . ./myread
5633                 longlongsize="$ans"
5634         fi
5635         if $test "X$longsize" = "X$longlongsize"; then
5636                 echo "(That isn't any different from an ordinary long.)"
5637         fi
5638         ;;
5639 esac
5640 $rm_try
5641
5642 : see if inttypes.h is available
5643 : we want a real compile instead of Inhdr because some systems
5644 : have an inttypes.h which includes non-existent headers
5645 echo " "
5646 $cat >try.c <<EOCP
5647 #include <inttypes.h>
5648 int main() {
5649         static int32_t foo32 = 0x12345678;
5650 }
5651 EOCP
5652 set try
5653 if eval $compile; then
5654         echo "<inttypes.h> found." >&4
5655         val="$define"
5656 else
5657         echo "<inttypes.h> NOT found." >&4
5658         val="$undef"
5659 fi
5660 $rm_try
5661 set i_inttypes
5662 eval $setvar
5663
5664 : check for int64_t
5665 echo " "
5666 echo "Checking to see if you have int64_t..." >&4
5667 $cat >try.c <<EOCP
5668 #include <sys/types.h>
5669 #$i_inttypes I_INTTYPES
5670 #ifdef I_INTTYPES
5671 #include <inttypes.h>
5672 #endif
5673 int main() { int64_t x = 7; }
5674 EOCP
5675 set try
5676 if eval $compile; then
5677         val="$define"
5678         echo "You have int64_t."
5679 else
5680         val="$undef"
5681         echo "You do not have int64_t."
5682 fi
5683 $rm_try
5684 set d_int64_t
5685 eval $setvar
5686
5687 : Check if 64bit ints have a quad type
5688 echo " "
5689 echo "Checking which 64-bit integer type we could use..." >&4
5690
5691 case "$intsize" in
5692 8) val=int
5693    set quadtype
5694    eval $setvar
5695    val='"unsigned int"'
5696    set uquadtype
5697    eval $setvar
5698    quadkind=1
5699    ;;
5700 *) case "$longsize" in
5701    8) val=long
5702       set quadtype
5703       eval $setvar
5704       val='"unsigned long"'
5705       set uquadtype
5706       eval $setvar
5707       quadkind=2
5708       ;;
5709    *) case "$d_longlong:$longlongsize" in
5710       define:8)
5711         val='"long long"'
5712         set quadtype
5713         eval $setvar
5714         val='"unsigned long long"'
5715         set uquadtype
5716         eval $setvar
5717         quadkind=3
5718         ;;
5719       *) case "$d_int64_t" in
5720          define)
5721            val=int64_t
5722            set quadtype
5723            eval $setvar
5724            val=uint64_t
5725            set uquadtype
5726            eval $setvar
5727            quadkind=4
5728            ;;
5729          esac
5730          ;;
5731       esac
5732       ;;
5733    esac
5734    ;;
5735 esac
5736
5737 case "$quadtype" in
5738 '')     echo "Alas, no 64-bit integer types in sight." >&4
5739         d_quad="$undef"
5740         ;;
5741 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5742         d_quad="$define"
5743         ;;
5744 esac
5745
5746 : Do we want 64bit support
5747 case "$uselonglong" in
5748 "$define"|true|[yY]*)
5749         cat <<EOM >&4
5750
5751 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5752 EOM
5753         use64bitint="$define"
5754         ;;
5755 esac
5756 case "$use64bits" in
5757 "$define"|true|[yY]*)
5758         cat <<EOM >&4
5759
5760 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5761 EOM
5762         use64bitint="$define"
5763         ;;
5764 esac
5765 case "$use64bitints" in
5766 "$define"|true|[yY]*)
5767         cat <<EOM >&4
5768
5769 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5770 EOM
5771         use64bitint="$define"
5772         ;;
5773 esac
5774 case "$use64bitsint" in
5775 "$define"|true|[yY]*)
5776         cat <<EOM >&4
5777
5778 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5779 EOM
5780         use64bitint="$define"
5781         ;;
5782 esac
5783 case "$uselonglongs" in
5784 "$define"|true|[yY]*)
5785         cat <<EOM >&4
5786
5787 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5788 EOM
5789         use64bitint="$define"
5790         ;;
5791 esac
5792 case "$use64bitsall" in
5793 "$define"|true|[yY]*)
5794         cat <<EOM >&4
5795
5796 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5797 EOM
5798         use64bitall="$define"
5799         ;;
5800 esac
5801
5802 case "$ccflags" in
5803 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5804 esac
5805 case "$use64bitall" in
5806 "$define"|true|[yY]*) use64bitint="$define" ;;
5807 esac
5808
5809 case "$longsize" in
5810 8) cat <<EOM
5811
5812 You have natively 64-bit long integers.
5813 EOM
5814    val="$define"
5815    ;;
5816 *) case "$use64bitint" in
5817    "$define"|true|[yY]*) dflt='y';;
5818    *) dflt='n';;
5819    esac
5820    case "$d_quad" in
5821    "$define") ;;
5822    *) dflt='n' ;;
5823    esac
5824    cat <<EOM
5825
5826 Perl can be built to take advantage of 64-bit integer types
5827 on some systems.  To do so, Configure can be run with -Duse64bitint.
5828 Choosing this option will most probably introduce binary incompatibilities.
5829
5830 If this doesn't make any sense to you, just accept the default '$dflt'.
5831 (The default has been chosen based on your configuration.)
5832 EOM
5833    rp='Try to use 64-bit integers, if available?'
5834    . ./myread
5835    case "$ans" in
5836    [yY]*) val="$define" ;;
5837    *)     val="$undef"  ;;
5838    esac
5839    ;;
5840 esac
5841 set use64bitint
5842 eval $setvar
5843
5844 case "$use64bitall" in
5845 "$define"|true|[yY]*) dflt='y' ;;
5846 *) case "$longsize" in
5847    8) dflt='y' ;;
5848    *) dflt='n' ;;
5849    esac
5850    ;;
5851 esac
5852 cat <<EOM
5853
5854 You may also choose to try maximal 64-bitness.  It means using as much
5855 64-bitness as possible on the platform.  This in turn means even more
5856 binary incompatibilities.  On the other hand, your platform may not
5857 have any more 64-bitness available than what you already have chosen.
5858
5859 If this doesn't make any sense to you, just accept the default '$dflt'.
5860 (The default has been chosen based on your configuration.)
5861 EOM
5862 rp='Try to use maximal 64-bit support, if available?'
5863 . ./myread
5864 case "$ans" in
5865 [yY]*) val="$define" ;;
5866 *)     val="$undef"  ;;
5867 esac
5868 set use64bitall
5869 eval $setvar
5870 case "$use64bitall" in
5871 "$define")
5872         case "$use64bitint" in
5873         "$undef")
5874                 cat <<EOM
5875
5876 Since you have chosen a maximally 64-bit build, I'm also turning on
5877 the use of 64-bit integers.
5878 EOM
5879                 use64bitint="$define" ;;
5880         esac
5881         ;;
5882 esac
5883
5884 : Look for a hint-file generated 'call-back-unit'.  If the
5885 : user has specified that a 64-bit perl is to be built,
5886 : we may need to set or change some other defaults.
5887 if $test -f use64bitint.cbu; then
5888         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5889         . ./use64bitint.cbu
5890 fi
5891 case "$use64bitint" in
5892 "$define"|true|[yY]*)
5893         case "$longsize" in
5894         4) case "$archname64" in
5895            '') archname64=64int ;;
5896            esac
5897            ;;
5898         esac
5899         ;;
5900 esac
5901
5902 : Look for a hint-file generated 'call-back-unit'.  If the
5903 : user has specified that a maximally 64-bit perl is to be built,
5904 : we may need to set or change some other defaults.
5905 if $test -f use64bitall.cbu; then
5906         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5907         . ./use64bitall.cbu
5908 fi
5909 case "$use64bitall" in
5910 "$define"|true|[yY]*)
5911         case "$longsize" in
5912         4) case "$archname64" in
5913            ''|64int) archname64=64all ;;
5914            esac
5915            ;;
5916         esac
5917         ;;
5918 esac
5919
5920 case "$d_quad:$use64bitint" in
5921 $undef:$define)
5922         cat >&4 <<EOF
5923
5924 *** You have chosen to use 64-bit integers,
5925 *** but none can be found.
5926 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5927 *** Cannot continue, aborting.
5928
5929 EOF
5930         exit 1
5931         ;;
5932 esac
5933
5934 : check for length of double
5935 echo " "
5936 case "$doublesize" in
5937 '')
5938         echo "Checking to see how big your double precision numbers are..." >&4
5939         $cat >try.c <<EOCP
5940 #include <stdio.h>
5941 #$i_stdlib I_STDLIB
5942 #ifdef I_STDLIB
5943 #include <stdlib.h>
5944 #endif
5945 int main()
5946 {
5947     printf("%d\n", (int)sizeof(double));
5948     exit(0);
5949 }
5950 EOCP
5951         set try
5952         if eval $compile_ok; then
5953                 doublesize=`$run ./try`
5954                 echo "Your double is $doublesize bytes long."
5955         else
5956                 dflt='8'
5957                 echo "(I can't seem to compile the test program.  Guessing...)"
5958                 rp="What is the size of a double precision number (in bytes)?"
5959                 . ./myread
5960                 doublesize="$ans"
5961         fi
5962         ;;
5963 esac
5964 $rm_try
5965
5966 : check for long doubles
5967 echo " "
5968 echo "Checking to see if you have long double..." >&4
5969 echo 'int main() { long double x = 7.0; }' > try.c
5970 set try
5971 if eval $compile; then
5972         val="$define"
5973         echo "You have long double."
5974 else
5975         val="$undef"
5976         echo "You do not have long double."
5977 fi
5978 $rm_try
5979 set d_longdbl
5980 eval $setvar
5981
5982 : check for length of long double
5983 case "${d_longdbl}${longdblsize}" in
5984 $define)
5985         echo " "
5986         echo "Checking to see how big your long doubles are..." >&4
5987         $cat >try.c <<'EOCP'
5988 #include <stdio.h>
5989 int main()
5990 {
5991         printf("%d\n", sizeof(long double));
5992 }
5993 EOCP
5994         set try
5995         set try
5996         if eval $compile; then
5997                 longdblsize=`$run ./try`
5998                 echo "Your long doubles are $longdblsize bytes long."
5999         else
6000                 dflt='8'
6001                 echo " "
6002                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6003                 rp="What is the size of a long double (in bytes)?"
6004                 . ./myread
6005                 longdblsize="$ans"
6006         fi
6007         if $test "X$doublesize" = "X$longdblsize"; then
6008                 echo "That isn't any different from an ordinary double."
6009                 echo "I'll keep your setting anyway, but you may see some"
6010                 echo "harmless compilation warnings."
6011         fi
6012         ;;
6013 esac
6014 $rm_try
6015
6016 : determine the architecture name
6017 echo " "
6018 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6019         tarch=`arch`"-$osname"
6020 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6021         if uname -m > tmparch 2>&1 ; then
6022                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6023                         -e 's/$/'"-$osname/" tmparch`
6024         else
6025                 tarch="$osname"
6026         fi
6027         $rm -f tmparch
6028 else
6029         tarch="$osname"
6030 fi
6031 case "$myarchname" in
6032 ''|"$tarch") ;;
6033 *)
6034         echo "(Your architecture name used to be $myarchname.)"
6035         archname=''
6036         ;;
6037 esac
6038 case "$targetarch" in
6039 '') ;;
6040 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6041 esac
6042 myarchname="$tarch"
6043 case "$archname" in
6044 '') dflt="$tarch";;
6045 *) dflt="$archname";;
6046 esac
6047 rp='What is your architecture name'
6048 . ./myread
6049 archname="$ans"
6050 case "$usethreads" in
6051 $define)
6052         echo "Threads selected." >&4
6053         case "$archname" in
6054         *-thread*) echo "...and architecture name already has -thread." >&4
6055                 ;;
6056         *)      archname="$archname-thread"
6057                 echo "...setting architecture name to $archname." >&4
6058                 ;;
6059         esac
6060         ;;
6061 esac
6062 case "$usemultiplicity" in
6063 $define)
6064         echo "Multiplicity selected." >&4
6065         case "$archname" in
6066         *-multi*) echo "...and architecture name already has -multi." >&4
6067                 ;;
6068         *)      archname="$archname-multi"
6069                 echo "...setting architecture name to $archname." >&4
6070                 ;;
6071         esac
6072         ;;
6073 esac
6074 case "$use64bitint$use64bitall" in
6075 *"$define"*)
6076         case "$archname64" in
6077         '')
6078                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6079                 ;;
6080         *)
6081                 case "$use64bitint" in
6082                 "$define") echo "64 bit integers selected." >&4 ;;
6083                 esac
6084                 case "$use64bitall" in
6085                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6086                 esac
6087                 case "$archname" in
6088                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6089                         ;;
6090                 *)      archname="$archname-$archname64"
6091                         echo "...setting architecture name to $archname." >&4
6092                         ;;
6093                 esac
6094                 ;;
6095         esac
6096 esac
6097 case "$uselongdouble" in
6098 $define)
6099         echo "Long doubles selected." >&4
6100         case "$longdblsize" in
6101         $doublesize)
6102                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6103                 ;;
6104         *)
6105                 case "$archname" in
6106                 *-ld*) echo "...and architecture name already has -ld." >&4
6107                         ;;
6108                 *)      archname="$archname-ld"
6109                         echo "...setting architecture name to $archname." >&4
6110                         ;;
6111                 esac
6112                 ;;
6113         esac
6114         ;;
6115 esac
6116 case "$useperlio" in
6117 $define)
6118         echo "Perlio selected." >&4
6119         ;;
6120 *)
6121         echo "Perlio not selected, using stdio." >&4
6122         case "$archname" in
6123         *-stdio*) echo "...and architecture name already has -stdio." >&4
6124                 ;;
6125         *)      archname="$archname-stdio"
6126                 echo "...setting architecture name to $archname." >&4
6127                 ;;
6128         esac
6129         ;;
6130 esac
6131 if $test -f archname.cbu; then
6132         echo "Your platform has some specific hints for architecture name, using them..."
6133         . ./archname.cbu
6134 fi
6135
6136 : set the prefixit variable, to compute a suitable default value
6137 prefixit='case "$3" in
6138 ""|none)
6139         case "$oldprefix" in
6140         "") eval "$1=\"\$$2\"";;
6141         *)
6142                 case "$3" in
6143                 "") eval "$1=";;
6144                 none)
6145                         eval "tp=\"\$$2\"";
6146                         case "$tp" in
6147                         ""|" ") eval "$1=\"\$$2\"";;
6148                         *) eval "$1=";;
6149                         esac;;
6150                 esac;;
6151         esac;;
6152 *)
6153         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6154         case "$tp" in
6155         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6156         /*-$oldprefix/*|\~*-$oldprefix/*)
6157                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6158         *) eval "$1=\"\$$2\"";;
6159         esac;;
6160 esac'
6161
6162 : determine installation style
6163 : For now, try to deduce it from prefix unless it is already set.
6164 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6165 case "$installstyle" in
6166 '')     case "$prefix" in
6167                 *perl*) dflt='lib';;
6168                 *) dflt='lib/perl5' ;;
6169         esac
6170         ;;
6171 *)      dflt="$installstyle" ;;
6172 esac
6173 : Probably not worth prompting for this since we prompt for all
6174 : the directories individually, and the prompt would be too long and
6175 : confusing anyway.
6176 installstyle=$dflt
6177
6178 : determine where public executables go
6179 echo " "
6180 set dflt bin bin
6181 eval $prefixit
6182 fn=d~
6183 rp='Pathname where the public executables will reside?'
6184 . ./getfile
6185 if $test "X$ansexp" != "X$binexp"; then
6186         installbin=''
6187 fi
6188 prefixvar=bin
6189 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6190 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6191 :     this via initialinstalllocation
6192 . ./setprefixvar
6193
6194 case "$userelocatableinc" in
6195 $define|true|[yY]*)     dflt='y' ;;
6196 *)                      dflt='n' ;;
6197 esac
6198 cat <<EOM
6199
6200 Would you like to build Perl so that the installation is relocatable, so that
6201 library paths in @INC are determined relative to the path of the perl binary?
6202 This is not advised for system Perl installs, or if you need to run setid
6203 scripts or scripts under taint mode.
6204
6205 If this doesn't make any sense to you, just accept the default '$dflt'.
6206 EOM
6207 rp='Use relocatable @INC?'
6208 . ./myread
6209 case "$ans" in
6210 y|Y)    val="$define" ;;
6211 *)      val="$undef"  ;;
6212 esac
6213 set userelocatableinc
6214 eval $setvar
6215
6216 initialinstalllocation="$binexp"
6217 : Default prefix is now "up one level from where the binaries are"
6218 case "$userelocatableinc" in
6219 $define|true|[yY]*)
6220     bin=".../"
6221     binexp=".../"
6222     prefix=".../.."
6223     prefixexp=".../.."
6224     installprefixexp=".../.."
6225     ;;
6226 esac
6227
6228 : determine where private library files go
6229 : Usual default is /usr/local/lib/perl5/$version.
6230 : Also allow things like /opt/perl/lib/$version, since
6231 : /opt/perl/lib/perl5... would be redundant.
6232 : The default "style" setting is made in installstyle.U
6233 case "$installstyle" in
6234 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6235 *)       set dflt privlib lib/$version ;;
6236 esac
6237 eval $prefixit
6238 $cat <<EOM
6239
6240 There are some auxiliary files for $package that need to be put into a
6241 private library directory that is accessible by everyone.
6242
6243 EOM
6244 fn=$binexp
6245 fn=d~+
6246 rp='Pathname where the private library files will reside?'
6247 . ./getfile
6248 prefixvar=privlib
6249 . ./setprefixvar
6250
6251 : set the prefixup variable, to restore leading tilda escape
6252 prefixup='case "$prefixexp" in
6253 "$prefix") ;;
6254 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6255 esac'
6256
6257 : determine where public architecture dependent libraries go
6258 set archlib archlib
6259 eval $prefixit
6260 : privlib default is /usr/local/lib/$package/$version
6261 : archlib default is /usr/local/lib/$package/$version/$archname
6262 : privlib may have an optional trailing /share.
6263 tdflt=`echo $privlib | $sed 's,/share$,,'`
6264 tdflt=$tdflt/$archname
6265 case "$archlib" in
6266 '')     dflt=$tdflt
6267         ;;
6268 *)      dflt="$archlib"
6269     ;;
6270 esac
6271 $cat <<EOM
6272
6273 $spackage contains architecture-dependent library files.  If you are
6274 sharing libraries in a heterogeneous environment, you might store
6275 these files in a separate location.  Otherwise, you can just include
6276 them with the rest of the public library files.
6277
6278 EOM
6279 fn=$binexp
6280 fn=d+~
6281 rp='Where do you want to put the public architecture-dependent libraries?'
6282 . ./getfile
6283 prefixvar=archlib
6284 . ./setprefixvar
6285 if $test X"$archlib" = X"$privlib"; then
6286         d_archlib="$undef"
6287 else
6288         d_archlib="$define"
6289 fi
6290
6291 : see if setuid scripts can be secure
6292 $cat <<EOM
6293
6294 Some kernels have a bug that prevents setuid #! scripts from being
6295 secure.  Some sites have disabled setuid #! scripts because of this.
6296
6297 First let's decide if your kernel supports secure setuid #! scripts.
6298 (If setuid #! scripts would be secure but have been disabled anyway,
6299 don't say that they are secure if asked.)
6300
6301 EOM
6302
6303 val="$undef"
6304 if $test -d /dev/fd; then
6305         echo "#!$ls" >reflect
6306         chmod +x,u+s reflect
6307         ./reflect >flect 2>&1
6308         if $contains "/dev/fd" flect >/dev/null; then
6309                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6310                 val="$define"
6311         else
6312                 $cat <<EOM
6313 If you are not sure if they are secure, I can check but I'll need a
6314 username and password different from the one you are using right now.
6315 If you don't have such a username or don't want me to test, simply
6316 enter 'none'.
6317
6318 EOM
6319                 rp='Other username to test security of setuid scripts with?'
6320                 dflt='none'
6321                 . ./myread
6322                 case "$ans" in
6323                 n|none)
6324                         case "$d_suidsafe" in
6325                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6326                                 dflt=n;;
6327                         "$undef")
6328                                 echo "Well, the $hint value is *not* secure." >&4
6329                                 dflt=n;;
6330                         *)      echo "Well, the $hint value *is* secure." >&4
6331                                 dflt=y;;
6332                         esac
6333                         ;;
6334                 *)
6335                         $rm -f reflect flect
6336                         echo "#!$ls" >reflect
6337                         chmod +x,u+s reflect
6338                         echo >flect
6339                         chmod a+w flect
6340                         echo '"su" will (probably) prompt you for '"$ans's password."
6341                         su $ans -c './reflect >flect'
6342                         if $contains "/dev/fd" flect >/dev/null; then
6343                                 echo "Okay, it looks like setuid scripts are secure." >&4
6344                                 dflt=y
6345                         else
6346                                 echo "I don't think setuid scripts are secure." >&4
6347                                 dflt=n
6348                         fi
6349                         ;;
6350                 esac
6351                 rp='Does your kernel have *secure* setuid scripts?'
6352                 . ./myread
6353                 case "$ans" in
6354                 [yY]*)  val="$define";;
6355                 *)      val="$undef";;
6356                 esac
6357         fi
6358 else
6359         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6360         echo "(That's for file descriptors, not floppy disks.)"
6361         val="$undef"
6362 fi
6363 set d_suidsafe
6364 eval $setvar
6365
6366 $rm -f reflect flect
6367
6368 : now see if they want to do setuid emulation
6369 if $test $patchlevel -lt 11; then
6370 echo " "
6371 val="$undef"
6372 case "$d_suidsafe" in
6373 "$define")
6374         val="$undef"
6375         echo "No need to emulate SUID scripts since they are secure here." >&4
6376         ;;
6377 *)
6378         $cat <<EOM
6379 Some systems have disabled setuid scripts, especially systems where
6380 setuid scripts cannot be secure.  On systems where setuid scripts have
6381 been disabled, the setuid/setgid bits on scripts are currently
6382 useless.  It is possible for $package to detect those bits and emulate
6383 setuid/setgid in a secure fashion.  This emulation will only work if
6384 setuid scripts have been disabled in your kernel.
6385
6386 EOM
6387         case "$d_dosuid" in
6388         "$define") dflt=y ;;
6389         *) dflt=n ;;
6390         esac
6391         rp="Do you want to do setuid/setgid emulation?"
6392         . ./myread
6393         case "$ans" in
6394         [yY]*)  val="$define";;
6395         *)      val="$undef";;
6396         esac
6397         ;;
6398 esac
6399 set d_dosuid
6400 eval $setvar
6401 else
6402     case "$d_dosuid" in
6403         "$define")
6404         cat >&4 <<EOH
6405
6406 SUID emulation has been removed for 5.12
6407 Please re-run Configure without -Dd_dosuid
6408
6409 EOH
6410         exit 1;
6411         ;;
6412     esac
6413     d_dosuid=undef
6414 fi
6415
6416 : Find perl5.005 or later.
6417 echo "Looking for a previously installed perl5.005 or later... "
6418 case "$perl5" in
6419 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6420                 : Check if this perl is recent and can load a simple module
6421                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6422                         perl5=$tdir/perl
6423                         break;
6424                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6425                         perl5=$tdir/perl5
6426                         break;
6427                 fi
6428         done
6429         ;;
6430 *)      perl5="$perl5"
6431         ;;
6432 esac
6433 case "$perl5" in
6434 '')     echo "None found.  That's ok.";;
6435 *)      echo "Using $perl5." ;;
6436 esac
6437
6438 : Set the siteprefix variables
6439 $cat <<EOM
6440
6441 After $package is installed, you may wish to install various
6442 add-on modules and utilities.  Typically, these add-ons will
6443 be installed under $prefix with the rest
6444 of this package.  However, you may wish to install such add-ons
6445 elsewhere under a different prefix.
6446
6447 If you do not wish to put everything under a single prefix, that's
6448 ok.  You will be prompted for the individual locations; this siteprefix
6449 is only used to suggest the defaults.
6450
6451 The default should be fine for most people.
6452
6453 EOM
6454 fn=d~+
6455 rp='Installation prefix to use for add-on modules and utilities?'
6456 : XXX Here might be another good place for an installstyle setting.
6457 case "$siteprefix" in
6458 '') dflt=$prefix ;;
6459 *)  dflt=$siteprefix ;;
6460 esac
6461 . ./getfile
6462 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6463 oldsiteprefix=''
6464 case "$siteprefix" in
6465 '') ;;
6466 *)      case "$ans" in
6467         "$prefix") ;;
6468         *) oldsiteprefix="$prefix";;
6469         esac
6470         ;;
6471 esac
6472 siteprefix="$ans"
6473 siteprefixexp="$ansexp"
6474
6475 : determine where site specific libraries go.
6476 : Usual default is /usr/local/lib/perl5/site_perl/$version
6477 : The default "style" setting is made in installstyle.U
6478 : XXX No longer works with Prefixit stuff.
6479 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6480 case "$sitelib" in
6481 '') case "$installstyle" in
6482         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6483         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6484         esac
6485         ;;
6486 *)      dflt="$sitelib"
6487         ;;
6488 esac
6489 $cat <<EOM
6490
6491 The installation process will create a directory for
6492 site-specific extensions and modules.  Most users find it convenient
6493 to place all site-specific files in this directory rather than in the
6494 main distribution directory.
6495
6496 EOM
6497 fn=d~+
6498 rp='Pathname for the site-specific library files?'
6499 . ./getfile
6500 prefixvar=sitelib
6501 . ./setprefixvar
6502 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6503
6504 : Determine list of previous versions to include in @INC
6505 $cat > getverlist <<EOPL
6506 #!$perl5 -w
6507 use File::Basename;
6508 \$api_versionstring = "$api_versionstring";
6509 \$version = "$version";
6510 \$stem = "$sitelib_stem";
6511 \$archname = "$archname";
6512 EOPL
6513         $cat >> getverlist <<'EOPL'
6514 # The list found is store twice for each entry: the original name, and
6515 # the binary broken down version as pack "sss", so sorting is easy and
6516 # unambiguous. This will work for all versions that have a maximum of
6517 # three digit groups, separate by '.'s or '_'s. Names are extended with
6518 # ".0.0" to ensure at least three elements for the pack.
6519 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6520
6521 # Can't have leading @ because metaconfig interprets it as a command!
6522 ;@inc_version_list=();
6523 # XXX Redo to do opendir/readdir?
6524 if (-d $stem) {
6525     chdir($stem);
6526     ;@candidates = map {
6527         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6528 }
6529 else {
6530     ;@candidates = ();
6531 }
6532
6533 ($pversion, $aversion, $vsn5005) = map {
6534     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6535 foreach $d (@candidates) {
6536     if ($d->[1] lt $pversion) {
6537         if ($d->[1] ge $aversion) {
6538             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6539         }
6540         elsif ($d->[1] ge $vsn5005) {
6541             unshift(@inc_version_list, grep { -d } $d->[0]);
6542         }
6543     }
6544     else {
6545         # Skip newer version.  I.e. don't look in
6546         # 5.7.0 if we're installing 5.6.1.
6547     }
6548 }
6549
6550 if (@inc_version_list) {
6551     print join(' ', @inc_version_list);
6552 }
6553 else {
6554     # Blank space to preserve value for next Configure run.
6555     print " ";
6556 }
6557 EOPL
6558 chmod +x getverlist
6559 case "$inc_version_list" in
6560 '')     if test -x "$perl5$exe_ext"; then
6561                 dflt=`$perl5 getverlist`
6562         else
6563                 dflt='none'
6564         fi
6565         ;;
6566 $undef) dflt='none' ;;
6567 *)  eval dflt=\"$inc_version_list\" ;;
6568 esac
6569 case "$dflt" in
6570 ''|' ') dflt=none ;;
6571 esac
6572 case "$dflt" in
6573 5.005) dflt=none ;;
6574 esac
6575 $cat <<EOM
6576
6577 In order to ease the process of upgrading, this version of perl
6578 can be configured to use modules built and installed with earlier
6579 versions of perl that were installed under $prefix.  Specify here
6580 the list of earlier versions that this version of perl should check.
6581 If Configure detected no earlier versions of perl installed under
6582 $prefix, then the list will be empty.  Answer 'none' to tell perl
6583 to not search earlier versions.
6584
6585 The default should almost always be sensible, so if you're not sure,
6586 just accept the default.
6587 EOM
6588
6589 rp='List of earlier versions to include in @INC?'
6590 . ./myread
6591 case "$ans" in
6592 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6593 *) inc_version_list="$ans" ;;
6594 esac
6595 case "$inc_version_list" in
6596 ''|' ')
6597         inc_version_list_init='0'
6598         d_inc_version_list="$undef"
6599         ;;
6600 *)      inc_version_list_init=`echo $inc_version_list |
6601                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6602         d_inc_version_list="$define"
6603         ;;
6604 esac
6605 $rm -f getverlist
6606
6607 : see if malloc/malloc.h has to be included
6608 set malloc/malloc.h i_mallocmalloc
6609 eval $inhdr
6610
6611 : see if this is a malloc.h system
6612 : we want a real compile instead of Inhdr because some systems have a
6613 : malloc.h that just gives a compile error saying to use stdlib.h instead
6614 echo " "
6615 $cat >try.c <<EOCP
6616 #include <stdlib.h>
6617 #include <malloc.h>
6618 #$i_mallocmalloc I_MALLOCMALLOC
6619 #ifdef I_MALLOCMALLOC
6620 # include <malloc/malloc.h>
6621 #endif
6622
6623 int main () { return 0; }
6624 EOCP
6625 set try
6626 if eval $compile; then
6627     echo "<malloc.h> found." >&4
6628     val="$define"
6629 else
6630     echo "<malloc.h> NOT found." >&4
6631     val="$undef"
6632 fi
6633 $rm_try
6634 set i_malloc
6635 eval $setvar
6636
6637 : check for void type
6638 echo " "
6639 echo "Checking to see how well your C compiler groks the void type..." >&4
6640 case "$voidflags" in
6641 '')
6642         $cat >try.c <<EOCP
6643 #$i_stdlib I_STDLIB
6644 #ifdef I_STDLIB
6645 #include <stdlib.h>
6646 #endif
6647 #if TRY & 1
6648 void sub() {
6649 #else
6650 sub() {
6651 #endif
6652         extern void moo();      /* function returning void */
6653         void (*goo)();          /* ptr to func returning void */
6654 #if TRY & 8
6655         void *hue;              /* generic ptr */
6656 #endif
6657 #if TRY & 2
6658         void (*foo[10])();
6659 #endif
6660
6661 #if TRY & 4
6662         if(goo == moo) {
6663                 exit(0);
6664         }
6665 #endif
6666         exit(0);
6667 }
6668 int main() { sub(); }
6669 EOCP
6670         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6671                 voidflags=$defvoidused
6672         echo "Good.  It appears to support void to the level $package wants.">&4
6673                 if $contains warning .out >/dev/null 2>&1; then
6674                         echo "However, you might get some warnings that look like this:"
6675                         $cat .out
6676                 fi
6677         else
6678 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6679                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6680                         echo "It supports 1..."
6681                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6682                                 echo "It also supports 2..."
6683                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6684                                         voidflags=7
6685                                         echo "And it supports 4 but not 8 definitely."
6686                                 else
6687                                         echo "It doesn't support 4..."
6688                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6689                                                 voidflags=11
6690                                                 echo "But it supports 8."
6691                                         else
6692                                                 voidflags=3
6693                                                 echo "Neither does it support 8."
6694                                         fi
6695                                 fi
6696                         else
6697                                 echo "It does not support 2..."
6698                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6699                                         voidflags=13
6700                                         echo "But it supports 4 and 8."
6701                                 else
6702                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6703                                                 voidflags=5
6704                                                 echo "And it supports 4 but has not heard about 8."
6705                                         else
6706                                                 echo "However it supports 8 but not 4."
6707                                         fi
6708                                 fi
6709                         fi
6710                 else
6711                         echo "There is no support at all for void."
6712                         voidflags=0
6713                 fi
6714         fi
6715 esac
6716 case "$voidflags" in
6717 "$defvoidused") ;;
6718 *)      $cat >&4 <<'EOM'
6719   Support flag bits are:
6720     1: basic void declarations.
6721     2: arrays of pointers to functions returning void.
6722     4: operations between pointers to and addresses of void functions.
6723     8: generic void pointers.
6724 EOM
6725         dflt="$voidflags";
6726         rp="Your void support flags add up to what?"
6727         . ./myread
6728         voidflags="$ans"
6729         ;;
6730 esac
6731 $rm_try
6732
6733 : check for length of pointer
6734 echo " "
6735 case "$ptrsize" in
6736 '')
6737         echo "Checking to see how big your pointers are..." >&4
6738         if test "$voidflags" -gt 7; then
6739                 echo '#define VOID_PTR char *' > try.c
6740         else
6741                 echo '#define VOID_PTR void *' > try.c
6742         fi
6743         $cat >>try.c <<EOCP
6744 #include <stdio.h>
6745 #$i_stdlib I_STDLIB
6746 #ifdef I_STDLIB
6747 #include <stdlib.h>
6748 #endif
6749 int main()
6750 {
6751     printf("%d\n", (int)sizeof(VOID_PTR));
6752     exit(0);
6753 }
6754 EOCP
6755         set try
6756         if eval $compile_ok; then
6757                 ptrsize=`$run ./try`
6758                 echo "Your pointers are $ptrsize bytes long."
6759         else
6760                 dflt='4'
6761                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6762                 rp="What is the size of a pointer (in bytes)?"
6763                 . ./myread
6764                 ptrsize="$ans"
6765         fi
6766         ;;
6767 esac
6768 $rm_try
6769 case "$use64bitall" in
6770 "$define"|true|[yY]*)
6771         case "$ptrsize" in
6772         4)      cat <<EOM >&4
6773
6774 *** You have chosen a maximally 64-bit build,
6775 *** but your pointers are only 4 bytes wide.
6776 *** Please rerun Configure without -Duse64bitall.
6777 EOM
6778                 case "$d_quad" in
6779                 define)
6780                         cat <<EOM >&4
6781 *** Since you have quads, you could possibly try with -Duse64bitint.
6782 EOM
6783                         ;;
6784                 esac
6785                 cat <<EOM >&4
6786 *** Cannot continue, aborting.
6787
6788 EOM
6789
6790                 exit 1
6791                 ;;
6792         esac
6793         ;;
6794 esac
6795
6796
6797 : determine whether to use malloc wrapping
6798 echo " "
6799 case "$usemallocwrap" in
6800 [yY]*|true|$define)     dflt='y' ;;
6801 [nN]*|false|$undef)     dflt='n' ;;
6802 *)      case "$usedevel" in
6803         [yY]*|true|$define)     dflt='y' ;;
6804         *) dflt='n' ;;
6805         esac
6806         ;;
6807 esac
6808 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6809 . ./myread
6810 usemallocwrap="$ans"
6811 case "$ans" in
6812 y*|true)
6813         usemallocwrap="$define" ;;
6814 *)
6815         usemallocwrap="$undef" ;;
6816 esac
6817
6818 : determine which malloc to compile in
6819 echo " "
6820 case "$usemymalloc" in
6821 [yY]*|true|$define)     dflt='y' ;;
6822 [nN]*|false|$undef)     dflt='n' ;;
6823 *)      case "$ptrsize" in
6824         4) dflt='y' ;;
6825         *) dflt='n' ;;
6826         esac
6827         ;;
6828 esac
6829 rp="Do you wish to attempt to use the malloc that comes with $package?"
6830 . ./myread
6831 usemymalloc="$ans"
6832 case "$ans" in
6833 y*|true)
6834         usemymalloc='y'
6835         mallocsrc='malloc.c'
6836         mallocobj="malloc$_o"
6837         d_mymalloc="$define"
6838         case "$libs" in
6839         *-lmalloc*)
6840                 : Remove malloc from list of libraries to use
6841                 echo "Removing unneeded -lmalloc from library list" >&4
6842                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6843                 shift
6844                 libs="$*"
6845                 echo "libs = $libs" >&4
6846                 ;;
6847         esac
6848         ;;
6849 *)
6850         usemymalloc='n'
6851         mallocsrc=''
6852         mallocobj=''
6853         d_mymalloc="$undef"
6854         ;;
6855 esac
6856
6857 : compute the return types of malloc and free
6858 echo " "
6859 $cat >malloc.c <<END
6860 #$i_malloc I_MALLOC
6861 #$i_stdlib I_STDLIB
6862 #include <stdio.h>
6863 #include <sys/types.h>
6864 #ifdef I_MALLOC
6865 #include <malloc.h>
6866 #endif
6867 #ifdef I_STDLIB
6868 #include <stdlib.h>
6869 #endif
6870 #ifdef TRY_MALLOC
6871 void *malloc();
6872 #endif
6873 #ifdef TRY_FREE
6874 void free();
6875 #endif
6876 END
6877 case "$malloctype" in
6878 '')
6879         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6880                 malloctype='void *'
6881         else
6882                 malloctype='char *'
6883         fi
6884         ;;
6885 esac
6886 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6887
6888 case "$freetype" in
6889 '')
6890         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6891                 freetype='void'
6892         else
6893                 freetype='int'
6894         fi
6895         ;;
6896 esac
6897 echo "Your system uses $freetype free(), it would seem." >&4
6898 $rm -f malloc.[co]
6899 : determine where site specific architecture-dependent libraries go.
6900 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6901 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6902 : sitelib may have an optional trailing /share.
6903 case "$sitearch" in
6904 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6905         dflt="$dflt/$archname"
6906         ;;
6907 *)      dflt="$sitearch"
6908         ;;
6909 esac
6910 set sitearch sitearch none
6911 eval $prefixit
6912 $cat <<EOM
6913
6914 The installation process will also create a directory for
6915 architecture-dependent site-specific extensions and modules.
6916
6917 EOM
6918 fn=d~+
6919 rp='Pathname for the site-specific architecture-dependent library files?'
6920 . ./getfile
6921 prefixvar=sitearch
6922 . ./setprefixvar
6923 if $test X"$sitearch" = X"$sitelib"; then
6924         d_sitearch="$undef"
6925 else
6926         d_sitearch="$define"
6927 fi
6928
6929 : Set the vendorprefix variables
6930 $cat <<EOM
6931
6932 The installation process will also create a directory for
6933 vendor-supplied add-ons.  Vendors who supply perl with their system
6934 may find it convenient to place all vendor-supplied files in this
6935 directory rather than in the main distribution directory.  This will
6936 ease upgrades between binary-compatible maintenance versions of perl.
6937
6938 Of course you may also use these directories in whatever way you see
6939 fit.  For example, you might use them to access modules shared over a
6940 company-wide network.
6941
6942 The default answer should be fine for most people.
6943 This causes further questions about vendor add-ons to be skipped
6944 and no vendor-specific directories will be configured for perl.
6945
6946 EOM
6947 rp='Do you want to configure vendor-specific add-on directories?'
6948 case "$usevendorprefix" in
6949 define|true|[yY]*) dflt=y ;;
6950 *)      : User may have set vendorprefix directly on Configure command line.
6951         case "$vendorprefix" in
6952         ''|' ') dflt=n ;;
6953         *)      dflt=y ;;
6954         esac
6955         ;;
6956 esac
6957 . ./myread
6958 case "$ans" in
6959 [yY]*)  fn=d~+
6960         rp='Installation prefix to use for vendor-supplied add-ons?'
6961         case "$vendorprefix" in
6962         '') dflt='' ;;
6963         *)  dflt=$vendorprefix ;;
6964         esac
6965         . ./getfile
6966         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6967         oldvendorprefix=''
6968         case "$vendorprefix" in
6969         '') ;;
6970         *)      case "$ans" in
6971                 "$prefix") ;;
6972                 *) oldvendorprefix="$prefix";;
6973                 esac
6974                 ;;
6975         esac
6976         usevendorprefix="$define"
6977         vendorprefix="$ans"
6978         vendorprefixexp="$ansexp"
6979         ;;
6980 *)      usevendorprefix="$undef"
6981         vendorprefix=''
6982         vendorprefixexp=''
6983         ;;
6984 esac
6985
6986 : Set the vendorlib variables
6987 case "$vendorprefix" in
6988 '')     d_vendorlib="$undef"
6989         vendorlib=''
6990         vendorlibexp=''
6991         ;;
6992 *)      d_vendorlib="$define"
6993         : determine where vendor-supplied modules go.
6994         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6995         case "$vendorlib" in
6996         '')
6997                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6998                 case "$installstyle" in
6999                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7000                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7001                 esac
7002                 ;;
7003         *)      dflt="$vendorlib"
7004                 ;;
7005         esac
7006         fn=d~+
7007         rp='Pathname for the vendor-supplied library files?'
7008         . ./getfile
7009         vendorlib="$ans"
7010         vendorlibexp="$ansexp"
7011         ;;
7012 esac
7013 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7014 prefixvar=vendorlib
7015 . ./installprefix
7016
7017 : Set the vendorarch variables
7018 case "$vendorprefix" in
7019 '')     d_vendorarch="$undef"
7020         vendorarch=''
7021         vendorarchexp=''
7022         ;;
7023 *)      d_vendorarch="$define"
7024         : determine where vendor-supplied architecture-dependent libraries go.
7025         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7026         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7027         : vendorlib may have an optional trailing /share.
7028         case "$vendorarch" in
7029         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7030                 dflt="$dflt/$archname"
7031                 ;;
7032         *)      dflt="$vendorarch" ;;
7033         esac
7034         fn=d~+
7035         rp='Pathname for vendor-supplied architecture-dependent files?'
7036         . ./getfile
7037         vendorarch="$ans"
7038         vendorarchexp="$ansexp"
7039         ;;
7040 esac
7041 prefixvar=vendorarch
7042 . ./installprefix
7043 if $test X"$vendorarch" = X"$vendorlib"; then
7044         d_vendorarch="$undef"
7045 else
7046         d_vendorarch="$define"
7047 fi
7048
7049 : Final catch-all directories to search
7050 $cat <<EOM
7051
7052 Lastly, you can have perl look in other directories for extensions and
7053 modules in addition to those already specified.
7054 These directories will be searched after 
7055         $sitearch 
7056         $sitelib 
7057 EOM
7058 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7059 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7060 echo ' '
7061 case "$otherlibdirs" in
7062 ''|' ') dflt='none' ;;
7063 *)      dflt="$otherlibdirs" ;;
7064 esac
7065 $cat <<EOM
7066 Enter a colon-separated set of extra paths to include in perl's @INC
7067 search path, or enter 'none' for no extra paths.
7068
7069 EOM
7070
7071 rp='Colon-separated list of additional directories for perl to search?'
7072 . ./myread
7073 case "$ans" in
7074 ' '|''|none)    otherlibdirs=' ' ;;     
7075 *)      otherlibdirs="$ans" ;;
7076 esac
7077 case "$otherlibdirs" in
7078 ' ') val=$undef ;;
7079 *)      val=$define ;;
7080 esac
7081 set d_perl_otherlibdirs
7082 eval $setvar
7083
7084 : Cruising for prototypes
7085 echo " "
7086 echo "Checking out function prototypes..." >&4
7087 $cat >prototype.c <<EOCP
7088 #$i_stdlib I_STDLIB
7089 #ifdef I_STDLIB
7090 #include <stdlib.h>
7091 #endif
7092 int main(int argc, char *argv[]) {
7093         exit(0);}
7094 EOCP
7095 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7096         echo "Your C compiler appears to support function prototypes."
7097         val="$define"
7098 else
7099         echo "Your C compiler doesn't seem to understand function prototypes."
7100         val="$undef"
7101 fi
7102 set prototype
7103 eval $setvar
7104 $rm -f prototype*
7105
7106 : Check if ansi2knr is required
7107 case "$prototype" in
7108 "$define") ;;
7109 *)      ansi2knr='ansi2knr'
7110         echo " "
7111         cat <<EOM >&4
7112
7113 $me:  FATAL ERROR:
7114 This version of $package can only be compiled by a compiler that 
7115 understands function prototypes.  Unfortunately, your C compiler 
7116         $cc $ccflags
7117 doesn't seem to understand them.  Sorry about that.
7118
7119 If GNU cc is available for your system, perhaps you could try that instead.  
7120
7121 Eventually, we hope to support building Perl with pre-ANSI compilers.
7122 If you would like to help in that effort, please contact <perlbug@perl.org>.
7123
7124 Aborting Configure now.
7125 EOM
7126         exit 2
7127         ;;
7128 esac
7129
7130 : DTrace support
7131 dflt_dtrace='/usr/sbin/dtrace'
7132 cat <<EOM
7133
7134 Perl can be built to support DTrace on platforms that support it.
7135 DTrace is a diagnosis and performance analysis tool from Sun.
7136
7137 If this doesn't make any sense to you, just accept the default '$dflt'.
7138 EOM
7139
7140 while $test 1 ; do
7141         case "$usedtrace" in
7142         $define|true|[yY]*)
7143                 dflt='y'
7144                 ;;
7145         ?*)
7146                 dflt='y'
7147                 dflt_dtrace=$usedtrace
7148                 ;;
7149         *)
7150                 dflt='n'
7151                 ;;
7152         esac
7153
7154         rp='Support DTrace if available?'
7155         . ./myread
7156         case "$ans" in
7157         y|Y)    val="$define" ;;
7158         *)      val="$undef" ;;
7159         esac
7160         set usedtrace
7161         eval $setvar
7162
7163         test "X$usedtrace" != "X$define" && break
7164
7165         echo " "
7166         rp='Where is the dtrace executable?'
7167         dflt=$dflt_dtrace
7168         . ./getfile
7169         val="$ans"
7170         set dtrace
7171         eval $setvar
7172
7173         if $test -f $dtrace
7174         then
7175                 if $dtrace -h -s ../perldtrace.d \
7176                         -o perldtrace.tmp >/dev/null 2>&1 \
7177                         && rm -f perldtrace.tmp
7178                 then
7179                         echo " "
7180                         echo "Good: your $dtrace knows about the -h flag."
7181                 else
7182                         cat >&2 <<EOM
7183
7184 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7185 ***
7186 *** Your installed dtrace doesn't support the -h switch to compile a D
7187 *** program into a C header. Can't continue.
7188
7189 EOM
7190                         exit 1
7191                 fi
7192                 break;
7193         fi
7194
7195         case "$fastread" in
7196         yes)
7197                 cat >&2 <<EOM
7198
7199 *** $me:  Fatal Error:  $dtrace not found.
7200 *** Can't continue.
7201
7202 EOM
7203                 exit 1
7204                 ;;
7205         *)
7206                 echo "*** $dtrace was not found."
7207                 echo " "
7208                 ;;
7209         esac
7210 done
7211
7212 : See if we want extra modules installed
7213 echo " "
7214 case "$extras" in
7215 '') dflt='n';;
7216 *) dflt='y';;
7217 esac
7218 cat <<EOM
7219 Perl can be built with extra modules or bundles of modules which
7220 will be fetched from the CPAN and installed alongside Perl.
7221
7222 Notice that you will need access to the CPAN; either via the Internet,
7223 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7224 be asked later to configure the CPAN.pm module which will in turn do
7225 the installation of the rest of the extra modules or bundles.)
7226
7227 Notice also that if the modules require any external software such as
7228 libraries and headers (the libz library and the zlib.h header for the
7229 Compress::Zlib module, for example) you MUST have any such software
7230 already installed, this configuration process will NOT install such
7231 things for you.
7232
7233 If this doesn't make any sense to you, just accept the default '$dflt'.
7234 EOM
7235 rp='Install any extra modules (y or n)?'
7236 . ./myread
7237 case "$ans" in
7238 y|Y)
7239         cat <<EOM
7240
7241 Please list any extra modules or bundles to be installed from CPAN,
7242 with spaces between the names.  The names can be in any format the
7243 'install' command of CPAN.pm will understand.  (Answer 'none',
7244 without the quotes, to install no extra modules or bundles.)
7245 EOM
7246         rp='Extras?'
7247         dflt="$extras"
7248         . ./myread
7249         extras="$ans"
7250 esac
7251 case "$extras" in
7252 ''|'none')
7253         val=''
7254         $rm -f ../extras.lst
7255         ;;
7256 *)      echo "(Saving the list of extras for later...)"
7257         echo "$extras" > ../extras.lst
7258         val="'$extras'"
7259         ;;
7260 esac
7261 set extras
7262 eval $setvar
7263 echo " "
7264
7265 : determine where html pages for programs go
7266 set html1dir html1dir none
7267 eval $prefixit
7268 $cat <<EOM
7269
7270 If you wish to install html files for programs in $spackage, indicate
7271 the appropriate directory here.  To skip installing html files,
7272 answer "none".
7273 EOM
7274 case "$html1dir" in
7275 ''|none|$undef|' ') dflt=none ;;
7276 *) dflt=$html1dir ;;
7277 esac
7278 fn=dn+~
7279 rp="Directory for the main $spackage html pages?"
7280 . ./getfile
7281 prefixvar=html1dir
7282 . ./setprefixvar
7283 : Use ' ' for none so value is preserved next time through Configure
7284 $test X"$html1dir" = "X" && html1dir=' '
7285
7286 : determine where html pages for libraries and modules go
7287 set html3dir html3dir none
7288 eval $prefixit
7289 $cat <<EOM
7290
7291 If you wish to install html files for modules associated with $spackage,
7292 indicate the appropriate directory here.  To skip installing html files,
7293 answer "none".
7294 EOM
7295 : There is no obvious default.  If they have specified html1dir, then
7296 : try to key off that, possibly changing .../html1 into .../html3.
7297 case "$html3dir" in
7298 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7299 *) dflt=$html3dir ;;
7300 esac
7301 fn=dn+~
7302 rp="Directory for the $spackage module html pages?"
7303 . ./getfile
7304 prefixvar=html3dir
7305 . ./setprefixvar
7306 : Use ' ' for none so value is preserved next time through Configure
7307 $test X"$html3dir" = "X" && html3dir=' '
7308
7309 : determine whether to install perl also as /usr/bin/perl
7310
7311 echo " "
7312 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7313         $cat <<EOM
7314 Many scripts expect perl to be installed as /usr/bin/perl.
7315
7316 If you want to, I can install the perl you are about to compile
7317 as /usr/bin/perl (in addition to $bin/perl).
7318 EOM
7319         if test -f /usr/bin/perl; then
7320             $cat <<EOM
7321
7322 However, please note that because you already have a /usr/bin/perl,
7323 overwriting that with a new Perl would very probably cause problems.
7324 Therefore I'm assuming you don't want to do that (unless you insist).
7325
7326 EOM
7327             case "$installusrbinperl" in
7328             "$define"|[yY]*)    dflt='y';;
7329             *)                  dflt='n';;
7330             esac
7331         else
7332             $cat <<EOM
7333
7334 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7335
7336 EOM
7337             case "$installusrbinperl" in
7338             "$undef"|[nN]*)     dflt='n';;
7339             *)                  dflt='y';;
7340             esac
7341         fi
7342         rp="Do you want to install perl as /usr/bin/perl?"
7343         . ./myread
7344         case "$ans" in
7345         [yY]*)  val="$define";;
7346         *)      val="$undef" ;;
7347         esac
7348 else
7349         val="$undef"
7350 fi
7351 set installusrbinperl
7352 eval $setvar
7353
7354 : Check if we are using the GNU C library
7355 echo " "
7356 echo "Checking for GNU C Library..." >&4
7357 cat >try.c <<'EOCP'
7358 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7359    alone are insufficient to distinguish different versions, such as
7360    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7361    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7362 */
7363 #include <stdio.h>
7364 int main(void)
7365 {
7366 #ifdef __GLIBC__
7367 #   ifdef __GLIBC_MINOR__
7368 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7369 #           include <gnu/libc-version.h>
7370             printf("%s\n",  gnu_get_libc_version());
7371 #       else
7372             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7373 #       endif
7374 #   else
7375         printf("%d\n",  __GLIBC__);
7376 #   endif
7377     return 0;
7378 #else
7379     return 1;
7380 #endif
7381 }
7382 EOCP
7383 set try
7384 if eval $compile_ok && $run ./try > glibc.ver; then
7385         val="$define"
7386         gnulibc_version=`$cat glibc.ver`
7387         echo "You are using the GNU C Library version $gnulibc_version"
7388 else
7389         val="$undef"
7390         gnulibc_version=''
7391         echo "You are not using the GNU C Library"
7392 fi
7393 $rm_try glibc.ver
7394 set d_gnulibc
7395 eval $setvar
7396
7397 : see if nm is to be used to determine whether a symbol is defined or not
7398 case "$usenm" in
7399 '')
7400         dflt=''
7401         case "$d_gnulibc" in
7402         "$define")
7403                 echo " "
7404                 echo "nm probably won't work on the GNU C Library." >&4
7405                 dflt=n
7406                 ;;
7407         esac
7408         case "$dflt" in
7409         '') 
7410                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7411                         echo " "
7412                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7413                         echo "'nm' won't be sufficient on this sytem." >&4
7414                         dflt=n
7415                 fi
7416                 ;;
7417         esac
7418         case "$dflt" in
7419         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7420                 if $test $dflt -gt 20; then
7421                         dflt=y
7422                 else
7423                         dflt=n
7424                 fi
7425                 ;;
7426         esac
7427         ;;
7428 *)
7429         case "$usenm" in
7430         true|$define) dflt=y;;
7431         *) dflt=n;;
7432         esac
7433         ;;
7434 esac
7435 $cat <<EOM
7436
7437 I can use $nm to extract the symbols from your C libraries. This
7438 is a time consuming task which may generate huge output on the disk (up
7439 to 3 megabytes) but that should make the symbols extraction faster. The
7440 alternative is to skip the 'nm' extraction part and to compile a small
7441 test program instead to determine whether each symbol is present. If
7442 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7443 this may be the best solution.
7444
7445 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7446
7447 EOM
7448 rp="Shall I use $nm to extract C symbols from the libraries?"
7449 . ./myread
7450 case "$ans" in
7451 [Nn]*) usenm=false;;
7452 *) usenm=true;;
7453 esac
7454
7455 runnm=$usenm
7456 case "$reuseval" in
7457 true) runnm=false;;
7458 esac
7459
7460 : nm options which may be necessary
7461 case "$nm_opt" in
7462 '') if $test -f /mach_boot; then
7463                 nm_opt=''       # Mach
7464         elif $test -d /usr/ccs/lib; then
7465                 nm_opt='-p'     # Solaris (and SunOS?)
7466         elif $test -f /dgux; then
7467                 nm_opt='-p'     # DG-UX
7468         elif $test -f /lib64/rld; then
7469                 nm_opt='-p'     # 64-bit Irix
7470         else
7471                 nm_opt=''
7472         fi;;
7473 esac
7474
7475 : nm options which may be necessary for shared libraries but illegal
7476 : for archive libraries.  Thank you, Linux.
7477 case "$nm_so_opt" in
7478 '')     case "$myuname" in
7479         *linux*|gnu*)
7480                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7481                         nm_so_opt='--dynamic'
7482                 fi
7483                 ;;
7484         esac
7485         ;;
7486 esac
7487
7488 : Figure out where the libc is located
7489 case "$runnm" in
7490 true)
7491 : get list of predefined functions in a handy place
7492 echo " "
7493 case "$libc" in
7494 '') libc=unknown
7495         case "$libs" in
7496         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7497         esac
7498         ;;
7499 esac
7500 case "$libs" in
7501 '') ;;
7502 *)  for thislib in $libs; do
7503         case "$thislib" in
7504         -lc|-lc_s)
7505                 : Handle C library specially below.
7506                 ;;
7507         -l*)
7508                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7509                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7510                         :
7511                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7512                         :
7513                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7514                         :
7515                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7516                         :
7517                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7518                         :
7519                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7520                         :
7521                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7522                         :
7523                 else
7524                         try=''
7525                 fi
7526                 libnames="$libnames $try"
7527                 ;;
7528         *) libnames="$libnames $thislib" ;;
7529         esac
7530         done
7531         ;;
7532 esac
7533 xxx=normal
7534 case "$libc" in
7535 unknown)
7536         set /lib/libc.$so
7537         for xxx in $libpth; do
7538                 $test -r $1 || set $xxx/libc.$so
7539                 : The messy sed command sorts on library version numbers.
7540                 $test -r $1 || \
7541                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7542                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7543                                 h
7544                                 s/[0-9][0-9]*/0000&/g
7545                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7546                                 G
7547                                 s/\n/ /' | \
7548                          $sort | $sed -e 's/^.* //'`
7549                 eval set \$$#
7550         done
7551         $test -r $1 || set /usr/ccs/lib/libc.$so
7552         $test -r $1 || set /lib/libsys_s$_a
7553         ;;
7554 *)
7555         set blurfl
7556         ;;
7557 esac
7558 if $test -r "$1"; then
7559         echo "Your (shared) C library seems to be in $1."
7560         libc="$1"
7561 elif $test -r /lib/libc && $test -r /lib/clib; then
7562         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7563         xxx=apollo
7564         libc='/lib/clib /lib/libc'
7565         if $test -r /lib/syslib; then
7566                 echo "(Your math library is in /lib/syslib.)"
7567                 libc="$libc /lib/syslib"
7568         fi
7569 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7570         echo "Your C library seems to be in $libc, as you said before."
7571 elif $test -r $incpath/usr/lib/libc$_a; then
7572         libc=$incpath/usr/lib/libc$_a;
7573         echo "Your C library seems to be in $libc.  That's fine."
7574 elif $test -r /lib/libc$_a; then
7575         libc=/lib/libc$_a;
7576         echo "Your C library seems to be in $libc.  You're normal."
7577 else
7578         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7579                 :
7580         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7581                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7582         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7583                 :
7584         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7585                 :
7586         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7587                 :
7588         else
7589                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7590         fi
7591         if $test -r "$tans"; then
7592                 echo "Your C library seems to be in $tans, of all places."
7593                 libc=$tans
7594         else
7595                 libc='blurfl'
7596         fi
7597 fi
7598 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7599         dflt="$libc"
7600         cat <<EOM
7601
7602 If the guess above is wrong (which it might be if you're using a strange
7603 compiler, or your machine supports multiple models), you can override it here.
7604
7605 EOM
7606 else
7607         dflt=''
7608         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7609         cat >&4 <<EOM
7610 I can't seem to find your C library.  I've looked in the following places:
7611
7612 EOM
7613         $sed 's/^/      /' libpath
7614         cat <<EOM
7615
7616 None of these seems to contain your C library. I need to get its name...
7617
7618 EOM
7619 fi
7620 fn=f
7621 rp='Where is your C library?'
7622 . ./getfile
7623 libc="$ans"
7624
7625 echo " "
7626 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7627 set X `cat libnames`
7628 shift
7629 xxx=files
7630 case $# in 1) xxx=file; esac
7631 echo "Extracting names from the following $xxx for later perusal:" >&4
7632 echo " "
7633 $sed 's/^/      /' libnames >&4
7634 echo " "
7635 $echo $n "This may take a while...$c" >&4
7636
7637 for file in $*; do
7638         case $file in
7639         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7640         *) $nm $nm_opt $file 2>/dev/null;;
7641         esac
7642 done >libc.tmp
7643
7644 $echo $n ".$c"
7645 $grep fprintf libc.tmp > libc.ptf
7646 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7647 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7648 xxx='[ADTSIW]'
7649 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7650         eval $xscan;\
7651         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7652                 eval $xrun
7653 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7654         eval $xscan;\
7655         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7656                 eval $xrun
7657 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7658         eval $xscan;\
7659         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7660                 eval $xrun
7661 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7662         eval $xscan;\
7663         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7664                 eval $xrun
7665 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7666         eval $xscan;\
7667         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7668                 eval $xrun
7669 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7670         eval $xscan;\
7671         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7672                 eval $xrun
7673 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7674                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7675         eval $xscan;\
7676         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7677                 eval $xrun
7678 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7679         eval $xscan;\
7680         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7681                 eval $xrun
7682 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7683         eval $xscan;\
7684         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7685                 eval $xrun
7686 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7687         eval $xscan;\
7688         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7689                 eval $xrun
7690 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7691         eval $xscan;\
7692         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7693                 eval $xrun
7694 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7695         eval $xscan;\
7696         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7697                 eval $xrun
7698 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7699         eval $xscan;\
7700         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7701                 eval $xrun
7702 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7703         eval $xscan;\
7704         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7705                 eval $xrun
7706 else
7707         $nm -p $* 2>/dev/null >libc.tmp
7708         $grep fprintf libc.tmp > libc.ptf
7709         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7710                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7711         then
7712                 nm_opt='-p'
7713                 eval $xrun
7714         else
7715                 echo " "
7716                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7717                 com=''
7718                 if $ar t $libc > libc.tmp && \
7719                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7720                 then
7721                         for thisname in $libnames $libc; do
7722                                 $ar t $thisname >>libc.tmp
7723                         done
7724                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7725                         echo "Ok." >&4
7726                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7727                         for thisname in $libnames $libc; do
7728                                 $ar tv $thisname >>libc.tmp
7729                                 emximp -o tmp.imp $thisname \
7730                                     2>/dev/null && \
7731                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7732                                     < tmp.imp >>libc.tmp
7733                                 $rm -f tmp.imp
7734                         done
7735                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7736                         echo "Ok." >&4
7737                 else
7738                         echo "$ar didn't seem to work right." >&4
7739                         echo "Maybe this is a Cray...trying bld instead..." >&4
7740                         if  bld t $libc | \
7741                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7742                                 $test -s libc.list
7743                         then
7744                                 for thisname in $libnames; do
7745                                         bld t $libnames | \
7746                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7747                                         $ar t $thisname >>libc.tmp
7748                                 done
7749                                 echo "Ok." >&4
7750                         else
7751                                 echo "That didn't work either.  Giving up." >&4
7752                                 exit 1
7753                         fi
7754                 fi
7755         fi
7756 fi
7757 nm_extract="$com"
7758 case "$PASE" in
7759 define)
7760     echo " "
7761     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7762     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7763     ;;
7764 *)  if $test -f /lib/syscalls.exp; then
7765         echo " "
7766         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7767         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7768                 /lib/syscalls.exp >>libc.list
7769     fi
7770     ;;
7771 esac
7772 ;;
7773 esac
7774 $rm -f libnames libpath
7775
7776 : see if dld is available
7777 set dld.h i_dld
7778 eval $inhdr
7779
7780 : Check if we are using C++
7781 echo " "
7782 echo "Checking for C++..." >&4
7783 $cat >try.c <<'EOCP'
7784 #include <stdio.h>
7785 int main(void)
7786 {
7787 #ifdef __cplusplus
7788     return 0;
7789 #else
7790     return 1;
7791 #endif
7792 }
7793 EOCP
7794 set try
7795 if eval $compile_ok && $run ./try; then
7796         val="$define"
7797         echo "You are using a C++ compiler."
7798 else
7799         val="$undef"
7800         echo "You are not using a C++ compiler."
7801 fi
7802 $rm_try cplusplus$$
7803 set d_cplusplus
7804 eval $setvar
7805
7806 : is a C symbol defined?
7807 csym='tlook=$1;
7808 case "$3" in
7809 -v) tf=libc.tmp; tdc="";;
7810 -a) tf=libc.tmp; tdc="[]";;
7811 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7812 esac;
7813 case "$d_cplusplus" in
7814     $define)    extern_C="extern \"C\"" ;;
7815     *)          extern_C="extern"       ;;
7816 esac;
7817 tx=yes;
7818 case "$reuseval-$4" in
7819 true-) ;;
7820 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7821 esac;
7822 case "$tx" in
7823 yes)
7824         tval=false;
7825         if $test "$runnm" = true; then
7826                 if $contains $tlook $tf >/dev/null 2>&1; then
7827                         tval=true;
7828                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7829                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7830                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7831                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7832                         $rm_try;
7833                 fi;
7834         else
7835                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7836                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7837                 $rm_try;
7838         fi;
7839         ;;
7840 *)
7841         case "$tval" in
7842         $define) tval=true;;
7843         *) tval=false;;
7844         esac;
7845         ;;
7846 esac;
7847 eval "$2=$tval"'
7848
7849 : define an is-in-libc? function
7850 inlibc='echo " "; td=$define; tu=$undef;
7851 sym=$1; var=$2; eval "was=\$$2";
7852 tx=yes;
7853 case "$reuseval$was" in
7854 true) ;;
7855 true*) tx=no;;
7856 esac;
7857 case "$tx" in
7858 yes)
7859         set $sym tres -f;
7860         eval $csym;
7861         case "$tres" in
7862         true)
7863                 echo "$sym() found." >&4;
7864                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7865         *)
7866                 echo "$sym() NOT found." >&4;
7867                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7868         esac;;
7869 *)
7870         case "$was" in
7871         $define) echo "$sym() found." >&4;;
7872         *) echo "$sym() NOT found." >&4;;
7873         esac;;
7874 esac'
7875
7876 : see if dlopen exists
7877 xxx_runnm="$runnm"
7878 xxx_ccflags="$ccflags"
7879 runnm=false
7880 : with g++ one needs -shared to get is-in-libc to work for dlopen
7881 case "$gccversion" in
7882 '')     ;;
7883 *)      case "$d_cplusplus" in
7884         "$define") ccflags="$ccflags -shared" ;;
7885         esac
7886         ;;
7887 esac
7888 set dlopen d_dlopen
7889 eval $inlibc
7890 runnm="$xxx_runnm"
7891 ccflags="$xxx_ccflags"
7892
7893 : see if this is a unistd.h system
7894 set unistd.h i_unistd
7895 eval $inhdr
7896
7897 : determine which dynamic loading, if any, to compile in
7898 echo " "
7899 dldir="ext/DynaLoader"
7900 case "$usedl" in
7901 $define|y|true)
7902         dflt='y'
7903         usedl="$define"
7904         ;;
7905 $undef|n|false)
7906         dflt='n'
7907         usedl="$undef"
7908         ;;
7909 *)
7910         dflt='n'
7911         case "$d_dlopen" in
7912             $define) dflt='y' ;;
7913         esac
7914         case "$i_dld" in
7915             $define) dflt='y' ;;
7916         esac
7917         : Does a dl_xxx.xs file exist for this operating system
7918         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7919         ;;
7920 esac
7921 rp="Do you wish to use dynamic loading?"
7922 . ./myread
7923 usedl="$ans"
7924 case "$ans" in
7925 y*) usedl="$define"
7926         case "$dlsrc" in
7927         '')
7928                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7929                         dflt="$dldir/dl_${osname}.xs"
7930                 elif $test "$d_dlopen" = "$define" ; then
7931                         dflt="$dldir/dl_dlopen.xs"
7932                 elif $test "$i_dld" = "$define" ; then
7933                         dflt="$dldir/dl_dld.xs"
7934                 else
7935                         dflt=''
7936                 fi
7937                 ;;
7938         *)      dflt="$dldir/$dlsrc"
7939                 ;;
7940         esac
7941     echo "The following dynamic loading files are available:"
7942         : Can not go over to $dldir because getfile has path hard-coded in.
7943         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7944         rp="Source file to use for dynamic loading"
7945         fn="fne"
7946         gfpth="$src"
7947         . ./getfile
7948         usedl="$define"
7949         : emulate basename
7950         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7951
7952         $cat << EOM
7953
7954 Some systems may require passing special flags to $cc -c to
7955 compile modules that will be used to create a shared library.
7956 To use no flags, say "none".
7957
7958 EOM
7959     case "$cccdlflags" in
7960     '') case "$gccversion" in
7961                 '') case "$osname" in
7962                         hpux)   dflt='+z' ;;
7963                         next)   dflt='none' ;;
7964                         irix*)  dflt='-KPIC' ;;
7965                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7966                         sunos)  dflt='-pic' ;;
7967                         *)      dflt='none' ;;
7968                     esac
7969                         ;;
7970                 *)  case "$osname" in
7971                         darwin) dflt='none' ;;
7972                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7973                         *)      dflt='-fpic' ;;
7974                     esac ;;
7975             esac ;;
7976         ' ') dflt='none' ;;
7977     *)  dflt="$cccdlflags" ;;
7978     esac
7979     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7980     . ./myread
7981     case "$ans" in
7982     none) cccdlflags=' ' ;;
7983     *) cccdlflags="$ans" ;;
7984     esac
7985
7986     cat << EOM
7987
7988 Some systems use ld to create libraries that can be dynamically loaded,
7989 while other systems (such as those using ELF) use $cc.
7990
7991 EOM
7992         case "$ld" in
7993         '')     $cat >try.c <<EOM
7994 /* Test for whether ELF binaries are produced */
7995 #include <fcntl.h>
7996 #$i_stdlib I_STDLIB
7997 #ifdef I_STDLIB
7998 #include <stdlib.h>
7999 #endif
8000 #$i_unistd I_UNISTD
8001 #ifdef I_UNISTD
8002 #include <unistd.h>
8003 #endif
8004 int main() {
8005         char b[4];
8006         int i = open("a.out",O_RDONLY);
8007         if(i == -1)
8008                 exit(1); /* fail */
8009         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8010                 exit(0); /* succeed (yes, it's ELF) */
8011         else
8012                 exit(1); /* fail */
8013 }
8014 EOM
8015                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8016                         cat <<EOM
8017 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8018 EOM
8019                         dflt="$cc"
8020                 else
8021                         echo "I'll use ld to build dynamic libraries."
8022                         dflt='ld'
8023                 fi
8024                 $rm_try
8025                 ;;
8026         *)      dflt="$ld"
8027                 ;;
8028         esac
8029
8030     rp="What command should be used to create dynamic libraries?"
8031     . ./myread
8032         ld="$ans"
8033
8034     cat << EOM
8035
8036 Some systems may require passing special flags to $ld to create a
8037 library that can be dynamically loaded.  If your ld flags include
8038 -L/other/path options to locate libraries outside your loader's normal
8039 search path, you may need to specify those -L options here as well.  To
8040 use no flags, say "none".
8041
8042 EOM
8043     case "$lddlflags" in
8044     '') case "$osname" in
8045                         beos) dflt='-nostart' ;;
8046                         haiku) dflt='-shared' ;;
8047                         hpux) dflt='-b';
8048                               case "$gccversion" in
8049                               '') dflt="$dflt +vnocompatwarnings" ;;
8050                               esac
8051                               ;;
8052                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8053                         next)  dflt='none' ;;
8054                         solaris) dflt='-G' ;;
8055                         sunos) dflt='-assert nodefinitions' ;;
8056                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8057                 *)     dflt='none' ;;
8058                         esac
8059                         ;;
8060     *) dflt="$lddlflags" ;;
8061     esac
8062
8063         : Try to guess additional flags to pick up local libraries.
8064         : Be careful not to append to a plain 'none'
8065         case "$dflt" in
8066         none) dflt='' ;;
8067         esac
8068         for thisflag in $ldflags; do
8069                 case "$thisflag" in
8070                 -L*|-R*|-Wl,-R*)
8071                         case " $dflt " in
8072                         *" $thisflag "*) ;;
8073                         *) dflt="$dflt $thisflag" ;;
8074                         esac
8075                         ;;
8076                 esac
8077         done
8078
8079         case "$dflt" in
8080         ''|' ') dflt='none' ;;
8081         esac
8082
8083         case "$ldflags" in
8084         *-fstack-protector*)
8085             case "$dflt" in
8086                         *-fstack-protector*) ;; # Don't add it again
8087                         *) dflt="$dflt -fstack-protector" ;; 
8088                 esac
8089                 ;;
8090         esac
8091
8092
8093     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8094     . ./myread
8095     case "$ans" in
8096     none) lddlflags=' ' ;;
8097     *) lddlflags="$ans" ;;
8098     esac
8099
8100         cat <<EOM
8101
8102 Some systems may require passing special flags to $cc to indicate that
8103 the resulting executable will use dynamic linking.  To use no flags,
8104 say "none".
8105
8106 EOM
8107     case "$ccdlflags" in
8108     '') case "$osname" in
8109             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8110             next|sunos) dflt='none' ;;
8111             *)          dflt='none' ;;
8112             esac ;;
8113     ' ')  dflt='none' ;;
8114     *)  dflt="$ccdlflags" ;;
8115     esac
8116     rp="Any special flags to pass to $cc to use dynamic linking?"
8117     . ./myread
8118     case "$ans" in
8119     none) ccdlflags=' ' ;;
8120     *) ccdlflags="$ans" ;;
8121     esac
8122     ;;
8123 *)  usedl="$undef"
8124         ld='ld'
8125     dlsrc='dl_none.xs'
8126     lddlflags=''
8127     ccdlflags=''
8128     ;;
8129 esac
8130
8131 : Do we want a shared libperl?
8132 also=''
8133 case "$usedl" in
8134 $undef)
8135         # No dynamic loading being used, so don't bother even to prompt.
8136         useshrplib='false'
8137         ;;
8138 *)      case "$useshrplib" in
8139         '')     case "$osname" in
8140                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8141                         dflt=y
8142                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8143                         ;;
8144                 next*)
8145                         case "$osvers" in
8146                         4*)     dflt=y
8147                                 also='Building a shared libperl is needed for MAB support.'
8148                                 ;;
8149                         *)      dflt=n
8150                                 ;;
8151                         esac
8152                         ;;
8153                 *)      dflt=n
8154                         ;;
8155                 esac
8156                 ;;
8157         $define|true|[Yy]*)
8158                 dflt=y
8159                 ;;
8160         *)      dflt=n
8161                 ;;
8162         esac
8163         $cat << EOM
8164
8165 The perl executable is normally obtained by linking perlmain.c with
8166 libperl${_a}, any static extensions (usually just DynaLoader), and
8167 any other libraries needed on this system (such as -lm, etc.).  Since
8168 your system supports dynamic loading, it is probably possible to build
8169 a shared libperl.$so.  If you will have more than one executable linked
8170 to libperl.$so, this will significantly reduce the size of each
8171 executable, but it may have a noticeable effect on performance.  The
8172 default is probably sensible for your system.
8173 $also
8174
8175 EOM
8176         rp="Build a shared libperl.$so (y/n)"
8177         . ./myread
8178         case "$ans" in
8179         true|$define|[Yy]*)
8180                 useshrplib='true'  ;;
8181         *)      useshrplib='false' ;;
8182         esac
8183         ;;
8184 esac
8185
8186 case "$useshrplib" in
8187 true)
8188         case "$libperl" in
8189         '')
8190                 # Figure out a good name for libperl.so.  Since it gets stored in
8191                 # a version-specific architecture-dependent library, the version
8192                 # number isn't really that important, except for making cc/ld happy.
8193                 #
8194                 # A name such as libperl.so.10.1
8195                 majmin="libperl.$so.$patchlevel.$subversion"
8196                 # A name such as libperl.so.100
8197                 majonly=`echo $patchlevel $subversion |
8198                         $awk '{printf "%d%02d", $1, $2}'`
8199                 majonly=libperl.$so.$majonly
8200                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8201                 # rely on figuring it out from the naming of libc.
8202                 case "${osname}${osvers}" in
8203                 next4*)
8204                         dflt=libperl.5.$so
8205                         # XXX How handle the --version stuff for MAB?
8206                         ;;
8207                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8208                         dflt=libperl.$so
8209                         ;;
8210                 cygwin*) # ld links now against the dll directly
8211                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8212                         majonly=`echo $patchlevel $subversion |
8213                                 $awk '{printf "%03d%03d", $1, $2}'`
8214                         majonly=cygperl5.$majonly.$so
8215                         dflt=$majmin
8216                         ;;
8217                 *)      # Try to guess based on whether libc has major.minor.
8218                         case "$libc" in
8219                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8220                         *libc.$so.[0-9]*) dflt=$majonly ;;
8221                         *)      dflt=libperl.$so ;;
8222                         esac
8223                         ;;
8224                 esac
8225                 ;;
8226         *)      dflt=$libperl
8227                 ;;
8228         esac
8229         cat << EOM
8230
8231 I need to select a good name for the shared libperl.  If your system uses
8232 library names with major and minor numbers, then you might want something
8233 like $majmin.  Alternatively, if your system uses a single version
8234 number for shared libraries, then you might want to use $majonly.
8235 Or, your system might be quite happy with a simple libperl.$so.
8236
8237 Since the shared libperl will get installed into a version-specific
8238 architecture-dependent directory, the version number of the shared perl
8239 library probably isn't important, so the default should be o.k.
8240
8241 EOM
8242         rp='What name do you want to give to the shared libperl?'
8243         . ./myread
8244         libperl=$ans
8245         echo "Ok, I'll use $libperl"
8246         ;;
8247 *)
8248         libperl="libperl${_a}"
8249         ;;
8250 esac
8251
8252 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8253 case "$shrpdir" in
8254 '') ;;
8255 *)      $cat >&4 <<EOM
8256 WARNING:  Use of the shrpdir variable for the installation location of
8257 the shared $libperl is not supported.  It was never documented and
8258 will not work in this version.  Let me (perlbug@perl.org)
8259 know of any problems this may cause.
8260
8261 EOM
8262         case "$shrpdir" in
8263         "$archlibexp/CORE")
8264                 $cat >&4 <<EOM
8265 But your current setting of $shrpdir is
8266 the default anyway, so it's harmless.
8267 EOM
8268                 ;;
8269         *)
8270                 $cat >&4 <<EOM
8271 Further, your current attempted setting of $shrpdir
8272 conflicts with the value of $archlibexp/CORE
8273 that installperl will use.
8274 EOM
8275                 ;;
8276         esac
8277         ;;
8278 esac
8279
8280 # How will the perl executable find the installed shared $libperl?
8281 # Add $xxx to ccdlflags.
8282 # If we can't figure out a command-line option, use $shrpenv to
8283 # set env LD_RUN_PATH.  The main perl makefile uses this.
8284 shrpdir=$archlibexp/CORE
8285 xxx=''
8286 tmp_shrpenv=''
8287 if "$useshrplib"; then
8288     case "$osname" in
8289         aix)
8290                 # We'll set it in Makefile.SH...
8291                 ;;
8292         solaris)
8293                 xxx="-R $shrpdir"
8294                 ;;
8295         freebsd|netbsd|openbsd|interix|dragonfly)
8296                 xxx="-Wl,-R$shrpdir"
8297                 ;;
8298         bsdos|linux|irix*|dec_osf|gnu*)
8299                 xxx="-Wl,-rpath,$shrpdir"
8300                 ;;
8301         next)
8302                 # next doesn't like the default...
8303                 ;;
8304         beos)
8305                 # beos doesn't like the default, either.
8306                 ;;
8307         haiku)
8308                 # Haiku doesn't like the default, either.
8309                 ;;
8310         hpux*)
8311                 # hpux doesn't like the default, either.
8312                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8313                 ;;
8314         cygwin)
8315                 # cygwin needs only ldlibpth
8316                 ;;
8317         *)
8318                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8319                 ;;
8320         esac
8321         case "$xxx" in
8322         '') ;;
8323         *)
8324                 # Only add $xxx if it isn't already in ccdlflags.
8325                 case " $ccdlflags " in
8326                 *" $xxx "*)     ;;
8327                 *)      ccdlflags="$ccdlflags $xxx"
8328                         cat <<EOM >&4
8329
8330 Adding $xxx to the flags
8331 passed to $ld so that the perl executable will find the
8332 installed shared $libperl.
8333
8334 EOM
8335                         ;;
8336                 esac
8337                 ;;
8338         esac
8339 fi
8340 # Fix ccdlflags in AIX for building external extensions.
8341 # (For building Perl itself bare -bE:perl.exp is needed,
8342 #  Makefile.SH takes care of this.)
8343 case "$osname" in
8344 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8345 esac
8346 # Respect a hint or command-line value.
8347 case "$shrpenv" in
8348 '') shrpenv="$tmp_shrpenv" ;;
8349 esac
8350 case "$ldlibpthname" in
8351 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8352 none)   ldlibpthname='' ;;
8353 esac
8354
8355 : determine where manual pages are on this system
8356 echo " "
8357 case "$sysman" in
8358 '') 
8359         syspath='/usr/share/man/man1 /usr/man/man1'
8360         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8361         syspath="$syspath /usr/man/u_man/man1"
8362         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8363         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8364         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8365         sysman=`./loc . /usr/man/man1 $syspath`
8366         ;;
8367 esac
8368 if $test -d "$sysman"; then
8369         echo "System manual is in $sysman." >&4
8370 else
8371         echo "Could not find manual pages in source form." >&4
8372 fi
8373
8374 : determine where manual pages go
8375 set man1dir man1dir none
8376 eval $prefixit
8377 $cat <<EOM
8378
8379 $spackage has manual pages available in source form.
8380 EOM
8381 case "$nroff" in
8382 nroff)
8383         echo "However, you don't have nroff, so they're probably useless to you."
8384         case "$man1dir" in
8385         '') man1dir="none";;
8386         esac;;
8387 esac
8388 echo "If you don't want the manual sources installed, answer 'none'."
8389 case "$man1dir" in
8390 ' ') dflt=none
8391         ;;
8392 '')
8393         lookpath="$prefixexp/share/man/man1"
8394         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8395         lookpath="$lookpath $prefixexp/man/p_man/man1"
8396         lookpath="$lookpath $prefixexp/man/u_man/man1"
8397         lookpath="$lookpath $prefixexp/man/man.1"
8398         case "$sysman" in
8399         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8400         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8401         esac
8402         set dflt
8403         eval $prefixup
8404         ;;
8405 *)  dflt="$man1dir"
8406         ;;
8407 esac
8408 echo " "
8409 fn=dn+~
8410 rp="Where do the main $spackage manual pages (source) go?"
8411 . ./getfile
8412 if $test "X$man1direxp" != "X$ansexp"; then
8413         installman1dir=''
8414 fi
8415 prefixvar=man1dir
8416 . ./setprefixvar
8417
8418 case "$man1dir" in
8419 '')     man1dir=' '
8420         installman1dir='';;
8421 esac
8422
8423 : What suffix to use on installed man pages
8424
8425 case "$man1dir" in
8426 ' ')
8427         man1ext='0'
8428         ;;
8429 *)
8430         rp="What suffix should be used for the main $spackage man pages?"
8431         case "$man1ext" in
8432         '')     case "$man1dir" in
8433                 *1)  dflt=1 ;;
8434                 *1p) dflt=1p ;;
8435                 *1pm) dflt=1pm ;;
8436                 *l) dflt=l;;
8437                 *n) dflt=n;;
8438                 *o) dflt=o;;
8439                 *p) dflt=p;;
8440                 *C) dflt=C;;
8441                 *L) dflt=L;;
8442                 *L1) dflt=L1;;
8443                 *) dflt=1;;
8444                 esac
8445                 ;;
8446         *)      dflt="$man1ext";;
8447         esac
8448         . ./myread
8449         man1ext="$ans"
8450         ;;
8451 esac
8452
8453 : see if we can have long filenames
8454 echo " "
8455 first=123456789abcdef
8456 $rm -f $first
8457 if (echo hi >$first) 2>/dev/null; then
8458         if $test -f 123456789abcde; then
8459                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8460                 val="$undef"
8461         else
8462                 echo 'You can have filenames longer than 14 characters.'>&4
8463                 val="$define"
8464         fi
8465 else
8466         $cat <<'EOM'
8467 You can't have filenames longer than 14 chars.
8468 You can't even think about them!
8469 EOM
8470         val="$undef"
8471 fi
8472 set d_flexfnam
8473 eval $setvar
8474 $rm -rf 123456789abcde*
8475
8476 : determine where library module manual pages go
8477 set man3dir man3dir none
8478 eval $prefixit
8479 $cat <<EOM
8480
8481 $spackage has manual pages for many of the library modules.
8482 EOM
8483
8484 case "$nroff" in
8485 nroff)
8486         $cat <<'EOM'
8487 However, you don't have nroff, so they're probably useless to you.
8488 EOM
8489         case "$man3dir" in
8490         '') man3dir="none";;
8491         esac;;
8492 esac
8493
8494 case "$d_flexfnam" in
8495 undef)
8496         $cat <<'EOM'
8497 However, your system can't handle the long file names like File::Basename.3.
8498 EOM
8499         case "$man3dir" in
8500         '') man3dir="none";;
8501         esac;;
8502 esac
8503
8504 echo "If you don't want the manual sources installed, answer 'none'."
8505 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8506 case "$man3dir" in
8507 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8508         if $test -d "$privlib/man/man3"; then
8509                 cat <<EOM >&4
8510
8511 WARNING:  Previous versions of perl installed man3 pages into
8512 $privlib/man/man3.  This version will suggest a
8513 new default of $dflt.
8514 EOM
8515                 tdflt=$dflt
8516                 dflt='n'
8517                 rp='Do you wish to preserve the old behavior?(y/n)'
8518                 . ./myread
8519                 case "$ans" in
8520                 y*) dflt="$privlib/man/man3" ;;
8521                 *)  dflt=$tdflt ;;
8522                 esac
8523     fi
8524         ;;
8525 *)      dflt="$man3dir" ;;
8526 esac
8527 case "$dflt" in
8528 ' ') dflt=none ;;
8529 esac
8530 echo " "
8531 fn=dn+~
8532 rp="Where do the $package library man pages (source) go?"
8533 . ./getfile
8534 prefixvar=man3dir
8535 . ./setprefixvar
8536
8537 case "$man3dir" in
8538 '')     man3dir=' '
8539         installman3dir='';;
8540 esac
8541
8542 : What suffix to use on installed man pages
8543 case "$man3dir" in
8544 ' ')
8545         man3ext='0'
8546         ;;
8547 *)
8548         rp="What suffix should be used for the $package library man pages?"
8549         case "$man3ext" in
8550         '')     case "$man3dir" in
8551                 *3)  dflt=3 ;;
8552                 *3p) dflt=3p ;;
8553                 *3pm) dflt=3pm ;;
8554                 *l) dflt=l;;
8555                 *n) dflt=n;;
8556                 *o) dflt=o;;
8557                 *p) dflt=p;;
8558                 *C) dflt=C;;
8559                 *L) dflt=L;;
8560                 *L3) dflt=L3;;
8561                 *) dflt=3;;
8562                 esac
8563                 ;;
8564         *)      dflt="$man3ext";;
8565         esac
8566         . ./myread
8567         man3ext="$ans"
8568         ;;
8569 esac
8570
8571 : see if we have to deal with yellow pages, now NIS.
8572 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8573         if $test -f /usr/etc/nibindd; then
8574                 echo " "
8575                 echo "I'm fairly confident you're on a NeXT."
8576                 echo " "
8577                 rp='Do you get the hosts file via NetInfo?'
8578                 dflt=y
8579                 case "$hostcat" in
8580                 nidump*) ;;
8581                 '') ;;
8582                 *) dflt=n;;
8583                 esac
8584                 . ./myread
8585                 case "$ans" in
8586                 y*) hostcat='nidump hosts .';;
8587                 *)      case "$hostcat" in
8588                         nidump*) hostcat='';;
8589                         esac
8590                         ;;
8591                 esac
8592         fi
8593         case "$hostcat" in
8594         nidump*) ;;
8595         *)
8596                 case "$hostcat" in
8597                 *ypcat*) dflt=y;;
8598                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8599                                 dflt=y
8600                         else
8601                                 dflt=n
8602                         fi;;
8603                 *) dflt=n;;
8604                 esac
8605                 echo " "
8606                 rp='Are you getting the hosts file via yellow pages?'
8607                 . ./myread
8608                 case "$ans" in
8609                 y*) hostcat='ypcat hosts';;
8610                 *) hostcat='cat /etc/hosts';;
8611                 esac
8612                 ;;
8613         esac
8614 fi
8615 case "$hostcat" in
8616 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8617 esac
8618 case "$groupcat" in
8619 '') test -f /etc/group && groupcat='cat /etc/group';;
8620 esac
8621 case "$passcat" in
8622 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8623 esac
8624
8625 : now get the host name
8626 echo " "
8627 echo "Figuring out host name..." >&4
8628 case "$myhostname" in
8629 '') cont=true
8630         echo 'Maybe "hostname" will work...'
8631         if tans=`sh -c hostname 2>&1` ; then
8632                 myhostname=$tans
8633                 phostname=hostname
8634                 cont=''
8635         fi
8636         ;;
8637 *) cont='';;
8638 esac
8639 if $test "$cont"; then
8640         if ./xenix; then
8641                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8642                 if tans=`cat /etc/systemid 2>&1` ; then
8643                         myhostname=$tans
8644                         phostname='cat /etc/systemid'
8645                         echo "Whadyaknow.  Xenix always was a bit strange..."
8646                         cont=''
8647                 fi
8648         elif $test -r /etc/systemid; then
8649                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8650         fi
8651 fi
8652 if $test "$cont"; then
8653         echo 'No, maybe "uuname -l" will work...'
8654         if tans=`sh -c 'uuname -l' 2>&1` ; then
8655                 myhostname=$tans
8656                 phostname='uuname -l'
8657         else
8658                 echo 'Strange.  Maybe "uname -n" will work...'
8659                 if tans=`sh -c 'uname -n' 2>&1` ; then
8660                         myhostname=$tans
8661                         phostname='uname -n'
8662                 else
8663                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8664                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8665                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8666                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8667                         else
8668                                 case "$myhostname" in
8669                                 '') echo "Does this machine have an identity crisis or something?"
8670                                         phostname='';;
8671                                 *)
8672                                         echo "Well, you said $myhostname before..."
8673                                         phostname='echo $myhostname';;
8674                                 esac
8675                         fi
8676                 fi
8677         fi
8678 fi
8679 case "$myhostname" in
8680 '') myhostname=noname ;;
8681 esac
8682 : you do not want to know about this
8683 set $myhostname
8684 myhostname=$1
8685
8686 : verify guess
8687 if $test "$myhostname" ; then
8688         dflt=y
8689         rp='Your host name appears to be "'$myhostname'".'" Right?"
8690         . ./myread
8691         case "$ans" in
8692         y*) ;;
8693         *) myhostname='';;
8694         esac
8695 fi
8696
8697 : bad guess or no guess
8698 while $test "X$myhostname" = X ; do
8699         dflt=''
8700         rp="Please type the (one word) name of your host:"
8701         . ./myread
8702         myhostname="$ans"
8703 done
8704
8705 : translate upper to lower if necessary
8706 case "$myhostname" in
8707 *[A-Z]*)
8708         echo "(Normalizing case in your host name)"
8709         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8710         ;;
8711 esac
8712
8713 case "$myhostname" in
8714 *.*)
8715         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8716         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8717         echo "(Trimming domain name from host name--host name is now $myhostname)"
8718         ;;
8719 *) case "$mydomain" in
8720         '')
8721                 {
8722                         test "X$hostcat" = "Xypcat hosts" &&
8723                         ypmatch "$myhostname" hosts 2>/dev/null |\
8724                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8725                         $test -s hosts
8726                 } || {
8727                         test "X$hostcat" != "X" &&
8728                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8729                                         /[       ]$myhostname[  . ]/p" > hosts
8730                 }
8731                 tmp_re="[       . ]"
8732                 if $test -f hosts; then
8733                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8734                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8735                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8736                                 hosts | $sort | $uniq | \
8737                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8738                         case `$echo X$dflt` in
8739                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8740                                 dflt=.
8741                                 ;;
8742                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8743                                 ;;
8744                         esac
8745                 else
8746                         echo "(I cannot locate a hosts database anywhere)"
8747                         dflt=.
8748                 fi
8749                 case "$dflt" in
8750                 .)
8751                         tans=`./loc resolv.conf X /etc /usr/etc`
8752                         if $test -f "$tans"; then
8753                                 echo "(Attempting domain name extraction from $tans)"
8754                                 dflt=.`$sed -n -e 's/   / /g' \
8755                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8756                                   -e 1q 2>/dev/null`
8757                                 case "$dflt" in
8758                                 .) dflt=.`$sed -n -e 's/        / /g' \
8759                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8760                                      -e 1q 2>/dev/null`
8761                                         ;;
8762                                 esac
8763                         fi
8764                         ;;
8765                 esac
8766                 case "$dflt" in
8767                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8768                         dflt=.`sh -c domainname 2>/dev/null`
8769                         case "$dflt" in
8770                         '') dflt='.';;
8771                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8772                         esac
8773                         ;;
8774                 esac
8775                 case "$dflt$osname" in
8776                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8777                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8778                         ;;
8779                 esac
8780                 case "$dflt" in
8781                 .) echo "(Lost all hope -- silly guess then)"
8782                         dflt='.nonet'
8783                         ;;
8784                 esac
8785                 $rm -f hosts
8786                 ;;
8787         *) dflt="$mydomain";;
8788         esac;;
8789 esac
8790 echo " "
8791 rp="What is your domain name?"
8792 . ./myread
8793 tans="$ans"
8794 case "$ans" in
8795 '') ;;
8796 .*) ;;
8797 *) tans=".$tans";;
8798 esac
8799 mydomain="$tans"
8800
8801 : translate upper to lower if necessary
8802 case "$mydomain" in
8803 *[A-Z]*)
8804         echo "(Normalizing case in your domain name)"
8805         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8806         ;;
8807 esac
8808
8809 : a little sanity check here
8810 case "$phostname" in
8811 '') ;;
8812 *)
8813         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8814         $myhostname$mydomain|$myhostname) ;;
8815         *)
8816                 case "$phostname" in
8817                 sed*)
8818                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8819                         ;;
8820                 *)
8821                         echo "(That doesn't agree with your $phostname command, by the way.)"
8822                         ;;
8823                 esac
8824         ;;
8825         esac
8826         ;;
8827 esac
8828
8829 : determine the e-mail address of the user who is running us
8830 $cat <<EOM
8831
8832 I need to get your e-mail address in Internet format if possible, i.e.
8833 something like user@host.domain. Please answer accurately since I have
8834 no easy means to double check it. The default value provided below
8835 is most probably close to reality but may not be valid from outside
8836 your organization...
8837
8838 EOM
8839 cont=x
8840 while test "$cont"; do
8841         case "$cf_email" in
8842         '') dflt="$cf_by@$myhostname$mydomain";;
8843         *) dflt="$cf_email";;
8844         esac
8845         rp='What is your e-mail address?'
8846         . ./myread
8847         cf_email="$ans"
8848         case "$cf_email" in
8849         *@*.*) cont='' ;;
8850         *)
8851                 rp='Address does not look like an Internet one.  Use it anyway?'
8852                 case "$fastread" in
8853                 yes) dflt=y ;;
8854                 *) dflt=n ;;
8855                 esac
8856                 . ./myread
8857                 case "$ans" in
8858                 y*) cont='' ;;
8859                 *) echo " " ;;
8860                 esac
8861                 ;;
8862         esac
8863 done
8864
8865 : Ask e-mail of administrator
8866 $cat <<EOM
8867
8868 If you or somebody else will be maintaining perl at your site, please
8869 fill in the correct e-mail address here so that they may be contacted
8870 if necessary. Currently, the "perlbug" program included with perl
8871 will send mail to this address in addition to perlbug@perl.org. You may
8872 enter "none" for no administrator.
8873
8874 EOM
8875 case "$perladmin" in
8876 '') dflt="$cf_email";;
8877 *) dflt="$perladmin";;
8878 esac
8879 rp='Perl administrator e-mail address'
8880 . ./myread
8881 perladmin="$ans"
8882
8883 : determine whether to only install version-specific parts.
8884 echo " "
8885 $cat <<EOM
8886 Do you want to install only the version-specific parts of the perl
8887 distribution?  Usually you do *not* want to do this.
8888 EOM
8889 case "$versiononly" in
8890 "$define"|[Yy]*|true) dflt='y' ;;
8891 *) dflt='n';
8892 esac
8893 rp="Do you want to install only the version-specific parts of perl?"
8894 . ./myread
8895 case "$ans" in
8896 [yY]*)  val="$define";;
8897 *)      val="$undef" ;;
8898 esac
8899 set versiononly
8900 eval $setvar
8901
8902 case "$versiononly" in
8903 "$define") inc_version_list=''
8904            inc_version_list_init=0
8905            ;;
8906 esac
8907
8908 : figure out how to guarantee perl startup
8909 : XXX Note that this currently takes advantage of the bug that binexp ignores
8910 :     the Configure -Dinstallprefix setting, which in turn means that under
8911 :     relocatable @INC, initialinstalllocation is what binexp started as.
8912 case "$startperl" in
8913 '')
8914         case "$sharpbang" in
8915         *!)
8916                 $cat <<EOH
8917
8918 I can use the #! construct to start perl on your system. This will
8919 make startup of perl scripts faster, but may cause problems if you
8920 want to share those scripts and perl is not in a standard place
8921 ($initialinstalllocation/perl) on all your platforms. The alternative
8922 is to force a shell by starting the script with a single ':' character.
8923
8924 EOH
8925                 case "$versiononly" in
8926                 "$define")      dflt="$initialinstalllocation/perl$version";;
8927                 *)              dflt="$initialinstalllocation/perl";;
8928                 esac
8929                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8930                 . ./myread
8931                 case "$ans" in
8932                 none)   startperl=": # use perl";;
8933                 *)      startperl="#!$ans"
8934                         if $test 30 -lt `echo "$ans" | wc -c`; then
8935                                 $cat >&4 <<EOM
8936
8937 WARNING:  Some systems limit the #! command to 32 characters.
8938 If you experience difficulty running Perl scripts with #!, try
8939 installing Perl in a directory with a shorter pathname.
8940
8941 EOM
8942                         fi ;;
8943                 esac
8944                 ;;
8945         *) startperl=": # use perl"
8946                 ;;
8947         esac
8948         ;;
8949 esac
8950 echo "I'll use $startperl to start perl scripts."
8951
8952 : figure best path for perl in scripts
8953 case "$perlpath" in
8954 '')
8955         case "$versiononly" in
8956         "$define")      perlpath="$initialinstalllocation/perl$version";;
8957         *)              perlpath="$initialinstalllocation/perl";;
8958         esac
8959         case "$startperl" in
8960         *!*) ;;
8961         *)
8962                 $cat <<EOH
8963
8964 I will use the "eval 'exec'" idiom to start Perl on your system.
8965 I can use the full path of your Perl binary for this purpose, but
8966 doing so may cause problems if you want to share those scripts and
8967 Perl is not always in a standard place ($initialinstalllocation/perl).
8968
8969 EOH
8970                 dflt="$initialinstalllocation/perl"
8971                 rp="What path shall I use in \"eval 'exec'\"?"
8972                 . ./myread
8973                 perlpath="$ans"
8974                 ;;
8975         esac
8976         ;;
8977 esac
8978 case "$startperl" in
8979 *!*)    ;;
8980 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8981 esac
8982
8983 : determine where public executable scripts go
8984 set scriptdir scriptdir
8985 eval $prefixit
8986 case "$scriptdir" in
8987 '')
8988         dflt="$bin"
8989         : guess some guesses
8990         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8991         $test -d /usr/share/bin     && dflt=/usr/share/bin
8992         $test -d /usr/local/script  && dflt=/usr/local/script
8993         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8994         $test -d $prefixexp/script  && dflt=$prefixexp/script
8995         set dflt
8996         eval $prefixup
8997         ;;
8998 *)  dflt="$scriptdir"
8999         ;;
9000 esac
9001 $cat <<EOM
9002
9003 Some installations have a separate directory just for executable scripts so
9004 that they can mount it across multiple architectures but keep the scripts in
9005 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9006 Or you might just lump your scripts in with all your other executables.
9007
9008 EOM
9009 fn=d~
9010 rp='Where do you keep publicly executable scripts?'
9011 . ./getfile
9012 if $test "X$ansexp" != "X$scriptdirexp"; then
9013         installscript=''
9014 fi
9015 installscriptdir=''
9016 prefixvar=scriptdir
9017 . ./setprefixvar
9018 : A little fix up for an irregularly named variable.
9019 installscript="$installscriptdir"
9020
9021 : determine where add-on public executables go
9022 case "$sitebin" in
9023 '')     dflt=$siteprefix/bin ;;
9024 *)      dflt=$sitebin ;;
9025 esac
9026 fn=d~
9027 rp='Pathname where the add-on public executables should be installed?'
9028 . ./getfile
9029 prefixvar=sitebin
9030 . ./setprefixvar
9031
9032 : determine where add-on html pages go
9033 : There is no standard location, so try to copy the previously-selected
9034 : directory structure for the core html pages.
9035 case "$sitehtml1dir" in
9036 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9037 *)     dflt=$sitehtml1dir ;;
9038 esac
9039 case "$dflt" in
9040 ''|' ') dflt=none ;;
9041 esac
9042 fn=dn+~
9043 rp='Pathname where the site-specific html pages should be installed?'
9044 . ./getfile
9045 prefixvar=sitehtml1dir
9046 . ./setprefixvar
9047
9048 : determine where add-on library html pages go
9049 : There is no standard location, so try to copy the previously-selected
9050 : directory structure for the core html pages.
9051 case "$sitehtml3dir" in
9052 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9053 *)     dflt=$sitehtml3dir ;;
9054 esac
9055 case "$dflt" in
9056 ''|' ') dflt=none ;;
9057 esac
9058 fn=dn+~
9059 rp='Pathname where the site-specific library html pages should be installed?'
9060 . ./getfile
9061 prefixvar=sitehtml3dir
9062 . ./setprefixvar
9063
9064 : determine where add-on manual pages go
9065 case "$siteman1dir" in
9066 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9067 *)      dflt=$siteman1dir ;;
9068 esac
9069 case "$dflt" in
9070 ''|' ') dflt=none ;;
9071 esac
9072 fn=dn+~
9073 rp='Pathname where the site-specific manual pages should be installed?'
9074 . ./getfile
9075 prefixvar=siteman1dir
9076 . ./setprefixvar
9077
9078 : determine where add-on library man pages go
9079 case "$siteman3dir" in
9080 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9081 *)      dflt=$siteman3dir ;;
9082 esac
9083 case "$dflt" in
9084 ''|' ') dflt=none ;;
9085 esac
9086 fn=dn+~
9087 rp='Pathname where the site-specific library manual pages should be installed?'
9088 . ./getfile
9089 prefixvar=siteman3dir
9090 . ./setprefixvar
9091
9092 : determine where add-on public executable scripts go
9093 case "$sitescript" in
9094 '')     dflt=$siteprefix/script
9095         $test -d $dflt || dflt=$sitebin ;;
9096 *)  dflt="$sitescript" ;;
9097 esac
9098 fn=d~+
9099 rp='Pathname where add-on public executable scripts should be installed?'
9100 . ./getfile
9101 prefixvar=sitescript
9102 . ./setprefixvar
9103
9104 : Check if faststdio is requested and available
9105 case "$usefaststdio" in
9106 $define|true|[yY]*|'')
9107         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9108         case "$xversion" in
9109         [68])   dflt='y' ;;
9110         *)      dflt='n' ;;
9111         esac
9112         ;;
9113 *) dflt='n';;
9114 esac
9115 cat <<EOM
9116
9117 Perl can be built to use 'fast stdio', which means using the stdio
9118 library but also directly manipulating the stdio buffers to enable
9119 faster I/O.  Using stdio is better for backward compatibility (especially
9120 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9121 interface has been preferred instead of stdio.
9122
9123 If this doesn't make any sense to you, just accept the default '$dflt'.
9124 EOM
9125 rp='Use the "fast stdio" if available?'
9126 . ./myread
9127 case "$ans" in
9128 y|Y)    val="$define" ;;
9129 *)      val="$undef" ;;
9130 esac
9131 set usefaststdio
9132 eval $setvar
9133
9134
9135 : define an is-a-typedef? function
9136 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9137 case "$inclist" in
9138 "") inclist="sys/types.h";;
9139 esac;
9140 eval "varval=\$$var";
9141 case "$varval" in
9142 "")
9143         $rm -f temp.c;
9144         for inc in $inclist; do
9145                 echo "#include <$inc>" >>temp.c;
9146         done;
9147         echo "#ifdef $type" >> temp.c;
9148         echo "printf(\"We have $type\");" >> temp.c;
9149         echo "#endif" >> temp.c;
9150         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9151         if $contains $type temp.E >/dev/null 2>&1; then
9152                 eval "$var=\$type";
9153         else
9154                 eval "$var=\$def";
9155         fi;
9156         $rm -f temp.?;;
9157 *) eval "$var=\$varval";;
9158 esac'
9159
9160 : define an is-a-typedef? function that prompts if the type is not available.
9161 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9162 case "$inclist" in
9163 "") inclist="sys/types.h";;
9164 esac;
9165 eval "varval=\$$var";
9166 case "$varval" in
9167 "")
9168         $rm -f temp.c;
9169         for inc in $inclist; do
9170                 echo "#include <$inc>" >>temp.c;
9171         done;
9172         echo "#ifdef $type" >> temp.c;
9173         echo "printf(\"We have $type\");" >> temp.c;
9174         echo "#endif" >> temp.c;
9175         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9176         echo " " ;
9177         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9178         if $contains $type temp.E >/dev/null 2>&1; then
9179                 echo "$type found." >&4;
9180                 eval "$var=\$type";
9181         else
9182                 echo "$type NOT found." >&4;
9183                 dflt="$def";
9184                 . ./myread ;
9185                 eval "$var=\$ans";
9186         fi;
9187         $rm -f temp.?;;
9188 *) eval "$var=\$varval";;
9189 esac'
9190
9191 : see what type lseek is declared as in the kernel
9192 rp="What is the type used for lseek's offset on this system?"
9193 set off_t lseektype long stdio.h sys/types.h
9194 eval $typedef_ask
9195
9196 echo " "
9197 echo "Checking to see how big your file offsets are..." >&4
9198 $cat >try.c <<EOCP
9199 #include <sys/types.h>
9200 #include <stdio.h>
9201 int main()
9202 {
9203     printf("%d\n", (int)sizeof($lseektype));
9204     return(0);
9205 }
9206 EOCP
9207 set try
9208 if eval $compile_ok; then
9209         lseeksize=`$run ./try`
9210         echo "Your file offsets are $lseeksize bytes long."
9211 else
9212         dflt=$longsize
9213         echo " "
9214         echo "(I can't seem to compile the test program.  Guessing...)"
9215         rp="What is the size of your file offsets (in bytes)?"
9216         . ./myread
9217         lseeksize="$ans"
9218 fi
9219 $rm_try
9220
9221 : see what type file positions are declared as in the library
9222 rp="What is the type for file position used by fsetpos()?"
9223 set fpos_t fpostype long stdio.h sys/types.h
9224 eval $typedef_ask
9225
9226 : Check size for Fpos_t
9227 echo " "
9228 case "$fpostype" in
9229 *_t) zzz="$fpostype"    ;;
9230 *)   zzz="fpos_t"       ;;
9231 esac
9232 echo "Checking the size of $zzz..." >&4
9233 cat > try.c <<EOCP
9234 #include <sys/types.h>
9235 #include <stdio.h>
9236 #$i_stdlib I_STDLIB
9237 #ifdef I_STDLIB
9238 #include <stdlib.h>
9239 #endif
9240 int main() {
9241     printf("%d\n", (int)sizeof($fpostype));
9242     exit(0);
9243 }
9244 EOCP
9245 set try
9246 if eval $compile_ok; then
9247         yyy=`$run ./try`
9248         case "$yyy" in
9249         '')     fpossize=4
9250                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9251                 ;;
9252         *)      fpossize=$yyy
9253                 echo "Your $zzz is $fpossize bytes long."
9254                 ;;
9255         esac
9256 else
9257         dflt="$longsize"
9258         echo " " >&4
9259         echo "(I can't compile the test program.  Guessing...)" >&4
9260         rp="What is the size of your file positions (in bytes)?"
9261         . ./myread
9262         fpossize="$ans"
9263 fi
9264
9265 : Check for large file support
9266 # Backward compatibility (uselfs is deprecated).
9267 case "$uselfs" in
9268 "$define"|true|[yY]*)
9269         cat <<EOM >&4
9270
9271 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9272 EOM
9273         uselargefiles="$define"
9274         ;;
9275 esac
9276
9277 case "$lseeksize:$fpossize" in
9278 8:8) cat <<EOM
9279
9280 You can have files larger than 2 gigabytes.
9281 EOM
9282    val="$define" ;;
9283 *)    case "$uselargefiles" in
9284    "$undef"|false|[nN]*) dflt='n' ;;
9285    *)   dflt='y' ;;
9286    esac
9287    cat <<EOM
9288
9289 Perl can be built to understand large files (files larger than 2 gigabytes)
9290 on some systems.  To do so, Configure can be run with -Duselargefiles.
9291
9292 If this doesn't make any sense to you, just accept the default '$dflt'.
9293 EOM
9294    rp='Try to understand large files, if available?'
9295    . ./myread
9296    case "$ans" in
9297    y|Y)         val="$define" ;;
9298    *)           val="$undef"  ;;
9299    esac
9300    ;;
9301 esac
9302 set uselargefiles
9303 eval $setvar
9304 : Look for a hint-file generated 'call-back-unit'.  If the
9305 : user has specified that a large files perl is to be built,
9306 : we may need to set or change some other defaults.
9307 if $test -f uselargefiles.cbu; then
9308         echo "Your platform has some specific hints regarding large file builds, using them..."
9309         . ./uselargefiles.cbu
9310 fi
9311 case "$uselargefiles" in
9312 "$define")
9313         if $test -f uselargefiles.cbu; then
9314                 echo " "
9315                 echo "Rechecking to see how big your file offsets are..." >&4
9316                 $cat >try.c <<EOCP
9317 #include <sys/types.h>
9318 #include <stdio.h>
9319 int main()
9320 {
9321     printf("%d\n", (int)sizeof($lseektype));
9322     return(0);
9323 }
9324 EOCP
9325                 set try
9326                 if eval $compile_ok; then
9327                         lseeksize=`$run ./try`
9328                         $echo "Your file offsets are now $lseeksize bytes long."
9329                 else
9330                         dflt="$lseeksize"
9331                         echo " "
9332                         echo "(I can't seem to compile the test program.  Guessing...)"
9333                         rp="What is the size of your file offsets (in bytes)?"
9334                         . ./myread
9335                         lseeksize="$ans"
9336                 fi
9337                 case "$fpostype" in
9338                 *_t) zzz="$fpostype"    ;;
9339                 *)   zzz="fpos_t"       ;;
9340                 esac
9341                 $echo $n "Rechecking the size of $zzz...$c" >&4
9342                 $cat > try.c <<EOCP
9343 #include <sys/types.h>
9344 #include <stdio.h>
9345 #$i_stdlib I_STDLIB
9346 #ifdef I_STDLIB
9347 #include <stdlib.h>
9348 #endif
9349 int main() {
9350     printf("%d\n", (int)sizeof($fpostype));
9351     return(0);
9352 }
9353 EOCP
9354                 set try
9355                 if eval $compile_ok; then
9356                         yyy=`$run ./try`
9357                         dflt="$lseeksize"
9358                         case "$yyy" in
9359                         '')     echo " "
9360                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9361                                 ;;
9362                         *)      fpossize=$yyy
9363                                 echo " $fpossize bytes." >&4
9364                                 ;;
9365                         esac
9366                 else
9367                         dflt="$fpossize"
9368                         echo " "
9369                         echo "(I can't compile the test program.  Guessing...)" >&4
9370                         rp="What is the size of your file positions (in bytes)?"
9371                         . ./myread
9372                         fpossize="$ans"
9373                 fi
9374                 $rm_try
9375         fi
9376         ;;
9377 esac
9378
9379 : Set the vendorbin variables
9380 case "$vendorprefix" in
9381 '')     d_vendorbin="$undef"
9382         vendorbin=''
9383         vendorbinexp=''
9384         ;;
9385 *)      d_vendorbin="$define"
9386         : determine where vendor-supplied executables go.
9387         case "$vendorbin" in
9388         '') dflt=$vendorprefix/bin ;;
9389         *)      dflt="$vendorbin" ;;
9390         esac
9391         fn=d~+
9392         rp='Pathname for the vendor-supplied executables directory?'
9393         . ./getfile
9394         vendorbin="$ans"
9395         vendorbinexp="$ansexp"
9396         ;;
9397 esac
9398 prefixvar=vendorbin
9399 . ./installprefix
9400
9401 : Set the vendorhtml1dir variables
9402 case "$vendorprefix" in
9403 '')     vendorhtml1dir=''
9404         vendorhtml1direxp=''
9405         ;;
9406 *)      : determine where vendor-supplied html pages go.
9407         : There is no standard location, so try to copy the previously-selected
9408         : directory structure for the core html pages.
9409         : XXX Better default suggestions would be welcome.
9410         case "$vendorhtml1dir" in
9411         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9412         *)      dflt=$vendorhtml1dir ;;
9413         esac
9414         case "$dflt" in
9415         ''|' ') dflt=none ;;
9416         esac
9417         fn=dn+~
9418         rp='Pathname for the vendor-supplied html pages?'
9419         . ./getfile
9420         vendorhtml1dir="$ans"
9421         vendorhtml1direxp="$ansexp"
9422         ;;
9423 esac
9424 : Use ' ' for none so value is preserved next time through Configure
9425 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9426 prefixvar=vendorhtml1dir
9427 . ./installprefix
9428
9429 : Set the vendorhtml3dir variables
9430 case "$vendorprefix" in
9431 '')     vendorhtml3dir=''
9432         vendorhtml3direxp=''
9433         ;;
9434 *)      : determine where vendor-supplied module html pages go.
9435         : There is no standard location, so try to copy the previously-selected
9436         : directory structure for the core html pages.
9437         : XXX Better default suggestions would be welcome.
9438         case "$vendorhtml3dir" in
9439         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9440         *)      dflt=$vendorhtml3dir ;;
9441         esac
9442         case "$dflt" in
9443         ''|' ') dflt=none ;;
9444         esac
9445         fn=dn+~
9446         rp='Pathname for the vendor-supplied html pages?'
9447         . ./getfile
9448         vendorhtml3dir="$ans"
9449         vendorhtml3direxp="$ansexp"
9450         ;;
9451 esac
9452 : Use ' ' for none so value is preserved next time through Configure
9453 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9454 prefixvar=vendorhtml3dir
9455 . ./installprefix
9456
9457 : Set the vendorman1dir variables
9458 case "$vendorprefix" in
9459 '')     vendorman1dir=''
9460         vendorman1direxp=''
9461         ;;
9462 *)      : determine where vendor-supplied manual pages go.
9463         case "$vendorman1dir" in
9464         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9465         *)      dflt=$vendorman1dir ;;
9466         esac
9467         case "$dflt" in
9468         ''|' ') dflt=none ;;
9469         esac
9470         fn=nd~+
9471         rp='Pathname for the vendor-supplied manual section 1 pages?'
9472         . ./getfile
9473         vendorman1dir="$ans"
9474         vendorman1direxp="$ansexp"
9475         ;;
9476 esac
9477 : Use ' ' for none so value is preserved next time through Configure
9478 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9479 prefixvar=vendorman1dir
9480 . ./installprefix
9481
9482 : Set the vendorman3dir variables
9483 case "$vendorprefix" in
9484 '')     vendorman3dir=''
9485         vendorman3direxp=''
9486         ;;
9487 *)      : determine where vendor-supplied module manual pages go.
9488         case "$vendorman3dir" in
9489         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9490         *)      dflt=$vendorman3dir ;;
9491         esac
9492         case "$dflt" in
9493         ''|' ') dflt=none ;;
9494         esac
9495         fn=nd~+
9496         rp='Pathname for the vendor-supplied manual section 3 pages?'
9497         . ./getfile
9498         vendorman3dir="$ans"
9499         vendorman3direxp="$ansexp"
9500         ;;
9501 esac
9502 : Use ' ' for none so value is preserved next time through Configure
9503 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9504 prefixvar=vendorman3dir
9505 . ./installprefix
9506
9507 : Set the vendorscript variables
9508 case "$vendorprefix" in
9509 '')     d_vendorscript="$undef"
9510         vendorscript=''
9511         vendorscriptexp=''
9512         ;;
9513 *)      d_vendorscript="$define"
9514         : determine where vendor-supplied scripts go.
9515         case "$vendorscript" in
9516         '')     dflt=$vendorprefix/script
9517                 $test -d $dflt || dflt=$vendorbin ;;
9518         *)  dflt="$vendorscript" ;;
9519         esac
9520         $cat <<EOM
9521
9522 The installation process will create a directory for
9523 vendor-supplied scripts.
9524
9525 EOM
9526         fn=d~+
9527         rp='Pathname for the vendor-supplied scripts directory?'
9528         . ./getfile
9529         vendorscript="$ans"
9530         vendorscriptexp="$ansexp"
9531         ;;
9532 esac
9533 prefixvar=vendorscript
9534 . ./installprefix
9535
9536 : script used to emit important warnings
9537 cat >warn <<EOS
9538 $startsh
9539 if test \$# -gt 0; then
9540         echo "\$@" >msg
9541 else
9542         cat >msg
9543 fi
9544 echo "*** WARNING:" >&4
9545 sed -e 's/^/*** /' <msg >&4
9546 echo "*** " >&4
9547 cat msg >>config.msg
9548 echo " " >>config.msg
9549 rm -f msg
9550 EOS
9551 chmod +x warn
9552 $eunicefix warn
9553
9554 : see which of string.h or strings.h is needed
9555 echo " "
9556 strings=`./findhdr string.h`
9557 if $test "$strings" && $test -r "$strings"; then
9558         echo "Using <string.h> instead of <strings.h>." >&4
9559         val="$define"
9560 else
9561         val="$undef"
9562         strings=`./findhdr strings.h`
9563         if $test "$strings" && $test -r "$strings"; then
9564                 echo "Using <strings.h> instead of <string.h>." >&4
9565         else
9566                 ./warn "No string header found -- You'll surely have problems."
9567         fi
9568 fi
9569 set i_string
9570 eval $setvar
9571 case "$i_string" in
9572 "$undef") strings=`./findhdr strings.h`;;
9573 *)        strings=`./findhdr string.h`;;
9574 esac
9575
9576 : see if qgcvt exists
9577 set qgcvt d_qgcvt
9578 eval $inlibc
9579
9580 : Check print/scan long double stuff
9581 echo " "
9582
9583 if $test X"$d_longdbl" = X"$define"; then
9584
9585 echo "Checking how to print long doubles..." >&4
9586
9587 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9588         $cat >try.c <<'EOCP'
9589 #include <sys/types.h>
9590 #include <stdio.h>
9591 int main() {
9592   double d = 123.456;
9593   printf("%.3f\n", d);
9594 }
9595 EOCP
9596         set try
9597         if eval $compile; then
9598                 yyy=`$run ./try`
9599                 case "$yyy" in
9600                 123.456)
9601                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9602                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9603                         echo "We will use %f."
9604                         ;;
9605                 esac
9606         fi
9607 fi
9608
9609 if $test X"$sPRIfldbl" = X; then
9610         $cat >try.c <<'EOCP'
9611 #include <sys/types.h>
9612 #include <stdio.h>
9613 int main() {
9614   long double d = 123.456;
9615   printf("%.3Lf\n", d);
9616 }
9617 EOCP
9618         set try
9619         if eval $compile; then
9620                 yyy=`$run ./try`
9621                 case "$yyy" in
9622                 123.456)
9623                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9624                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9625                         echo "We will use %Lf."
9626                         ;;
9627                 esac
9628         fi
9629 fi
9630
9631 if $test X"$sPRIfldbl" = X; then
9632         $cat >try.c <<'EOCP'
9633 #include <sys/types.h>
9634 #include <stdio.h>
9635 int main() {
9636   long double d = 123.456;
9637   printf("%.3llf\n", d);
9638 }
9639 EOCP
9640         set try
9641         if eval $compile; then
9642                 yyy=`$run ./try`
9643                 case "$yyy" in
9644                 123.456)
9645                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9646                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9647                         echo "We will use %llf."
9648                         ;;
9649                 esac
9650         fi
9651 fi
9652
9653 if $test X"$sPRIfldbl" = X; then
9654         $cat >try.c <<'EOCP'
9655 #include <sys/types.h>
9656 #include <stdio.h>
9657 int main() {
9658   long double d = 123.456;
9659   printf("%.3lf\n", d);
9660 }
9661 EOCP
9662         set try
9663         if eval $compile; then
9664                 yyy=`$run ./try`
9665                 case "$yyy" in
9666                 123.456)
9667                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9668                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9669                         echo "We will use %lf."
9670                         ;;
9671                 esac
9672         fi
9673 fi
9674
9675 if $test X"$sPRIfldbl" = X; then
9676         echo "Cannot figure out how to print long doubles." >&4
9677 else
9678         sSCNfldbl=$sPRIfldbl    # expect consistency
9679 fi
9680
9681 $rm_try
9682
9683 fi # d_longdbl
9684
9685 case "$sPRIfldbl" in
9686 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9687         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9688         d_SCNfldbl="$undef";
9689         ;;
9690 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9691         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9692         d_SCNfldbl="$define";
9693         ;;
9694 esac
9695
9696 : Check how to convert floats to strings.
9697
9698 if test "X$d_Gconvert" = X; then
9699
9700 echo " "
9701 echo "Checking for an efficient way to convert floats to strings."
9702 echo " " > try.c
9703 case "$uselongdouble" in
9704 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9705 esac
9706 case "$d_longdbl" in
9707 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9708 esac
9709 case "$d_PRIgldbl" in
9710 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9711 esac
9712 $cat >>try.c <<EOP
9713 #ifdef TRY_gconvert
9714 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9715 char *myname = "gconvert";
9716 #endif
9717 #ifdef TRY_gcvt
9718 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9719 char *myname = "gcvt";
9720 #endif
9721 #ifdef TRY_qgcvt
9722 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9723 char *myname = "qgcvt";
9724 #define DOUBLETYPE long double
9725 #endif
9726 #ifdef TRY_sprintf
9727 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9728 #ifdef HAS_PRIgldbl
9729 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9730 #else
9731 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9732 #endif
9733 #else
9734 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9735 #endif
9736 char *myname = "sprintf";
9737 #endif
9738
9739 #ifndef DOUBLETYPE
9740 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9741 #define DOUBLETYPE long double
9742 #else
9743 #define DOUBLETYPE double
9744 #endif
9745 #endif
9746
9747 #include <stdio.h>
9748
9749 #$i_stdlib I_STDLIB
9750 #ifdef I_STDLIB
9751 #include <stdlib.h>
9752 #endif
9753 #$i_string I_STRING
9754 #ifdef I_STRING
9755 #  include <string.h>
9756 #else
9757 #  include <strings.h>
9758 #endif
9759
9760 int checkit(char *expect, char *got)
9761 {
9762     if (strcmp(expect, got)) {
9763                 printf("%s oddity:  Expected %s, got %s\n",
9764                         myname, expect, got);
9765                 exit(1);
9766         }
9767 }
9768
9769 int main()
9770 {
9771         char buf[64];
9772         buf[63] = '\0';
9773
9774         /* This must be 1st test on (which?) platform */
9775         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9776         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9777         checkit("0.1", buf);
9778
9779         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9780         checkit("0.01", buf);
9781
9782         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9783         checkit("0.001", buf);
9784
9785         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9786         checkit("0.0001", buf);
9787
9788         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9789         if (strlen(buf) > 5)
9790             checkit("9e-005", buf); /* for Microsoft ?? */
9791         else
9792             checkit("9e-05", buf);
9793
9794         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9795         checkit("1", buf);
9796
9797         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9798         checkit("1.1", buf);
9799
9800         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9801         checkit("1.01", buf);
9802
9803         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9804         checkit("1.001", buf);
9805
9806         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9807         checkit("1.0001", buf);
9808
9809         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9810         checkit("1.00001", buf);
9811
9812         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9813         checkit("1.000001", buf);
9814
9815         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9816         checkit("0", buf);
9817
9818         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9819         checkit("-1", buf);
9820
9821         /* Some Linux gcvt's give 1.e+5 here. */
9822         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9823         checkit("100000", buf);
9824
9825         /* Some Linux gcvt's give -1.e+5 here. */
9826         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9827         checkit("-100000", buf);
9828
9829         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9830         checkit("123.456", buf);
9831
9832         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9833         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9834         /* 34 should be enough to scare even long double
9835          * places into using the e notation. */
9836         if (strlen(buf) > 5)
9837             checkit("1e+034", buf); /* for Microsoft */
9838         else
9839             checkit("1e+34", buf);
9840
9841         /* For Perl, if you add additional tests here, also add them to
9842          * t/base/num.t for benefit of platforms not using Configure or
9843          * overriding d_Gconvert */
9844
9845         exit(0);
9846 }
9847 EOP
9848 : first add preferred functions to our list
9849 xxx_list=""
9850 for xxx_convert in $gconvert_preference; do
9851     case $xxx_convert in
9852     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9853     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9854     esac
9855 done
9856 : then add any others
9857 for xxx_convert in gconvert gcvt sprintf; do
9858     case "$xxx_list" in
9859     *$xxx_convert*) ;;
9860     *) xxx_list="$xxx_list $xxx_convert" ;;
9861     esac
9862 done
9863
9864 case "$d_longdbl$uselongdouble" in
9865 "$define$define")
9866     : again, add prefered functions to our list first
9867     xxx_ld_list=""
9868     for xxx_convert in $gconvert_ld_preference; do
9869         case $xxx_convert in
9870         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9871         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9872         esac
9873     done
9874     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9875     for xxx_convert in qgcvt sprintf $xxx_list; do
9876         case "$xxx_ld_list" in
9877         $xxx_convert*|*" $xxx_convert"*) ;;
9878         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9879         esac
9880     done
9881     : if sprintf cannot do long doubles, move it to the end
9882     if test "$d_PRIgldbl" != "$define"; then
9883         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9884     fi
9885     : if no qgcvt, remove it
9886     if test "$d_qgcvt" != "$define"; then
9887         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9888     fi
9889     : use the ld_list
9890     xxx_list="$xxx_ld_list"
9891     ;;
9892 esac
9893
9894 for xxx_convert in $xxx_list; do
9895         echo "Trying $xxx_convert..."
9896         $rm -f try try$_o core
9897         set try -DTRY_$xxx_convert
9898         if eval $compile; then
9899                 echo "$xxx_convert() found." >&4
9900                 if $run ./try; then
9901                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9902                         break;
9903                 else
9904                         echo "...But $xxx_convert didn't work as I expected."
9905                         xxx_convert=''
9906                 fi
9907         else
9908                 echo "$xxx_convert NOT found." >&4
9909         fi
9910 done
9911
9912 if test X$xxx_convert = X; then
9913     echo "*** WHOA THERE!!! ***" >&4
9914     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9915     xxx_convert=sprintf
9916 fi
9917
9918 case "$xxx_convert" in
9919 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9920 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9921 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9922 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9923    "$define$define$define")
9924       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9925    "$define$define$undef")
9926       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9927    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9928    esac
9929    ;;
9930 esac
9931
9932 fi
9933 $rm_try
9934
9935 : see if _fwalk exists
9936 set fwalk d__fwalk
9937 eval $inlibc
9938
9939 : Initialize h_fcntl
9940 h_fcntl=false
9941
9942 : Initialize h_sysfile
9943 h_sysfile=false
9944
9945 : access call always available on UNIX
9946 set access d_access
9947 eval $inlibc
9948
9949 : locate the flags for 'access()'
9950 case "$d_access" in
9951 "$define")
9952         echo " "
9953         $cat >access.c <<EOCP
9954 #include <sys/types.h>
9955 #ifdef I_FCNTL
9956 #include <fcntl.h>
9957 #endif
9958 #ifdef I_SYS_FILE
9959 #include <sys/file.h>
9960 #endif
9961 #ifdef I_UNISTD
9962 #include <unistd.h>
9963 #endif
9964 #$i_stdlib I_STDLIB
9965 #ifdef I_STDLIB
9966 #include <stdlib.h>
9967 #endif
9968 int main() {
9969         exit(R_OK);
9970 }
9971 EOCP
9972         : check sys/file.h first, no particular reason here
9973         if $test `./findhdr sys/file.h` && \
9974                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9975                 h_sysfile=true;
9976                 echo "<sys/file.h> defines the *_OK access constants." >&4
9977         elif $test `./findhdr fcntl.h` && \
9978                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9979                 h_fcntl=true;
9980                 echo "<fcntl.h> defines the *_OK access constants." >&4
9981         elif $test `./findhdr unistd.h` && \
9982                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9983                 echo "<unistd.h> defines the *_OK access constants." >&4
9984         else
9985                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9986         fi
9987         ;;
9988 esac
9989 $rm -f access*
9990
9991 : see if accessx exists
9992 set accessx d_accessx
9993 eval $inlibc
9994
9995 : see if aintl exists
9996 set aintl d_aintl
9997 eval $inlibc
9998
9999 : see if alarm exists
10000 set alarm d_alarm
10001 eval $inlibc
10002
10003 : see if 64bit time functions exists
10004
10005 set ctime64 d_ctime64
10006 eval $inlibc
10007
10008 set localtime64 d_localtime64
10009 eval $inlibc
10010
10011 set gmtime64 d_gmtime64
10012 eval $inlibc
10013
10014 set mktime64 d_mktime64
10015 eval $inlibc
10016
10017 set difftime64 d_difftime64
10018 eval $inlibc
10019
10020 set asctime64 d_asctime64
10021 eval $inlibc
10022
10023 : see if POSIX threads are available
10024 set pthread.h i_pthread
10025 eval $inhdr
10026
10027 : define a fucntion to check prototypes
10028 $cat > protochk <<EOSH
10029 $startsh
10030 cc="$cc"
10031 optimize="$optimize"
10032 ccflags="$ccflags"
10033 prototype="$prototype"
10034 define="$define"
10035 rm_try="$rm_try"
10036 usethreads=$usethreads
10037 i_pthread=$i_pthread
10038 pthread_h_first=$pthread_h_first
10039 EOSH
10040
10041 $cat >> protochk <<'EOSH'
10042
10043 $rm_try
10044 foo="$1"
10045 shift
10046 while test $# -ge 2; do
10047         case "$1" in
10048                 $define) echo "#include <$2>" >> try.c ;;
10049                 literal) echo "$2" >> try.c ;;
10050         esac
10051     # Extra magic for the benefit of systems that need pthread.h
10052     # to be included early to correctly detect threadsafe functions.
10053     # Such functions must guarantee themselves, though, that the usethreads
10054     # and i_pthread have been defined, before calling protochk.
10055     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10056         echo "#include <pthread.h>" >> try.c
10057         pthread_h_done=yes
10058     fi
10059     shift 2
10060 done
10061 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10062 cat >> try.c <<'EOCP'
10063 #ifdef CAN_PROTOTYPE
10064 #define _(args) args
10065 #else
10066 #define _(args) ()
10067 #endif
10068 EOCP
10069 echo "$foo" >> try.c
10070 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10071 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10072 status=$?
10073 $rm_try
10074 exit $status
10075 EOSH
10076 chmod +x protochk
10077 $eunicefix protochk
10078
10079 : Define hasproto macro for Configure internal use
10080 hasproto='varname=$1; func=$2; shift; shift;
10081 while $test $# -ge 2; do
10082         case "$1" in
10083         $define) echo "#include <$2>";;
10084         esac ;
10085     shift 2;
10086 done > try.c;
10087 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10088 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10089         echo "$func() prototype found.";
10090         val="$define";
10091 else
10092         echo "$func() prototype NOT found.";
10093         val="$undef";
10094 fi;
10095 set $varname;
10096 eval $setvar;
10097 $rm_try tryout.c'
10098
10099 : see if sys/types.h has to be included
10100 set sys/types.h i_systypes
10101 eval $inhdr
10102
10103 : see if sys/select.h has to be included
10104 set sys/select.h i_sysselct
10105 eval $inhdr
10106
10107 : Define hasfield macro for Configure internal use
10108 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10109 while $test $# -ge 2; do
10110         case "$1" in
10111         $define) echo "#include <$2>";;
10112         esac ;
10113     shift 2;
10114 done > try.c;
10115 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10116 set try;
10117 if eval $compile; then
10118         val="$define";
10119 else
10120         val="$undef";
10121 fi;
10122 set $varname;
10123 eval $setvar;
10124 $rm_try'
10125
10126 : see if we should include time.h, sys/time.h, or both
10127 echo " "
10128 if test "X$timeincl" = X; then
10129         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10130         $echo $n "I'm now running the test program...$c"
10131         $cat >try.c <<EOCP
10132 #include <sys/types.h>
10133 #ifdef I_TIME
10134 #include <time.h>
10135 #endif
10136 #ifdef I_SYSTIME
10137 #ifdef SYSTIMEKERNEL
10138 #define KERNEL
10139 #endif
10140 #include <sys/time.h>
10141 #endif
10142 #ifdef I_SYSSELECT
10143 #include <sys/select.h>
10144 #endif
10145 #$i_stdlib I_STDLIB
10146 #ifdef I_STDLIB
10147 #include <stdlib.h>
10148 #endif
10149 int main()
10150 {
10151         struct tm foo;
10152 #ifdef S_TIMEVAL
10153         struct timeval bar;
10154 #endif
10155 #ifdef S_TIMEZONE
10156         struct timezone tzp;
10157 #endif
10158         if (foo.tm_sec == foo.tm_sec)
10159                 exit(0);
10160 #ifdef S_TIMEVAL
10161         if (bar.tv_sec == bar.tv_sec)
10162                 exit(0);
10163 #endif
10164         exit(1);
10165 }
10166 EOCP
10167         flags=''
10168         for s_timezone in '-DS_TIMEZONE' ''; do
10169         sysselect=''
10170         for s_timeval in '-DS_TIMEVAL' ''; do
10171         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10172         for i_time in '' '-DI_TIME'; do
10173         for i_systime in '-DI_SYSTIME' ''; do
10174                 case "$flags" in
10175                 '') $echo $n ".$c"
10176                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10177                         if eval $compile; then
10178                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10179                                 shift
10180                                 flags="$*"
10181                                 echo " "
10182                                 $echo $n "Succeeded with $flags$c"
10183                         fi
10184                         ;;
10185                 esac
10186         done
10187         done
10188         done
10189         done
10190         done
10191         timeincl=''
10192         echo " "
10193         case "$flags" in
10194         *SYSTIMEKERNEL*) i_systimek="$define"
10195                 timeincl=`./findhdr sys/time.h`
10196                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10197         *) i_systimek="$undef";;
10198         esac
10199         case "$flags" in
10200         *I_TIME*) i_time="$define"
10201                 timeincl=`./findhdr time.h`" $timeincl"
10202                 echo "We'll include <time.h>." >&4;;
10203         *) i_time="$undef";;
10204         esac
10205         case "$flags" in
10206         *I_SYSTIME*) i_systime="$define"
10207                 timeincl=`./findhdr sys/time.h`" $timeincl"
10208                 echo "We'll include <sys/time.h>." >&4;;
10209         *) i_systime="$undef";;
10210         esac
10211         $rm_try
10212 fi
10213 : see if struct tm knows about tm_zone
10214 case "$i_systime$i_time" in
10215 *$define*)
10216         echo " "
10217         echo "Checking to see if your struct tm has tm_zone field..." >&4
10218         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10219         eval $hasfield
10220         ;;
10221 *)      val="$undef"
10222         set d_tm_tm_zone
10223         eval $setvar
10224         ;;
10225 esac
10226 case "$d_tm_tm_zone" in
10227 "$define")      echo "Yes, it does."   ;;
10228 *)              echo "No, it doesn't." ;;
10229 esac
10230 : see if struct tm knows about tm_gmtoff
10231 case "$i_systime$i_time" in
10232 *$define*)
10233         echo " "
10234         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10235         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10236         eval $hasfield
10237         ;;
10238 *)      val="$undef"
10239         set d_tm_tm_gmtoff
10240         eval $setvar
10241         ;;
10242 esac
10243 case "$d_tm_tm_gmtoff" in
10244 "$define")      echo "Yes, it does."   ;;
10245 *)              echo "No, it doesn't." ;;
10246 esac
10247
10248 : see if asctime_r exists
10249 set asctime_r d_asctime_r
10250 eval $inlibc
10251 case "$d_asctime_r" in
10252 "$define")
10253         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10254         case "$d_asctime_r_proto:$usethreads" in
10255         ":define")      d_asctime_r_proto=define
10256                 set d_asctime_r_proto asctime_r $hdrs
10257                 eval $hasproto ;;
10258         *)      ;;
10259         esac
10260         case "$d_asctime_r_proto" in
10261         define)
10262         case "$asctime_r_proto" in
10263         ''|0) try='char* asctime_r(const struct tm*, char*);'
10264         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10265         esac
10266         case "$asctime_r_proto" in
10267         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10268         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10269         esac
10270         case "$asctime_r_proto" in
10271         ''|0) try='int asctime_r(const struct tm*, char*);'
10272         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10273         esac
10274         case "$asctime_r_proto" in
10275         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10276         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10277         esac
10278         case "$asctime_r_proto" in
10279         ''|0)   d_asctime_r=undef
10280                 asctime_r_proto=0
10281                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10282         * )     case "$asctime_r_proto" in
10283                 REENTRANT_PROTO*) ;;
10284                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10285                 esac
10286                 echo "Prototype: $try" ;;
10287         esac
10288         ;;
10289         *)      case "$usethreads" in
10290                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10291                 esac
10292                 d_asctime_r=undef
10293                 asctime_r_proto=0
10294                 ;;
10295         esac
10296         ;;
10297 *)      asctime_r_proto=0
10298         ;;
10299 esac
10300
10301 : see if atolf exists
10302 set atolf d_atolf
10303 eval $inlibc
10304
10305 : see if atoll exists
10306 set atoll d_atoll
10307 eval $inlibc
10308
10309 : Look for GCC-style attribute format
10310 case "$d_attribute_format" in
10311 '')
10312 echo " "
10313 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10314 $cat >attrib.c <<'EOCP'
10315 #include <stdio.h>
10316 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10317 EOCP
10318 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10319         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10320                 echo "Your C compiler doesn't support __attribute__((format))."
10321                 val="$undef"
10322         else
10323                 echo "Your C compiler supports __attribute__((format))."
10324                 val="$define"
10325         fi
10326 else
10327         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10328         val="$undef"
10329 fi
10330 ;;
10331 *) val="$d_attribute_format" ;;
10332 esac
10333 set d_attribute_format
10334 eval $setvar
10335 $rm -f attrib*
10336
10337 : Look for GCC-style attribute format with null format allowed
10338 case "$d_printf_format_null" in
10339 '') case "$d_attribute_format" in
10340     $define)
10341         echo " "
10342         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10343 $cat >attrib.c <<EOCP
10344 #include <stdio.h>
10345 #$i_stdlib I_STDLIB
10346 #ifdef I_STDLIB
10347 #include <stdlib.h>
10348 #endif
10349 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10350 int null_printf (char* pat,...) { return (int)pat; }
10351 int main () { exit(null_printf(NULL)); }
10352 EOCP
10353         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10354             : run the executable in case it produces a run-time warning
10355             if $run ./attrib >>attrib.out 2>&1; then
10356                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10357                     echo "Your C compiler doesn't allow __printf__ format to be null."
10358                     val="$undef"
10359                 else
10360                     echo "Your C compiler allows __printf__ format to be null."
10361                     val="$define"
10362                 fi
10363             else
10364             echo "Your C compiler executable failed with __printf__ format null."
10365             val="$undef"
10366         fi
10367     else
10368         echo "Your C compiler fails with __printf__ format null."
10369         val="$undef"
10370     fi
10371     ;;
10372     *)  val="$undef" ;;
10373     esac
10374 ;;
10375 *)  val="$d_printf_format_null" ;;
10376 esac
10377 set d_printf_format_null
10378 eval $setvar
10379 $rm -f attrib*
10380
10381 : Look for GCC-style attribute malloc
10382 case "$d_attribute_malloc" in
10383 '')
10384 echo " "
10385 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10386 $cat >attrib.c <<'EOCP'
10387 #include <stdio.h>
10388 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10389 EOCP
10390 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10391         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10392                 echo "Your C compiler doesn't support __attribute__((malloc))."
10393                 val="$undef"
10394         else
10395                 echo "Your C compiler supports __attribute__((malloc))."
10396                 val="$define"
10397         fi
10398 else
10399         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10400         val="$undef"
10401 fi
10402 ;;
10403 *) val="$d_attribute_malloc" ;;
10404 esac
10405 set d_attribute_malloc
10406 eval $setvar
10407 $rm -f attrib*
10408
10409 : Look for GCC-style attribute nonnull
10410 case "$d_attribute_nonnull" in
10411 '')
10412 echo " "
10413 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10414 $cat >attrib.c <<'EOCP'
10415 #include <stdio.h>
10416 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10417 EOCP
10418 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10419         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10420                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10421                 val="$undef"
10422         else
10423                 echo "Your C compiler supports __attribute__((nonnull))."
10424                 val="$define"
10425         fi
10426 else
10427         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10428         val="$undef"
10429 fi
10430 ;;
10431 *) val="$d_attribute_nonnull" ;;
10432 esac
10433 set d_attribute_nonnull
10434 eval $setvar
10435 $rm -f attrib*
10436
10437 : Look for GCC-style attribute noreturn
10438 case "$d_attribute_noreturn" in
10439 '')
10440 echo " "
10441 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10442 $cat >attrib.c <<'EOCP'
10443 #include <stdio.h>
10444 void fall_over_dead( void ) __attribute__((noreturn));
10445 EOCP
10446 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10447         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10448                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10449                 val="$undef"
10450         else
10451                 echo "Your C compiler supports __attribute__((noreturn))."
10452                 val="$define"
10453         fi
10454 else
10455         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10456         val="$undef"
10457 fi
10458 ;;
10459 *) val="$d_attribute_noreturn" ;;
10460 esac
10461 set d_attribute_noreturn
10462 eval $setvar
10463 $rm -f attrib*
10464
10465 : Look for GCC-style attribute pure
10466 case "$d_attribute_pure" in
10467 '')
10468 echo " "
10469 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10470 $cat >attrib.c <<'EOCP'
10471 #include <stdio.h>
10472 int square( int n ) __attribute__((pure));
10473 EOCP
10474 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10475         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10476                 echo "Your C compiler doesn't support __attribute__((pure))."
10477                 val="$undef"
10478         else
10479                 echo "Your C compiler supports __attribute__((pure))."
10480                 val="$define"
10481         fi
10482 else
10483         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10484         val="$undef"
10485 fi
10486 ;;
10487 *) val="$d_attribute_pure" ;;
10488 esac
10489 set d_attribute_pure
10490 eval $setvar
10491 $rm -f attrib*
10492
10493 : Look for GCC-style attribute unused
10494 case "$d_attribute_unused" in
10495 '')
10496 echo " "
10497 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10498 $cat >attrib.c <<'EOCP'
10499 #include <stdio.h>
10500 int do_something( int dummy __attribute__((unused)), int n );
10501 EOCP
10502 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10503         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10504                 echo "Your C compiler doesn't support __attribute__((unused))."
10505                 val="$undef"
10506         else
10507                 echo "Your C compiler supports __attribute__((unused))."
10508                 val="$define"
10509         fi
10510 else
10511         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10512         val="$undef"
10513 fi
10514 ;;
10515 *) val="$d_attribute_unused" ;;
10516 esac
10517 set d_attribute_unused
10518 eval $setvar
10519 $rm -f attrib*
10520
10521 : Look for GCC-style attribute deprecated
10522 case "$d_attribute_deprecated" in
10523 '')
10524 echo " "
10525 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10526 $cat >attrib.c <<'EOCP'
10527 #include <stdio.h>
10528 int I_am_deprecated(void) __attribute__((deprecated));
10529 EOCP
10530 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10531         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10532                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10533                 val="$undef"
10534         else
10535                 echo "Your C compiler supports __attribute__((deprecated))."
10536                 val="$define"
10537         fi
10538 else
10539         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10540         val="$undef"
10541 fi
10542 ;;
10543 *) val="$d_attribute_deprecated" ;;
10544 esac
10545 set d_attribute_deprecated
10546 eval $setvar
10547 $rm -f attrib*
10548
10549 : Look for GCC-style attribute warn_unused_result
10550 case "$d_attribute_warn_unused_result" in
10551 '')
10552 echo " "
10553 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10554 $cat >attrib.c <<'EOCP'
10555 #include <stdio.h>
10556 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10557 EOCP
10558 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10559         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10560                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10561                 val="$undef"
10562         else
10563                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10564                 val="$define"
10565         fi
10566 else
10567         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10568         val="$undef"
10569 fi
10570 ;;
10571 *) val="$d_attribute_warn_unused_result" ;;
10572 esac
10573 set d_attribute_warn_unused_result
10574 eval $setvar
10575 $rm -f attrib*
10576
10577 : see if bcmp exists
10578 set bcmp d_bcmp
10579 eval $inlibc
10580
10581 : see if bcopy exists
10582 set bcopy d_bcopy
10583 eval $inlibc
10584
10585 : see if getpgrp exists
10586 set getpgrp d_getpgrp
10587 eval $inlibc
10588
10589 case "$d_getpgrp" in
10590 "$define")
10591         echo " "
10592         echo "Checking to see which flavor of getpgrp is in use..."
10593         $cat >try.c <<EOP
10594 #$i_unistd I_UNISTD
10595 #include <sys/types.h>
10596 #ifdef I_UNISTD
10597 #  include <unistd.h>
10598 #endif
10599 #$i_stdlib I_STDLIB
10600 #ifdef I_STDLIB
10601 #include <stdlib.h>
10602 #endif
10603 int main()
10604 {
10605         if (getuid() == 0) {
10606                 printf("(I see you are running Configure as super-user...)\n");
10607                 setuid(1);
10608         }
10609 #ifdef TRY_BSD_PGRP
10610         if (getpgrp(1) == 0)
10611                 exit(0);
10612 #else
10613         if (getpgrp() > 0)
10614                 exit(0);
10615 #endif
10616         exit(1);
10617 }
10618 EOP
10619         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10620                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10621                 val="$define"
10622         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10623                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10624                 val="$undef"
10625         else
10626                 echo "I can't seem to compile and run the test program."
10627                 if ./usg; then
10628                         xxx="a USG one, i.e. you use getpgrp()."
10629                 else
10630                         # SVR4 systems can appear rather BSD-ish.
10631                         case "$i_unistd" in
10632                         $undef)
10633                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10634                                 val="$define"
10635                                 ;;
10636                         $define)
10637                                 xxx="probably a USG one, i.e. you use getpgrp()."
10638                                 val="$undef"
10639                                 ;;
10640                         esac
10641                 fi
10642                 echo "Assuming your getpgrp is $xxx" >&4
10643         fi
10644         ;;
10645 *) val="$undef";;
10646 esac
10647 set d_bsdgetpgrp
10648 eval $setvar
10649 $rm_try
10650
10651 : see if setpgrp exists
10652 set setpgrp d_setpgrp
10653 eval $inlibc
10654
10655 case "$d_setpgrp" in
10656 "$define")
10657         echo " "
10658         echo "Checking to see which flavor of setpgrp is in use..."
10659         $cat >try.c <<EOP
10660 #$i_unistd I_UNISTD
10661 #include <sys/types.h>
10662 #ifdef I_UNISTD
10663 #  include <unistd.h>
10664 #endif
10665 #$i_stdlib I_STDLIB
10666 #ifdef I_STDLIB
10667 #include <stdlib.h>
10668 #endif
10669 int main()
10670 {
10671         if (getuid() == 0) {
10672                 printf("(I see you are running Configure as super-user...)\n");
10673                 setuid(1);
10674         }
10675 #ifdef TRY_BSD_PGRP
10676         if (-1 == setpgrp(1, 1))
10677                 exit(0);
10678 #else
10679         if (setpgrp() != -1)
10680                 exit(0);
10681 #endif
10682         exit(1);
10683 }
10684 EOP
10685         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10686                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10687                 val="$define"
10688         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10689                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10690                 val="$undef"
10691         else
10692                 echo "(I can't seem to compile and run the test program.)"
10693                 if ./usg; then
10694                         xxx="a USG one, i.e. you use setpgrp()."
10695                 else
10696                         # SVR4 systems can appear rather BSD-ish.
10697                         case "$i_unistd" in
10698                         $undef)
10699                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10700                                 val="$define"
10701                                 ;;
10702                         $define)
10703                                 xxx="probably a USG one, i.e. you use setpgrp()."
10704                                 val="$undef"
10705                                 ;;
10706                         esac
10707                 fi
10708                 echo "Assuming your setpgrp is $xxx" >&4
10709         fi
10710         ;;
10711 *) val="$undef";;
10712 esac
10713 set d_bsdsetpgrp
10714 eval $setvar
10715 $rm_try
10716
10717 : Look for GCC-style __builtin_choose_expr
10718 case "$d_builtin_choose_expr" in
10719 '')
10720     echo " "
10721     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10722     $cat >try.c <<'EOCP'
10723 #include <assert.h>
10724 #include <stdlib.h>
10725 #include <stdio.h>
10726
10727 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10728
10729 int main(void) {
10730     assert( SYRINX(1) == 2112 );
10731     assert( SYRINX(1) != 5150 );
10732     assert( SYRINX(0) == 5150 );
10733     assert( SYRINX(0) != 2112 );
10734     puts( "All good!" );
10735     exit(0);
10736 }
10737
10738 EOCP
10739     set try
10740     if eval $compile && $run ./try; then
10741         echo "Your C compiler supports __builtin_choose_expr."
10742         val="$define"
10743     else
10744         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10745         val="$undef"
10746     fi
10747 ;;
10748 *) val="$d_builtin_choose_expr" ;;
10749 esac
10750
10751 set d_builtin_choose_expr
10752 eval $setvar
10753 $rm_try
10754
10755 : Look for GCC-style __builtin_expect
10756 case "$d_builtin_expect" in
10757 '')
10758     echo " "
10759     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10760     $cat >try.c <<'EOCP'
10761 int main(void) {
10762     int n = 50;
10763     if ( __builtin_expect(n, 0) ) n = 1;
10764     /* Remember shell exit code truth is 0, C truth is non-zero */
10765     return !(n == 1);
10766 }
10767 EOCP
10768     set try
10769     if eval $compile && $run ./try; then
10770         echo "Your C compiler supports __builtin_expect."
10771         val="$define"
10772     else
10773         echo "Your C compiler doesn't seem to understand __builtin_expect."
10774         val="$undef"
10775     fi
10776     ;;
10777 *) val="$d_builtin_expect" ;;
10778 esac
10779
10780 set d_builtin_expect
10781 eval $setvar
10782 $rm_try
10783
10784 : see if bzero exists
10785 set bzero d_bzero
10786 eval $inlibc
10787
10788 : see if stdarg is available
10789 echo " "
10790 if $test `./findhdr stdarg.h`; then
10791         echo "<stdarg.h> found." >&4
10792         valstd="$define"
10793 else
10794         echo "<stdarg.h> NOT found." >&4
10795         valstd="$undef"
10796 fi
10797
10798 : see if varags is available
10799 echo " "
10800 if $test `./findhdr varargs.h`; then
10801         echo "<varargs.h> found." >&4
10802 else
10803         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10804 fi
10805
10806 : set up the varargs testing programs
10807 $cat > varargs.c <<EOP
10808 #ifdef I_STDARG
10809 #include <stdarg.h>
10810 #endif
10811 #ifdef I_VARARGS
10812 #include <varargs.h>
10813 #endif
10814
10815 #ifdef I_STDARG
10816 int f(char *p, ...)
10817 #else
10818 int f(va_alist)
10819 va_dcl
10820 #endif
10821 {
10822         va_list ap;
10823 #ifndef I_STDARG
10824         char *p;
10825 #endif
10826 #ifdef I_STDARG
10827         va_start(ap,p);
10828 #else
10829         va_start(ap);
10830         p = va_arg(ap, char *);
10831 #endif
10832         va_end(ap);
10833         return 0;
10834 }
10835 EOP
10836 $cat > varargs <<EOP
10837 $startsh
10838 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10839         echo "true"
10840 else
10841         echo "false"
10842 fi
10843 $rm -f varargs$_o
10844 EOP
10845 chmod +x varargs
10846
10847 : now check which varargs header should be included
10848 echo " "
10849 i_varhdr=''
10850 case "$valstd" in
10851 "$define")
10852         if `./varargs I_STDARG`; then
10853                 val='stdarg.h'
10854         elif `./varargs I_VARARGS`; then
10855                 val='varargs.h'
10856         fi
10857         ;;
10858 *)
10859         if `./varargs I_VARARGS`; then
10860                 val='varargs.h'
10861         fi
10862         ;;
10863 esac
10864 case "$val" in
10865 '')
10866 echo "I could not find the definition for va_dcl... You have problems..." >&4
10867         val="$undef"; set i_stdarg; eval $setvar
10868         val="$undef"; set i_varargs; eval $setvar
10869         ;;
10870 *)
10871         set i_varhdr
10872         eval $setvar
10873         case "$i_varhdr" in
10874         stdarg.h)
10875                 val="$define"; set i_stdarg; eval $setvar
10876                 val="$undef"; set i_varargs; eval $setvar
10877                 ;;
10878         varargs.h)
10879                 val="$undef"; set i_stdarg; eval $setvar
10880                 val="$define"; set i_varargs; eval $setvar
10881                 ;;
10882         esac
10883         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10884 esac
10885 $rm -f varargs*
10886
10887 : see if the Compiler supports C99 variadic macros
10888 case "$i_stdarg$i_stdlib" in
10889     "$define$define")
10890     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10891     $cat >try.c <<EOCP
10892 #include <stdio.h>
10893 #include <stdarg.h>
10894
10895 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10896
10897 int main() {
10898   char buf[20];
10899   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10900   puts(buf);
10901   return 0;
10902 }
10903 EOCP
10904     set try
10905     if eval $compile && $run ./try 2>&1 >/dev/null; then
10906         case "`$run ./try`" in
10907             "123 456 789")
10908             echo "You have C99 variadic macros." >&4
10909             d_c99_variadic_macros="$define"
10910             ;;
10911             *)
10912             echo "You don't have functional C99 variadic macros." >&4
10913             d_c99_variadic_macros="$undef"
10914             ;;
10915         esac
10916     else
10917         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10918         d_c99_variadic_macros="$undef"
10919     fi
10920     $rm_try
10921     ;;
10922     *)
10923     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10924     d_c99_variadic_macros="$undef"
10925     ;;
10926 esac
10927
10928 : see if signal is declared as pointer to function returning int or void
10929 echo " "
10930 xxx=`./findhdr signal.h`
10931 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10932 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10933         echo "You have int (*signal())() instead of void." >&4
10934         val="$undef"
10935 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10936         echo "You have void (*signal())()." >&4
10937         val="$define"
10938 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10939         echo "You have int (*signal())() instead of void." >&4
10940         val="$undef"
10941 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10942         echo "You have void (*signal())()." >&4
10943         val="$define"
10944 else
10945         case "$d_voidsig" in
10946         '')
10947         echo "I can't determine whether signal handler returns void or int..." >&4
10948                 dflt=void
10949                 rp="What type does your signal handler return?"
10950                 . ./myread
10951                 case "$ans" in
10952                 v*) val="$define";;
10953                 *) val="$undef";;
10954                 esac;;
10955         "$define")
10956                 echo "As you already told me, signal handler returns void." >&4
10957                 val="$define"
10958                 ;;
10959         *)      echo "As you already told me, signal handler returns int." >&4
10960                 val="$undef"
10961                 ;;
10962         esac
10963 fi
10964 set d_voidsig
10965 eval $setvar
10966 case "$d_voidsig" in
10967 "$define") signal_t="void";;
10968 *) signal_t="int";;
10969 esac
10970 $rm -f $$.tmp
10971
10972 : check for ability to cast large floats to 32-bit ints.
10973 echo " "
10974 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10975 if $test "$intsize" -ge 4; then
10976         xxx=int
10977 else
10978         xxx=long
10979 fi
10980 $cat >try.c <<EOCP
10981 #include <stdio.h>
10982 #$i_stdlib I_STDLIB
10983 #ifdef I_STDLIB
10984 #include <stdlib.h>
10985 #endif
10986 #include <sys/types.h>
10987 #include <signal.h>
10988 $signal_t blech(int s) { exit(3); }
10989 int main()
10990 {
10991         $xxx i32;
10992         double f, g;
10993         int result = 0;
10994         char str[16];
10995         signal(SIGFPE, blech);
10996
10997         /* Don't let compiler optimize the test away.  Store the number
10998            in a writable string for gcc to pass to sscanf under HP/UX.
10999         */
11000         sprintf(str, "2147483647");
11001         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11002         g = 10 * f;
11003         i32  = ($xxx) g;
11004
11005         /* x86 processors will probably give 0x8000 0000, which is a
11006            sign change.  We don't want that.  We want to mimic SPARC
11007            behavior here, which is to preserve the sign and give
11008            back 0x7fff ffff.
11009         */
11010         if (i32 != ($xxx) f)
11011                 result |= 1;
11012         exit(result);
11013 }
11014 EOCP
11015 set try
11016 if eval $compile_ok; then
11017         $run ./try
11018         yyy=$?
11019 else
11020         echo "(I can't seem to compile the test program--assuming it can't)"
11021         yyy=1
11022 fi
11023 case "$yyy" in
11024 0)      val="$define"
11025         echo "Yup, it can."
11026         ;;
11027 *)      val="$undef"
11028         echo "Nope, it can't."
11029         ;;
11030 esac
11031 set d_casti32
11032 eval $setvar
11033 $rm_try
11034
11035 : check for ability to cast negative floats to unsigned
11036 echo " "
11037 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11038 $cat >try.c <<EOCP
11039 #include <stdio.h>
11040 #$i_stdlib I_STDLIB
11041 #ifdef I_STDLIB
11042 #include <stdlib.h>
11043 #endif
11044 #include <sys/types.h>
11045 #include <signal.h>
11046 $signal_t blech(int s) { exit(7); }
11047 $signal_t blech_in_list(int s) { exit(4); }
11048 unsigned long dummy_long(unsigned long p) { return p; }
11049 unsigned int dummy_int(unsigned int p) { return p; }
11050 unsigned short dummy_short(unsigned short p) { return p; }
11051 int main()
11052 {
11053         double f;
11054         unsigned long along;
11055         unsigned int aint;
11056         unsigned short ashort;
11057         int result = 0;
11058         char str[16];
11059
11060         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11061            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11062            optimized the whole file away
11063         */
11064         /* Store the number in a writable string for gcc to pass to
11065            sscanf under HP/UX.
11066         */
11067         sprintf(str, "-123");
11068         sscanf(str, "%lf", &f);  /* f = -123.; */
11069
11070         signal(SIGFPE, blech);
11071         along = (unsigned long)f;
11072         aint = (unsigned int)f;
11073         ashort = (unsigned short)f;
11074         if (along != (unsigned long)-123)
11075                 result |= 1;
11076         if (aint != (unsigned int)-123)
11077                 result |= 1;
11078         if (ashort != (unsigned short)-123)
11079                 result |= 1;
11080         sprintf(str, "1073741824.");
11081         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11082         f = f + f;
11083         along = 0;
11084         along = (unsigned long)f;
11085         if (along != 0x80000000)
11086                 result |= 2;
11087         f -= 1.;
11088         along = 0;
11089         along = (unsigned long)f;
11090         if (along != 0x7fffffff)
11091                 result |= 1;
11092         f += 2.;
11093         along = 0;
11094         along = (unsigned long)f;
11095         if (along != 0x80000001)
11096                 result |= 2;
11097         if (result)
11098                 exit(result);
11099         signal(SIGFPE, blech_in_list);
11100         sprintf(str, "123.");
11101         sscanf(str, "%lf", &f);  /* f = 123.; */
11102         along = dummy_long((unsigned long)f);
11103         aint = dummy_int((unsigned int)f);
11104         ashort = dummy_short((unsigned short)f);
11105         if (along != (unsigned long)123)
11106                 result |= 4;
11107         if (aint != (unsigned int)123)
11108                 result |= 4;
11109         if (ashort != (unsigned short)123)
11110                 result |= 4;
11111         exit(result);
11112
11113 }
11114 EOCP
11115 set try
11116 if eval $compile_ok; then
11117         $run ./try
11118         castflags=$?
11119 else
11120         echo "(I can't seem to compile the test program--assuming it can't)"
11121         castflags=7
11122 fi
11123 case "$castflags" in
11124 0)      val="$define"
11125         echo "Yup, it can."
11126         ;;
11127 *)      val="$undef"
11128         echo "Nope, it can't."
11129         ;;
11130 esac
11131 set d_castneg
11132 eval $setvar
11133 $rm_try
11134
11135 : see if vprintf exists
11136 echo " "
11137 if set vprintf val -f d_vprintf; eval $csym; $val; then
11138         echo 'vprintf() found.' >&4
11139         val="$define"
11140         $cat >try.c <<EOF
11141 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11142 #$i_varargs I_VARARGS
11143
11144 #$i_stdlib I_STDLIB
11145 #$i_unistd I_UNISTD
11146
11147 #ifdef I_STDARG
11148 #  include <stdarg.h>
11149 #else /* I_VARARGS */
11150 #  include <varargs.h>
11151 #endif
11152
11153 #ifdef I_UNISTD
11154 #  include <unistd.h>
11155 #endif
11156
11157 #ifdef I_STDLIB
11158 #  include <stdlib.h>
11159 #endif
11160
11161 #include <stdio.h> /* vsprintf prototype */
11162
11163 #ifdef I_STDARG
11164 void xxx(int n, ...)
11165 {
11166     va_list args;
11167     char buf[10];
11168     va_start(args, n);
11169     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11170 }
11171 int main() { xxx(1, "foo"); }
11172
11173 #else /* I_VARARGS */
11174
11175 xxx(va_alist)
11176 va_dcl
11177 {
11178     va_list args;
11179     char buf[10];
11180     va_start(args);
11181     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11182 }
11183 int main() { xxx("foo"); }
11184
11185 #endif
11186
11187 EOF
11188         set try
11189         if eval $compile_ok; then
11190                 if $run ./try; then
11191                         echo "Your vsprintf() returns (int)." >&4
11192                         val2="$undef"
11193                 else
11194                         echo "Your vsprintf() returns (char*)." >&4
11195                         val2="$define"
11196                 fi
11197         else
11198                 echo 'I am unable to compile the vsprintf() test program.' >&4
11199                 # We shouldn't get here.  If we do, assume the standard signature,
11200                 # not the old BSD one.
11201                 echo 'Guessing that vsprintf() returns (int).' >&4
11202                 val2="$undef"
11203         fi
11204 else
11205         echo 'vprintf() NOT found.' >&4
11206         val="$undef"
11207         val2="$undef"
11208 fi
11209 $rm_try
11210 set d_vprintf
11211 eval $setvar
11212 val=$val2
11213 set d_charvspr
11214 eval $setvar
11215
11216 : see if chown exists
11217 set chown d_chown
11218 eval $inlibc
11219
11220 : see if chroot exists
11221 set chroot d_chroot
11222 eval $inlibc
11223
11224 : see if chsize exists
11225 set chsize d_chsize
11226 eval $inlibc
11227
11228 : see if class exists
11229 set class d_class
11230 eval $inlibc
11231
11232 : see if clearenv exists
11233 set clearenv d_clearenv
11234 eval $inlibc
11235
11236 : Define hasstruct macro for Configure internal use
11237 hasstruct='varname=$1; struct=$2; shift; shift;
11238 while $test $# -ge 2; do
11239         case "$1" in
11240         $define) echo "#include <$2>";;
11241         esac ;
11242     shift 2;
11243 done > try.c;
11244 echo "int main () { struct $struct foo; }" >> try.c;
11245 set try;
11246 if eval $compile; then
11247         val="$define";
11248 else
11249         val="$undef";
11250 fi;
11251 set $varname;
11252 eval $setvar;
11253 $rm_try'
11254
11255 : see whether socket exists
11256 socketlib=''
11257 sockethdr=''
11258 echo " "
11259 $echo $n "Hmm... $c" >&4
11260 if set socket val -f d_socket; eval $csym; $val; then
11261         echo "Looks like you have Berkeley networking support." >&4
11262         d_socket="$define"
11263         if set setsockopt val -f; eval $csym; $val; then
11264                 d_oldsock="$undef"
11265         else
11266                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11267                 d_oldsock="$define"
11268         fi
11269 else
11270         if $contains socklib libc.list >/dev/null 2>&1; then
11271                 echo "Looks like you have Berkeley networking support." >&4
11272                 d_socket="$define"
11273                 : we will have to assume that it supports the 4.2 BSD interface
11274                 d_oldsock="$undef"
11275         else
11276                 echo "You don't have Berkeley networking in libc$_a..." >&4
11277                 if test "X$d_socket" = "X$define"; then
11278                    echo "...but you seem to believe that you have sockets." >&4
11279                 else
11280                         for net in net socket
11281                         do
11282                                 if test -f /usr/lib/lib$net$_a; then
11283                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11284                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11285                                         if $contains socket libc.list >/dev/null 2>&1; then
11286                                                 d_socket="$define"
11287                                                 socketlib="-l$net"
11288                                                 case "$net" in
11289                                                 net)
11290                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11291                                                         sockethdr="-I/usr/netinclude"
11292                                                         ;;
11293                                                 esac
11294                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11295                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11296                                                         d_oldsock="$undef"
11297                                                 else
11298                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11299                                                         d_oldsock="$define"
11300                                                 fi
11301                                                 break
11302                                         fi
11303                                 fi
11304                         done
11305                         if test "X$d_socket" != "X$define"; then
11306                            echo "or anywhere else I see." >&4
11307                            d_socket="$undef"
11308                            d_oldsock="$undef"
11309                         fi
11310                 fi
11311         fi
11312 fi
11313
11314 : see if socketpair exists
11315 set socketpair d_sockpair
11316 eval $inlibc
11317
11318
11319 echo " "
11320 echo "Checking the availability of certain socket constants..." >&4
11321 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11322         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11323         $cat >try.c <<EOF
11324 #include <sys/types.h>
11325 #include <sys/socket.h>
11326 int main() {
11327     int i = $ENUM;
11328 }
11329 EOF
11330         val="$undef"
11331         set try; if eval $compile; then
11332                 val="$define"
11333         fi
11334         set d_${enum}; eval $setvar
11335         $rm_try
11336 done
11337
11338 : see if this is a sys/uio.h system
11339 set sys/uio.h i_sysuio
11340 eval $inhdr
11341
11342 : Check for cmsghdr support
11343 echo " "
11344 echo "Checking to see if your system supports struct cmsghdr..." >&4
11345 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11346 eval $hasstruct
11347 case "$d_cmsghdr_s" in
11348 "$define")      echo "Yes, it does."   ;;
11349 *)              echo "No, it doesn't." ;;
11350 esac
11351
11352
11353 : check for const keyword
11354 echo " "
11355 echo 'Checking to see if your C compiler knows about "const"...' >&4
11356 $cat >const.c <<'EOCP'
11357 typedef struct spug { int drokk; } spug;
11358 int main()
11359 {
11360         const char *foo;
11361         const spug y = { 0 };
11362 }
11363 EOCP
11364 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11365         val="$define"
11366         echo "Yup, it does."
11367 else
11368         val="$undef"
11369         echo "Nope, it doesn't."
11370 fi
11371 set d_const
11372 eval $setvar
11373
11374 : see if copysignl exists
11375 set copysignl d_copysignl
11376 eval $inlibc
11377
11378 : see if crypt exists
11379 echo " "
11380 set crypt d_crypt
11381 eval $inlibc
11382 case "$d_crypt" in
11383 $define) cryptlib='' ;;
11384 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11385                 echo 'crypt() found.' >&4
11386                 val="$define"
11387                 cryptlib=''
11388         else
11389                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11390                 if $test -z "$cryptlib"; then
11391                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11392                 else
11393                         cryptlib=-lcrypt
11394                 fi
11395                 if $test -z "$cryptlib"; then
11396                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11397                 else
11398                         cryptlib=-lcrypt
11399                 fi
11400                 if $test -z "$cryptlib"; then
11401                         cryptlib=`./loc libcrypt$_a "" $libpth`
11402                 else
11403                         cryptlib=-lcrypt
11404                 fi
11405                 if $test -z "$cryptlib"; then
11406                         echo 'crypt() NOT found.' >&4
11407                         val="$undef"
11408                 else
11409                         val="$define"
11410                 fi
11411         fi
11412         set d_crypt
11413         eval $setvar
11414         ;;
11415 esac
11416
11417 : see if this is a crypt.h system
11418 set crypt.h i_crypt
11419 eval $inhdr
11420
11421 : see if crypt_r exists
11422 set crypt_r d_crypt_r
11423 eval $inlibc
11424 case "$d_crypt_r" in
11425 "$define")
11426         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11427         case "$d_crypt_r_proto:$usethreads" in
11428         ":define")      d_crypt_r_proto=define
11429                 set d_crypt_r_proto crypt_r $hdrs
11430                 eval $hasproto ;;
11431         *)      ;;
11432         esac
11433         case "$d_crypt_r_proto" in
11434         define)
11435         case "$crypt_r_proto" in
11436         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11437         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11438         esac
11439         case "$crypt_r_proto" in
11440         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11441         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11442         esac
11443         case "$crypt_r_proto" in
11444         ''|0)   d_crypt_r=undef
11445                 crypt_r_proto=0
11446                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11447         * )     case "$crypt_r_proto" in
11448                 REENTRANT_PROTO*) ;;
11449                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11450                 esac
11451                 echo "Prototype: $try" ;;
11452         esac
11453         ;;
11454         *)      case "$usethreads" in
11455                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11456                 esac
11457                 d_crypt_r=undef
11458                 crypt_r_proto=0
11459                 ;;
11460         esac
11461         ;;
11462 *)      crypt_r_proto=0
11463         ;;
11464 esac
11465
11466 : get csh whereabouts
11467 case "$csh" in
11468 'csh') val="$undef" ;;
11469 *) val="$define" ;;
11470 esac
11471 set d_csh
11472 eval $setvar
11473 : Respect a hint or command line value for full_csh.
11474 case "$full_csh" in
11475 '') full_csh=$csh ;;
11476 esac
11477
11478 : see if ctermid exists
11479 set ctermid d_ctermid
11480 eval $inlibc
11481
11482 : see if ctermid_r exists
11483 set ctermid_r d_ctermid_r
11484 eval $inlibc
11485 case "$d_ctermid_r" in
11486 "$define")
11487         hdrs="$i_systypes sys/types.h define stdio.h "
11488         case "$d_ctermid_r_proto:$usethreads" in
11489         ":define")      d_ctermid_r_proto=define
11490                 set d_ctermid_r_proto ctermid_r $hdrs
11491                 eval $hasproto ;;
11492         *)      ;;
11493         esac
11494         case "$d_ctermid_r_proto" in
11495         define)
11496         case "$ctermid_r_proto" in
11497         ''|0) try='char* ctermid_r(char*);'
11498         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11499         esac
11500         case "$ctermid_r_proto" in
11501         ''|0)   d_ctermid_r=undef
11502                 ctermid_r_proto=0
11503                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11504         * )     case "$ctermid_r_proto" in
11505                 REENTRANT_PROTO*) ;;
11506                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11507                 esac
11508                 echo "Prototype: $try" ;;
11509         esac
11510         ;;
11511         *)      case "$usethreads" in
11512                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11513                 esac
11514                 d_ctermid_r=undef
11515                 ctermid_r_proto=0
11516                 ;;
11517         esac
11518         ;;
11519 *)      ctermid_r_proto=0
11520         ;;
11521 esac
11522
11523 : see if ctime_r exists
11524 set ctime_r d_ctime_r
11525 eval $inlibc
11526 case "$d_ctime_r" in
11527 "$define")
11528         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11529         case "$d_ctime_r_proto:$usethreads" in
11530         ":define")      d_ctime_r_proto=define
11531                 set d_ctime_r_proto ctime_r $hdrs
11532                 eval $hasproto ;;
11533         *)      ;;
11534         esac
11535         case "$d_ctime_r_proto" in
11536         define)
11537         case "$ctime_r_proto" in
11538         ''|0) try='char* ctime_r(const time_t*, char*);'
11539         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11540         esac
11541         case "$ctime_r_proto" in
11542         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11543         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11544         esac
11545         case "$ctime_r_proto" in
11546         ''|0) try='int ctime_r(const time_t*, char*);'
11547         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11548         esac
11549         case "$ctime_r_proto" in
11550         ''|0) try='int ctime_r(const time_t*, char*, int);'
11551         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11552         esac
11553         case "$ctime_r_proto" in
11554         ''|0)   d_ctime_r=undef
11555                 ctime_r_proto=0
11556                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11557         * )     case "$ctime_r_proto" in
11558                 REENTRANT_PROTO*) ;;
11559                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11560                 esac
11561                 echo "Prototype: $try" ;;
11562         esac
11563         ;;
11564         *)      case "$usethreads" in
11565                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11566                 esac
11567                 d_ctime_r=undef
11568                 ctime_r_proto=0
11569                 ;;
11570         esac
11571         ;;
11572 *)      ctime_r_proto=0
11573         ;;
11574 esac
11575
11576 : see if cuserid exists
11577 set cuserid d_cuserid
11578 eval $inlibc
11579
11580 : see if this is a limits.h system
11581 set limits.h i_limits
11582 eval $inhdr
11583
11584 : see if this is a float.h system
11585 set float.h i_float
11586 eval $inhdr
11587
11588 : See if number of significant digits in a double precision number is known
11589 echo " "
11590 $cat >dbl_dig.c <<EOM
11591 #$i_limits I_LIMITS
11592 #$i_float I_FLOAT
11593 #ifdef I_LIMITS
11594 #include <limits.h>
11595 #endif
11596 #ifdef I_FLOAT
11597 #include <float.h>
11598 #endif
11599 #ifdef DBL_DIG
11600 printf("Contains DBL_DIG");
11601 #endif
11602 EOM
11603 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11604 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11605         echo "DBL_DIG found." >&4
11606         val="$define"
11607 else
11608         echo "DBL_DIG NOT found." >&4
11609         val="$undef"
11610 fi
11611 $rm -f dbl_dig.?
11612 set d_dbl_dig
11613 eval $setvar
11614
11615 : see if dbm.h is available
11616 : see if dbmclose exists
11617 set dbmclose d_dbmclose
11618 eval $inlibc
11619
11620 case "$d_dbmclose" in
11621 $define)
11622         set dbm.h i_dbm
11623         eval $inhdr
11624         case "$i_dbm" in
11625         $define)
11626                 val="$undef"
11627                 set i_rpcsvcdbm
11628                 eval $setvar
11629                 ;;
11630         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11631                 eval $inhdr
11632                 ;;
11633         esac
11634         ;;
11635 *)      echo "We won't be including <dbm.h>"
11636         val="$undef"
11637         set i_dbm
11638         eval $setvar
11639         val="$undef"
11640         set i_rpcsvcdbm
11641         eval $setvar
11642         ;;
11643 esac
11644
11645 : see if prototype for dbminit is available
11646 echo " "
11647 set d_dbminitproto dbminit $i_dbm dbm.h
11648 eval $hasproto
11649
11650 : see if difftime exists
11651 set difftime d_difftime
11652 eval $inlibc
11653
11654 : see if this is a dirent system
11655 echo " "
11656 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11657         val="$define"
11658         echo "<dirent.h> found." >&4
11659 else
11660         val="$undef"
11661         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11662                 echo "<sys/dir.h> found." >&4
11663                 echo " "
11664         else
11665                 xinc=`./findhdr sys/ndir.h`
11666         fi
11667         echo "<dirent.h> NOT found." >&4
11668 fi
11669 set i_dirent
11670 eval $setvar
11671
11672 : Look for type of directory structure.
11673 echo " "
11674 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11675
11676 case "$direntrytype" in
11677 ''|' ')
11678         case "$i_dirent" in
11679         $define) guess1='struct dirent' ;;
11680         *) guess1='struct direct'  ;;
11681         esac
11682         ;;
11683 *)      guess1="$direntrytype"
11684         ;;
11685 esac
11686
11687 case "$guess1" in
11688 'struct dirent') guess2='struct direct' ;;
11689 *) guess2='struct dirent' ;;
11690 esac
11691
11692 if $contains "$guess1" try.c >/dev/null 2>&1; then
11693         direntrytype="$guess1"
11694         echo "Your directory entries are $direntrytype." >&4
11695 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11696         direntrytype="$guess2"
11697         echo "Your directory entries seem to be $direntrytype." >&4
11698 else
11699         echo "I don't recognize your system's directory entries." >&4
11700         rp="What type is used for directory entries on this system?"
11701         dflt="$guess1"
11702         . ./myread
11703         direntrytype="$ans"
11704 fi
11705 $rm_try
11706
11707 : see if the directory entry stores field length
11708 echo " "
11709 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11710 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11711         echo "Good, your directory entry keeps length information in d_namlen." >&4
11712         val="$define"
11713 else
11714         echo "Your directory entry does not know about the d_namlen field." >&4
11715         val="$undef"
11716 fi
11717 set d_dirnamlen
11718 eval $setvar
11719 $rm_try
11720
11721 : Look for DIR.dd_fd
11722 case "$i_dirent" in
11723 "$define")
11724     echo "Checking to see if DIR has a dd_fd member variable" >&4
11725     $cat >try.c <<EOCP
11726 #$i_stdlib I_STDLIB
11727 #ifdef I_STDLIB
11728 #include <stdlib.h>
11729 #endif
11730 #include <dirent.h>
11731
11732 int main() {
11733     DIR dir;
11734     dir.dd_fd = 1;
11735     return 0;
11736 }
11737 EOCP
11738     val=$undef
11739     set try
11740     if eval $compile; then
11741         echo "Yes, it does."
11742         val="$define"
11743     else
11744         echo "No, it does not."
11745         val="$undef"
11746     fi
11747     ;;
11748 *)
11749     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11750     val="$undef"
11751     ;;
11752 esac
11753 set d_dir_dd_fd
11754 eval $setvar
11755 $rm_try
11756
11757 : see if this is an sysdir system
11758 set sys/dir.h i_sysdir
11759 eval $inhdr
11760
11761 : see if this is an sysndir system
11762 set sys/ndir.h i_sysndir
11763 eval $inhdr
11764
11765 : Look for dirfd
11766 echo " "
11767 $cat >dirfd.c <<EOM
11768 #include <stdio.h>
11769 #$i_stdlib I_STDLIB
11770 #ifdef I_STDLIB
11771 #include <stdlib.h>
11772 #endif
11773 #$i_dirent I_DIRENT             /**/
11774 #$i_sysdir I_SYS_DIR            /**/
11775 #$i_sysndir I_SYS_NDIR          /**/
11776 #$i_systypes I_SYS_TYPES        /**/
11777 #if defined(I_SYS_TYPES)
11778 #include <sys/types.h>
11779 #endif
11780 #if defined(I_DIRENT)
11781 #include <dirent.h>
11782 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11783 #include <sys/dir.h>
11784 #endif
11785 #else
11786 #ifdef I_SYS_NDIR
11787 #include <sys/ndir.h>
11788 #else
11789 #ifdef I_SYS_DIR
11790 #ifdef hp9000s500
11791 #include <ndir.h>       /* may be wrong in the future */
11792 #else
11793 #include <sys/dir.h>
11794 #endif
11795 #endif
11796 #endif
11797 #endif 
11798 int main() {
11799         DIR *dirp = opendir(".");
11800         if (dirfd(dirp) >= 0)
11801                 exit(0);
11802         else
11803                 exit(1);
11804 }
11805 EOM
11806 val=$undef
11807 set dirfd
11808 if eval $compile; then
11809         val="$define"
11810 fi
11811 case "$val" in
11812 $define)        echo "dirfd() found." >&4       ;;
11813 *)              echo "dirfd() NOT found." >&4   ;;
11814 esac
11815 set d_dirfd
11816 eval $setvar
11817 $rm -f dirfd*
11818
11819 : see if dlerror exists
11820 xxx_runnm="$runnm"
11821 runnm=false
11822 set dlerror d_dlerror
11823 eval $inlibc
11824 runnm="$xxx_runnm"
11825
11826 : see if dlfcn is available
11827 set dlfcn.h i_dlfcn
11828 eval $inhdr
11829
11830 : Check what extension to use for shared libs
11831 case "$usedl" in
11832 $define|y|true)
11833         $cat << EOM
11834
11835 On a few systems, the dynamically loaded modules that perl generates and uses
11836 will need a different extension than shared libs. The default will probably
11837 be appropriate.
11838
11839 EOM
11840         case "$dlext" in
11841         '')     dflt="$so" ;;
11842         *)      dflt="$dlext" ;;
11843         esac
11844         rp='What is the extension of dynamically loaded modules'
11845         . ./myread
11846         dlext="$ans"
11847         ;;
11848 *)
11849         dlext="none"
11850         ;;
11851 esac
11852
11853 : Check if dlsym need a leading underscore
11854 echo " "
11855 val="$undef"
11856
11857 case "$dlsrc" in
11858 dl_dlopen.xs)
11859         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11860         $cat >dyna.c <<'EOM'
11861 fred () { }
11862 EOM
11863
11864 $cat >fred.c<<EOM
11865
11866 #include <stdio.h>
11867 #$i_stdlib I_STDLIB
11868 #ifdef I_STDLIB
11869 #include <stdlib.h>
11870 #endif
11871 #$i_dlfcn I_DLFCN
11872 #ifdef I_DLFCN
11873 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11874 #else
11875 #include <sys/types.h>
11876 #include <nlist.h>
11877 #include <link.h>
11878 #endif
11879
11880 extern int fred() ;
11881
11882 int main()
11883 {
11884     void * handle ;
11885     void * symbol ;
11886 #ifndef RTLD_LAZY
11887     int mode = 1 ;
11888 #else
11889     int mode = RTLD_LAZY ;
11890 #endif
11891     handle = dlopen("./dyna.$dlext", mode) ;
11892     if (handle == NULL) {
11893         printf ("1\n") ;
11894         fflush (stdout) ;
11895         exit(0);
11896     }
11897     symbol = dlsym(handle, "fred") ;
11898     if (symbol == NULL) {
11899         /* try putting a leading underscore */
11900         symbol = dlsym(handle, "_fred") ;
11901         if (symbol == NULL) {
11902             printf ("2\n") ;
11903             fflush (stdout) ;
11904             exit(0);
11905         }
11906         printf ("3\n") ;
11907     }
11908     else
11909         printf ("4\n") ;
11910     fflush (stdout) ;
11911     exit(0);
11912 }
11913 EOM
11914         : Call the object file tmp-dyna.o in case dlext=o.
11915         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11916                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11917                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11918                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11919                 xxx=`$run ./fred`
11920                 case $xxx in
11921                 1)      echo "Test program failed using dlopen." >&4
11922                         echo "Perhaps you should not use dynamic loading." >&4;;
11923                 2)      echo "Test program failed using dlsym." >&4
11924                         echo "Perhaps you should not use dynamic loading." >&4;;
11925                 3)      echo "dlsym needs a leading underscore" >&4
11926                         val="$define" ;;
11927                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11928                 esac
11929         else
11930                 echo "I can't compile and run the test program." >&4
11931                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11932         fi
11933         ;;
11934 esac
11935
11936 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11937
11938 set d_dlsymun
11939 eval $setvar
11940
11941 : see if drand48_r exists
11942 set drand48_r d_drand48_r
11943 eval $inlibc
11944 case "$d_drand48_r" in
11945 "$define")
11946         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11947         case "$d_drand48_r_proto:$usethreads" in
11948         ":define")      d_drand48_r_proto=define
11949                 set d_drand48_r_proto drand48_r $hdrs
11950                 eval $hasproto ;;
11951         *)      ;;
11952         esac
11953         case "$d_drand48_r_proto" in
11954         define)
11955         case "$drand48_r_proto" in
11956         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11957         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11958         esac
11959         case "$drand48_r_proto" in
11960         ''|0)   d_drand48_r=undef
11961                 drand48_r_proto=0
11962                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11963         * )     case "$drand48_r_proto" in
11964                 REENTRANT_PROTO*) ;;
11965                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11966                 esac
11967                 echo "Prototype: $try" ;;
11968         esac
11969         ;;
11970         *)      case "$usethreads" in
11971                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11972                 esac
11973                 d_drand48_r=undef
11974                 drand48_r_proto=0
11975                 ;;
11976         esac
11977         ;;
11978 *)      drand48_r_proto=0
11979         ;;
11980 esac
11981
11982 : see if prototype for drand48 is available
11983 echo " "
11984 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11985 eval $hasproto
11986
11987 : see if dup2 exists
11988 set dup2 d_dup2
11989 eval $inlibc
11990
11991 : see if eaccess exists
11992 set eaccess d_eaccess
11993 eval $inlibc
11994
11995 : see if endgrent exists
11996 set endgrent d_endgrent
11997 eval $inlibc
11998
11999 : see if this is an grp system
12000 set grp.h i_grp
12001 eval $inhdr
12002
12003 case "$i_grp" in
12004 $define)
12005         xxx=`./findhdr grp.h`
12006         $cppstdin $cppflags $cppminus < $xxx >$$.h
12007
12008         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12009                 val="$define"
12010         else
12011                 val="$undef"
12012         fi
12013         set d_grpasswd
12014         eval $setvar
12015
12016         $rm -f $$.h
12017         ;;
12018 *)
12019         val="$undef";
12020         set d_grpasswd; eval $setvar
12021         ;;
12022 esac
12023
12024 : see if endgrent_r exists
12025 set endgrent_r d_endgrent_r
12026 eval $inlibc
12027 case "$d_endgrent_r" in
12028 "$define")
12029         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12030         case "$d_endgrent_r_proto:$usethreads" in
12031         ":define")      d_endgrent_r_proto=define
12032                 set d_endgrent_r_proto endgrent_r $hdrs
12033                 eval $hasproto ;;
12034         *)      ;;
12035         esac
12036         case "$d_endgrent_r_proto" in
12037         define)
12038         case "$endgrent_r_proto" in
12039         ''|0) try='int endgrent_r(FILE**);'
12040         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12041         esac
12042         case "$endgrent_r_proto" in
12043         ''|0) try='void endgrent_r(FILE**);'
12044         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12045         esac
12046         case "$endgrent_r_proto" in
12047         ''|0)   d_endgrent_r=undef
12048                 endgrent_r_proto=0
12049                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12050         * )     case "$endgrent_r_proto" in
12051                 REENTRANT_PROTO*) ;;
12052                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12053                 esac
12054                 echo "Prototype: $try" ;;
12055         esac
12056         ;;
12057         *)      case "$usethreads" in
12058                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12059                 esac
12060                 d_endgrent_r=undef
12061                 endgrent_r_proto=0
12062                 ;;
12063         esac
12064         ;;
12065 *)      endgrent_r_proto=0
12066         ;;
12067 esac
12068
12069 : see if endhostent exists
12070 set endhostent d_endhent
12071 eval $inlibc
12072
12073 : see if this is a netdb.h system
12074 set netdb.h i_netdb
12075 eval $inhdr
12076
12077 : see if endhostent_r exists
12078 set endhostent_r d_endhostent_r
12079 eval $inlibc
12080 case "$d_endhostent_r" in
12081 "$define")
12082         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12083         case "$d_endhostent_r_proto:$usethreads" in
12084         ":define")      d_endhostent_r_proto=define
12085                 set d_endhostent_r_proto endhostent_r $hdrs
12086                 eval $hasproto ;;
12087         *)      ;;
12088         esac
12089         case "$d_endhostent_r_proto" in
12090         define)
12091         case "$endhostent_r_proto" in
12092         ''|0) try='int endhostent_r(struct hostent_data*);'
12093         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12094         esac
12095         case "$endhostent_r_proto" in
12096         ''|0) try='void endhostent_r(struct hostent_data*);'
12097         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12098         esac
12099         case "$endhostent_r_proto" in
12100         ''|0)   d_endhostent_r=undef
12101                 endhostent_r_proto=0
12102                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12103         * )     case "$endhostent_r_proto" in
12104                 REENTRANT_PROTO*) ;;
12105                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12106                 esac
12107                 echo "Prototype: $try" ;;
12108         esac
12109         ;;
12110         *)      case "$usethreads" in
12111                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12112                 esac
12113                 d_endhostent_r=undef
12114                 endhostent_r_proto=0
12115                 ;;
12116         esac
12117         ;;
12118 *)      endhostent_r_proto=0
12119         ;;
12120 esac
12121
12122 : see if endnetent exists
12123 set endnetent d_endnent
12124 eval $inlibc
12125
12126 : see if endnetent_r exists
12127 set endnetent_r d_endnetent_r
12128 eval $inlibc
12129 case "$d_endnetent_r" in
12130 "$define")
12131         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12132         case "$d_endnetent_r_proto:$usethreads" in
12133         ":define")      d_endnetent_r_proto=define
12134                 set d_endnetent_r_proto endnetent_r $hdrs
12135                 eval $hasproto ;;
12136         *)      ;;
12137         esac
12138         case "$d_endnetent_r_proto" in
12139         define)
12140         case "$endnetent_r_proto" in
12141         ''|0) try='int endnetent_r(struct netent_data*);'
12142         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12143         esac
12144         case "$endnetent_r_proto" in
12145         ''|0) try='void endnetent_r(struct netent_data*);'
12146         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12147         esac
12148         case "$endnetent_r_proto" in
12149         ''|0)   d_endnetent_r=undef
12150                 endnetent_r_proto=0
12151                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12152         * )     case "$endnetent_r_proto" in
12153                 REENTRANT_PROTO*) ;;
12154                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12155                 esac
12156                 echo "Prototype: $try" ;;
12157         esac
12158         ;;
12159         *)      case "$usethreads" in
12160                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12161                 esac
12162                 d_endnetent_r=undef
12163                 endnetent_r_proto=0
12164                 ;;
12165         esac
12166         ;;
12167 *)      endnetent_r_proto=0
12168         ;;
12169 esac
12170
12171 : see if endprotoent exists
12172 set endprotoent d_endpent
12173 eval $inlibc
12174
12175 : see if endprotoent_r exists
12176 set endprotoent_r d_endprotoent_r
12177 eval $inlibc
12178 case "$d_endprotoent_r" in
12179 "$define")
12180         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12181         case "$d_endprotoent_r_proto:$usethreads" in
12182         ":define")      d_endprotoent_r_proto=define
12183                 set d_endprotoent_r_proto endprotoent_r $hdrs
12184                 eval $hasproto ;;
12185         *)      ;;
12186         esac
12187         case "$d_endprotoent_r_proto" in
12188         define)
12189         case "$endprotoent_r_proto" in
12190         ''|0) try='int endprotoent_r(struct protoent_data*);'
12191         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12192         esac
12193         case "$endprotoent_r_proto" in
12194         ''|0) try='void endprotoent_r(struct protoent_data*);'
12195         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12196         esac
12197         case "$endprotoent_r_proto" in
12198         ''|0)   d_endprotoent_r=undef
12199                 endprotoent_r_proto=0
12200                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12201         * )     case "$endprotoent_r_proto" in
12202                 REENTRANT_PROTO*) ;;
12203                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12204                 esac
12205                 echo "Prototype: $try" ;;
12206         esac
12207         ;;
12208         *)      case "$usethreads" in
12209                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12210                 esac
12211                 d_endprotoent_r=undef
12212                 endprotoent_r_proto=0
12213                 ;;
12214         esac
12215         ;;
12216 *)      endprotoent_r_proto=0
12217         ;;
12218 esac
12219
12220 : see if endpwent exists
12221 set endpwent d_endpwent
12222 eval $inlibc
12223
12224 : see if this is a pwd.h system
12225 set pwd.h i_pwd
12226 eval $inhdr
12227
12228 case "$i_pwd" in
12229 $define)
12230         xxx=`./findhdr pwd.h`
12231         $cppstdin $cppflags $cppminus < $xxx >$$.h
12232
12233         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12234                 val="$define"
12235         else
12236                 val="$undef"
12237         fi
12238         set d_pwquota
12239         eval $setvar
12240
12241         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12242                 val="$define"
12243         else
12244                 val="$undef"
12245         fi
12246         set d_pwage
12247         eval $setvar
12248
12249         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12250                 val="$define"
12251         else
12252                 val="$undef"
12253         fi
12254         set d_pwchange
12255         eval $setvar
12256
12257         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12258                 val="$define"
12259         else
12260                 val="$undef"
12261         fi
12262         set d_pwclass
12263         eval $setvar
12264
12265         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12266                 val="$define"
12267         else
12268                 val="$undef"
12269         fi
12270         set d_pwexpire
12271         eval $setvar
12272
12273         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12274                 val="$define"
12275         else
12276                 val="$undef"
12277         fi
12278         set d_pwcomment
12279         eval $setvar
12280
12281         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12282                 val="$define"
12283         else
12284                 val="$undef"
12285         fi
12286         set d_pwgecos
12287         eval $setvar
12288
12289         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12290                 val="$define"
12291         else
12292                 val="$undef"
12293         fi
12294         set d_pwpasswd
12295         eval $setvar
12296
12297         $rm -f $$.h
12298         ;;
12299 *)
12300         val="$undef"; 
12301         set d_pwquota; eval $setvar
12302         set d_pwage; eval $setvar
12303         set d_pwchange; eval $setvar
12304         set d_pwclass; eval $setvar
12305         set d_pwexpire; eval $setvar
12306         set d_pwcomment; eval $setvar
12307         set d_pwgecos; eval $setvar
12308         set d_pwpasswd; eval $setvar
12309         ;;
12310 esac
12311
12312 : see if endpwent_r exists
12313 set endpwent_r d_endpwent_r
12314 eval $inlibc
12315 case "$d_endpwent_r" in
12316 "$define")
12317         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12318         case "$d_endpwent_r_proto:$usethreads" in
12319         ":define")      d_endpwent_r_proto=define
12320                 set d_endpwent_r_proto endpwent_r $hdrs
12321                 eval $hasproto ;;
12322         *)      ;;
12323         esac
12324         case "$d_endpwent_r_proto" in
12325         define)
12326         case "$endpwent_r_proto" in
12327         ''|0) try='int endpwent_r(FILE**);'
12328         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12329         esac
12330         case "$endpwent_r_proto" in
12331         ''|0) try='void endpwent_r(FILE**);'
12332         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12333         esac
12334         case "$endpwent_r_proto" in
12335         ''|0)   d_endpwent_r=undef
12336                 endpwent_r_proto=0
12337                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12338         * )     case "$endpwent_r_proto" in
12339                 REENTRANT_PROTO*) ;;
12340                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12341                 esac
12342                 echo "Prototype: $try" ;;
12343         esac
12344         ;;
12345         *)      case "$usethreads" in
12346                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12347                 esac
12348                 d_endpwent_r=undef
12349                 endpwent_r_proto=0
12350                 ;;
12351         esac
12352         ;;
12353 *)      endpwent_r_proto=0
12354         ;;
12355 esac
12356
12357 : see if endservent exists
12358 set endservent d_endsent
12359 eval $inlibc
12360
12361 : see if endservent_r exists
12362 set endservent_r d_endservent_r
12363 eval $inlibc
12364 case "$d_endservent_r" in
12365 "$define")
12366         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12367         case "$d_endservent_r_proto:$usethreads" in
12368         ":define")      d_endservent_r_proto=define
12369                 set d_endservent_r_proto endservent_r $hdrs
12370                 eval $hasproto ;;
12371         *)      ;;
12372         esac
12373         case "$d_endservent_r_proto" in
12374         define)
12375         case "$endservent_r_proto" in
12376         ''|0) try='int endservent_r(struct servent_data*);'
12377         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12378         esac
12379         case "$endservent_r_proto" in
12380         ''|0) try='void endservent_r(struct servent_data*);'
12381         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12382         esac
12383         case "$endservent_r_proto" in
12384         ''|0)   d_endservent_r=undef
12385                 endservent_r_proto=0
12386                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12387         * )     case "$endservent_r_proto" in
12388                 REENTRANT_PROTO*) ;;
12389                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12390                 esac
12391                 echo "Prototype: $try" ;;
12392         esac
12393         ;;
12394         *)      case "$usethreads" in
12395                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12396                 esac
12397                 d_endservent_r=undef
12398                 endservent_r_proto=0
12399                 ;;
12400         esac
12401         ;;
12402 *)      endservent_r_proto=0
12403         ;;
12404 esac
12405
12406 : Locate the flags for 'open()'
12407 echo " "
12408 $cat >try.c <<EOCP
12409 #include <sys/types.h>
12410 #ifdef I_FCNTL
12411 #include <fcntl.h>
12412 #endif
12413 #ifdef I_SYS_FILE
12414 #include <sys/file.h>
12415 #endif
12416 #$i_stdlib I_STDLIB
12417 #ifdef I_STDLIB
12418 #include <stdlib.h>
12419 #endif
12420 int main() {
12421         if(O_RDONLY);
12422 #ifdef O_TRUNC
12423         exit(0);
12424 #else
12425         exit(1);
12426 #endif
12427 }
12428 EOCP
12429 : check sys/file.h first to get FREAD on Sun
12430 if $test `./findhdr sys/file.h` && \
12431                 set try -DI_SYS_FILE && eval $compile; then
12432         h_sysfile=true;
12433         echo "<sys/file.h> defines the O_* constants..." >&4
12434         if $run ./try; then
12435                 echo "and you have the 3 argument form of open()." >&4
12436                 val="$define"
12437         else
12438                 echo "but not the 3 argument form of open().  Oh, well." >&4
12439                 val="$undef"
12440         fi
12441 elif $test `./findhdr fcntl.h` && \
12442                 set try -DI_FCNTL && eval $compile; then
12443         h_fcntl=true;
12444         echo "<fcntl.h> defines the O_* constants..." >&4
12445         if $run ./try; then
12446                 echo "and you have the 3 argument form of open()." >&4
12447                 val="$define"
12448         else
12449                 echo "but not the 3 argument form of open().  Oh, well." >&4
12450                 val="$undef"
12451         fi
12452 else
12453         val="$undef"
12454         echo "I can't find the O_* constant definitions!  You got problems." >&4
12455 fi
12456 set d_open3
12457 eval $setvar
12458 $rm_try
12459
12460 : see if this is a sys/file.h system
12461 val=''
12462 set sys/file.h val
12463 eval $inhdr
12464
12465 : do we need to include sys/file.h ?
12466 case "$val" in
12467 "$define")
12468         echo " "
12469         if $h_sysfile; then
12470                 val="$define"
12471                 echo "We'll be including <sys/file.h>." >&4
12472         else
12473                 val="$undef"
12474                 echo "We won't be including <sys/file.h>." >&4
12475         fi
12476         ;;
12477 *)
12478         h_sysfile=false
12479         ;;
12480 esac
12481 set i_sysfile
12482 eval $setvar
12483
12484 : see if fcntl.h is there
12485 val=''
12486 set fcntl.h val
12487 eval $inhdr
12488
12489 : see if we can include fcntl.h
12490 case "$val" in
12491 "$define")
12492         echo " "
12493         if $h_fcntl; then
12494                 val="$define"
12495                 echo "We'll be including <fcntl.h>." >&4
12496         else
12497                 val="$undef"
12498                 if $h_sysfile; then
12499         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12500                 else
12501                         echo "We won't be including <fcntl.h>." >&4
12502                 fi
12503         fi
12504         ;;
12505 *)
12506         h_fcntl=false
12507         val="$undef"
12508         ;;
12509 esac
12510 set i_fcntl
12511 eval $setvar
12512
12513 : see if fork exists
12514 set fork d_fork
12515 eval $inlibc
12516
12517 : see if pipe exists
12518 set pipe d_pipe
12519 eval $inlibc
12520
12521 : check for non-blocking I/O stuff
12522 case "$h_sysfile" in
12523 true) echo "#include <sys/file.h>" > head.c;;
12524 *)
12525        case "$h_fcntl" in
12526        true) echo "#include <fcntl.h>" > head.c;;
12527        *) echo "#include <sys/fcntl.h>" > head.c;;
12528        esac
12529        ;;
12530 esac
12531 echo " "
12532 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12533 case "$o_nonblock" in
12534 '')
12535         $cat head.c > try.c
12536         $cat >>try.c <<EOCP
12537 #include <stdio.h>
12538 #$i_stdlib I_STDLIB
12539 #ifdef I_STDLIB
12540 #include <stdlib.h>
12541 #endif
12542 #$i_fcntl I_FCNTL
12543 #ifdef I_FCNTL
12544 #include <fcntl.h>
12545 #endif
12546 int main() {
12547 #ifdef O_NONBLOCK
12548         printf("O_NONBLOCK\n");
12549         exit(0);
12550 #endif
12551 #ifdef O_NDELAY
12552         printf("O_NDELAY\n");
12553         exit(0);
12554 #endif
12555 #ifdef FNDELAY
12556         printf("FNDELAY\n");
12557         exit(0);
12558 #endif
12559         exit(0);
12560 }
12561 EOCP
12562         set try
12563         if eval $compile_ok; then
12564                 o_nonblock=`$run ./try`
12565                 case "$o_nonblock" in
12566                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12567                 *) echo "Seems like we can use $o_nonblock.";;
12568                 esac
12569         else
12570                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12571         fi
12572         ;;
12573 *) echo "Using $hint value $o_nonblock.";;
12574 esac
12575 $rm_try
12576
12577 echo " "
12578 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12579 case "$eagain" in
12580 '')
12581         case "$d_fork:$d_pipe" in
12582         define:define)
12583         $cat head.c > try.c
12584         $cat >>try.c <<EOCP
12585 #include <errno.h>
12586 #include <sys/types.h>
12587 #include <signal.h>
12588 #include <stdio.h>
12589 #$i_stdlib I_STDLIB
12590 #ifdef I_STDLIB
12591 #include <stdlib.h>
12592 #endif
12593 #$i_fcntl I_FCNTL
12594 #ifdef I_FCNTL
12595 #include <fcntl.h>
12596 #endif
12597 #define MY_O_NONBLOCK $o_nonblock
12598 #ifndef errno  /* XXX need better Configure test */
12599 extern int errno;
12600 #endif
12601 #$i_unistd I_UNISTD
12602 #ifdef I_UNISTD
12603 #include <unistd.h>
12604 #endif
12605 #$i_string I_STRING
12606 #ifdef I_STRING
12607 #include <string.h>
12608 #else
12609 #include <strings.h>
12610 #endif
12611 $signal_t blech(int x) { exit(3); }
12612 EOCP
12613         $cat >> try.c <<'EOCP'
12614 int main()
12615 {
12616         int pd[2];
12617         int pu[2];
12618         char buf[1];
12619         char string[100];
12620
12621         pipe(pd);       /* Down: child -> parent */
12622         pipe(pu);       /* Up: parent -> child */
12623         if (0 != fork()) {
12624                 int ret;
12625                 close(pd[1]);   /* Parent reads from pd[0] */
12626                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12627 #ifdef F_SETFL
12628                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12629                         exit(1);
12630 #else
12631                 exit(4);
12632 #endif
12633                 signal(SIGALRM, blech);
12634                 alarm(5);
12635                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12636                         exit(2);
12637                 sprintf(string, "%d\n", ret);
12638                 write(2, string, strlen(string));
12639                 alarm(0);
12640 #ifdef EAGAIN
12641                 if (errno == EAGAIN) {
12642                         printf("EAGAIN\n");
12643                         goto ok;
12644                 }
12645 #endif
12646 #ifdef EWOULDBLOCK
12647                 if (errno == EWOULDBLOCK)
12648                         printf("EWOULDBLOCK\n");
12649 #endif
12650         ok:
12651                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12652                 sleep(2);                               /* Give it time to close our pipe */
12653                 alarm(5);
12654                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12655                 alarm(0);
12656                 sprintf(string, "%d\n", ret);
12657                 write(4, string, strlen(string));
12658                 exit(0);
12659         }
12660
12661         close(pd[0]);                   /* We write to pd[1] */
12662         close(pu[1]);                   /* We read from pu[0] */
12663         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12664         close(pd[1]);                   /* Pipe pd is now fully closed! */
12665         exit(0);                                /* Bye bye, thank you for playing! */
12666 }
12667 EOCP
12668         set try
12669         if eval $compile_ok; then
12670                 echo "$startsh" >mtry
12671                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12672                 chmod +x mtry
12673                 ./mtry >/dev/null 2>&1
12674                 case $? in
12675                 0) eagain=`$cat try.out`;;
12676                 1) echo "Could not perform non-blocking setting!";;
12677                 2) echo "I did a successful read() for something that was not there!";;
12678                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12679                 4) echo "Could not find F_SETFL!";;
12680                 *) echo "Something terribly wrong happened during testing.";;
12681                 esac
12682                 rd_nodata=`$cat try.ret`
12683                 echo "A read() system call with no data present returns $rd_nodata."
12684                 case "$rd_nodata" in
12685                 0|-1) ;;
12686                 *)
12687                         echo "(That's peculiar, fixing that to be -1.)"
12688                         rd_nodata=-1
12689                         ;;
12690                 esac
12691                 case "$eagain" in
12692                 '')
12693                         echo "Forcing errno EAGAIN on read() with no data available."
12694                         eagain=EAGAIN
12695                         ;;
12696                 *)
12697                         echo "Your read() sets errno to $eagain when no data is available."
12698                         ;;
12699                 esac
12700                 status=`$cat try.err`
12701                 case "$status" in
12702                 0) echo "And it correctly returns 0 to signal EOF.";;
12703                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12704                 *) echo "However, your read() returns '$status' on EOF??";;
12705                 esac
12706                 val="$define"
12707                 if test "$status" = "$rd_nodata"; then
12708                         echo "WARNING: you can't distinguish between EOF and no data!"
12709                         val="$undef"
12710                 fi
12711         else
12712                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12713                 eagain=EAGAIN
12714         fi
12715         ;;
12716         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12717                 eagain=EAGAIN
12718                 val="$define"
12719                 ;;
12720         esac
12721         set d_eofnblk
12722         eval $setvar
12723         ;;
12724 *)
12725         echo "Using $hint value $eagain."
12726         echo "Your read() returns $rd_nodata when no data is present."
12727         case "$d_eofnblk" in
12728         "$define") echo "And you can see EOF because read() returns 0.";;
12729         "$undef") echo "But you can't see EOF status from read() returned value.";;
12730         *)
12731                 echo "(Assuming you can't see EOF status from read anyway.)"
12732                 d_eofnblk=$undef
12733                 ;;
12734         esac
12735         ;;
12736 esac
12737 $rm_try head.c mtry
12738
12739 : see if _ptr and _cnt from stdio act std
12740 echo " "
12741
12742 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12743         echo "(Looks like you have stdio.h from BSD.)"
12744         case "$stdio_ptr" in
12745         '') stdio_ptr='((fp)->_p)'
12746                 ptr_lval=$define
12747                 ;;
12748         *)      ptr_lval=$d_stdio_ptr_lval;;
12749         esac
12750         case "$stdio_cnt" in
12751         '') stdio_cnt='((fp)->_r)'
12752                 cnt_lval=$define
12753                 ;;
12754         *)      cnt_lval=$d_stdio_cnt_lval;;
12755         esac
12756         case "$stdio_base" in
12757         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12758         esac
12759         case "$stdio_bufsiz" in
12760         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12761         esac
12762 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12763         echo "(Looks like you have stdio.h from Linux.)"
12764         case "$stdio_ptr" in
12765         '') stdio_ptr='((fp)->_IO_read_ptr)'
12766                 ptr_lval=$define
12767                 ;;
12768         *)      ptr_lval=$d_stdio_ptr_lval;;
12769         esac
12770         case "$stdio_cnt" in
12771         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12772                 cnt_lval=$undef
12773                 ;;
12774         *)      cnt_lval=$d_stdio_cnt_lval;;
12775         esac
12776         case "$stdio_base" in
12777         '') stdio_base='((fp)->_IO_read_base)';;
12778         esac
12779         case "$stdio_bufsiz" in
12780         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12781         esac
12782 else
12783         case "$stdio_ptr" in
12784         '') stdio_ptr='((fp)->_ptr)'
12785                 ptr_lval=$define
12786                 ;;
12787         *)      ptr_lval=$d_stdio_ptr_lval;;
12788         esac
12789         case "$stdio_cnt" in
12790         '') stdio_cnt='((fp)->_cnt)'
12791                 cnt_lval=$define
12792                 ;;
12793         *)      cnt_lval=$d_stdio_cnt_lval;;
12794         esac
12795         case "$stdio_base" in
12796         '') stdio_base='((fp)->_base)';;
12797         esac
12798         case "$stdio_bufsiz" in
12799         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12800         esac
12801 fi
12802
12803 : test whether _ptr and _cnt really work
12804 echo "Checking how std your stdio is..." >&4
12805 $cat >try.c <<EOP
12806 #include <stdio.h>
12807 #$i_stdlib I_STDLIB
12808 #ifdef I_STDLIB
12809 #include <stdlib.h>
12810 #endif
12811 #define FILE_ptr(fp)    $stdio_ptr
12812 #define FILE_cnt(fp)    $stdio_cnt
12813 int main() {
12814         FILE *fp = fopen("try.c", "r");
12815         char c = getc(fp);
12816         if (
12817                 18 <= FILE_cnt(fp) &&
12818                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12819         )
12820                 exit(0);
12821         exit(1);
12822 }
12823 EOP
12824 val="$undef"
12825 set try
12826 if eval $compile && $to try.c; then
12827         if $run ./try; then
12828                 echo "Your stdio acts pretty std."
12829                 val="$define"
12830         else
12831                 echo "Your stdio isn't very std."
12832         fi
12833 else
12834         echo "Your stdio doesn't appear very std."
12835 fi
12836 $rm_try
12837
12838 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12839 # direct buffer manipulation no longer works.  The Configure tests
12840 # should be changed to correctly detect this, but until then,
12841 # the following check should at least let perl compile and run.
12842 # (This quick fix should be updated before 5.8.1.)
12843 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12844 # A. Dougherty, June 3, 2002.
12845 case "$d_gnulibc" in
12846 $define)
12847         case "$gnulibc_version" in
12848         2.[01]*)  ;;
12849         2.2) ;;
12850         2.2.[0-9]) ;;
12851         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12852                 val="$undef"
12853                 ;;
12854         esac
12855         ;;
12856 esac
12857 set d_stdstdio
12858 eval $setvar
12859
12860 : Can _ptr be used as an lvalue?
12861 case "$d_stdstdio$ptr_lval" in
12862 $define$define) val=$define ;;
12863 *) val=$undef ;;
12864 esac
12865 set d_stdio_ptr_lval
12866 eval $setvar
12867
12868 : Can _cnt be used as an lvalue?
12869 case "$d_stdstdio$cnt_lval" in
12870 $define$define) val=$define ;;
12871 *) val=$undef ;;
12872 esac
12873 set d_stdio_cnt_lval
12874 eval $setvar
12875
12876
12877 : test whether setting _ptr sets _cnt as a side effect
12878 d_stdio_ptr_lval_sets_cnt="$undef"
12879 d_stdio_ptr_lval_nochange_cnt="$undef"
12880 case "$d_stdio_ptr_lval$d_stdstdio" in
12881 $define$define)
12882         echo "Checking to see what happens if we set the stdio ptr..." >&4
12883 $cat >try.c <<EOP
12884 #include <stdio.h>
12885 /* Can we scream? */
12886 /* Eat dust sed :-) */
12887 /* In the buffer space, no one can hear you scream. */
12888 #$i_stdlib I_STDLIB
12889 #ifdef I_STDLIB
12890 #include <stdlib.h>
12891 #endif
12892 #define FILE_ptr(fp)    $stdio_ptr
12893 #define FILE_cnt(fp)    $stdio_cnt
12894 #include <sys/types.h>
12895 int main() {
12896         FILE *fp = fopen("try.c", "r");
12897         int c;
12898         char *ptr;
12899         size_t cnt;
12900         if (!fp) {
12901             puts("Fail even to read");
12902             exit(1);
12903         }
12904         c = getc(fp); /* Read away the first # */
12905         if (c == EOF) {
12906             puts("Fail even to read");
12907             exit(1);
12908         }
12909         if (!(
12910                 18 <= FILE_cnt(fp) &&
12911                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12912         )) {
12913                 puts("Fail even to read");
12914                 exit (1);
12915         }
12916         ptr = (char*) FILE_ptr(fp);
12917         cnt = (size_t)FILE_cnt(fp);
12918
12919         FILE_ptr(fp) += 42;
12920
12921         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12922                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12923                 exit (1);
12924         }
12925         if (FILE_cnt(fp) <= 20) {
12926                 printf ("Fail (<20 chars to test)");
12927                 exit (1);
12928         }
12929         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12930                 puts("Fail compare");
12931                 exit (1);
12932         }
12933         if (cnt == FILE_cnt(fp)) {
12934                 puts("Pass_unchanged");
12935                 exit (0);
12936         }
12937         if (FILE_cnt(fp) == (cnt - 42)) {
12938                 puts("Pass_changed");
12939                 exit (0);
12940         }
12941         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12942         return 1;
12943
12944 }
12945 EOP
12946         set try
12947         if eval $compile && $to try.c; then
12948                 case `$run ./try` in
12949                 Pass_changed)
12950                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12951                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12952                 Pass_unchanged)
12953                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12954                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12955                 Fail*)
12956                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12957                 *)
12958                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12959         esac
12960         else
12961                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12962         fi
12963         $rm_try
12964         ;;
12965 esac
12966
12967 : see if _base is also standard
12968 val="$undef"
12969 case "$d_stdstdio" in
12970 $define)
12971         $cat >try.c <<EOP
12972 #include <stdio.h>
12973 #$i_stdlib I_STDLIB
12974 #ifdef I_STDLIB
12975 #include <stdlib.h>
12976 #endif
12977 #define FILE_base(fp)   $stdio_base
12978 #define FILE_bufsiz(fp) $stdio_bufsiz
12979 int main() {
12980         FILE *fp = fopen("try.c", "r");
12981         char c = getc(fp);
12982         if (
12983                 19 <= FILE_bufsiz(fp) &&
12984                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12985         )
12986                 exit(0);
12987         exit(1);
12988 }
12989 EOP
12990         set try
12991         if eval $compile && $to try.c; then
12992                 if $run ./try; then
12993                         echo "And its _base field acts std."
12994                         val="$define"
12995                 else
12996                         echo "But its _base field isn't std."
12997                 fi
12998         else
12999                 echo "However, it seems to be lacking the _base field."
13000         fi
13001         $rm_try
13002         ;;
13003 esac
13004 set d_stdiobase
13005 eval $setvar
13006
13007 : see if fast_stdio exists
13008 val="$undef"
13009 case "$d_stdstdio:$d_stdio_ptr_lval" in
13010 "$define:$define")
13011         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13012         *$define*)
13013                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13014                 val="$define"
13015                 ;;
13016         esac
13017         ;;
13018 esac
13019 set d_faststdio
13020 eval $setvar
13021
13022
13023
13024 : see if fchdir exists
13025 set fchdir d_fchdir
13026 eval $inlibc
13027
13028 : see if fchmod exists
13029 set fchmod d_fchmod
13030 eval $inlibc
13031
13032 : see if fchown exists
13033 set fchown d_fchown
13034 eval $inlibc
13035
13036 : see if this is an fcntl system
13037 set fcntl d_fcntl
13038 eval $inlibc
13039
13040 : See if fcntl-based locking works.
13041 echo " "
13042 $cat >try.c <<EOCP
13043 #$i_stdlib I_STDLIB
13044 #ifdef I_STDLIB
13045 #include <stdlib.h>
13046 #endif
13047 #include <unistd.h>
13048 #include <fcntl.h>
13049 #include <signal.h>
13050 $signal_t blech(int x) { exit(3); }
13051 int main() {
13052 #if defined(F_SETLK) && defined(F_SETLKW)
13053      struct flock flock;
13054      int retval, fd;
13055      fd = open("try.c", O_RDONLY);
13056      flock.l_type = F_RDLCK;
13057      flock.l_whence = SEEK_SET;
13058      flock.l_start = flock.l_len = 0;
13059      signal(SIGALRM, blech);
13060      alarm(10);
13061      retval = fcntl(fd, F_SETLK, &flock);
13062      close(fd);
13063      (retval < 0 ? exit(2) : exit(0));
13064 #else
13065      exit(2);
13066 #endif
13067 }
13068 EOCP
13069 echo "Checking if fcntl-based file locking works... "
13070 case "$d_fcntl" in
13071 "$define")
13072         set try
13073         if eval $compile_ok; then
13074                 if $run ./try; then
13075                         echo "Yes, it seems to work."
13076                         val="$define"
13077                 else
13078                         echo "Nope, it didn't work."
13079                         val="$undef"
13080                         case "$?" in
13081                         3) $cat >&4 <<EOM
13082 ***
13083 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13084 *** This is (almost) impossible.
13085 *** If your NFS lock daemons are not feeling well, something like
13086 *** this may happen, please investigate.  Cannot continue, aborting.
13087 ***
13088 EOM
13089                                 exit 1
13090                                 ;;
13091                         esac
13092                 fi
13093         else
13094                 echo "I'm unable to compile the test program, so I'll assume not."
13095                 val="$undef"
13096         fi
13097         ;;
13098 *) val="$undef";
13099         echo "Nope, since you don't even have fcntl()."
13100         ;;
13101 esac
13102 set d_fcntl_can_lock
13103 eval $setvar
13104 $rm_try
13105
13106 : check for fd_set items
13107 $cat <<EOM
13108
13109 Checking to see how well your C compiler handles fd_set and friends ...
13110 EOM
13111 $cat >try.c <<EOCP
13112 #$i_stdlib I_STDLIB
13113 #ifdef I_STDLIB
13114 #include <stdlib.h>
13115 #endif
13116 #$i_systime I_SYS_TIME
13117 #$i_sysselct I_SYS_SELECT
13118 #$d_socket HAS_SOCKET
13119 #include <sys/types.h>
13120 #ifdef HAS_SOCKET
13121 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13122 #endif
13123 #ifdef I_SYS_TIME
13124 #include <sys/time.h>
13125 #endif
13126 #ifdef I_SYS_SELECT
13127 #include <sys/select.h>
13128 #endif
13129 int main() {
13130         fd_set fds;
13131
13132 #ifdef TRYBITS
13133         if(fds.fds_bits);
13134 #endif
13135
13136 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13137         exit(0);
13138 #else
13139         exit(1);
13140 #endif
13141 }
13142 EOCP
13143 set try -DTRYBITS
13144 if eval $compile; then
13145         d_fds_bits="$define"
13146         d_fd_set="$define"
13147         echo "Well, your system knows about the normal fd_set typedef..." >&4
13148         if $run ./try; then
13149                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13150                 d_fd_macros="$define"
13151         else
13152                 $cat >&4 <<'EOM'
13153 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13154 EOM
13155                 d_fd_macros="$undef"
13156         fi
13157 else
13158         $cat <<'EOM'
13159 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13160 EOM
13161         set try
13162         if eval $compile; then
13163                 d_fds_bits="$undef"
13164                 d_fd_set="$define"
13165                 echo "Well, your system has some sort of fd_set available..." >&4
13166                 if $run ./try; then
13167                         echo "and you have the normal fd_set macros." >&4
13168                         d_fd_macros="$define"
13169                 else
13170                         $cat <<'EOM'
13171 but not the normal fd_set macros!  Gross!  More work for me...
13172 EOM
13173                         d_fd_macros="$undef"
13174                 fi
13175         else
13176         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13177                 d_fd_set="$undef"
13178                 d_fds_bits="$undef"
13179                 d_fd_macros="$undef"
13180         fi
13181 fi
13182 $rm_try
13183
13184 : see if fgetpos exists
13185 set fgetpos d_fgetpos
13186 eval $inlibc
13187
13188 : see if finite exists
13189 set finite d_finite
13190 eval $inlibc
13191
13192 : see if finitel exists
13193 set finitel d_finitel
13194 eval $inlibc
13195
13196 : see if flock exists
13197 set flock d_flock
13198 eval $inlibc
13199
13200 : see if prototype for flock is available
13201 echo " "
13202 set d_flockproto flock $i_sysfile sys/file.h
13203 eval $hasproto
13204
13205 : see if fp_class exists
13206 set fp_class d_fp_class
13207 eval $inlibc
13208
13209 : see if pathconf exists
13210 set pathconf d_pathconf
13211 eval $inlibc
13212
13213 : see if fpathconf exists
13214 set fpathconf d_fpathconf
13215 eval $inlibc
13216
13217 : see if fpclass exists
13218 set fpclass d_fpclass
13219 eval $inlibc
13220
13221 : see if fpclassify exists
13222 set fpclassify d_fpclassify
13223 eval $inlibc
13224
13225 : see if fpclassl exists
13226 set fpclassl d_fpclassl
13227 eval $inlibc
13228
13229 : check for fpos64_t
13230 echo " "
13231 echo "Checking to see if you have fpos64_t..." >&4
13232 $cat >try.c <<EOCP
13233 #include <stdio.h>
13234 int main() { fpos64_t x = 7; }
13235 EOCP
13236 set try
13237 if eval $compile; then
13238         val="$define"
13239         echo "You have fpos64_t."
13240 else
13241         val="$undef"
13242         echo "You do not have fpos64_t."
13243         case "$fpossize" in
13244         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13245         esac
13246 fi
13247 $rm_try
13248 set d_fpos64_t
13249 eval $setvar
13250
13251 : see if frexpl exists
13252 set frexpl d_frexpl
13253 eval $inlibc
13254
13255 : see if this is a sys/param system
13256 set sys/param.h i_sysparam
13257 eval $inhdr
13258
13259 : see if this is a sys/mount.h system
13260 set sys/mount.h i_sysmount
13261 eval $inhdr
13262
13263 : Check for fs_data_s
13264 echo " "
13265 echo "Checking to see if your system supports struct fs_data..." >&4
13266 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13267 eval $hasstruct
13268 case "$d_fs_data_s" in
13269 "$define")      echo "Yes, it does."   ;;
13270 *)              echo "No, it doesn't." ;;
13271 esac
13272
13273 : see if fseeko exists
13274 set fseeko d_fseeko
13275 eval $inlibc
13276 case "$longsize" in
13277 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13278 esac
13279
13280 : see if fsetpos exists
13281 set fsetpos d_fsetpos
13282 eval $inlibc
13283
13284 : see if fstatfs exists
13285 set fstatfs d_fstatfs
13286 eval $inlibc
13287
13288 : see if statvfs exists
13289 set statvfs d_statvfs
13290 eval $inlibc
13291
13292 : see if fstatvfs exists
13293 set fstatvfs d_fstatvfs
13294 eval $inlibc
13295
13296
13297 : see if fsync exists
13298 set fsync d_fsync
13299 eval $inlibc
13300
13301 : see if ftello exists
13302 set ftello d_ftello
13303 eval $inlibc
13304 case "$longsize" in
13305 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13306 esac
13307
13308 : check for a working futimes
13309 d_futimes="$undef"
13310 echo " "
13311 echo "Checking if you have a working futimes()" >&4
13312 $cat >try.c <<EOCP
13313 #include <stdio.h>
13314 #include <sys/time.h>
13315 #include <errno.h>
13316 #include <fcntl.h>
13317
13318 int main ()
13319 {
13320     int fd, rv;
13321     fd = open ("try.c", O_RDWR);
13322     if (-1 == fd) exit (1);
13323     rv = futimes (fd, NULL);
13324     exit (rv == -1 ? errno : 0);
13325 }
13326 EOCP
13327 set try
13328 if eval $compile; then
13329     `$run ./try`
13330     rc=$?
13331     case "$rc" in
13332         0)  echo "Yes, you have" >&4
13333             d_futimes="$define"
13334             ;;
13335         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13336             ;;
13337     esac
13338 else
13339     echo "No, it does not (probably harmless)" >&4
13340 fi
13341 $rm_try
13342
13343 : see if ndbm.h is available
13344 set ndbm.h i_ndbm
13345 eval $inhdr
13346 : Compatibility location for RedHat 7.1
13347 set gdbm/ndbm.h i_gdbmndbm
13348 eval $inhdr
13349 : Compatibility location for Debian 4.0
13350 set gdbm-ndbm.h i_gdbm_ndbm
13351 eval $inhdr
13352
13353 val="$undef"
13354 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13355         : see if dbm_open exists
13356         set dbm_open d_dbm_open
13357         eval $inlibc
13358         case "$d_dbm_open" in
13359         $undef)
13360                 i_ndbm="$undef"
13361                 i_gdbmndbm="$undef"
13362                 i_gdbm_ndbm="$undef"
13363                 echo "We won't be including <ndbm.h>"
13364                 val="$undef"
13365                 ;;
13366         *) val="$define"
13367            ;;
13368         esac
13369 fi
13370 set d_ndbm
13371 eval $setvar
13372
13373 ndbm_hdr_protochk='name=$1; hdr=$2;
13374 eval "ihdr=\$""i_$name";
13375 val="$undef";
13376 if $test "$ihdr" = "$define"; then
13377         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13378         case "$d_cplusplus" in
13379         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13380         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13381         esac;
13382         case "$val" in
13383         $define) $echo "Your <$hdr> seems to have prototypes";;
13384         *) $echo "Your <$hdr> does not seem to have prototypes";;
13385         esac;
13386 fi;
13387 set "d_${name}_h_uses_prototypes";
13388 eval $setvar'
13389
13390 set ndbm ndbm.h
13391 eval $ndbm_hdr_protochk
13392 set gdbmndbm gdbm/ndbm.h
13393 eval $ndbm_hdr_protochk
13394 set gdbm_ndbm gdbm-ndbm.h
13395 eval $ndbm_hdr_protochk
13396
13397 : see if getcwd exists
13398 set getcwd d_getcwd
13399 eval $inlibc
13400
13401 : see if getespwnam exists
13402 set getespwnam d_getespwnam
13403 eval $inlibc
13404
13405 : see if getfsstat exists
13406 set getfsstat d_getfsstat
13407 eval $inlibc
13408
13409 : see if getgrent exists
13410 set getgrent d_getgrent
13411 eval $inlibc
13412
13413 : see if getgrent_r exists
13414 set getgrent_r d_getgrent_r
13415 eval $inlibc
13416 case "$d_getgrent_r" in
13417 "$define")
13418         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13419         case "$d_getgrent_r_proto:$usethreads" in
13420         ":define")      d_getgrent_r_proto=define
13421                 set d_getgrent_r_proto getgrent_r $hdrs
13422                 eval $hasproto ;;
13423         *)      ;;
13424         esac
13425         case "$d_getgrent_r_proto" in
13426         define)
13427         case "$getgrent_r_proto" in
13428         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13429         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13430         esac
13431         case "$getgrent_r_proto" in
13432         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13433         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13434         esac
13435         case "$getgrent_r_proto" in
13436         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13437         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13438         esac
13439         case "$getgrent_r_proto" in
13440         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13441         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13442         esac
13443         case "$getgrent_r_proto" in
13444         ''|0) try='int getgrent_r(struct group*, char*, int);'
13445         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13446         esac
13447         case "$getgrent_r_proto" in
13448         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13449         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13450         esac
13451         case "$getgrent_r_proto" in
13452         ''|0)   d_getgrent_r=undef
13453                 getgrent_r_proto=0
13454                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13455         * )     case "$getgrent_r_proto" in
13456                 REENTRANT_PROTO*) ;;
13457                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13458                 esac
13459                 echo "Prototype: $try" ;;
13460         esac
13461         ;;
13462         *)      case "$usethreads" in
13463                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13464                 esac
13465                 d_getgrent_r=undef
13466                 getgrent_r_proto=0
13467                 ;;
13468         esac
13469         ;;
13470 *)      getgrent_r_proto=0
13471         ;;
13472 esac
13473
13474 : see if getgrgid_r exists
13475 set getgrgid_r d_getgrgid_r
13476 eval $inlibc
13477 case "$d_getgrgid_r" in
13478 "$define")
13479         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13480         case "$d_getgrgid_r_proto:$usethreads" in
13481         ":define")      d_getgrgid_r_proto=define
13482                 set d_getgrgid_r_proto getgrgid_r $hdrs
13483                 eval $hasproto ;;
13484         *)      ;;
13485         esac
13486         case "$d_getgrgid_r_proto" in
13487         define)
13488         case "$getgrgid_r_proto" in
13489         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13490         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13491         esac
13492         case "$getgrgid_r_proto" in
13493         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13494         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13495         esac
13496         case "$getgrgid_r_proto" in
13497         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13498         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13499         esac
13500         case "$getgrgid_r_proto" in
13501         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13502         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13503         esac
13504         case "$getgrgid_r_proto" in
13505         ''|0)   d_getgrgid_r=undef
13506                 getgrgid_r_proto=0
13507                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13508         * )     case "$getgrgid_r_proto" in
13509                 REENTRANT_PROTO*) ;;
13510                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13511                 esac
13512                 echo "Prototype: $try" ;;
13513         esac
13514         ;;
13515         *)      case "$usethreads" in
13516                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13517                 esac
13518                 d_getgrgid_r=undef
13519                 getgrgid_r_proto=0
13520                 ;;
13521         esac
13522         ;;
13523 *)      getgrgid_r_proto=0
13524         ;;
13525 esac
13526
13527 : see if getgrnam_r exists
13528 set getgrnam_r d_getgrnam_r
13529 eval $inlibc
13530 case "$d_getgrnam_r" in
13531 "$define")
13532         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13533         case "$d_getgrnam_r_proto:$usethreads" in
13534         ":define")      d_getgrnam_r_proto=define
13535                 set d_getgrnam_r_proto getgrnam_r $hdrs
13536                 eval $hasproto ;;
13537         *)      ;;
13538         esac
13539         case "$d_getgrnam_r_proto" in
13540         define)
13541         case "$getgrnam_r_proto" in
13542         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13543         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13544         esac
13545         case "$getgrnam_r_proto" in
13546         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13547         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13548         esac
13549         case "$getgrnam_r_proto" in
13550         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13551         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13552         esac
13553         case "$getgrnam_r_proto" in
13554         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13555         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13556         esac
13557         case "$getgrnam_r_proto" in
13558         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13559         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13560         esac
13561         case "$getgrnam_r_proto" in
13562         ''|0)   d_getgrnam_r=undef
13563                 getgrnam_r_proto=0
13564                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13565         * )     case "$getgrnam_r_proto" in
13566                 REENTRANT_PROTO*) ;;
13567                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13568                 esac
13569                 echo "Prototype: $try" ;;
13570         esac
13571         ;;
13572         *)      case "$usethreads" in
13573                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13574                 esac
13575                 d_getgrnam_r=undef
13576                 getgrnam_r_proto=0
13577                 ;;
13578         esac
13579         ;;
13580 *)      getgrnam_r_proto=0
13581         ;;
13582 esac
13583
13584 : see if gethostbyaddr exists
13585 set gethostbyaddr d_gethbyaddr
13586 eval $inlibc
13587
13588 : see if gethostbyname exists
13589 set gethostbyname d_gethbyname
13590 eval $inlibc
13591
13592 : see if gethostent exists
13593 set gethostent d_gethent
13594 eval $inlibc
13595
13596 : see how we will look up host name
13597 echo " "
13598 call=''
13599 if set gethostname val -f d_gethname; eval $csym; $val; then
13600         echo 'gethostname() found.' >&4
13601         d_gethname="$define"
13602         call=gethostname
13603 fi
13604 if set uname val -f d_uname; eval $csym; $val; then
13605         if ./xenix; then
13606                 $cat <<'EOM'
13607 uname() was found, but you're running xenix, and older versions of xenix
13608 have a broken uname(). If you don't really know whether your xenix is old
13609 enough to have a broken system call, use the default answer.
13610
13611 EOM
13612                 dflt=y
13613                 case "$d_uname" in
13614                 "$define") dflt=n;;
13615                 esac
13616                 rp='Is your uname() broken?'
13617                 . ./myread
13618                 case "$ans" in
13619                 n*) d_uname="$define"; call=uname;;
13620                 esac
13621         else
13622                 echo 'uname() found.' >&4
13623                 d_uname="$define"
13624                 case "$call" in
13625                 '') call=uname ;;
13626                 esac
13627         fi
13628 fi
13629 case "$d_gethname" in
13630 '') d_gethname="$undef";;
13631 esac
13632 case "$d_uname" in
13633 '') d_uname="$undef";;
13634 esac
13635 case "$d_uname$d_gethname" in
13636 *define*)
13637         dflt=n
13638         cat <<EOM
13639
13640 Every now and then someone has a $call() that lies about the hostname
13641 but can't be fixed for political or economic reasons.  If you wish, I can
13642 pretend $call() isn't there and maybe compute hostname at run-time
13643 thanks to the '$phostname' command.
13644
13645 EOM
13646         rp="Shall I ignore $call() from now on?"
13647         . ./myread
13648         case "$ans" in
13649         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13650         esac;;
13651 esac
13652 case "$phostname" in
13653 '') aphostname='';;
13654 *) case "$aphostname" in
13655         /*) ;;
13656         *) set X $phostname
13657                 shift
13658                 file=$1
13659                 shift
13660                 file=`./loc $file $file $pth`
13661                 aphostname=`echo $file $*`
13662                 ;;
13663         esac
13664         ;;
13665 esac
13666 case "$d_uname$d_gethname" in
13667 *define*) ;;
13668 *)
13669         case "$phostname" in
13670         '')
13671                 echo "There will be no way for $package to get your hostname." >&4;;
13672         *)
13673         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13674                 ;;
13675         esac;;
13676 esac
13677 case "$d_phostname" in
13678 '') d_phostname="$undef";;
13679 esac
13680
13681 : see if gethostbyaddr_r exists
13682 set gethostbyaddr_r d_gethostbyaddr_r
13683 eval $inlibc
13684 case "$d_gethostbyaddr_r" in
13685 "$define")
13686         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13687         case "$d_gethostbyaddr_r_proto:$usethreads" in
13688         ":define")      d_gethostbyaddr_r_proto=define
13689                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13690                 eval $hasproto ;;
13691         *)      ;;
13692         esac
13693         case "$d_gethostbyaddr_r_proto" in
13694         define)
13695         case "$gethostbyaddr_r_proto" in
13696         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13697         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13698         esac
13699         case "$gethostbyaddr_r_proto" in
13700         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13701         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13702         esac
13703         case "$gethostbyaddr_r_proto" in
13704         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13705         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13706         esac
13707         case "$gethostbyaddr_r_proto" in
13708         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13709         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13710         esac
13711         case "$gethostbyaddr_r_proto" in
13712         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13713         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13714         esac
13715         case "$gethostbyaddr_r_proto" in
13716         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13717         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13718         esac
13719         case "$gethostbyaddr_r_proto" in
13720         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13721         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13722         esac
13723         case "$gethostbyaddr_r_proto" in
13724         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13725         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13726         esac
13727         case "$gethostbyaddr_r_proto" in
13728         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13729         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13730         esac
13731         case "$gethostbyaddr_r_proto" in
13732         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13733         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13734         esac
13735         case "$gethostbyaddr_r_proto" in
13736         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13737         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13738         esac
13739         case "$gethostbyaddr_r_proto" in
13740         ''|0)   d_gethostbyaddr_r=undef
13741                 gethostbyaddr_r_proto=0
13742                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13743         * )     case "$gethostbyaddr_r_proto" in
13744                 REENTRANT_PROTO*) ;;
13745                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13746                 esac
13747                 echo "Prototype: $try" ;;
13748         esac
13749         ;;
13750         *)      case "$usethreads" in
13751                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13752                 esac
13753                 d_gethostbyaddr_r=undef
13754                 gethostbyaddr_r_proto=0
13755                 ;;
13756         esac
13757         ;;
13758 *)      gethostbyaddr_r_proto=0
13759         ;;
13760 esac
13761
13762 : see if gethostbyname_r exists
13763 set gethostbyname_r d_gethostbyname_r
13764 eval $inlibc
13765 case "$d_gethostbyname_r" in
13766 "$define")
13767         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13768         case "$d_gethostbyname_r_proto:$usethreads" in
13769         ":define")      d_gethostbyname_r_proto=define
13770                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13771                 eval $hasproto ;;
13772         *)      ;;
13773         esac
13774         case "$d_gethostbyname_r_proto" in
13775         define)
13776         case "$gethostbyname_r_proto" in
13777         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13778         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13779         esac
13780         case "$gethostbyname_r_proto" in
13781         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13782         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13783         esac
13784         case "$gethostbyname_r_proto" in
13785         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13786         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13787         esac
13788         case "$gethostbyname_r_proto" in
13789         ''|0)   d_gethostbyname_r=undef
13790                 gethostbyname_r_proto=0
13791                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13792         * )     case "$gethostbyname_r_proto" in
13793                 REENTRANT_PROTO*) ;;
13794                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13795                 esac
13796                 echo "Prototype: $try" ;;
13797         esac
13798         ;;
13799         *)      case "$usethreads" in
13800                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13801                 esac
13802                 d_gethostbyname_r=undef
13803                 gethostbyname_r_proto=0
13804                 ;;
13805         esac
13806         ;;
13807 *)      gethostbyname_r_proto=0
13808         ;;
13809 esac
13810
13811 : see if gethostent_r exists
13812 set gethostent_r d_gethostent_r
13813 eval $inlibc
13814 case "$d_gethostent_r" in
13815 "$define")
13816         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13817         case "$d_gethostent_r_proto:$usethreads" in
13818         ":define")      d_gethostent_r_proto=define
13819                 set d_gethostent_r_proto gethostent_r $hdrs
13820                 eval $hasproto ;;
13821         *)      ;;
13822         esac
13823         case "$d_gethostent_r_proto" in
13824         define)
13825         case "$gethostent_r_proto" in
13826         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13827         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13828         esac
13829         case "$gethostent_r_proto" in
13830         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13831         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13832         esac
13833         case "$gethostent_r_proto" in
13834         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13835         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13836         esac
13837         case "$gethostent_r_proto" in
13838         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13839         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13840         esac
13841         case "$gethostent_r_proto" in
13842         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13843         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13844         esac
13845         case "$gethostent_r_proto" in
13846         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13847         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13848         esac
13849         case "$gethostent_r_proto" in
13850         ''|0)   d_gethostent_r=undef
13851                 gethostent_r_proto=0
13852                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13853         * )     case "$gethostent_r_proto" in
13854                 REENTRANT_PROTO*) ;;
13855                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13856                 esac
13857                 echo "Prototype: $try" ;;
13858         esac
13859         ;;
13860         *)      case "$usethreads" in
13861                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13862                 esac
13863                 d_gethostent_r=undef
13864                 gethostent_r_proto=0
13865                 ;;
13866         esac
13867         ;;
13868 *)      gethostent_r_proto=0
13869         ;;
13870 esac
13871
13872 : see if prototypes for various gethostxxx netdb.h functions are available
13873 echo " "
13874 set d_gethostprotos gethostent $i_netdb netdb.h
13875 eval $hasproto
13876
13877 : see if getitimer exists
13878 set getitimer d_getitimer
13879 eval $inlibc
13880
13881 : see if getlogin exists
13882 set getlogin d_getlogin
13883 eval $inlibc
13884
13885 : see if getlogin_r exists
13886 set getlogin_r d_getlogin_r
13887 eval $inlibc
13888 case "$d_getlogin_r" in
13889 "$define")
13890         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13891         case "$d_getlogin_r_proto:$usethreads" in
13892         ":define")      d_getlogin_r_proto=define
13893                 set d_getlogin_r_proto getlogin_r $hdrs
13894                 eval $hasproto ;;
13895         *)      ;;
13896         esac
13897         case "$d_getlogin_r_proto" in
13898         define)
13899         case "$getlogin_r_proto" in
13900         ''|0) try='int getlogin_r(char*, size_t);'
13901         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13902         esac
13903         case "$getlogin_r_proto" in
13904         ''|0) try='int getlogin_r(char*, int);'
13905         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13906         esac
13907         case "$getlogin_r_proto" in
13908         ''|0) try='char* getlogin_r(char*, size_t);'
13909         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13910         esac
13911         case "$getlogin_r_proto" in
13912         ''|0) try='char* getlogin_r(char*, int);'
13913         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13914         esac
13915         case "$getlogin_r_proto" in
13916         ''|0)   d_getlogin_r=undef
13917                 getlogin_r_proto=0
13918                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13919         * )     case "$getlogin_r_proto" in
13920                 REENTRANT_PROTO*) ;;
13921                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13922                 esac
13923                 echo "Prototype: $try" ;;
13924         esac
13925         ;;
13926         *)      case "$usethreads" in
13927                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13928                 esac
13929                 d_getlogin_r=undef
13930                 getlogin_r_proto=0
13931                 ;;
13932         esac
13933         ;;
13934 *)      getlogin_r_proto=0
13935         ;;
13936 esac
13937
13938 : see if getmnt exists
13939 set getmnt d_getmnt
13940 eval $inlibc
13941
13942 : see if getmntent exists
13943 set getmntent d_getmntent
13944 eval $inlibc
13945
13946 : see if getnetbyaddr exists
13947 set getnetbyaddr d_getnbyaddr
13948 eval $inlibc
13949
13950 : see if getnetbyname exists
13951 set getnetbyname d_getnbyname
13952 eval $inlibc
13953
13954 : see if getnetent exists
13955 set getnetent d_getnent
13956 eval $inlibc
13957
13958 : see if getnetbyaddr_r exists
13959 set getnetbyaddr_r d_getnetbyaddr_r
13960 eval $inlibc
13961 case "$d_getnetbyaddr_r" in
13962 "$define")
13963         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13964         case "$d_getnetbyaddr_r_proto:$usethreads" in
13965         ":define")      d_getnetbyaddr_r_proto=define
13966                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13967                 eval $hasproto ;;
13968         *)      ;;
13969         esac
13970         case "$d_getnetbyaddr_r_proto" in
13971         define)
13972         case "$getnetbyaddr_r_proto" in
13973         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13974         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13975         esac
13976         case "$getnetbyaddr_r_proto" in
13977         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13978         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13979         esac
13980         case "$getnetbyaddr_r_proto" in
13981         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13982         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13983         esac
13984         case "$getnetbyaddr_r_proto" in
13985         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13986         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13987         esac
13988         case "$getnetbyaddr_r_proto" in
13989         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13990         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13991         esac
13992         case "$getnetbyaddr_r_proto" in
13993         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13994         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13995         esac
13996         case "$getnetbyaddr_r_proto" in
13997         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13998         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13999         esac
14000         case "$getnetbyaddr_r_proto" in
14001         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14002         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14003         esac
14004         case "$getnetbyaddr_r_proto" in
14005         ''|0)   d_getnetbyaddr_r=undef
14006                 getnetbyaddr_r_proto=0
14007                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14008         * )     case "$getnetbyaddr_r_proto" in
14009                 REENTRANT_PROTO*) ;;
14010                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14011                 esac
14012                 echo "Prototype: $try" ;;
14013         esac
14014         ;;
14015         *)      case "$usethreads" in
14016                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14017                 esac
14018                 d_getnetbyaddr_r=undef
14019                 getnetbyaddr_r_proto=0
14020                 ;;
14021         esac
14022         ;;
14023 *)      getnetbyaddr_r_proto=0
14024         ;;
14025 esac
14026
14027 : see if getnetbyname_r exists
14028 set getnetbyname_r d_getnetbyname_r
14029 eval $inlibc
14030 case "$d_getnetbyname_r" in
14031 "$define")
14032         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14033         case "$d_getnetbyname_r_proto:$usethreads" in
14034         ":define")      d_getnetbyname_r_proto=define
14035                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14036                 eval $hasproto ;;
14037         *)      ;;
14038         esac
14039         case "$d_getnetbyname_r_proto" in
14040         define)
14041         case "$getnetbyname_r_proto" in
14042         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14043         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14044         esac
14045         case "$getnetbyname_r_proto" in
14046         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14047         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14048         esac
14049         case "$getnetbyname_r_proto" in
14050         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14051         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14052         esac
14053         case "$getnetbyname_r_proto" in
14054         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14055         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14056         esac
14057         case "$getnetbyname_r_proto" in
14058         ''|0)   d_getnetbyname_r=undef
14059                 getnetbyname_r_proto=0
14060                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14061         * )     case "$getnetbyname_r_proto" in
14062                 REENTRANT_PROTO*) ;;
14063                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14064                 esac
14065                 echo "Prototype: $try" ;;
14066         esac
14067         ;;
14068         *)      case "$usethreads" in
14069                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14070                 esac
14071                 d_getnetbyname_r=undef
14072                 getnetbyname_r_proto=0
14073                 ;;
14074         esac
14075         ;;
14076 *)      getnetbyname_r_proto=0
14077         ;;
14078 esac
14079
14080 : see if getnetent_r exists
14081 set getnetent_r d_getnetent_r
14082 eval $inlibc
14083 case "$d_getnetent_r" in
14084 "$define")
14085         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14086         case "$d_getnetent_r_proto:$usethreads" in
14087         ":define")      d_getnetent_r_proto=define
14088                 set d_getnetent_r_proto getnetent_r $hdrs
14089                 eval $hasproto ;;
14090         *)      ;;
14091         esac
14092         case "$d_getnetent_r_proto" in
14093         define)
14094         case "$getnetent_r_proto" in
14095         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14096         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14097         esac
14098         case "$getnetent_r_proto" in
14099         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14100         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14101         esac
14102         case "$getnetent_r_proto" in
14103         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14104         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14105         esac
14106         case "$getnetent_r_proto" in
14107         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14108         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14109         esac
14110         case "$getnetent_r_proto" in
14111         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14112         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14113         esac
14114         case "$getnetent_r_proto" in
14115         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14116         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14117         esac
14118         case "$getnetent_r_proto" in
14119         ''|0)   d_getnetent_r=undef
14120                 getnetent_r_proto=0
14121                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14122         * )     case "$getnetent_r_proto" in
14123                 REENTRANT_PROTO*) ;;
14124                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14125                 esac
14126                 echo "Prototype: $try" ;;
14127         esac
14128         ;;
14129         *)      case "$usethreads" in
14130                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14131                 esac
14132                 d_getnetent_r=undef
14133                 getnetent_r_proto=0
14134                 ;;
14135         esac
14136         ;;
14137 *)      getnetent_r_proto=0
14138         ;;
14139 esac
14140
14141 : see if prototypes for various getnetxxx netdb.h functions are available
14142 echo " "
14143 set d_getnetprotos getnetent $i_netdb netdb.h
14144 eval $hasproto
14145
14146 : see if getpagesize exists
14147 set getpagesize d_getpagsz
14148 eval $inlibc
14149
14150 : Optional checks for getprotobyname and getprotobynumber
14151
14152 : see if getprotobyname exists
14153 set getprotobyname d_getpbyname
14154 eval $inlibc
14155
14156 : see if getprotobynumber exists
14157 set getprotobynumber d_getpbynumber
14158 eval $inlibc
14159
14160 : see if getprotoent exists
14161 set getprotoent d_getpent
14162 eval $inlibc
14163
14164 : see if getpgid exists
14165 set getpgid d_getpgid
14166 eval $inlibc
14167
14168 : see if getpgrp2 exists
14169 set getpgrp2 d_getpgrp2
14170 eval $inlibc
14171
14172 : see if getppid exists
14173 set getppid d_getppid
14174 eval $inlibc
14175
14176 : see if getpriority exists
14177 set getpriority d_getprior
14178 eval $inlibc
14179
14180 : see if getprotobyname_r exists
14181 set getprotobyname_r d_getprotobyname_r
14182 eval $inlibc
14183 case "$d_getprotobyname_r" in
14184 "$define")
14185         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14186         case "$d_getprotobyname_r_proto:$usethreads" in
14187         ":define")      d_getprotobyname_r_proto=define
14188                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14189                 eval $hasproto ;;
14190         *)      ;;
14191         esac
14192         case "$d_getprotobyname_r_proto" in
14193         define)
14194         case "$getprotobyname_r_proto" in
14195         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14196         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14197         esac
14198         case "$getprotobyname_r_proto" in
14199         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14200         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14201         esac
14202         case "$getprotobyname_r_proto" in
14203         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14204         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14205         esac
14206         case "$getprotobyname_r_proto" in
14207         ''|0)   d_getprotobyname_r=undef
14208                 getprotobyname_r_proto=0
14209                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14210         * )     case "$getprotobyname_r_proto" in
14211                 REENTRANT_PROTO*) ;;
14212                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14213                 esac
14214                 echo "Prototype: $try" ;;
14215         esac
14216         ;;
14217         *)      case "$usethreads" in
14218                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14219                 esac
14220                 d_getprotobyname_r=undef
14221                 getprotobyname_r_proto=0
14222                 ;;
14223         esac
14224         ;;
14225 *)      getprotobyname_r_proto=0
14226         ;;
14227 esac
14228
14229 : see if getprotobynumber_r exists
14230 set getprotobynumber_r d_getprotobynumber_r
14231 eval $inlibc
14232 case "$d_getprotobynumber_r" in
14233 "$define")
14234         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14235         case "$d_getprotobynumber_r_proto:$usethreads" in
14236         ":define")      d_getprotobynumber_r_proto=define
14237                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14238                 eval $hasproto ;;
14239         *)      ;;
14240         esac
14241         case "$d_getprotobynumber_r_proto" in
14242         define)
14243         case "$getprotobynumber_r_proto" in
14244         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14245         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14246         esac
14247         case "$getprotobynumber_r_proto" in
14248         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14249         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14250         esac
14251         case "$getprotobynumber_r_proto" in
14252         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14253         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14254         esac
14255         case "$getprotobynumber_r_proto" in
14256         ''|0)   d_getprotobynumber_r=undef
14257                 getprotobynumber_r_proto=0
14258                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14259         * )     case "$getprotobynumber_r_proto" in
14260                 REENTRANT_PROTO*) ;;
14261                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14262                 esac
14263                 echo "Prototype: $try" ;;
14264         esac
14265         ;;
14266         *)      case "$usethreads" in
14267                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14268                 esac
14269                 d_getprotobynumber_r=undef
14270                 getprotobynumber_r_proto=0
14271                 ;;
14272         esac
14273         ;;
14274 *)      getprotobynumber_r_proto=0
14275         ;;
14276 esac
14277
14278 : see if getprotoent_r exists
14279 set getprotoent_r d_getprotoent_r
14280 eval $inlibc
14281 case "$d_getprotoent_r" in
14282 "$define")
14283         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14284         case "$d_getprotoent_r_proto:$usethreads" in
14285         ":define")      d_getprotoent_r_proto=define
14286                 set d_getprotoent_r_proto getprotoent_r $hdrs
14287                 eval $hasproto ;;
14288         *)      ;;
14289         esac
14290         case "$d_getprotoent_r_proto" in
14291         define)
14292         case "$getprotoent_r_proto" in
14293         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14294         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14295         esac
14296         case "$getprotoent_r_proto" in
14297         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14298         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14299         esac
14300         case "$getprotoent_r_proto" in
14301         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14302         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14303         esac
14304         case "$getprotoent_r_proto" in
14305         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14306         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14307         esac
14308         case "$getprotoent_r_proto" in
14309         ''|0)   d_getprotoent_r=undef
14310                 getprotoent_r_proto=0
14311                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14312         * )     case "$getprotoent_r_proto" in
14313                 REENTRANT_PROTO*) ;;
14314                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14315                 esac
14316                 echo "Prototype: $try" ;;
14317         esac
14318         ;;
14319         *)      case "$usethreads" in
14320                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14321                 esac
14322                 d_getprotoent_r=undef
14323                 getprotoent_r_proto=0
14324                 ;;
14325         esac
14326         ;;
14327 *)      getprotoent_r_proto=0
14328         ;;
14329 esac
14330
14331 : see if prototypes for various getprotoxxx netdb.h functions are available
14332 echo " "
14333 set d_getprotoprotos getprotoent $i_netdb netdb.h
14334 eval $hasproto
14335
14336 : see if getprpwnam exists
14337 set getprpwnam d_getprpwnam
14338 eval $inlibc
14339
14340 : see if getpwent exists
14341 set getpwent d_getpwent
14342 eval $inlibc
14343
14344 : see if getpwent_r exists
14345 set getpwent_r d_getpwent_r
14346 eval $inlibc
14347 case "$d_getpwent_r" in
14348 "$define")
14349         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14350         case "$d_getpwent_r_proto:$usethreads" in
14351         ":define")      d_getpwent_r_proto=define
14352                 set d_getpwent_r_proto getpwent_r $hdrs
14353                 eval $hasproto ;;
14354         *)      ;;
14355         esac
14356         case "$d_getpwent_r_proto" in
14357         define)
14358         case "$getpwent_r_proto" in
14359         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14360         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14361         esac
14362         case "$getpwent_r_proto" in
14363         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14364         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14365         esac
14366         case "$getpwent_r_proto" in
14367         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14368         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14369         esac
14370         case "$getpwent_r_proto" in
14371         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14372         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14373         esac
14374         case "$getpwent_r_proto" in
14375         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14376         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14377         esac
14378         case "$getpwent_r_proto" in
14379         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14380         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14381         esac
14382         case "$getpwent_r_proto" in
14383         ''|0)   d_getpwent_r=undef
14384                 getpwent_r_proto=0
14385                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14386         * )     case "$getpwent_r_proto" in
14387                 REENTRANT_PROTO*) ;;
14388                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14389                 esac
14390                 echo "Prototype: $try" ;;
14391         esac
14392         ;;
14393         *)      case "$usethreads" in
14394                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14395                 esac
14396                 d_getpwent_r=undef
14397                 getpwent_r_proto=0
14398                 ;;
14399         esac
14400         ;;
14401 *)      getpwent_r_proto=0
14402         ;;
14403 esac
14404
14405 : see if getpwnam_r exists
14406 set getpwnam_r d_getpwnam_r
14407 eval $inlibc
14408 case "$d_getpwnam_r" in
14409 "$define")
14410         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14411         case "$d_getpwnam_r_proto:$usethreads" in
14412         ":define")      d_getpwnam_r_proto=define
14413                 set d_getpwnam_r_proto getpwnam_r $hdrs
14414                 eval $hasproto ;;
14415         *)      ;;
14416         esac
14417         case "$d_getpwnam_r_proto" in
14418         define)
14419         case "$getpwnam_r_proto" in
14420         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14421         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14422         esac
14423         case "$getpwnam_r_proto" in
14424         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14425         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14426         esac
14427         case "$getpwnam_r_proto" in
14428         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14429         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14430         esac
14431         case "$getpwnam_r_proto" in
14432         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14433         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14434         esac
14435         case "$getpwnam_r_proto" in
14436         ''|0)   d_getpwnam_r=undef
14437                 getpwnam_r_proto=0
14438                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14439         * )     case "$getpwnam_r_proto" in
14440                 REENTRANT_PROTO*) ;;
14441                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14442                 esac
14443                 echo "Prototype: $try" ;;
14444         esac
14445         ;;
14446         *)      case "$usethreads" in
14447                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14448                 esac
14449                 d_getpwnam_r=undef
14450                 getpwnam_r_proto=0
14451                 ;;
14452         esac
14453         ;;
14454 *)      getpwnam_r_proto=0
14455         ;;
14456 esac
14457
14458 : see if getpwuid_r exists
14459 set getpwuid_r d_getpwuid_r
14460 eval $inlibc
14461 case "$d_getpwuid_r" in
14462 "$define")
14463         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14464         case "$d_getpwuid_r_proto:$usethreads" in
14465         ":define")      d_getpwuid_r_proto=define
14466                 set d_getpwuid_r_proto getpwuid_r $hdrs
14467                 eval $hasproto ;;
14468         *)      ;;
14469         esac
14470         case "$d_getpwuid_r_proto" in
14471         define)
14472         case "$getpwuid_r_proto" in
14473         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14474         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14475         esac
14476         case "$getpwuid_r_proto" in
14477         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14478         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14479         esac
14480         case "$getpwuid_r_proto" in
14481         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14482         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14483         esac
14484         case "$getpwuid_r_proto" in
14485         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14486         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14487         esac
14488         case "$getpwuid_r_proto" in
14489         ''|0)   d_getpwuid_r=undef
14490                 getpwuid_r_proto=0
14491                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14492         * )     case "$getpwuid_r_proto" in
14493                 REENTRANT_PROTO*) ;;
14494                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14495                 esac
14496                 echo "Prototype: $try" ;;
14497         esac
14498         ;;
14499         *)      case "$usethreads" in
14500                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14501                 esac
14502                 d_getpwuid_r=undef
14503                 getpwuid_r_proto=0
14504                 ;;
14505         esac
14506         ;;
14507 *)      getpwuid_r_proto=0
14508         ;;
14509 esac
14510
14511 : Optional checks for getsbyname and getsbyport
14512
14513 : see if getservbyname exists
14514 set getservbyname d_getsbyname
14515 eval $inlibc
14516
14517 : see if getservbyport exists
14518 set getservbyport d_getsbyport
14519 eval $inlibc
14520
14521 : see if getservent exists
14522 set getservent d_getsent
14523 eval $inlibc
14524
14525 : see if getservbyname_r exists
14526 set getservbyname_r d_getservbyname_r
14527 eval $inlibc
14528 case "$d_getservbyname_r" in
14529 "$define")
14530         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14531         case "$d_getservbyname_r_proto:$usethreads" in
14532         ":define")      d_getservbyname_r_proto=define
14533                 set d_getservbyname_r_proto getservbyname_r $hdrs
14534                 eval $hasproto ;;
14535         *)      ;;
14536         esac
14537         case "$d_getservbyname_r_proto" in
14538         define)
14539         case "$getservbyname_r_proto" in
14540         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14541         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14542         esac
14543         case "$getservbyname_r_proto" in
14544         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14545         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14546         esac
14547         case "$getservbyname_r_proto" in
14548         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14549         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14550         esac
14551         case "$getservbyname_r_proto" in
14552         ''|0)   d_getservbyname_r=undef
14553                 getservbyname_r_proto=0
14554                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14555         * )     case "$getservbyname_r_proto" in
14556                 REENTRANT_PROTO*) ;;
14557                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14558                 esac
14559                 echo "Prototype: $try" ;;
14560         esac
14561         ;;
14562         *)      case "$usethreads" in
14563                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14564                 esac
14565                 d_getservbyname_r=undef
14566                 getservbyname_r_proto=0
14567                 ;;
14568         esac
14569         ;;
14570 *)      getservbyname_r_proto=0
14571         ;;
14572 esac
14573
14574 : see if getservbyport_r exists
14575 set getservbyport_r d_getservbyport_r
14576 eval $inlibc
14577 case "$d_getservbyport_r" in
14578 "$define")
14579         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14580         case "$d_getservbyport_r_proto:$usethreads" in
14581         ":define")      d_getservbyport_r_proto=define
14582                 set d_getservbyport_r_proto getservbyport_r $hdrs
14583                 eval $hasproto ;;
14584         *)      ;;
14585         esac
14586         case "$d_getservbyport_r_proto" in
14587         define)
14588         case "$getservbyport_r_proto" in
14589         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14590         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14591         esac
14592         case "$getservbyport_r_proto" in
14593         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14594         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14595         esac
14596         case "$getservbyport_r_proto" in
14597         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14598         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14599         esac
14600         case "$getservbyport_r_proto" in
14601         ''|0)   d_getservbyport_r=undef
14602                 getservbyport_r_proto=0
14603                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14604         * )     case "$getservbyport_r_proto" in
14605                 REENTRANT_PROTO*) ;;
14606                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14607                 esac
14608                 echo "Prototype: $try" ;;
14609         esac
14610         ;;
14611         *)      case "$usethreads" in
14612                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14613                 esac
14614                 d_getservbyport_r=undef
14615                 getservbyport_r_proto=0
14616                 ;;
14617         esac
14618         ;;
14619 *)      getservbyport_r_proto=0
14620         ;;
14621 esac
14622
14623 : see if getservent_r exists
14624 set getservent_r d_getservent_r
14625 eval $inlibc
14626 case "$d_getservent_r" in
14627 "$define")
14628         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14629         case "$d_getservent_r_proto:$usethreads" in
14630         ":define")      d_getservent_r_proto=define
14631                 set d_getservent_r_proto getservent_r $hdrs
14632                 eval $hasproto ;;
14633         *)      ;;
14634         esac
14635         case "$d_getservent_r_proto" in
14636         define)
14637         case "$getservent_r_proto" in
14638         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14639         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14640         esac
14641         case "$getservent_r_proto" in
14642         ''|0) try='int getservent_r(struct servent*, char*, int);'
14643         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14644         esac
14645         case "$getservent_r_proto" in
14646         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14647         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14648         esac
14649         case "$getservent_r_proto" in
14650         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14651         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14652         esac
14653         case "$getservent_r_proto" in
14654         ''|0)   d_getservent_r=undef
14655                 getservent_r_proto=0
14656                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14657         * )     case "$getservent_r_proto" in
14658                 REENTRANT_PROTO*) ;;
14659                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14660                 esac
14661                 echo "Prototype: $try" ;;
14662         esac
14663         ;;
14664         *)      case "$usethreads" in
14665                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14666                 esac
14667                 d_getservent_r=undef
14668                 getservent_r_proto=0
14669                 ;;
14670         esac
14671         ;;
14672 *)      getservent_r_proto=0
14673         ;;
14674 esac
14675
14676 : see if prototypes for various getservxxx netdb.h functions are available
14677 echo " "
14678 set d_getservprotos getservent $i_netdb netdb.h
14679 eval $hasproto
14680
14681 : see if getspnam exists
14682 set getspnam d_getspnam
14683 eval $inlibc
14684
14685 : see if this is a shadow.h system
14686 set shadow.h i_shadow
14687 eval $inhdr
14688
14689 : see if getspnam_r exists
14690 set getspnam_r d_getspnam_r
14691 eval $inlibc
14692 case "$d_getspnam_r" in
14693 "$define")
14694         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14695         case "$d_getspnam_r_proto:$usethreads" in
14696         ":define")      d_getspnam_r_proto=define
14697                 set d_getspnam_r_proto getspnam_r $hdrs
14698                 eval $hasproto ;;
14699         *)      ;;
14700         esac
14701         case "$d_getspnam_r_proto" in
14702         define)
14703         case "$getspnam_r_proto" in
14704         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14705         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14706         esac
14707         case "$getspnam_r_proto" in
14708         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14709         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14710         esac
14711         case "$getspnam_r_proto" in
14712         ''|0)   d_getspnam_r=undef
14713                 getspnam_r_proto=0
14714                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14715         * )     case "$getspnam_r_proto" in
14716                 REENTRANT_PROTO*) ;;
14717                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14718                 esac
14719                 echo "Prototype: $try" ;;
14720         esac
14721         ;;
14722         *)      case "$usethreads" in
14723                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14724                 esac
14725                 d_getspnam_r=undef
14726                 getspnam_r_proto=0
14727                 ;;
14728         esac
14729         ;;
14730 *)      getspnam_r_proto=0
14731         ;;
14732 esac
14733
14734 : see if gettimeofday or ftime exists
14735 set gettimeofday d_gettimeod
14736 eval $inlibc
14737 case "$d_gettimeod" in
14738 "$undef")
14739         set ftime d_ftime 
14740         eval $inlibc
14741         ;;
14742 *)
14743         val="$undef"; set d_ftime; eval $setvar
14744         ;;
14745 esac
14746 case "$d_gettimeod$d_ftime" in
14747 "$undef$undef")
14748         echo " "
14749         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14750         ;;
14751 esac
14752
14753 : see if gmtime_r exists
14754 set gmtime_r d_gmtime_r
14755 eval $inlibc
14756 case "$d_gmtime_r" in
14757 "$define")
14758         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14759         case "$d_gmtime_r_proto:$usethreads" in
14760         ":define")      d_gmtime_r_proto=define
14761                 set d_gmtime_r_proto gmtime_r $hdrs
14762                 eval $hasproto ;;
14763         *)      ;;
14764         esac
14765         case "$d_gmtime_r_proto" in
14766         define)
14767         case "$gmtime_r_proto" in
14768         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14769         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14770         esac
14771         case "$gmtime_r_proto" in
14772         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14773         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14774         esac
14775         case "$gmtime_r_proto" in
14776         ''|0)   d_gmtime_r=undef
14777                 gmtime_r_proto=0
14778                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14779         * )     case "$gmtime_r_proto" in
14780                 REENTRANT_PROTO*) ;;
14781                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14782                 esac
14783                 echo "Prototype: $try" ;;
14784         esac
14785         ;;
14786         *)      case "$usethreads" in
14787                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14788                 esac
14789                 d_gmtime_r=undef
14790                 gmtime_r_proto=0
14791                 ;;
14792         esac
14793         ;;
14794 *)      gmtime_r_proto=0
14795         ;;
14796 esac
14797
14798 : see if hasmntopt exists
14799 set hasmntopt d_hasmntopt
14800 eval $inlibc
14801
14802 : see if this is a netinet/in.h or sys/in.h system
14803 set netinet/in.h i_niin sys/in.h i_sysin
14804 eval $inhdr
14805
14806 : see if arpa/inet.h has to be included
14807 set arpa/inet.h i_arpainet
14808 eval $inhdr
14809
14810 : see if htonl --and friends-- exists
14811 val=''
14812 set htonl val
14813 eval $inlibc
14814
14815 : Maybe they are macros.
14816 case "$val" in
14817 $undef)
14818         $cat >htonl.c <<EOM
14819 #include <stdio.h>
14820 #include <sys/types.h>
14821 #$i_niin I_NETINET_IN
14822 #$i_sysin I_SYS_IN
14823 #$i_arpainet I_ARPA_INET
14824 #ifdef I_NETINET_IN
14825 #include <netinet/in.h>
14826 #endif
14827 #ifdef I_SYS_IN
14828 #include <sys/in.h>
14829 #endif
14830 #ifdef I_ARPA_INET
14831 #include <arpa/inet.h>
14832 #endif
14833 #ifdef htonl
14834 printf("Defined as a macro.");
14835 #endif
14836 EOM
14837         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14838         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14839                 val="$define"
14840                 echo "But it seems to be defined as a macro." >&4
14841         fi
14842         $rm -f htonl.?
14843         ;;
14844 esac
14845 set d_htonl
14846 eval $setvar
14847
14848 : see if ilogbl exists
14849 set ilogbl d_ilogbl
14850 eval $inlibc
14851
14852 : index or strchr
14853 echo " "
14854 if set index val -f; eval $csym; $val; then
14855         if set strchr val -f d_strchr; eval $csym; $val; then
14856                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14857                         val="$define"
14858                         vali="$undef"
14859                         echo "strchr() found." >&4
14860                 else
14861                         val="$undef"
14862                         vali="$define"
14863                         echo "index() found." >&4
14864                 fi
14865         else
14866                 val="$undef"
14867                 vali="$define"
14868                 echo "index() found." >&4
14869         fi
14870 else
14871         if set strchr val -f d_strchr; eval $csym; $val; then
14872                 val="$define"
14873                 vali="$undef"
14874                 echo "strchr() found." >&4
14875         else
14876                 echo "No index() or strchr() found!" >&4
14877                 val="$undef"
14878                 vali="$undef"
14879         fi
14880 fi
14881 set d_strchr; eval $setvar
14882 val="$vali"
14883 set d_index; eval $setvar
14884
14885 : check whether inet_aton exists
14886 set inet_aton d_inetaton
14887 eval $inlibc
14888
14889 : Look for isascii
14890 echo " "
14891 $cat >isascii.c <<EOCP
14892 #include <stdio.h>
14893 #include <ctype.h>
14894 #$i_stdlib I_STDLIB
14895 #ifdef I_STDLIB
14896 #include <stdlib.h>
14897 #endif
14898 int main() {
14899         int c = 'A';
14900         if (isascii(c))
14901                 exit(0);
14902         else
14903                 exit(1);
14904 }
14905 EOCP
14906 set isascii
14907 if eval $compile; then
14908         echo "isascii() found." >&4
14909         val="$define"
14910 else
14911         echo "isascii() NOT found." >&4
14912         val="$undef"
14913 fi
14914 set d_isascii
14915 eval $setvar
14916 $rm -f isascii*
14917
14918 : see if isfinite exists
14919 set isfinite d_isfinite
14920 eval $inlibc
14921
14922 : see if isinf exists
14923 set isinf d_isinf
14924 eval $inlibc
14925
14926 : see if isnan exists
14927 set isnan d_isnan
14928 eval $inlibc
14929
14930 : see if isnanl exists
14931 set isnanl d_isnanl
14932 eval $inlibc
14933
14934 : see if killpg exists
14935 set killpg d_killpg
14936 eval $inlibc
14937
14938 : see if lchown exists
14939 echo " "
14940 $cat > try.c <<'EOCP'
14941 /* System header to define __stub macros and hopefully few prototypes,
14942     which can conflict with char lchown(); below.  */
14943 #include <assert.h>
14944 /* Override any gcc2 internal prototype to avoid an error.  */
14945 /* We use char because int might match the return type of a gcc2
14946    builtin and then its argument prototype would still apply.  */
14947 char lchown();
14948 int main() {
14949     /*  The GNU C library defines this for functions which it implements
14950         to always fail with ENOSYS.  Some functions are actually named
14951         something starting with __ and the normal name is an alias.  */
14952 #if defined (__stub_lchown) || defined (__stub___lchown)
14953 choke me
14954 #else
14955 lchown();
14956 #endif
14957 ; return 0; }
14958 EOCP
14959 set try
14960 if eval $compile; then
14961     $echo "lchown() found." >&4
14962     val="$define"
14963 else
14964     $echo "lchown() NOT found." >&4
14965     val="$undef"
14966 fi
14967 set d_lchown
14968 eval $setvar
14969
14970 : See if number of significant digits in a double precision number is known
14971 echo " "
14972 $cat >ldbl_dig.c <<EOM
14973 #$i_limits I_LIMITS
14974 #$i_float I_FLOAT
14975 #ifdef I_LIMITS
14976 #include <limits.h>
14977 #endif
14978 #ifdef I_FLOAT
14979 #include <float.h>
14980 #endif
14981 #ifdef LDBL_DIG
14982 printf("Contains LDBL_DIG");
14983 #endif
14984 EOM
14985 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14986 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14987         echo "LDBL_DIG found." >&4
14988         val="$define"
14989 else
14990         echo "LDBL_DIG NOT found." >&4
14991         val="$undef"
14992 fi
14993 $rm -f ldbl_dig.?
14994 set d_ldbl_dig
14995 eval $setvar
14996
14997 : see if this is a math.h system
14998 set math.h i_math
14999 eval $inhdr
15000
15001 : check to see if math.h defines _LIB_VERSION
15002 d_libm_lib_version="$undef"
15003 case $i_math in
15004     $define)
15005         echo " "
15006         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15007         $cat >try.c <<EOCP
15008 #include <unistd.h>
15009 #include <math.h>
15010 int main (int argc, char *argv[])
15011 {
15012     printf ("%d\n", _LIB_VERSION);
15013     return (0);
15014     } /* main */
15015 EOCP
15016         set try
15017         if eval $compile; then
15018             foo=`$run ./try`
15019             echo "Yes, it does ($foo)" >&4
15020             d_libm_lib_version="$define"
15021         else
15022             echo "No, it does not (probably harmless)" >&4
15023             fi
15024         $rm_try
15025         ;;
15026
15027     esac
15028
15029 : see if link exists
15030 set link d_link
15031 eval $inlibc
15032
15033 : see if localtime_r exists
15034 set localtime_r d_localtime_r
15035 eval $inlibc
15036 case "$d_localtime_r" in
15037 "$define")
15038         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15039         case "$d_localtime_r_proto:$usethreads" in
15040         ":define")      d_localtime_r_proto=define
15041                 set d_localtime_r_proto localtime_r $hdrs
15042                 eval $hasproto ;;
15043         *)      ;;
15044         esac
15045         case "$d_localtime_r_proto" in
15046         define)
15047         case "$localtime_r_proto" in
15048         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15049         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15050         esac
15051         case "$localtime_r_proto" in
15052         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15053         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15054         esac
15055         case "$localtime_r_proto" in
15056         ''|0)   d_localtime_r=undef
15057                 localtime_r_proto=0
15058                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15059         * )     case "$localtime_r_proto" in
15060                 REENTRANT_PROTO*) ;;
15061                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15062                 esac
15063                 echo "Prototype: $try" ;;
15064         esac
15065         ;;
15066         *)      case "$usethreads" in
15067                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15068                 esac
15069                 d_localtime_r=undef
15070                 localtime_r_proto=0
15071                 ;;
15072         esac
15073         ;;
15074 *)      localtime_r_proto=0
15075         ;;
15076 esac
15077
15078 : see if localtime_r calls tzset
15079 case "$localtime_r_proto" in
15080 REENTRANT_PROTO*)
15081         $cat >try.c <<EOCP
15082 /*  Does our libc's localtime_r call tzset ?
15083  *  return 0 if so, 1 otherwise.
15084  */
15085 #$i_systypes    I_SYS_TYPES
15086 #$i_unistd      I_UNISTD
15087 #$i_time        I_TIME
15088 #$i_stdlib      I_STDLIB
15089 #$i_string      I_STRING
15090 #$i_malloc      I_MALLOC
15091 #ifdef I_SYS_TYPES
15092 #  include <sys/types.h>
15093 #endif
15094 #ifdef I_UNISTD
15095 #  include <unistd.h>
15096 #endif
15097 #ifdef I_TIME
15098 #  include <time.h>
15099 #endif
15100 #ifdef I_STDLIB
15101 #include <stdlib.h>
15102 #endif
15103 #ifdef I_STRING
15104 #  include <string.h>
15105 #else
15106 #  include <strings.h>
15107 #endif
15108 #ifdef I_MALLOC
15109 #  include <malloc.h>
15110 #endif
15111 int main()
15112 {
15113     time_t t = time(0L);
15114     char w_tz[]="TZ" "=GMT+5",
15115          e_tz[]="TZ" "=GMT-5",
15116         *tz_e = (char*)malloc(16),
15117         *tz_w = (char*)malloc(16);
15118     struct tm tm_e, tm_w;
15119     memset(&tm_e,'\0',sizeof(struct tm));
15120     memset(&tm_w,'\0',sizeof(struct tm));
15121     strcpy(tz_e,e_tz);
15122     strcpy(tz_w,w_tz);
15123
15124     putenv(tz_e);
15125     localtime_r(&t, &tm_e);
15126
15127     putenv(tz_w);
15128     localtime_r(&t, &tm_w);
15129
15130     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15131         return 1;
15132     return 0;
15133 }
15134 EOCP
15135         set try
15136         if eval $compile; then
15137             if $run ./try; then
15138                 d_localtime_r_needs_tzset=undef;
15139             else
15140                 d_localtime_r_needs_tzset=define;
15141             fi;
15142         else
15143             d_localtime_r_needs_tzset=undef;
15144         fi;
15145      ;;
15146   *)
15147      d_localtime_r_needs_tzset=undef;
15148      ;;
15149 esac
15150 $rm_try
15151
15152 : see if localeconv exists
15153 set localeconv d_locconv
15154 eval $inlibc
15155
15156 : see if lockf exists
15157 set lockf d_lockf
15158 eval $inlibc
15159
15160 : see if prototype for lseek is available
15161 echo " "
15162 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15163 eval $hasproto
15164
15165 : see if lstat exists
15166 set lstat d_lstat
15167 eval $inlibc
15168
15169 : see if madvise exists
15170 set madvise d_madvise
15171 eval $inlibc
15172
15173 : see if malloc_size exists
15174 set malloc_size d_malloc_size
15175 eval $inlibc
15176
15177 : see if malloc_size_good exists
15178 set malloc_good_size d_malloc_good_size
15179 eval $inlibc
15180
15181 : see if mblen exists
15182 set mblen d_mblen
15183 eval $inlibc
15184
15185 : see if mbstowcs exists
15186 set mbstowcs d_mbstowcs
15187 eval $inlibc
15188
15189 : see if mbtowc exists
15190 set mbtowc d_mbtowc
15191 eval $inlibc
15192
15193 : see if memchr exists
15194 set memchr d_memchr
15195 eval $inlibc
15196
15197 : see if memcmp exists
15198 set memcmp d_memcmp
15199 eval $inlibc
15200
15201 : see if memcpy exists
15202 set memcpy d_memcpy
15203 eval $inlibc
15204
15205 : see if memmove exists
15206 set memmove d_memmove
15207 eval $inlibc
15208
15209 : see if memset exists
15210 set memset d_memset
15211 eval $inlibc
15212
15213 : see if mkdir exists
15214 set mkdir d_mkdir
15215 eval $inlibc
15216
15217 : see if mkdtemp exists
15218 set mkdtemp d_mkdtemp
15219 eval $inlibc
15220
15221 : see if mkfifo exists
15222 set mkfifo d_mkfifo
15223 eval $inlibc
15224
15225 : see if mkstemp exists
15226 set mkstemp d_mkstemp
15227 eval $inlibc
15228
15229 : see if mkstemps exists
15230 set mkstemps d_mkstemps
15231 eval $inlibc
15232
15233 : see if mktime exists
15234 set mktime d_mktime
15235 eval $inlibc
15236
15237 : see if this is a sys/mman.h system
15238 set sys/mman.h i_sysmman
15239 eval $inhdr
15240
15241 : see if mmap exists
15242 set mmap d_mmap
15243 eval $inlibc
15244 : see what shmat returns
15245 : default to something harmless
15246 mmaptype='void *'
15247 case "$i_sysmman$d_mmap" in
15248 "$define$define")
15249         $cat >mmap.c <<'END'
15250 #include <sys/mman.h>
15251 void *mmap();
15252 END
15253         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15254                 mmaptype='void *'
15255         else
15256                 mmaptype='caddr_t'
15257         fi
15258         echo "and it returns ($mmaptype)." >&4
15259         ;;
15260 esac
15261
15262
15263
15264 : see if sqrtl exists
15265 set sqrtl d_sqrtl
15266 eval $inlibc
15267
15268 : see if scalbnl exists
15269 set scalbnl d_scalbnl
15270 eval $inlibc
15271
15272 : see if modfl exists
15273 set modfl d_modfl
15274 eval $inlibc
15275
15276 : see if prototype for modfl is available
15277 echo " "
15278 set d_modflproto modfl $i_math math.h
15279 eval $hasproto
15280
15281 d_modfl_pow32_bug="$undef"
15282
15283 case "$d_longdbl$d_modfl" in
15284 $define$define)
15285         $cat <<EOM
15286 Checking to see whether your modfl() is okay for large values...
15287 EOM
15288 $cat >try.c <<EOCP
15289 #include <math.h>
15290 #include <stdio.h>
15291 EOCP
15292 if $test "X$d_modflproto" != "X$define"; then
15293         $cat >>try.c <<EOCP
15294 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15295 long double modfl (long double, long double *);
15296 EOCP
15297 fi
15298 $cat >>try.c <<EOCP
15299 int main() {
15300     long double nv = 4294967303.15;
15301     long double v, w;
15302     v = modfl(nv, &w);
15303 #ifdef __GLIBC__
15304     printf("glibc");
15305 #endif
15306     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15307     return 0;
15308 }
15309 EOCP
15310         case "$osname:$gccversion" in
15311         aix:)   saveccflags="$ccflags"
15312                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15313         esac
15314         set try
15315         if eval $compile; then
15316                 foo=`$run ./try`
15317                 case "$foo" in
15318                 *" 4294967303.150000 1.150000 4294967302.000000")
15319                         echo >&4 "Your modfl() is broken for large values."
15320                         d_modfl_pow32_bug="$define"
15321                         case "$foo" in
15322                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15323                         ;;
15324                         esac
15325                         ;;
15326                 *" 4294967303.150000 0.150000 4294967303.000000")
15327                         echo >&4 "Your modfl() seems okay for large values."
15328                         ;;
15329                 *)      echo >&4 "I don't understand your modfl() at all."
15330                         d_modfl="$undef"
15331                         ;;
15332                 esac
15333                 $rm_try
15334         else
15335                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15336                 d_modfl="$undef"
15337         fi
15338         case "$osname:$gccversion" in
15339         aix:)   ccflags="$saveccflags" ;; # restore
15340         esac
15341         ;;
15342 esac
15343
15344 if $test "$uselongdouble" = "$define"; then
15345     message=""
15346     if $test "$d_sqrtl" != "$define"; then
15347         message="$message sqrtl"
15348     fi
15349     if $test "$d_modfl" != "$define"; then
15350         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15351             echo "You have both aintl and copysignl, so I can emulate modfl."
15352         else
15353             message="$message modfl"
15354         fi
15355     fi
15356     if $test "$d_frexpl" != "$define"; then
15357         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15358             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15359         else
15360             message="$message frexpl"
15361         fi
15362     fi
15363
15364     if $test "$message" != ""; then
15365         $cat <<EOM >&4
15366
15367 *** You requested the use of long doubles but you do not seem to have
15368 *** the following mathematical functions needed for long double support:
15369 ***    $message
15370 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15371 *** Cannot continue, aborting.
15372
15373 EOM
15374
15375         exit 1
15376     fi
15377 fi
15378
15379 : see if mprotect exists
15380 set mprotect d_mprotect
15381 eval $inlibc
15382
15383 : see if msgctl exists
15384 set msgctl d_msgctl
15385 eval $inlibc
15386
15387 : see if msgget exists
15388 set msgget d_msgget
15389 eval $inlibc
15390
15391 : see if msgsnd exists
15392 set msgsnd d_msgsnd
15393 eval $inlibc
15394
15395 : see if msgrcv exists
15396 set msgrcv d_msgrcv
15397 eval $inlibc
15398
15399 : see how much of the 'msg*(2)' library is present.
15400 h_msg=true
15401 echo " "
15402 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15403 *"$undef"*) h_msg=false;;
15404 esac
15405 case "$osname" in
15406 freebsd)
15407     case "`ipcs 2>&1`" in
15408     "SVID messages"*"not configured"*)
15409         echo "Your $osname does not have the msg*(2) configured." >&4
15410         h_msg=false
15411         val="$undef"
15412         set msgctl d_msgctl
15413         eval $setvar
15414         set msgget d_msgget
15415         eval $setvar
15416         set msgsnd d_msgsnd
15417         eval $setvar
15418         set msgrcv d_msgrcv
15419         eval $setvar
15420         ;;
15421     esac
15422     ;;
15423 esac
15424 : we could also check for sys/ipc.h ...
15425 if $h_msg && $test `./findhdr sys/msg.h`; then
15426         echo "You have the full msg*(2) library." >&4
15427         val="$define"
15428 else
15429         echo "You don't have the full msg*(2) library." >&4
15430         val="$undef"
15431 fi
15432 set d_msg
15433 eval $setvar
15434
15435 : Check for msghdr_s
15436 echo " "
15437 echo "Checking to see if your system supports struct msghdr..." >&4
15438 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15439 eval $hasstruct
15440 case "$d_msghdr_s" in
15441 "$define")      echo "Yes, it does."   ;;
15442 *)              echo "No, it doesn't." ;;
15443 esac
15444
15445
15446 : see if msync exists
15447 set msync d_msync
15448 eval $inlibc
15449
15450 : see if munmap exists
15451 set munmap d_munmap
15452 eval $inlibc
15453
15454 : see if nice exists
15455 set nice d_nice
15456 eval $inlibc
15457
15458 : see if this is a langinfo.h system
15459 set langinfo.h i_langinfo
15460 eval $inhdr
15461
15462 : see if nl_langinfo exists
15463 set nl_langinfo d_nl_langinfo
15464 eval $inlibc
15465
15466 : check for volatile keyword
15467 echo " "
15468 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15469 $cat >try.c <<'EOCP'
15470 int main()
15471 {
15472         typedef struct _goo_struct goo_struct;
15473         goo_struct * volatile goo = ((goo_struct *)0);
15474         struct _goo_struct {
15475                 long long_int;
15476                 int reg_int;
15477                 char char_var;
15478         };
15479         typedef unsigned short foo_t;
15480         char *volatile foo;
15481         volatile int bar;
15482         volatile foo_t blech;
15483         foo = foo;
15484 }
15485 EOCP
15486 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15487         val="$define"
15488         echo "Yup, it does."
15489 else
15490         val="$undef"
15491         echo "Nope, it doesn't."
15492 fi
15493 set d_volatile
15494 eval $setvar
15495 $rm_try
15496
15497 : Check basic sizes
15498 echo " "
15499 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15500
15501 case "$use64bitint:$d_quad:$quadtype" in
15502 define:define:?*)
15503         ivtype="$quadtype"
15504         uvtype="$uquadtype"
15505         ivsize=8
15506         uvsize=8
15507         ;;
15508 *)      ivtype="long"
15509         uvtype="unsigned long"
15510         ivsize=$longsize
15511         uvsize=$longsize
15512         ;;
15513 esac
15514
15515 case "$uselongdouble:$d_longdbl" in
15516 define:define)
15517         nvtype="long double"
15518         nvsize=$longdblsize
15519         ;;
15520 *)      nvtype=double
15521         nvsize=$doublesize
15522         ;;
15523 esac
15524
15525 $echo "(IV will be "$ivtype", $ivsize bytes)"
15526 $echo "(UV will be "$uvtype", $uvsize bytes)"
15527 $echo "(NV will be "$nvtype", $nvsize bytes)"
15528
15529 $cat >try.c <<EOCP
15530 #$i_inttypes I_INTTYPES
15531 #ifdef I_INTTYPES
15532 #include <inttypes.h>
15533 #endif
15534 #include <stdio.h>
15535 int main() {
15536 #ifdef INT8
15537    int8_t i =  INT8_MAX;
15538   uint8_t u = UINT8_MAX;
15539   printf("int8_t\n");
15540 #endif
15541 #ifdef INT16
15542    int16_t i =  INT16_MAX;
15543   uint16_t i = UINT16_MAX;
15544   printf("int16_t\n");
15545 #endif
15546 #ifdef INT32
15547    int32_t i =  INT32_MAX;
15548   uint32_t u = UINT32_MAX;
15549   printf("int32_t\n");
15550 #endif
15551 }
15552 EOCP
15553
15554 i8type="signed char"
15555 u8type="unsigned char"
15556 i8size=1
15557 u8size=1
15558
15559 case "$i16type" in
15560 '')     case "$shortsize" in
15561         2)      i16type=short
15562                 u16type="unsigned short"
15563                 i16size=$shortsize
15564                 u16size=$shortsize
15565                 ;;
15566         esac
15567         ;;
15568 esac
15569 case "$i16type" in
15570 '')     set try -DINT16
15571         if eval $compile; then
15572                 case "`$run ./try`" in
15573                 int16_t)
15574                         i16type=int16_t
15575                         u16type=uint16_t
15576                         i16size=2
15577                         u16size=2
15578                         ;;
15579                 esac
15580         fi
15581         ;;
15582 esac
15583 case "$i16type" in
15584 '')     if $test $shortsize -ge 2; then
15585                 i16type=short
15586                 u16type="unsigned short"
15587                 i16size=$shortsize
15588                 u16size=$shortsize
15589         fi
15590         ;;
15591 esac
15592
15593 case "$i32type" in
15594 '')     case "$longsize" in
15595         4)      i32type=long
15596                 u32type="unsigned long"
15597                 i32size=$longsize
15598                 u32size=$longsize
15599                 ;;
15600         *)      case "$intsize" in
15601                 4)      i32type=int
15602                         u32type="unsigned int"
15603                         i32size=$intsize
15604                         u32size=$intsize
15605                         ;;
15606                 esac
15607                 ;;
15608         esac
15609         ;;
15610 esac
15611 case "$i32type" in
15612 '')     set try -DINT32
15613         if eval $compile; then
15614                 case "`$run ./try`" in
15615                 int32_t)
15616                         i32type=int32_t
15617                         u32type=uint32_t
15618                         i32size=4
15619                         u32size=4
15620                         ;;
15621                 esac
15622         fi
15623         ;;
15624 esac
15625 case "$i32type" in
15626 '')     if $test $intsize -ge 4; then
15627                 i32type=int
15628                 u32type="unsigned int"
15629                 i32size=$intsize
15630                 u32size=$intsize
15631         fi
15632         ;;
15633 esac
15634
15635 case "$i64type" in
15636 '')     case "$d_quad:$quadtype" in
15637         define:?*)
15638                 i64type="$quadtype"
15639                 u64type="$uquadtype"
15640                 i64size=8
15641                 u64size=8
15642                 ;;
15643         esac
15644         ;;
15645 esac
15646
15647 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15648 : volatile so that the compiler has to store it out to memory.
15649 if test X"$d_volatile" = X"$define"; then
15650         volatile=volatile
15651 fi
15652 $cat <<EOP >try.c
15653 #include <stdio.h>
15654 #$i_stdlib I_STDLIB
15655 #ifdef I_STDLIB
15656 #include <stdlib.h>
15657 #endif
15658 #include <sys/types.h>
15659 #include <signal.h>
15660 #ifdef SIGFPE
15661 $volatile int bletched = 0;
15662 $signal_t blech(int s) { bletched = 1; }
15663 #endif
15664 int main() {
15665     $uvtype u = 0;
15666     $nvtype d;
15667     int     n = 8 * $uvsize;
15668     int     i;
15669 #ifdef SIGFPE
15670     signal(SIGFPE, blech);
15671 #endif
15672
15673     for (i = 0; i < n; i++) {
15674       u = u << 1 | ($uvtype)1;
15675       d = ($nvtype)u;
15676       if (($uvtype)d != u)
15677         break;
15678       if (d <= 0)
15679         break;
15680       d = ($nvtype)(u - 1);
15681       if (($uvtype)d != (u - 1))
15682         break;
15683 #ifdef SIGFPE
15684       if (bletched)
15685         break;
15686 #endif
15687     }
15688     printf("%d\n", ((i == n) ? -n : i));
15689     exit(0);
15690 }
15691 EOP
15692 set try
15693
15694 d_nv_preserves_uv="$undef"
15695 if eval $compile; then
15696         nv_preserves_uv_bits="`$run ./try`"
15697 fi
15698 case "$nv_preserves_uv_bits" in
15699 \-[1-9]*)
15700         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15701         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15702         d_nv_preserves_uv="$define"
15703         ;;
15704 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15705         d_nv_preserves_uv="$undef" ;;
15706 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15707         nv_preserves_uv_bits="0" ;;
15708 esac
15709 $rm_try
15710
15711 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15712 : volatile so that the compiler has to store it out to memory.
15713 if test X"$d_volatile" = X"$define"; then
15714         volatile=volatile
15715 fi
15716 $cat <<EOP >try.c
15717 #include <stdio.h>
15718
15719 typedef $nvtype NV;
15720
15721 int
15722 main() {
15723   NV value = 2;
15724   int count = 1;
15725
15726   while(count < 256) {
15727     $volatile NV up = value + 1.0;
15728     $volatile NV negated = -value;
15729     $volatile NV down = negated - 1.0;
15730     $volatile NV got_up = up - value;
15731     int up_good = got_up == 1.0;
15732     int got_down = down - negated;
15733     int down_good = got_down == -1.0;
15734
15735     if (down_good != up_good) {
15736       fprintf(stderr,
15737               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15738               up_good, (double) got_up, down_good, (double) got_down,
15739               count, (double) value);
15740       return 1;
15741     }
15742     if (!up_good) {
15743       while (1) {
15744         if (count > 8) {
15745           count -= 8;
15746           fputs("256.0", stdout);
15747         } else {
15748           count--;
15749           fputs("2.0", stdout);
15750         }
15751         if (!count) {
15752           puts("");
15753           return 0;
15754         }
15755         fputs("*", stdout);
15756       }
15757     }
15758     value *= 2;
15759     ++count;
15760   }
15761   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15762           count, (double) value);
15763   return 1;
15764 }
15765 EOP
15766 set try
15767
15768 nv_overflows_integers_at='0'
15769 if eval $compile; then
15770     xxx="`$run ./try`"
15771     case "$?" in
15772         0)
15773             case "$xxx" in
15774                 2*)  cat >&4 <<EOM
15775 The largest integer your NVs can preserve is equal to $xxx
15776 EOM
15777                     nv_overflows_integers_at="$xxx"
15778                     ;;
15779                 *)  cat >&4 <<EOM
15780 Cannot determine the largest integer value your NVs can hold, unexpected output
15781 '$xxx'
15782 EOM
15783                     ;;
15784             esac
15785             ;;
15786         *)  cat >&4 <<EOM
15787 Cannot determine the largest integer value your NVs can hold
15788 EOM
15789             ;;
15790     esac
15791 fi
15792 $rm_try
15793
15794 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15795 : volatile so that the compiler has to store it out to memory.
15796 if test X"$d_volatile" = X"$define"; then
15797         volatile=volatile
15798 fi
15799 $cat <<EOP >try.c
15800 #include <stdio.h>
15801 #$i_stdlib I_STDLIB
15802 #ifdef I_STDLIB
15803 #include <stdlib.h>
15804 #endif
15805 #$i_string I_STRING
15806 #ifdef I_STRING
15807 #  include <string.h>
15808 #else
15809 #  include <strings.h>
15810 #endif
15811 #include <sys/types.h>
15812 #include <signal.h>
15813 #ifdef SIGFPE
15814 $volatile int bletched = 0;
15815 $signal_t blech(int s) { bletched = 1; }
15816 #endif
15817
15818 int checkit($nvtype d, char *where) {
15819     unsigned char *p = (char *)&d;
15820     unsigned char *end = p + sizeof(d);
15821     int fail = 0;
15822
15823     while (p < end)
15824         fail += *p++;
15825
15826     if (!fail)
15827         return 0;
15828
15829     p = (char *)&d;
15830     printf("No - %s: 0x", where);
15831     while (p < end)
15832         printf ("%02X", *p++);
15833     printf("\n");
15834     return 1;
15835 }
15836
15837 int main(int argc, char **argv) {
15838     $nvtype d = 0.0;
15839     int fail = 0;
15840     fail += checkit(d, "0.0");
15841
15842     /* The compiler shouldn't be assuming that bletched is 0  */
15843     d = bletched;
15844
15845     fail += checkit(d, "bleched");
15846
15847 #ifdef SIGFPE
15848     signal(SIGFPE, blech);
15849 #endif
15850
15851     /* Paranoia - the compiler should have no way of knowing that ANSI says
15852        that argv[argc] will always be NULL.  Actually, if it did assume this it
15853        would be buggy, as this is C and main() can be called from elsewhere in
15854        the program.  */
15855     d = argv[argc] ? 1 : 0;
15856
15857     if (d) {
15858         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15859     }
15860
15861     fail += checkit(d, "ternary");
15862
15863     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15864
15865     if (d != 0.0) {
15866         printf("No - memset doesn't give 0.0\n");
15867         /* This might just blow up:  */
15868         printf("(gives %g)\n", d);
15869         return 1;
15870     }
15871
15872 #ifdef SIGFPE
15873     if (bletched) {
15874         printf("No - something bleched\n");
15875         return 1;
15876     }
15877 #endif
15878     if (fail) {
15879       printf("No - %d fail(s)\n", fail);
15880       return 1;
15881     }
15882     printf("Yes\n");
15883     return 0;
15884 }
15885 EOP
15886 set try
15887
15888 d_nv_zero_is_allbits_zero="$undef"
15889 if eval $compile; then
15890     xxx="`$run ./try`"
15891     case "$?" in
15892         0)
15893             case "$xxx" in
15894                 Yes)  cat >&4 <<EOM
15895 0.0 is represented as all bits zero in memory
15896 EOM
15897                     d_nv_zero_is_allbits_zero="$define"
15898                     ;;
15899                 *)  cat >&4 <<EOM
15900 0.0 is not represented as all bits zero in memory
15901 EOM
15902                     d_nv_zero_is_allbits_zero="$undef"
15903                     ;;
15904             esac
15905             ;;
15906         *)  cat >&4 <<EOM
15907 0.0 is not represented as all bits zero in memory
15908 EOM
15909             d_nv_zero_is_allbits_zero="$undef"
15910             ;;
15911     esac
15912 fi
15913 $rm_try
15914
15915 : check for off64_t
15916 echo " "
15917 echo "Checking to see if you have off64_t..." >&4
15918 $cat >try.c <<EOCP
15919 #include <sys/types.h>
15920 #include <unistd.h>
15921 int main() { off64_t x = 7; }
15922 EOCP
15923 set try
15924 if eval $compile; then
15925         val="$define"
15926         echo "You have off64_t."
15927 else
15928         val="$undef"
15929         echo "You do not have off64_t."
15930         case "$lseeksize" in
15931         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15932         esac
15933 fi
15934 $rm_try
15935 set d_off64_t
15936 eval $setvar
15937
15938 : how to create joinable pthreads
15939 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15940         echo " "
15941         echo "Checking what constant to use for creating joinable pthreads..." >&4
15942         $cat >try.c <<'EOCP'
15943 #include <pthread.h>
15944 int main() {
15945     int detachstate = JOINABLE;
15946 }
15947 EOCP
15948         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15949         if eval $compile; then
15950                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15951                 val="$undef" # Yes, undef.
15952                 set d_old_pthread_create_joinable
15953                 eval $setvar
15954                 val=""
15955                 set old_pthread_create_joinable
15956                 eval $setvar
15957         else
15958                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15959                 if eval $compile; then
15960                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15961                         val="$define"
15962                         set d_old_pthread_create_joinable
15963                         eval $setvar
15964                         val=PTHREAD_CREATE_UNDETACHED
15965                         set old_pthread_create_joinable
15966                         eval $setvar
15967                 else
15968                         set try -DJOINABLE=__UNDETACHED
15969                         if eval $compile; then
15970                                 echo "You seem to use __UNDETACHED." >&4
15971                                 val="$define"
15972                                 set d_old_pthread_create_joinable
15973                                 eval $setvar
15974                                 val=__UNDETACHED
15975                                 set old_pthread_create_joinable
15976                                 eval $setvar
15977                         else
15978                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15979                                 val="$define"
15980                                 set d_old_pthread_create_joinable
15981                                 eval $setvar
15982                                 val=0
15983                                 set old_pthread_create_joinable
15984                                 eval $setvar
15985                         fi
15986                 fi
15987         fi
15988         $rm_try
15989 else
15990     d_old_pthread_create_joinable="$undef"
15991     old_pthread_create_joinable=""
15992 fi
15993
15994 : see if pause exists
15995 set pause d_pause
15996 eval $inlibc
15997
15998 : see if poll exists
15999 set poll d_poll
16000 eval $inlibc
16001
16002 : see if readlink exists
16003 set readlink d_readlink
16004 eval $inlibc
16005
16006 : Check if exe is symlink to abs path of executing program
16007 echo " "
16008 procselfexe=''
16009 val="$undef"
16010 case "$d_readlink" in
16011 "$define")
16012         if $issymlink /proc/self/exe ; then
16013                 $ls -l /proc/self/exe > reflect
16014                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16015                         echo "You have Linux-like /proc/self/exe."
16016                         procselfexe='"/proc/self/exe"'
16017                         val="$define"
16018                 fi
16019         fi
16020         if $issymlink /proc/curproc/file ; then
16021                 $ls -l /proc/curproc/file > reflect
16022                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16023                         echo "You have BSD-like /proc/curproc/file."
16024                         procselfexe='"/proc/curproc/file"'
16025                         val="$define"
16026                 fi
16027         fi
16028         ;;
16029 esac
16030 $rm -f reflect
16031 set d_procselfexe
16032 eval $setvar
16033
16034 : backward compatibility for d_hvfork
16035 if test X$d_hvfork != X; then
16036         d_vfork="$d_hvfork"
16037         d_hvfork=''
16038 fi
16039 : see if there is a vfork
16040 val=''
16041 set vfork val
16042 eval $inlibc
16043
16044 d_pseudofork=$undef
16045
16046 : Ok, but do we want to use it. vfork is reportedly unreliable in
16047 : perl on Solaris 2.x, and probably elsewhere.
16048 case "$val" in
16049 $define)
16050         echo " "
16051         case "$usevfork" in
16052         false) dflt='n';;
16053         *) dflt='y';;
16054         esac
16055         cat <<'EOM'
16056
16057 Perl can only use a vfork() that doesn't suffer from strict
16058 restrictions on calling functions or modifying global data in
16059 the child.  For example, glibc-2.1 contains such a vfork()
16060 that is unsuitable.  If your system provides a proper fork()
16061 call, chances are that you do NOT want perl to use vfork().
16062
16063 EOM
16064         rp="Do you still want to use vfork()?"
16065         . ./myread
16066         case "$ans" in
16067         y|Y) ;;
16068         *)
16069                 echo "Ok, we won't use vfork()."
16070                 val="$undef"
16071                 ;;
16072         esac
16073         ;;
16074 esac
16075 set d_vfork
16076 eval $setvar
16077 case "$d_vfork" in
16078 $define) usevfork='true';;
16079 *) usevfork='false';;
16080 esac
16081
16082 : see whether the pthread_atfork exists
16083 $cat >try.c <<EOP
16084 #include <pthread.h>
16085 #include <stdio.h>
16086 int main() {
16087 #ifdef  PTHREAD_ATFORK
16088         pthread_atfork(NULL,NULL,NULL);
16089 #endif
16090 }
16091 EOP
16092
16093 : see if pthread_atfork exists
16094 set try -DPTHREAD_ATFORK
16095 if eval $compile; then
16096     val="$define"
16097 else
16098     val="$undef"
16099 fi
16100 case "$usethreads" in
16101 $define)
16102         case "$val" in
16103         $define) echo 'pthread_atfork found.' >&4        ;;
16104         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16105         esac
16106 esac
16107 set d_pthread_atfork
16108 eval $setvar
16109
16110 : see if pthread_attr_setscope exists
16111 set pthread_attr_setscope d_pthread_attr_setscope
16112 eval $inlibc
16113
16114 : see whether the various POSIXish _yields exist
16115 $cat >try.c <<EOP
16116 #include <pthread.h>
16117 #include <stdio.h>
16118 int main() {
16119 #ifdef SCHED_YIELD
16120         sched_yield();
16121 #else
16122 #ifdef PTHREAD_YIELD
16123         pthread_yield();
16124 #else
16125 #ifdef PTHREAD_YIELD_NULL
16126         pthread_yield(NULL);
16127 #endif
16128 #endif
16129 #endif
16130 }
16131 EOP
16132 : see if sched_yield exists
16133 set try -DSCHED_YIELD
16134 if eval $compile; then
16135     val="$define"
16136     sched_yield='sched_yield()'
16137 else
16138     val="$undef"
16139 fi
16140 case "$usethreads" in
16141 $define)
16142         case "$val" in
16143         $define) echo 'sched_yield() found.' >&4        ;;
16144         *)       echo 'sched_yield() NOT found.' >&4    ;;
16145         esac
16146 esac
16147 set d_sched_yield
16148 eval $setvar
16149
16150 : see if pthread_yield exists
16151 set try -DPTHREAD_YIELD
16152 if eval $compile; then
16153     val="$define"
16154     case "$sched_yield" in
16155     '') sched_yield='pthread_yield()' ;;
16156     esac
16157 else
16158     set try -DPTHREAD_YIELD_NULL
16159     if eval $compile; then
16160         val="$define"
16161         case "$sched_yield" in
16162         '') sched_yield='pthread_yield(NULL)' ;;
16163         esac
16164     else
16165         val="$undef"
16166     fi
16167 fi
16168 case "$usethreads" in
16169 $define)
16170         case "$val" in
16171         $define) echo 'pthread_yield() found.' >&4      ;;
16172         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16173         esac
16174         ;;
16175 esac
16176 set d_pthread_yield
16177 eval $setvar
16178 case "$sched_yield" in
16179 '') sched_yield=undef ;;
16180 esac
16181 $rm_try
16182
16183 : see if random_r exists
16184 set random_r d_random_r
16185 eval $inlibc
16186 case "$d_random_r" in
16187 "$define")
16188         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16189         case "$d_random_r_proto:$usethreads" in
16190         ":define")      d_random_r_proto=define
16191                 set d_random_r_proto random_r $hdrs
16192                 eval $hasproto ;;
16193         *)      ;;
16194         esac
16195         case "$d_random_r_proto" in
16196         define)
16197         case "$random_r_proto" in
16198         ''|0) try='int random_r(int*, struct random_data*);'
16199         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16200         esac
16201         case "$random_r_proto" in
16202         ''|0) try='int random_r(long*, struct random_data*);'
16203         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16204         esac
16205         case "$random_r_proto" in
16206         ''|0) try='int random_r(struct random_data*, int32_t*);'
16207         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16208         esac
16209         case "$random_r_proto" in
16210         ''|0)   d_random_r=undef
16211                 random_r_proto=0
16212                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16213         * )     case "$random_r_proto" in
16214                 REENTRANT_PROTO*) ;;
16215                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16216                 esac
16217                 echo "Prototype: $try" ;;
16218         esac
16219         ;;
16220         *)      case "$usethreads" in
16221                 define) echo "random_r has no prototype, not using it." >&4 ;;
16222                 esac
16223                 d_random_r=undef
16224                 random_r_proto=0
16225                 ;;
16226         esac
16227         ;;
16228 *)      random_r_proto=0
16229         ;;
16230 esac
16231
16232 : see if readdir and friends exist
16233 set readdir d_readdir
16234 eval $inlibc
16235 set seekdir d_seekdir
16236 eval $inlibc
16237 set telldir d_telldir
16238 eval $inlibc
16239 set rewinddir d_rewinddir
16240 eval $inlibc
16241
16242 : see if readdir64_r exists
16243 set readdir64_r d_readdir64_r
16244 eval $inlibc
16245 case "$d_readdir64_r" in
16246 "$define")
16247         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16248         case "$d_readdir64_r_proto:$usethreads" in
16249         ":define")      d_readdir64_r_proto=define
16250                 set d_readdir64_r_proto readdir64_r $hdrs
16251                 eval $hasproto ;;
16252         *)      ;;
16253         esac
16254         case "$d_readdir64_r_proto" in
16255         define)
16256         case "$readdir64_r_proto" in
16257         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16258         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16259         esac
16260         case "$readdir64_r_proto" in
16261         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16262         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16263         esac
16264         case "$readdir64_r_proto" in
16265         ''|0)   d_readdir64_r=undef
16266                 readdir64_r_proto=0
16267                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16268         * )     case "$readdir64_r_proto" in
16269                 REENTRANT_PROTO*) ;;
16270                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16271                 esac
16272                 echo "Prototype: $try" ;;
16273         esac
16274         ;;
16275         *)      case "$usethreads" in
16276                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16277                 esac
16278                 d_readdir64_r=undef
16279                 readdir64_r_proto=0
16280                 ;;
16281         esac
16282         ;;
16283 *)      readdir64_r_proto=0
16284         ;;
16285 esac
16286
16287 : see if readdir_r exists
16288 set readdir_r d_readdir_r
16289 eval $inlibc
16290 case "$d_readdir_r" in
16291 "$define")
16292         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16293         case "$d_readdir_r_proto:$usethreads" in
16294         ":define")      d_readdir_r_proto=define
16295                 set d_readdir_r_proto readdir_r $hdrs
16296                 eval $hasproto ;;
16297         *)      ;;
16298         esac
16299         case "$d_readdir_r_proto" in
16300         define)
16301         case "$readdir_r_proto" in
16302         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16303         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16304         esac
16305         case "$readdir_r_proto" in
16306         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16307         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16308         esac
16309         case "$readdir_r_proto" in
16310         ''|0)   d_readdir_r=undef
16311                 readdir_r_proto=0
16312                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16313         * )     case "$readdir_r_proto" in
16314                 REENTRANT_PROTO*) ;;
16315                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16316                 esac
16317                 echo "Prototype: $try" ;;
16318         esac
16319         ;;
16320         *)      case "$usethreads" in
16321                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16322                 esac
16323                 d_readdir_r=undef
16324                 readdir_r_proto=0
16325                 ;;
16326         esac
16327         ;;
16328 *)      readdir_r_proto=0
16329         ;;
16330 esac
16331
16332 : see if readv exists
16333 set readv d_readv
16334 eval $inlibc
16335
16336 : see if recvmsg exists
16337 set recvmsg d_recvmsg
16338 eval $inlibc
16339
16340 : see if rename exists
16341 set rename d_rename
16342 eval $inlibc
16343
16344 : see if rmdir exists
16345 set rmdir d_rmdir
16346 eval $inlibc
16347
16348 : see if memory.h is available.
16349 val=''
16350 set memory.h val
16351 eval $inhdr
16352
16353 : See if it conflicts with string.h
16354 case "$val" in
16355 $define)
16356         case "$strings" in
16357         '') ;;
16358         *)
16359                 $cppstdin $cppflags $cppminus < $strings > mem.h
16360                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16361                         echo " "
16362                         echo "We won't be including <memory.h>."
16363                         val="$undef"
16364                 fi
16365                 $rm -f mem.h
16366                 ;;
16367         esac
16368 esac
16369 set i_memory
16370 eval $setvar
16371
16372 : can bcopy handle overlapping blocks?
16373 echo " "
16374 val="$undef"
16375 case "$d_memmove" in
16376 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16377 *)      case "$d_bcopy" in
16378         "$define")
16379                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16380                 $cat >try.c <<EOCP
16381 #$i_memory I_MEMORY
16382 #$i_stdlib I_STDLIB
16383 #$i_string I_STRING
16384 #$i_unistd I_UNISTD
16385 EOCP
16386         $cat >>try.c <<'EOCP'
16387 #include <stdio.h>
16388 #ifdef I_MEMORY
16389 #  include <memory.h>
16390 #endif
16391 #ifdef I_STDLIB
16392 #  include <stdlib.h>
16393 #endif
16394 #ifdef I_STRING
16395 #  include <string.h>
16396 #else
16397 #  include <strings.h>
16398 #endif
16399 #ifdef I_UNISTD
16400 #  include <unistd.h>  /* Needed for NetBSD */
16401 #endif
16402 int main()
16403 {
16404 char buf[128], abc[128];
16405 char *b;
16406 int len;
16407 int off;
16408 int align;
16409
16410 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16411    try to store the string in read-only memory. */
16412 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16413
16414 for (align = 7; align >= 0; align--) {
16415         for (len = 36; len; len--) {
16416                 b = buf+align;
16417                 bcopy(abc, b, len);
16418                 for (off = 1; off <= len; off++) {
16419                         bcopy(b, b+off, len);
16420                         bcopy(b+off, b, len);
16421                         if (bcmp(b, abc, len))
16422                                 exit(1);
16423                 }
16424         }
16425 }
16426 exit(0);
16427 }
16428 EOCP
16429                 set try
16430                 if eval $compile_ok; then
16431                         if $run ./try 2>/dev/null; then
16432                                 echo "Yes, it can."
16433                                 val="$define"
16434                         else
16435                                 echo "It can't, sorry."
16436                         fi
16437                 else
16438                         echo "(I can't compile the test program, so we'll assume not...)"
16439                 fi
16440                 ;;
16441         esac
16442         $rm_try
16443         ;;
16444 esac
16445 set d_safebcpy
16446 eval $setvar
16447
16448 : can memcpy handle overlapping blocks?
16449 echo " "
16450 val="$undef"
16451 case "$d_memmove" in
16452 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16453 *)      case "$d_memcpy" in
16454         "$define")
16455                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16456                 $cat >try.c <<EOCP
16457 #$i_memory I_MEMORY
16458 #$i_stdlib I_STDLIB
16459 #$i_string I_STRING
16460 #$i_unistd I_UNISTD
16461 EOCP
16462         $cat >>try.c <<'EOCP'
16463 #include <stdio.h>
16464 #ifdef I_MEMORY
16465 #  include <memory.h>
16466 #endif
16467 #ifdef I_STDLIB
16468 #  include <stdlib.h>
16469 #endif
16470 #ifdef I_STRING
16471 #  include <string.h>
16472 #else
16473 #  include <strings.h>
16474 #endif
16475 #ifdef I_UNISTD
16476 #  include <unistd.h>  /* Needed for NetBSD */
16477 #endif
16478 int main()
16479 {
16480 char buf[128], abc[128];
16481 char *b;
16482 int len;
16483 int off;
16484 int align;
16485
16486 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16487    try to store the string in read-only memory. */
16488 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16489
16490 for (align = 7; align >= 0; align--) {
16491         for (len = 36; len; len--) {
16492                 b = buf+align;
16493                 memcpy(b, abc, len);
16494                 for (off = 1; off <= len; off++) {
16495                         memcpy(b+off, b, len);
16496                         memcpy(b, b+off, len);
16497                         if (memcmp(b, abc, len))
16498                                 exit(1);
16499                 }
16500         }
16501 }
16502 exit(0);
16503 }
16504 EOCP
16505                 set try
16506                 if eval $compile_ok; then
16507                         if $run ./try 2>/dev/null; then
16508                                 echo "Yes, it can."
16509                                 val="$define"
16510                         else
16511                                 echo "It can't, sorry."
16512                         fi
16513                 else
16514                         echo "(I can't compile the test program, so we'll assume not...)"
16515                 fi
16516                 ;;
16517         esac
16518         $rm_try
16519         ;;
16520 esac
16521 set d_safemcpy
16522 eval $setvar
16523
16524 : can memcmp be trusted to compare relative magnitude?
16525 val="$undef"
16526 case "$d_memcmp" in
16527 "$define")
16528         echo " "
16529         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16530         $cat >try.c <<EOCP
16531 #$i_memory I_MEMORY
16532 #$i_stdlib I_STDLIB
16533 #$i_string I_STRING
16534 #$i_unistd I_UNISTD
16535 EOCP
16536         $cat >>try.c <<'EOCP'
16537 #include <stdio.h>
16538 #ifdef I_MEMORY
16539 #  include <memory.h>
16540 #endif
16541 #ifdef I_STDLIB
16542 #  include <stdlib.h>
16543 #endif
16544 #ifdef I_STRING
16545 #  include <string.h>
16546 #else
16547 #  include <strings.h>
16548 #endif
16549 #ifdef I_UNISTD
16550 #  include <unistd.h>  /* Needed for NetBSD */
16551 #endif
16552 int main()
16553 {
16554 char a = -1;
16555 char b = 0;
16556 if ((a < b) && memcmp(&a, &b, 1) < 0)
16557         exit(1);
16558 exit(0);
16559 }
16560 EOCP
16561         set try
16562         if eval $compile_ok; then
16563                 if $run ./try 2>/dev/null; then
16564                         echo "Yes, it can."
16565                         val="$define"
16566                 else
16567                         echo "No, it can't (it uses signed chars)."
16568                 fi
16569         else
16570                 echo "(I can't compile the test program, so we'll assume not...)"
16571         fi
16572         ;;
16573 esac
16574 $rm_try
16575 set d_sanemcmp
16576 eval $setvar
16577
16578 : see if prototype for sbrk is available
16579 echo " "
16580 set d_sbrkproto sbrk $i_unistd unistd.h
16581 eval $hasproto
16582
16583 : see if select exists
16584 set select d_select
16585 eval $inlibc
16586
16587 : see if semctl exists
16588 set semctl d_semctl
16589 eval $inlibc
16590
16591 : see if semget exists
16592 set semget d_semget
16593 eval $inlibc
16594
16595 : see if semop exists
16596 set semop d_semop
16597 eval $inlibc
16598
16599 : see how much of the 'sem*(2)' library is present.
16600 h_sem=true
16601 echo " "
16602 case "$d_semctl$d_semget$d_semop" in
16603 *"$undef"*) h_sem=false;;
16604 esac
16605 case "$osname" in
16606 freebsd)
16607     case "`ipcs 2>&1`" in
16608     "SVID messages"*"not configured"*)
16609         echo "Your $osname does not have the sem*(2) configured." >&4
16610         h_sem=false
16611         val="$undef"
16612         set semctl d_semctl
16613         eval $setvar
16614         set semget d_semget
16615         eval $setvar
16616         set semop d_semop
16617         eval $setvar
16618         ;;
16619     esac
16620     ;;
16621 esac
16622 : we could also check for sys/ipc.h ...
16623 if $h_sem && $test `./findhdr sys/sem.h`; then
16624         echo "You have the full sem*(2) library." >&4
16625         val="$define"
16626 else
16627         echo "You don't have the full sem*(2) library." >&4
16628         val="$undef"
16629 fi
16630 set d_sem
16631 eval $setvar
16632
16633 : see whether sys/sem.h defines union semun
16634 echo " "
16635 $cat > try.c <<'END'
16636 #include <sys/types.h>
16637 #include <sys/ipc.h>
16638 #include <sys/sem.h>
16639 int main () { union semun semun; semun.buf = 0; }
16640 END
16641 set try
16642 if eval $compile; then
16643     echo "You have union semun in <sys/sem.h>." >&4
16644     val="$define"
16645 else
16646     echo "You do not have union semun in <sys/sem.h>." >&4
16647     val="$undef"
16648 fi
16649 $rm_try
16650 set d_union_semun
16651 eval $setvar
16652
16653 : see how to do semctl IPC_STAT
16654 case "$d_sem" in
16655 $define)
16656     echo " "
16657     $cat > tryh.h <<END
16658 #ifndef S_IRUSR
16659 #   ifdef S_IREAD
16660 #       define S_IRUSR S_IREAD
16661 #       define S_IWUSR S_IWRITE
16662 #       define S_IXUSR S_IEXEC
16663 #   else
16664 #       define S_IRUSR 0400
16665 #       define S_IWUSR 0200
16666 #       define S_IXUSR 0100
16667 #   endif
16668 #   define S_IRGRP (S_IRUSR>>3)
16669 #   define S_IWGRP (S_IWUSR>>3)
16670 #   define S_IXGRP (S_IXUSR>>3)
16671 #   define S_IROTH (S_IRUSR>>6)
16672 #   define S_IWOTH (S_IWUSR>>6)
16673 #   define S_IXOTH (S_IXUSR>>6)
16674 #endif
16675 #ifndef S_IRWXU
16676 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16677 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16678 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16679 #endif
16680 END
16681     : see whether semctl IPC_STAT can use union semun
16682     case "$d_semctl_semun" in
16683     '')
16684       val="$undef"
16685       $cat > try.c <<END
16686 #include <sys/types.h>
16687 #include <sys/ipc.h>
16688 #include <sys/sem.h>
16689 #include <sys/stat.h>
16690 #include <stdio.h>
16691 #include <errno.h>
16692 #include "tryh.h"
16693 #ifndef errno
16694 extern int errno;
16695 #endif
16696 #$d_union_semun HAS_UNION_SEMUN
16697 int main() {
16698     union semun
16699 #ifndef HAS_UNION_SEMUN
16700     {
16701         int val;
16702         struct semid_ds *buf;
16703         unsigned short *array;
16704     }
16705 #endif
16706     arg;
16707     int sem, st;
16708
16709 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16710     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16711     if (sem > -1) {
16712         struct semid_ds argbuf;
16713         arg.buf = &argbuf;
16714 #       ifdef IPC_STAT
16715         st = semctl(sem, 0, IPC_STAT, arg);
16716         if (st == 0)
16717             printf("semun\n");
16718         else
16719 #       endif /* IPC_STAT */
16720             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16721 #       ifdef IPC_RMID
16722         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16723 #       endif /* IPC_RMID */
16724             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16725     } else
16726 #endif /* IPC_PRIVATE && ... */
16727         printf("semget failed: errno = %d\n", errno);
16728   return 0;
16729 }
16730 END
16731       set try
16732       if eval $compile; then
16733           xxx=`$run ./try`
16734           case "$xxx" in
16735           semun) val="$define" ;;
16736           esac
16737       fi
16738       $rm_try
16739       set d_semctl_semun
16740       eval $setvar
16741       ;;
16742     esac
16743     case "$d_semctl_semun" in
16744     $define)
16745         echo "You can use union semun for semctl IPC_STAT." >&4
16746         also='also'
16747         ;;
16748     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16749         also=''
16750         ;;
16751     esac
16752
16753     : see whether semctl IPC_STAT can use struct semid_ds pointer
16754     case "$d_semctl_semid_ds" in
16755     '')
16756       val="$undef"
16757       $cat > try.c <<'END'
16758 #include <sys/types.h>
16759 #include <sys/ipc.h>
16760 #include <sys/sem.h>
16761 #include <sys/stat.h>
16762 #include "tryh.h"
16763 #include <stdio.h>
16764 #include <errno.h>
16765 #ifndef errno
16766 extern int errno;
16767 #endif
16768 int main() {
16769     struct semid_ds arg;
16770     int sem, st;
16771
16772 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16773     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16774     if (sem > -1) {
16775 #       ifdef IPC_STAT
16776         st = semctl(sem, 0, IPC_STAT, &arg);
16777         if (st == 0)
16778             printf("semid_ds\n");
16779         else
16780 #       endif /* IPC_STAT */
16781             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16782 #       ifdef IPC_RMID
16783         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16784 #       endif /* IPC_RMID */
16785             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16786     } else
16787 #endif /* IPC_PRIVATE && ... */
16788         printf("semget failed: errno = %d\n", errno);
16789
16790     return 0;
16791 }
16792 END
16793       set try
16794       if eval $compile; then
16795           xxx=`$run ./try`
16796           case "$xxx" in
16797           semid_ds) val="$define" ;;
16798           esac
16799       fi
16800       $rm_try
16801       set d_semctl_semid_ds
16802       eval $setvar
16803       ;;
16804     esac
16805     case "$d_semctl_semid_ds" in
16806     $define)
16807         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16808         ;;
16809     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16810         ;;
16811     esac
16812     ;;
16813 *)  val="$undef"
16814
16815     # We do not have the full sem*(2) library, so assume we can not
16816     # use either.
16817
16818     set d_semctl_semun
16819     eval $setvar
16820
16821     set d_semctl_semid_ds
16822     eval $setvar
16823     ;;
16824 esac
16825 $rm_try tryh.h
16826
16827 : see if sendmsg exists
16828 set sendmsg d_sendmsg
16829 eval $inlibc
16830
16831 : see if setegid exists
16832 set setegid d_setegid
16833 eval $inlibc
16834
16835 : see if seteuid exists
16836 set seteuid d_seteuid
16837 eval $inlibc
16838
16839 : see if setgrent exists
16840 set setgrent d_setgrent
16841 eval $inlibc
16842
16843 : see if setgrent_r exists
16844 set setgrent_r d_setgrent_r
16845 eval $inlibc
16846 case "$d_setgrent_r" in
16847 "$define")
16848         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16849         case "$d_setgrent_r_proto:$usethreads" in
16850         ":define")      d_setgrent_r_proto=define
16851                 set d_setgrent_r_proto setgrent_r $hdrs
16852                 eval $hasproto ;;
16853         *)      ;;
16854         esac
16855         case "$d_setgrent_r_proto" in
16856         define)
16857         case "$setgrent_r_proto" in
16858         ''|0) try='int setgrent_r(FILE**);'
16859         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16860         esac
16861         case "$setgrent_r_proto" in
16862         ''|0) try='void setgrent_r(FILE**);'
16863         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16864         esac
16865         case "$setgrent_r_proto" in
16866         ''|0)   d_setgrent_r=undef
16867                 setgrent_r_proto=0
16868                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16869         * )     case "$setgrent_r_proto" in
16870                 REENTRANT_PROTO*) ;;
16871                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16872                 esac
16873                 echo "Prototype: $try" ;;
16874         esac
16875         ;;
16876         *)      case "$usethreads" in
16877                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16878                 esac
16879                 d_setgrent_r=undef
16880                 setgrent_r_proto=0
16881                 ;;
16882         esac
16883         ;;
16884 *)      setgrent_r_proto=0
16885         ;;
16886 esac
16887
16888 : see if sethostent exists
16889 set sethostent d_sethent
16890 eval $inlibc
16891
16892 : see if sethostent_r exists
16893 set sethostent_r d_sethostent_r
16894 eval $inlibc
16895 case "$d_sethostent_r" in
16896 "$define")
16897         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16898         case "$d_sethostent_r_proto:$usethreads" in
16899         ":define")      d_sethostent_r_proto=define
16900                 set d_sethostent_r_proto sethostent_r $hdrs
16901                 eval $hasproto ;;
16902         *)      ;;
16903         esac
16904         case "$d_sethostent_r_proto" in
16905         define)
16906         case "$sethostent_r_proto" in
16907         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16908         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16909         esac
16910         case "$sethostent_r_proto" in
16911         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16912         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16913         esac
16914         case "$sethostent_r_proto" in
16915         ''|0)   d_sethostent_r=undef
16916                 sethostent_r_proto=0
16917                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16918         * )     case "$sethostent_r_proto" in
16919                 REENTRANT_PROTO*) ;;
16920                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16921                 esac
16922                 echo "Prototype: $try" ;;
16923         esac
16924         ;;
16925         *)      case "$usethreads" in
16926                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16927                 esac
16928                 d_sethostent_r=undef
16929                 sethostent_r_proto=0
16930                 ;;
16931         esac
16932         ;;
16933 *)      sethostent_r_proto=0
16934         ;;
16935 esac
16936
16937 : see if setitimer exists
16938 set setitimer d_setitimer
16939 eval $inlibc
16940
16941 : see if setlinebuf exists
16942 set setlinebuf d_setlinebuf
16943 eval $inlibc
16944
16945 : see if setlocale exists
16946 set setlocale d_setlocale
16947 eval $inlibc
16948
16949 : see if locale.h is available
16950 set locale.h i_locale
16951 eval $inhdr
16952
16953 : see if setlocale_r exists
16954 set setlocale_r d_setlocale_r
16955 eval $inlibc
16956 case "$d_setlocale_r" in
16957 "$define")
16958         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16959         case "$d_setlocale_r_proto:$usethreads" in
16960         ":define")      d_setlocale_r_proto=define
16961                 set d_setlocale_r_proto setlocale_r $hdrs
16962                 eval $hasproto ;;
16963         *)      ;;
16964         esac
16965         case "$d_setlocale_r_proto" in
16966         define)
16967         case "$setlocale_r_proto" in
16968         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16969         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16970         esac
16971         case "$setlocale_r_proto" in
16972         ''|0)   d_setlocale_r=undef
16973                 setlocale_r_proto=0
16974                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16975         * )     case "$setlocale_r_proto" in
16976                 REENTRANT_PROTO*) ;;
16977                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16978                 esac
16979                 echo "Prototype: $try" ;;
16980         esac
16981         ;;
16982         *)      case "$usethreads" in
16983                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16984                 esac
16985                 d_setlocale_r=undef
16986                 setlocale_r_proto=0
16987                 ;;
16988         esac
16989         ;;
16990 *)      setlocale_r_proto=0
16991         ;;
16992 esac
16993
16994 : see if setnetent exists
16995 set setnetent d_setnent
16996 eval $inlibc
16997
16998 : see if setnetent_r exists
16999 set setnetent_r d_setnetent_r
17000 eval $inlibc
17001 case "$d_setnetent_r" in
17002 "$define")
17003         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17004         case "$d_setnetent_r_proto:$usethreads" in
17005         ":define")      d_setnetent_r_proto=define
17006                 set d_setnetent_r_proto setnetent_r $hdrs
17007                 eval $hasproto ;;
17008         *)      ;;
17009         esac
17010         case "$d_setnetent_r_proto" in
17011         define)
17012         case "$setnetent_r_proto" in
17013         ''|0) try='int setnetent_r(int, struct netent_data*);'
17014         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17015         esac
17016         case "$setnetent_r_proto" in
17017         ''|0) try='void setnetent_r(int, struct netent_data*);'
17018         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17019         esac
17020         case "$setnetent_r_proto" in
17021         ''|0)   d_setnetent_r=undef
17022                 setnetent_r_proto=0
17023                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17024         * )     case "$setnetent_r_proto" in
17025                 REENTRANT_PROTO*) ;;
17026                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17027                 esac
17028                 echo "Prototype: $try" ;;
17029         esac
17030         ;;
17031         *)      case "$usethreads" in
17032                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17033                 esac
17034                 d_setnetent_r=undef
17035                 setnetent_r_proto=0
17036                 ;;
17037         esac
17038         ;;
17039 *)      setnetent_r_proto=0
17040         ;;
17041 esac
17042
17043 : see if setprotoent exists
17044 set setprotoent d_setpent
17045 eval $inlibc
17046
17047 : see if setpgid exists
17048 set setpgid d_setpgid
17049 eval $inlibc
17050
17051 : see if setpgrp2 exists
17052 set setpgrp2 d_setpgrp2
17053 eval $inlibc
17054
17055 : see if setpriority exists
17056 set setpriority d_setprior
17057 eval $inlibc
17058
17059 : see if setproctitle exists
17060 set setproctitle d_setproctitle
17061 eval $inlibc
17062
17063 : see if setprotoent_r exists
17064 set setprotoent_r d_setprotoent_r
17065 eval $inlibc
17066 case "$d_setprotoent_r" in
17067 "$define")
17068         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17069         case "$d_setprotoent_r_proto:$usethreads" in
17070         ":define")      d_setprotoent_r_proto=define
17071                 set d_setprotoent_r_proto setprotoent_r $hdrs
17072                 eval $hasproto ;;
17073         *)      ;;
17074         esac
17075         case "$d_setprotoent_r_proto" in
17076         define)
17077         case "$setprotoent_r_proto" in
17078         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17079         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17080         esac
17081         case "$setprotoent_r_proto" in
17082         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17083         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17084         esac
17085         case "$setprotoent_r_proto" in
17086         ''|0)   d_setprotoent_r=undef
17087                 setprotoent_r_proto=0
17088                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17089         * )     case "$setprotoent_r_proto" in
17090                 REENTRANT_PROTO*) ;;
17091                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17092                 esac
17093                 echo "Prototype: $try" ;;
17094         esac
17095         ;;
17096         *)      case "$usethreads" in
17097                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17098                 esac
17099                 d_setprotoent_r=undef
17100                 setprotoent_r_proto=0
17101                 ;;
17102         esac
17103         ;;
17104 *)      setprotoent_r_proto=0
17105         ;;
17106 esac
17107
17108 : see if setpwent exists
17109 set setpwent d_setpwent
17110 eval $inlibc
17111
17112 : see if setpwent_r exists
17113 set setpwent_r d_setpwent_r
17114 eval $inlibc
17115 case "$d_setpwent_r" in
17116 "$define")
17117         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17118         case "$d_setpwent_r_proto:$usethreads" in
17119         ":define")      d_setpwent_r_proto=define
17120                 set d_setpwent_r_proto setpwent_r $hdrs
17121                 eval $hasproto ;;
17122         *)      ;;
17123         esac
17124         case "$d_setpwent_r_proto" in
17125         define)
17126         case "$setpwent_r_proto" in
17127         ''|0) try='int setpwent_r(FILE**);'
17128         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17129         esac
17130         case "$setpwent_r_proto" in
17131         ''|0) try='void setpwent_r(FILE**);'
17132         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17133         esac
17134         case "$setpwent_r_proto" in
17135         ''|0)   d_setpwent_r=undef
17136                 setpwent_r_proto=0
17137                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17138         * )     case "$setpwent_r_proto" in
17139                 REENTRANT_PROTO*) ;;
17140                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17141                 esac
17142                 echo "Prototype: $try" ;;
17143         esac
17144         ;;
17145         *)      case "$usethreads" in
17146                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17147                 esac
17148                 d_setpwent_r=undef
17149                 setpwent_r_proto=0
17150                 ;;
17151         esac
17152         ;;
17153 *)      setpwent_r_proto=0
17154         ;;
17155 esac
17156
17157 : see if setregid exists
17158 set setregid d_setregid
17159 eval $inlibc
17160 set setresgid d_setresgid
17161 eval $inlibc
17162
17163 : see if setreuid exists
17164 set setreuid d_setreuid
17165 eval $inlibc
17166 set setresuid d_setresuid
17167 eval $inlibc
17168
17169 : see if setrgid exists
17170 set setrgid d_setrgid
17171 eval $inlibc
17172
17173 : see if setruid exists
17174 set setruid d_setruid
17175 eval $inlibc
17176
17177 : see if setservent exists
17178 set setservent d_setsent
17179 eval $inlibc
17180
17181 : see if setservent_r exists
17182 set setservent_r d_setservent_r
17183 eval $inlibc
17184 case "$d_setservent_r" in
17185 "$define")
17186         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17187         case "$d_setservent_r_proto:$usethreads" in
17188         ":define")      d_setservent_r_proto=define
17189                 set d_setservent_r_proto setservent_r $hdrs
17190                 eval $hasproto ;;
17191         *)      ;;
17192         esac
17193         case "$d_setservent_r_proto" in
17194         define)
17195         case "$setservent_r_proto" in
17196         ''|0) try='int setservent_r(int, struct servent_data*);'
17197         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17198         esac
17199         case "$setservent_r_proto" in
17200         ''|0) try='void setservent_r(int, struct servent_data*);'
17201         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17202         esac
17203         case "$setservent_r_proto" in
17204         ''|0)   d_setservent_r=undef
17205                 setservent_r_proto=0
17206                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17207         * )     case "$setservent_r_proto" in
17208                 REENTRANT_PROTO*) ;;
17209                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17210                 esac
17211                 echo "Prototype: $try" ;;
17212         esac
17213         ;;
17214         *)      case "$usethreads" in
17215                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17216                 esac
17217                 d_setservent_r=undef
17218                 setservent_r_proto=0
17219                 ;;
17220         esac
17221         ;;
17222 *)      setservent_r_proto=0
17223         ;;
17224 esac
17225
17226 : see if setsid exists
17227 set setsid d_setsid
17228 eval $inlibc
17229
17230 : see if setvbuf exists
17231 set setvbuf d_setvbuf
17232 eval $inlibc
17233
17234 : see if sfio.h is available
17235 set sfio.h i_sfio
17236 eval $inhdr
17237
17238 : see if sfio library is available
17239 case "$i_sfio" in
17240 $define)
17241         val=''
17242         set sfreserve val
17243         eval $inlibc
17244         ;;
17245 *)
17246         val="$undef"
17247         ;;
17248 esac
17249 : Ok, but do we want to use it.
17250 case "$val" in
17251 $define)
17252         case "$usesfio" in
17253         true|$define|[yY]*) dflt='y';;
17254         *) dflt='n';;
17255         esac
17256         echo "$package can use the sfio library, but it is experimental."
17257         case "$useperlio" in
17258         "$undef")
17259             echo "For sfio also the PerlIO abstraction layer is needed."
17260             echo "Earlier you said you wouldn't want that."
17261             ;;
17262         esac
17263         rp="You seem to have sfio available, do you want to try using it?"
17264         . ./myread
17265         case "$ans" in
17266         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17267                 useperlio="$define"
17268                 val="$define"
17269                 ;;
17270         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17271                 val="$undef"
17272                 ;;
17273         esac
17274         ;;
17275 *)      case "$usesfio" in
17276         true|$define|[yY]*)
17277                 echo "Sorry, cannot find sfio on this machine." >&4
17278                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17279                 val="$undef"
17280                 ;;
17281         esac
17282         ;;
17283 esac
17284 set d_sfio
17285 eval $setvar
17286 case "$d_sfio" in
17287 $define) usesfio='true';;
17288 *) usesfio='false';;
17289 esac
17290 case "$d_sfio" in
17291 $define) ;;
17292 *)      : Remove sfio from list of libraries to use
17293         case "$libs" in
17294         *-lsfio*)
17295                 echo "Removing unneeded -lsfio from library list" >&4
17296                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17297                 shift
17298                 libs="$*"
17299                 echo "libs = $libs" >&4
17300                 ;;
17301         esac
17302 ;;
17303 esac
17304
17305
17306 : see if shmctl exists
17307 set shmctl d_shmctl
17308 eval $inlibc
17309
17310 : see if shmget exists
17311 set shmget d_shmget
17312 eval $inlibc
17313
17314 : see if shmat exists
17315 set shmat d_shmat
17316 eval $inlibc
17317 : see what shmat returns
17318 case "$d_shmat" in
17319 "$define")
17320         $cat >shmat.c <<'END'
17321 #include <sys/shm.h>
17322 void *shmat();
17323 END
17324         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17325                 shmattype='void *'
17326         else
17327                 shmattype='char *'
17328         fi
17329         echo "and it returns ($shmattype)." >&4
17330         : see if a prototype for shmat is available
17331         xxx=`./findhdr sys/shm.h`
17332         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17333         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17334                 val="$define"
17335         else
17336                 val="$undef"
17337         fi
17338         $rm -f shmat.[co]
17339         ;;
17340 *)
17341         val="$undef"
17342         ;;
17343 esac
17344 set d_shmatprototype
17345 eval $setvar
17346
17347 : see if shmdt exists
17348 set shmdt d_shmdt
17349 eval $inlibc
17350
17351 : see how much of the 'shm*(2)' library is present.
17352 h_shm=true
17353 echo " "
17354 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17355 *"$undef"*) h_shm=false;;
17356 esac
17357 case "$osname" in
17358 freebsd)
17359     case "`ipcs 2>&1`" in
17360     "SVID shared memory"*"not configured"*)
17361         echo "Your $osname does not have the shm*(2) configured." >&4
17362         h_shm=false
17363         val="$undef"
17364         set shmctl d_shmctl
17365         evat $setvar
17366         set shmget d_shmget
17367         evat $setvar
17368         set shmat d_shmat
17369         evat $setvar
17370         set shmdt d_shmdt
17371         evat $setvar
17372         ;;
17373     esac
17374     ;;
17375 esac
17376 : we could also check for sys/ipc.h ...
17377 if $h_shm && $test `./findhdr sys/shm.h`; then
17378         echo "You have the full shm*(2) library." >&4
17379         val="$define"
17380 else
17381         echo "You don't have the full shm*(2) library." >&4
17382         val="$undef"
17383 fi
17384 set d_shm
17385 eval $setvar
17386
17387 : see if we have sigaction
17388 echo " "
17389 if set sigaction val -f d_sigaction; eval $csym; $val; then
17390         echo 'sigaction() found.' >&4
17391         $cat > try.c <<EOP
17392 #include <stdio.h>
17393 #include <sys/types.h>
17394 #include <signal.h>
17395 #$i_stdlib I_STDLIB
17396 #ifdef I_STDLIB
17397 #include <stdlib.h>
17398 #endif
17399 int main()
17400 {
17401     struct sigaction act, oact;
17402     act.sa_flags = 0;
17403     oact.sa_handler = 0;
17404     /* so that act and oact are used */
17405     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17406 }
17407 EOP
17408         set try
17409         if eval $compile_ok; then
17410                 val="$define"
17411         else
17412                 echo "But you don't seem to have a useable struct sigaction." >&4
17413                 val="$undef"
17414         fi
17415 else
17416         echo 'sigaction NOT found.' >&4
17417         val="$undef"
17418 fi
17419 set d_sigaction; eval $setvar
17420 $rm_try
17421
17422 : see if this is a sunmath.h system
17423 set sunmath.h i_sunmath
17424 eval $inhdr
17425
17426 : see if signbit exists
17427 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17428 $cat >try.c <<EOCP
17429 #$i_math I_MATH
17430 #$i_sunmath I_SUNMATH
17431 #ifdef I_MATH
17432 #  include <math.h>
17433 #endif
17434 #ifdef I_SUNMATH  /* Solaris special math library */
17435 #  include <sunmath.h>
17436 #endif
17437 #define NV $nvtype
17438 int main(int argc, char **argv)
17439 {
17440     NV x = 0.0;
17441     NV y = -0.0;
17442     if ((signbit(x) == 0) && (signbit(y) != 0))
17443         return 0;
17444     else
17445         return 1;
17446 }
17447 EOCP
17448 val="$undef"
17449 set try
17450 if eval $compile; then
17451     if $run ./try; then
17452         $echo "Yes." >&4
17453         val="$define"
17454     else
17455         $echo "Signbit seems to be available, but doesn't work as I expected."
17456         $echo "I won't use it." >&4
17457         val="$undef"
17458     fi
17459 else
17460     $echo "Nope." >&4
17461     dflt="$undef"
17462 fi
17463 set d_signbit
17464 eval $setvar
17465 $rm_try
17466
17467 : see if sigprocmask exists
17468 set sigprocmask d_sigprocmask
17469 eval $inlibc
17470
17471 : see if sigsetjmp exists
17472 echo " "
17473 case "$d_sigsetjmp" in
17474 '')
17475         $cat >try.c <<EOP
17476 #include <setjmp.h>
17477 #$i_stdlib I_STDLIB
17478 #ifdef I_STDLIB
17479 #include <stdlib.h>
17480 #endif
17481 sigjmp_buf env;
17482 int set = 1;
17483 int main()
17484 {
17485         if (sigsetjmp(env,1))
17486                 exit(set);
17487         set = 0;
17488         siglongjmp(env, 1);
17489         exit(1);
17490 }
17491 EOP
17492         set try
17493         if eval $compile; then
17494                 if $run ./try >/dev/null 2>&1; then
17495                         echo "POSIX sigsetjmp found." >&4
17496                         val="$define"
17497                 else
17498                         $cat >&4 <<EOM
17499 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17500 I'll ignore them.
17501 EOM
17502                         val="$undef"
17503                 fi
17504         else
17505                 echo "sigsetjmp not found." >&4
17506                 val="$undef"
17507         fi
17508         ;;
17509 *) val="$d_sigsetjmp"
17510         case "$d_sigsetjmp" in
17511         $define) echo "POSIX sigsetjmp found." >&4;;
17512         $undef) echo "sigsetjmp not found." >&4;;
17513         esac
17514         ;;
17515 esac
17516 set d_sigsetjmp
17517 eval $setvar
17518 $rm_try
17519
17520 : see if snprintf exists
17521 set snprintf d_snprintf
17522 eval $inlibc
17523
17524 : see if vsnprintf exists
17525 set vsnprintf d_vsnprintf
17526 eval $inlibc
17527
17528 case "$d_snprintf-$d_vsnprintf" in
17529 "$define-$define")
17530     $cat <<EOM
17531 Checking whether your snprintf() and vsnprintf() work okay...
17532 EOM
17533     $cat >try.c <<'EOCP'
17534 /* v?snprintf testing logic courtesy of Russ Allbery.
17535  * According to C99:
17536  * - if the buffer is too short it still must be \0-terminated
17537  * - if the buffer is too short the potentially required length
17538  *   must be returned and not -1
17539  * - if the buffer is NULL the potentially required length
17540  *   must be returned and not -1 or core dump
17541  */
17542 #include <stdio.h>
17543 #include <stdarg.h>
17544
17545 char buf[2];
17546
17547 int test (char *format, ...)
17548 {
17549     va_list args;
17550     int count;
17551
17552     va_start (args, format);
17553     count = vsnprintf (buf, sizeof buf, format, args);
17554     va_end (args);
17555     return count;
17556 }
17557
17558 int main ()
17559 {
17560     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17561              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17562 }
17563 EOCP
17564     set try
17565     if eval $compile; then
17566         `$run ./try`
17567         case "$?" in
17568         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17569         *) cat <<EOM >&4
17570 Your snprintf() and snprintf() don't seem to be working okay.
17571 EOM
17572            d_snprintf="$undef"
17573            d_vsnprintf="$undef"
17574            ;;
17575         esac
17576     else
17577         echo "(I can't seem to compile the test program--assuming they don't)"
17578         d_snprintf="$undef"
17579         d_vsnprintf="$undef"
17580     fi
17581     $rm_try
17582     ;;
17583 esac
17584
17585 : see if sockatmark exists
17586 set sockatmark d_sockatmark
17587 eval $inlibc
17588
17589 : see if prototype for sockatmark is available
17590 echo " "
17591 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17592 eval $hasproto
17593
17594 : see if socks5_init exists
17595 set socks5_init d_socks5_init
17596 eval $inlibc
17597
17598 : see if sprintf returns the length of the string in the buffer as per ANSI
17599 $echo "Checking whether sprintf returns the length of the string..." >&4
17600 $cat <<EOP >try.c
17601 #include <stdio.h>
17602 #$i_stdlib I_STDLIB
17603 #ifdef I_STDLIB
17604 #include <stdlib.h>
17605 #endif
17606 #$i_string I_STRING
17607 #ifdef I_STRING
17608 #  include <string.h>
17609 #else
17610 #  include <strings.h>
17611 #endif
17612 #$i_math I_MATH
17613 #ifdef I_MATH
17614 #include <math.h>
17615 #endif
17616
17617 char buffer[256];
17618
17619 int check (size_t expect, int test) {
17620   size_t got = strlen(buffer);
17621   if (expect == got)
17622     return 0;
17623
17624   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17625        test, buffer);
17626   exit (test);
17627 }
17628
17629 int main(int argc, char **argv) {
17630   int test = 0;
17631
17632   check(sprintf(buffer, ""), ++test);
17633   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17634   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17635
17636   return 0;
17637 }
17638 EOP
17639 set try
17640
17641 if eval $compile; then
17642     xxx="`$run ./try`"
17643     case "$?" in
17644         0) cat >&4 <<EOM
17645 sprintf returns the length of the string (as ANSI says it should)
17646 EOM
17647         d_sprintf_returns_strlen="$define"
17648         ;;
17649         *) cat >&4 <<EOM
17650 sprintf does not return the length of the string (how old is this system?)
17651 EOM
17652         d_sprintf_returns_strlen="$undef"
17653         ;;
17654     esac
17655 else
17656     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17657     d_sprintf_returns_strlen="$undef"
17658 fi
17659 $rm_try
17660
17661 : see if srand48_r exists
17662 set srand48_r d_srand48_r
17663 eval $inlibc
17664 case "$d_srand48_r" in
17665 "$define")
17666         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17667         case "$d_srand48_r_proto:$usethreads" in
17668         ":define")      d_srand48_r_proto=define
17669                 set d_srand48_r_proto srand48_r $hdrs
17670                 eval $hasproto ;;
17671         *)      ;;
17672         esac
17673         case "$d_srand48_r_proto" in
17674         define)
17675         case "$srand48_r_proto" in
17676         ''|0) try='int srand48_r(long, struct drand48_data*);'
17677         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17678         esac
17679         case "$srand48_r_proto" in
17680         ''|0)   d_srand48_r=undef
17681                 srand48_r_proto=0
17682                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17683         * )     case "$srand48_r_proto" in
17684                 REENTRANT_PROTO*) ;;
17685                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17686                 esac
17687                 echo "Prototype: $try" ;;
17688         esac
17689         ;;
17690         *)      case "$usethreads" in
17691                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17692                 esac
17693                 d_srand48_r=undef
17694                 srand48_r_proto=0
17695                 ;;
17696         esac
17697         ;;
17698 *)      srand48_r_proto=0
17699         ;;
17700 esac
17701
17702 : see if srandom_r exists
17703 set srandom_r d_srandom_r
17704 eval $inlibc
17705 case "$d_srandom_r" in
17706 "$define")
17707         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17708         case "$d_srandom_r_proto:$usethreads" in
17709         ":define")      d_srandom_r_proto=define
17710                 set d_srandom_r_proto srandom_r $hdrs
17711                 eval $hasproto ;;
17712         *)      ;;
17713         esac
17714         case "$d_srandom_r_proto" in
17715         define)
17716         case "$srandom_r_proto" in
17717         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17718         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17719         esac
17720         case "$srandom_r_proto" in
17721         ''|0)   d_srandom_r=undef
17722                 srandom_r_proto=0
17723                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17724         * )     case "$srandom_r_proto" in
17725                 REENTRANT_PROTO*) ;;
17726                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17727                 esac
17728                 echo "Prototype: $try" ;;
17729         esac
17730         ;;
17731         *)      case "$usethreads" in
17732                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17733                 esac
17734                 d_srandom_r=undef
17735                 srandom_r_proto=0
17736                 ;;
17737         esac
17738         ;;
17739 *)      srandom_r_proto=0
17740         ;;
17741 esac
17742
17743 : see if prototype for setresgid is available
17744 echo " "
17745 set d_sresgproto setresgid $i_unistd unistd.h
17746 eval $hasproto
17747
17748 : see if prototype for setresuid is available
17749 echo " "
17750 set d_sresuproto setresuid $i_unistd unistd.h
17751 eval $hasproto
17752
17753 : see if sys/stat.h is available
17754 set sys/stat.h i_sysstat
17755 eval $inhdr
17756
17757 : see if stat knows about block sizes
17758 echo " "
17759 echo "Checking to see if your struct stat has st_blocks field..." >&4
17760 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17761 eval $hasfield
17762
17763 : see if this is a sys/vfs.h system
17764 set sys/vfs.h i_sysvfs
17765 eval $inhdr
17766
17767 : see if this is a sys/statfs.h system
17768 set sys/statfs.h i_sysstatfs
17769 eval $inhdr
17770
17771 : Check for statfs_s
17772 echo " "
17773 echo "Checking to see if your system supports struct statfs..." >&4
17774 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
17775 eval $hasstruct
17776 case "$d_statfs_s" in
17777 "$define")      echo "Yes, it does."   ;;
17778 *)              echo "No, it doesn't." ;;
17779 esac
17780
17781
17782 : see if struct statfs knows about f_flags
17783 case "$d_statfs_s" in
17784 define)
17785         echo " "
17786         echo "Checking to see if your struct statfs has f_flags field..." >&4
17787         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
17788         eval $hasfield
17789         ;;
17790 *)      val="$undef"
17791         set d_statfs_f_flags
17792         eval $setvar
17793         ;;
17794 esac
17795 case "$d_statfs_f_flags" in
17796 "$define")      echo "Yes, it does."   ;;
17797 *)              echo "No, it doesn't." ;;
17798 esac
17799
17800 : Check stream access
17801 $cat >&4 <<EOM
17802 Checking how to access stdio streams by file descriptor number...
17803 EOM
17804 case "$stdio_stream_array" in
17805 '')     $cat >try.c <<EOCP
17806 #include <stdio.h>
17807 int main() {
17808   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17809     printf("yes\n");
17810 }
17811 EOCP
17812         for s in _iob __iob __sF
17813         do
17814                 set try -DSTDIO_STREAM_ARRAY=$s
17815                 if eval $compile; then
17816                         case "`$run ./try`" in
17817                         yes)    stdio_stream_array=$s; break ;;
17818                         esac
17819                 fi
17820         done
17821         $rm_try
17822 esac
17823 case "$stdio_stream_array" in
17824 '')     $cat >&4 <<EOM
17825 I can't figure out how to access stdio streams by file descriptor number.
17826 EOM
17827         d_stdio_stream_array="$undef"
17828         ;;
17829 *)      $cat >&4 <<EOM
17830 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17831 EOM
17832         d_stdio_stream_array="$define"
17833         ;;
17834 esac
17835
17836 : see if strcoll exists
17837 set strcoll d_strcoll
17838 eval $inlibc
17839
17840 : check for structure copying
17841 echo " "
17842 echo "Checking to see if your C compiler can copy structs..." >&4
17843 $cat >try.c <<'EOCP'
17844 int main()
17845 {
17846         struct blurfl {
17847                 int dyick;
17848         } foo, bar;
17849
17850         foo = bar;
17851 }
17852 EOCP
17853 if $cc -c try.c >/dev/null 2>&1 ; then
17854         val="$define"
17855         echo "Yup, it can."
17856 else
17857         val="$undef"
17858         echo "Nope, it can't."
17859 fi
17860 set d_strctcpy
17861 eval $setvar
17862 $rm_try
17863
17864 : see if strerror and/or sys_errlist[] exist
17865 echo " "
17866 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17867     if set strerror val -f d_strerror; eval $csym; $val; then
17868                 echo 'strerror() found.' >&4
17869                 d_strerror="$define"
17870                 d_strerrm='strerror(e)'
17871                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17872                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17873                         d_syserrlst="$define"
17874                 else
17875                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17876                         d_syserrlst="$undef"
17877                 fi
17878     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17879                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17880                 echo 'strerror() found in string header.' >&4
17881                 d_strerror="$define"
17882                 d_strerrm='strerror(e)'
17883                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17884                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17885                                 d_syserrlst="$define"
17886                 else
17887                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17888                         d_syserrlst="$undef"
17889                 fi
17890     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17891                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17892                 d_strerror="$undef"
17893                 d_syserrlst="$define"
17894                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17895     else
17896                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17897                 d_strerror="$undef"
17898                 d_syserrlst="$undef"
17899                 d_strerrm='"unknown"'
17900     fi
17901 fi
17902
17903 : see if strerror_r exists
17904 set strerror_r d_strerror_r
17905 eval $inlibc
17906 case "$d_strerror_r" in
17907 "$define")
17908         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17909         case "$d_strerror_r_proto:$usethreads" in
17910         ":define")      d_strerror_r_proto=define
17911                 set d_strerror_r_proto strerror_r $hdrs
17912                 eval $hasproto ;;
17913         *)      ;;
17914         esac
17915         case "$d_strerror_r_proto" in
17916         define)
17917         case "$strerror_r_proto" in
17918         ''|0) try='int strerror_r(int, char*, size_t);'
17919         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
17920         esac
17921         case "$strerror_r_proto" in
17922         ''|0) try='int strerror_r(int, char*, int);'
17923         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
17924         esac
17925         case "$strerror_r_proto" in
17926         ''|0) try='char* strerror_r(int, char*, size_t);'
17927         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
17928         esac
17929         case "$strerror_r_proto" in
17930         ''|0)   d_strerror_r=undef
17931                 strerror_r_proto=0
17932                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17933         * )     case "$strerror_r_proto" in
17934                 REENTRANT_PROTO*) ;;
17935                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17936                 esac
17937                 echo "Prototype: $try" ;;
17938         esac
17939         ;;
17940         *)      case "$usethreads" in
17941                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17942                 esac
17943                 d_strerror_r=undef
17944                 strerror_r_proto=0
17945                 ;;
17946         esac
17947         ;;
17948 *)      strerror_r_proto=0
17949         ;;
17950 esac
17951
17952 : see if strftime exists
17953 set strftime d_strftime
17954 eval $inlibc
17955
17956 : see if strlcat exists
17957 set strlcat d_strlcat
17958 eval $inlibc
17959
17960 : see if strlcpy exists
17961 set strlcpy d_strlcpy
17962 eval $inlibc
17963
17964 : see if strtod exists
17965 set strtod d_strtod
17966 eval $inlibc
17967
17968 : see if strtol exists
17969 set strtol d_strtol
17970 eval $inlibc
17971
17972 : see if strtold exists
17973 set strtold d_strtold
17974 eval $inlibc
17975
17976 : see if strtoll exists
17977 set strtoll d_strtoll
17978 eval $inlibc
17979
17980 case "$d_longlong-$d_strtoll" in
17981 "$define-$define")
17982         $cat <<EOM
17983 Checking whether your strtoll() works okay...
17984 EOM
17985         $cat >try.c <<'EOCP'
17986 #include <errno.h>
17987 #ifdef __hpux
17988 #define strtoll __strtoll
17989 #endif
17990 #ifdef __EMX__
17991 #define strtoll _strtoll
17992 #endif
17993 #include <stdio.h>
17994 extern long long int strtoll(char *s, char **, int);
17995 static int bad = 0;
17996 int check(char *s, long long ell, int een) {
17997         long long gll;
17998         errno = 0;
17999         gll = strtoll(s, 0, 10);
18000         if (!((gll == ell) && (errno == een)))
18001                 bad++;
18002 }
18003 int main() {
18004         check(" 1",                                      1LL, 0);
18005         check(" 0",                                      0LL, 0);
18006         check("-1",                                     -1LL, 0);
18007         check("-9223372036854775808", -9223372036854775808LL, 0);
18008         check("-9223372036854775808", -9223372036854775808LL, 0);
18009         check(" 9223372036854775807",  9223372036854775807LL, 0);
18010         check("-9223372036854775808", -9223372036854775808LL, 0);
18011         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18012         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18013         if (!bad)
18014                 printf("ok\n");
18015 }
18016 EOCP
18017         set try
18018         if eval $compile; then
18019                 yyy=`$run ./try`
18020                 case "$yyy" in
18021                 ok) echo "Your strtoll() seems to be working okay." ;;
18022                 *) cat <<EOM >&4
18023 Your strtoll() doesn't seem to be working okay.
18024 EOM
18025                    d_strtoll="$undef"
18026                    ;;
18027                 esac
18028         else
18029                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18030                 d_strtoll="$undef"
18031         fi
18032         ;;
18033 esac
18034
18035 : see if strtoq exists
18036 set strtoq d_strtoq
18037 eval $inlibc
18038
18039 : see if strtoul exists
18040 set strtoul d_strtoul
18041 eval $inlibc
18042
18043 case "$d_strtoul" in
18044 "$define")
18045         $cat <<EOM
18046 Checking whether your strtoul() works okay...
18047 EOM
18048         $cat >try.c <<'EOCP'
18049 #include <errno.h>
18050 #include <stdio.h>
18051 extern unsigned long int strtoul(char *s, char **, int);
18052 static int bad = 0;
18053 void check(char *s, unsigned long eul, int een) {
18054         unsigned long gul;
18055         errno = 0;
18056         gul = strtoul(s, 0, 10);
18057         if (!((gul == eul) && (errno == een)))
18058                 bad++;
18059 }
18060 int main() {
18061         check(" 1", 1L, 0);
18062         check(" 0", 0L, 0);
18063 EOCP
18064         case "$longsize" in
18065         8)
18066             $cat >>try.c <<'EOCP'
18067         check("18446744073709551615", 18446744073709551615UL, 0);
18068         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18069 #if 0 /* strtoul() for /^-/ strings is undefined. */
18070         check("-1", 18446744073709551615UL, 0);
18071         check("-18446744073709551614", 2, 0);
18072         check("-18446744073709551615", 1, 0);
18073         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18074         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18075 #endif
18076 EOCP
18077                 ;;
18078         4)
18079                     $cat >>try.c <<'EOCP'
18080         check("4294967295", 4294967295UL, 0);
18081         check("4294967296", 4294967295UL, ERANGE);
18082 #if 0 /* strtoul() for /^-/ strings is undefined. */
18083         check("-1", 4294967295UL, 0);
18084         check("-4294967294", 2, 0);
18085         check("-4294967295", 1, 0);
18086         check("-4294967296", 4294967295UL, ERANGE);
18087         check("-4294967297", 4294967295UL, ERANGE);
18088 #endif
18089 EOCP
18090                 ;;
18091         *)
18092 : Should we write these tests to be more portable by sprintf-ing
18093 : ~0 and then manipulating that char string as input for strtol?
18094                 ;;
18095         esac
18096         $cat >>try.c <<'EOCP'
18097         if (!bad)
18098                 printf("ok\n");
18099         return 0;
18100 }
18101 EOCP
18102         set try
18103         if eval $compile; then
18104                 case "`$run ./try`" in
18105                 ok) echo "Your strtoul() seems to be working okay." ;;
18106                 *) cat <<EOM >&4
18107 Your strtoul() doesn't seem to be working okay.
18108 EOM
18109                    d_strtoul="$undef"
18110                    ;;
18111                 esac
18112         else
18113                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18114                 d_strtoul="$undef"
18115         fi
18116         ;;
18117 esac
18118
18119 : see if strtoull exists
18120 set strtoull d_strtoull
18121 eval $inlibc
18122
18123 case "$d_longlong-$d_strtoull" in
18124 "$define-$define")
18125         $cat <<EOM
18126 Checking whether your strtoull() works okay...
18127 EOM
18128         $cat >try.c <<'EOCP'
18129 #include <errno.h>
18130 #ifdef __hpux
18131 #define strtoull __strtoull
18132 #endif
18133 #include <stdio.h>
18134 extern unsigned long long int strtoull(char *s, char **, int);
18135 static int bad = 0;
18136 int check(char *s, long long eull, int een) {
18137         long long gull;
18138         errno = 0;
18139         gull = strtoull(s, 0, 10);
18140         if (!((gull == eull) && (errno == een)))
18141                 bad++;
18142 }
18143 int main() {
18144         check(" 1",                                        1LL, 0);
18145         check(" 0",                                        0LL, 0);
18146         check("18446744073709551615",  18446744073709551615ULL, 0);
18147         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18148 #if 0 /* strtoull() for /^-/ strings is undefined. */
18149         check("-1",                    18446744073709551615ULL, 0);
18150         check("-18446744073709551614",                     2LL, 0);
18151         check("-18446744073709551615",                     1LL, 0);
18152         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18153         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18154 #endif
18155         if (!bad)
18156                 printf("ok\n");
18157 }
18158 EOCP
18159         set try
18160         if eval $compile; then
18161                 case "`$run ./try`" in
18162                 ok) echo "Your strtoull() seems to be working okay." ;;
18163                 *) cat <<EOM >&4
18164 Your strtoull() doesn't seem to be working okay.
18165 EOM
18166                    d_strtoull="$undef"
18167                    ;;
18168                 esac
18169         else
18170                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18171                 d_strtoull="$undef"
18172         fi
18173         ;;
18174 esac
18175
18176 : see if strtouq exists
18177 set strtouq d_strtouq
18178 eval $inlibc
18179
18180 case "$d_strtouq" in
18181 "$define")
18182         $cat <<EOM
18183 Checking whether your strtouq() works okay...
18184 EOM
18185         $cat >try.c <<'EOCP'
18186 #include <errno.h>
18187 #include <stdio.h>
18188 extern unsigned long long int strtouq(char *s, char **, int);
18189 static int bad = 0;
18190 void check(char *s, unsigned long long eull, int een) {
18191         unsigned long long gull;
18192         errno = 0;
18193         gull = strtouq(s, 0, 10);
18194         if (!((gull == eull) && (errno == een)))
18195                 bad++;
18196 }
18197 int main() {
18198         check(" 1",                                        1LL, 0);
18199         check(" 0",                                        0LL, 0);
18200         check("18446744073709551615",  18446744073709551615ULL, 0);
18201         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18202 #if 0 /* strtouq() for /^-/ strings is undefined. */
18203         check("-1",                    18446744073709551615ULL, 0);
18204         check("-18446744073709551614",                     2LL, 0);
18205         check("-18446744073709551615",                     1LL, 0);
18206         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18207         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18208 #endif
18209         if (!bad)
18210                 printf("ok\n");
18211         return 0;
18212 }
18213 EOCP
18214         set try
18215         if eval $compile; then
18216                 case "`$run ./try`" in
18217                 ok) echo "Your strtouq() seems to be working okay." ;;
18218                 *) cat <<EOM >&4
18219 Your strtouq() doesn't seem to be working okay.
18220 EOM
18221                    d_strtouq="$undef"
18222                    ;;
18223                 esac
18224         else
18225                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18226                 d_strtouq="$undef"
18227         fi
18228         ;;
18229 esac
18230
18231 : see if strxfrm exists
18232 set strxfrm d_strxfrm
18233 eval $inlibc
18234
18235 : see if symlink exists
18236 set symlink d_symlink
18237 eval $inlibc
18238
18239 : see if syscall exists
18240 set syscall d_syscall
18241 eval $inlibc
18242
18243 : see if prototype for syscall is available
18244 echo " "
18245 set d_syscallproto syscall $i_unistd unistd.h
18246 eval $hasproto
18247
18248 : see if sysconf exists
18249 set sysconf d_sysconf
18250 eval $inlibc
18251
18252 : see if system exists
18253 set system d_system
18254 eval $inlibc
18255
18256 : see if tcgetpgrp exists
18257 set tcgetpgrp d_tcgetpgrp
18258 eval $inlibc
18259
18260 : see if tcsetpgrp exists
18261 set tcsetpgrp d_tcsetpgrp
18262 eval $inlibc
18263
18264 : see if prototype for telldir is available
18265 echo " "
18266 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18267 eval $hasproto
18268
18269 : see if time exists
18270 echo " "
18271 if test "X$d_time" = X -o X"$timetype" = X; then
18272     if set time val -f d_time; eval $csym; $val; then
18273                 echo 'time() found.' >&4
18274                 val="$define"
18275                 rp="What is the type returned by time() on this system?"
18276                 set time_t timetype long stdio.h sys/types.h
18277                 eval $typedef_ask
18278     else
18279                 echo 'time() not found, hope that will do.' >&4
18280                 val="$undef"
18281                 timetype='int';
18282     fi
18283     set d_time
18284     eval $setvar
18285 fi
18286
18287 : see if timegm exists
18288 set timegm d_timegm
18289 eval $inlibc
18290
18291 : see if this is a sys/times.h system
18292 set sys/times.h i_systimes
18293 eval $inhdr
18294
18295 : see if times exists
18296 echo " "
18297 if set times val -f d_times; eval $csym; $val; then
18298         echo 'times() found.' >&4
18299         d_times="$define"
18300         inc=''
18301         case "$i_systimes" in
18302         "$define") inc='sys/times.h';;
18303         esac
18304         rp="What is the type returned by times() on this system?"
18305         set clock_t clocktype long stdio.h sys/types.h $inc
18306         eval $typedef_ask
18307 else
18308         echo 'times() NOT found, hope that will do.' >&4
18309         d_times="$undef"
18310         clocktype='int'
18311 fi
18312
18313 : see if tmpnam_r exists
18314 set tmpnam_r d_tmpnam_r
18315 eval $inlibc
18316 case "$d_tmpnam_r" in
18317 "$define")
18318         hdrs="$i_systypes sys/types.h define stdio.h "
18319         case "$d_tmpnam_r_proto:$usethreads" in
18320         ":define")      d_tmpnam_r_proto=define
18321                 set d_tmpnam_r_proto tmpnam_r $hdrs
18322                 eval $hasproto ;;
18323         *)      ;;
18324         esac
18325         case "$d_tmpnam_r_proto" in
18326         define)
18327         case "$tmpnam_r_proto" in
18328         ''|0) try='char* tmpnam_r(char*);'
18329         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18330         esac
18331         case "$tmpnam_r_proto" in
18332         ''|0)   d_tmpnam_r=undef
18333                 tmpnam_r_proto=0
18334                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18335         * )     case "$tmpnam_r_proto" in
18336                 REENTRANT_PROTO*) ;;
18337                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18338                 esac
18339                 echo "Prototype: $try" ;;
18340         esac
18341         ;;
18342         *)      case "$usethreads" in
18343                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18344                 esac
18345                 d_tmpnam_r=undef
18346                 tmpnam_r_proto=0
18347                 ;;
18348         esac
18349         ;;
18350 *)      tmpnam_r_proto=0
18351         ;;
18352 esac
18353
18354 : see if truncate exists
18355 set truncate d_truncate
18356 eval $inlibc
18357
18358 : see if ttyname_r exists
18359 set ttyname_r d_ttyname_r
18360 eval $inlibc
18361 case "$d_ttyname_r" in
18362 "$define")
18363         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18364         case "$d_ttyname_r_proto:$usethreads" in
18365         ":define")      d_ttyname_r_proto=define
18366                 set d_ttyname_r_proto ttyname_r $hdrs
18367                 eval $hasproto ;;
18368         *)      ;;
18369         esac
18370         case "$d_ttyname_r_proto" in
18371         define)
18372         case "$ttyname_r_proto" in
18373         ''|0) try='int ttyname_r(int, char*, size_t);'
18374         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18375         esac
18376         case "$ttyname_r_proto" in
18377         ''|0) try='int ttyname_r(int, char*, int);'
18378         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18379         esac
18380         case "$ttyname_r_proto" in
18381         ''|0) try='char* ttyname_r(int, char*, int);'
18382         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18383         esac
18384         case "$ttyname_r_proto" in
18385         ''|0)   d_ttyname_r=undef
18386                 ttyname_r_proto=0
18387                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18388         * )     case "$ttyname_r_proto" in
18389                 REENTRANT_PROTO*) ;;
18390                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18391                 esac
18392                 echo "Prototype: $try" ;;
18393         esac
18394         ;;
18395         *)      case "$usethreads" in
18396                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18397                 esac
18398                 d_ttyname_r=undef
18399                 ttyname_r_proto=0
18400                 ;;
18401         esac
18402         ;;
18403 *)      ttyname_r_proto=0
18404         ;;
18405 esac
18406
18407 : see if tzname[] exists
18408 echo " "
18409 if set tzname val -a d_tzname; eval $csym; $val; then
18410         val="$define"
18411         echo 'tzname[] found.' >&4
18412 else
18413         val="$undef"
18414         echo 'tzname[] NOT found.' >&4
18415 fi
18416 set d_tzname
18417 eval $setvar
18418
18419 : Check if is a multiplatform env
18420 case "$osname" in
18421 next|rhapsody|darwin) multiarch="$define" ;;
18422 esac
18423 case "$multiarch" in
18424 ''|[nN]*) multiarch="$undef" ;;
18425 esac
18426
18427 : check for ordering of bytes in a UV
18428 echo " "
18429 case "$usecrosscompile$multiarch" in
18430 *$define*)
18431         $cat <<EOM
18432 You seem to be either cross-compiling or doing a multiarchitecture build,
18433 skipping the byteorder check.
18434
18435 EOM
18436         byteorder='ffff'
18437         ;;
18438 *)
18439         case "$byteorder" in
18440         '')
18441                 $cat <<'EOM'
18442 In the following, larger digits indicate more significance.  A big-endian
18443 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18444 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18445 machines may have weird orders like 3412.  A Cray will report 87654321,
18446 an Alpha will report 12345678. If the test program works the default is
18447 probably right.
18448 I'm now running the test program...
18449 EOM
18450                 $cat >try.c <<EOCP
18451 #include <stdio.h>
18452 #$i_stdlib I_STDLIB
18453 #ifdef I_STDLIB
18454 #include <stdlib.h>
18455 #endif
18456 #include <sys/types.h>
18457 typedef $uvtype UV;
18458 int main()
18459 {
18460         int i;
18461         union {
18462                 UV l;
18463                 char c[$uvsize];
18464         } u;
18465
18466         if ($uvsize > 4)
18467                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18468         else
18469                 u.l = (UV)0x04030201;
18470         for (i = 0; i < $uvsize; i++)
18471                 printf("%c", u.c[i]+'0');
18472         printf("\n");
18473         exit(0);
18474 }
18475 EOCP
18476                 xxx_prompt=y
18477                 set try
18478                 if eval $compile && $run ./try > /dev/null; then
18479                         dflt=`$run ./try`
18480                         case "$dflt" in
18481                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18482                                 echo "(The test program ran ok.)"
18483                                 echo "byteorder=$dflt"
18484                                 xxx_prompt=n
18485                         ;;
18486                         ????|????????) echo "(The test program ran ok.)" ;;
18487                         *) echo "(The test program didn't run right for some reason.)" ;;
18488                         esac
18489                 else
18490                         dflt='4321'
18491                         cat <<'EOM'
18492 (I can't seem to compile the test program.  Guessing big-endian...)
18493 EOM
18494                 fi
18495                 case "$xxx_prompt" in
18496                 y)
18497                         rp="What is the order of bytes in $uvtype?"
18498                         . ./myread
18499                         byteorder="$ans"
18500                         ;;
18501                 *)      byteorder=$dflt
18502                         ;;
18503                 esac
18504                 ;;
18505         esac
18506         $rm_try
18507         ;;
18508 esac
18509
18510 : Checking 32bit aligndness
18511 $cat <<EOM
18512
18513 Checking to see whether you can access character data unalignedly...
18514 EOM
18515 case "$d_u32align" in
18516 '')   $cat >try.c <<EOCP
18517 #include <stdio.h>
18518 #$i_stdlib I_STDLIB
18519 #ifdef I_STDLIB
18520 #include <stdlib.h>
18521 #endif
18522 #define U32 $u32type
18523 #define BYTEORDER 0x$byteorder
18524 #define U8 $u8type
18525 #include <signal.h>
18526 #ifdef SIGBUS
18527 $signal_t bletch(int s) { exit(4); }
18528 #endif
18529 int main() {
18530 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18531     U8 buf[8];
18532     U32 *up;
18533     int i;
18534
18535     if (sizeof(U32) != 4) {
18536         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18537         exit(1);
18538     }
18539
18540     fflush(stdout);
18541
18542 #ifdef SIGBUS
18543     signal(SIGBUS, bletch);
18544 #endif
18545
18546     buf[0] = 0;
18547     buf[1] = 0;
18548     buf[2] = 0;
18549     buf[3] = 1;
18550     buf[4] = 0;
18551     buf[5] = 0;
18552     buf[6] = 0;
18553     buf[7] = 1;
18554
18555     for (i = 0; i < 4; i++) {
18556         up = (U32*)(buf + i);
18557         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18558                (*up == 1 << (8*(3-i)))  /* little-endian */
18559               )
18560            )
18561         {
18562             printf("read failed (%x)\n", *up);
18563             exit(2);
18564         }
18565     }
18566
18567     /* write test */
18568     for (i = 0; i < 4; i++) {
18569         up = (U32*)(buf + i);
18570         *up = 0xBeef;
18571         if (*up != 0xBeef) {
18572             printf("write failed (%x)\n", *up);
18573             exit(3);
18574         }
18575     }
18576
18577     exit(0);
18578 #else
18579     printf("1\n");
18580     exit(1);
18581 #endif
18582     return 0;
18583 }
18584 EOCP
18585 set try
18586 if eval $compile_ok; then
18587         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18588         $run ./try 2>&1 >/dev/null
18589         case "$?" in
18590         0)      cat >&4 <<EOM
18591 You can access character data pretty unalignedly.
18592 EOM
18593                 d_u32align="$undef"
18594                 ;;
18595         *)      cat >&4 <<EOM
18596 It seems that you must access character data in an aligned manner.
18597 EOM
18598                 d_u32align="$define"
18599                 ;;
18600         esac
18601 else
18602         rp='Can you access character data at unaligned addresses?'
18603         dflt='n'
18604         . ./myread
18605         case "$ans" in
18606         [yY]*)  d_u32align="$undef"  ;;
18607         *)      d_u32align="$define" ;;
18608         esac
18609 fi
18610 $rm_try
18611 ;;
18612 esac
18613
18614 : see if ualarm exists
18615 set ualarm d_ualarm
18616 eval $inlibc
18617
18618 : see if umask exists
18619 set umask d_umask
18620 eval $inlibc
18621
18622 : see if unordered exists
18623 set unordered d_unordered
18624 eval $inlibc
18625
18626 : see if unsetenv exists
18627 set unsetenv d_unsetenv
18628 eval $inlibc
18629
18630 : see if usleep exists
18631 set usleep d_usleep
18632 eval $inlibc
18633
18634 : see if prototype for usleep is available
18635 echo " "
18636 set d_usleepproto usleep $i_unistd unistd.h
18637 eval $hasproto
18638
18639 : see if ustat exists
18640 set ustat d_ustat
18641 eval $inlibc
18642
18643 : see if closedir exists
18644 set closedir d_closedir
18645 eval $inlibc
18646
18647 case "$d_closedir" in
18648 "$define")
18649         echo " "
18650         echo "Checking whether closedir() returns a status..." >&4
18651         cat > try.c <<EOM
18652 #$i_dirent I_DIRENT             /**/
18653 #$i_sysdir I_SYS_DIR            /**/
18654 #$i_sysndir I_SYS_NDIR          /**/
18655 #$i_systypes I_SYS_TYPES        /**/
18656
18657 #if defined(I_SYS_TYPES)
18658 #include <sys/types.h>
18659 #endif
18660 #if defined(I_DIRENT)
18661 #include <dirent.h>
18662 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18663 #include <sys/dir.h>
18664 #endif
18665 #else
18666 #ifdef I_SYS_NDIR
18667 #include <sys/ndir.h>
18668 #else
18669 #ifdef I_SYS_DIR
18670 #ifdef hp9000s500
18671 #include <ndir.h>       /* may be wrong in the future */
18672 #else
18673 #include <sys/dir.h>
18674 #endif
18675 #endif
18676 #endif
18677 #endif
18678 int main() { return closedir(opendir(".")); }
18679 EOM
18680         set try
18681         if eval $compile_ok; then
18682                 if $run ./try > /dev/null 2>&1 ; then
18683                         echo "Yes, it does."
18684                         val="$undef"
18685                 else
18686                         echo "No, it doesn't."
18687                         val="$define"
18688                 fi
18689         else
18690                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18691                 val="$define"
18692         fi
18693         ;;
18694 *)
18695         val="$undef";
18696         ;;
18697 esac
18698 set d_void_closedir
18699 eval $setvar
18700 $rm_try
18701
18702 : see if there is a wait4
18703 set wait4 d_wait4
18704 eval $inlibc
18705
18706 : see if waitpid exists
18707 set waitpid d_waitpid
18708 eval $inlibc
18709
18710 : see if wcstombs exists
18711 set wcstombs d_wcstombs
18712 eval $inlibc
18713
18714 : see if wctomb exists
18715 set wctomb d_wctomb
18716 eval $inlibc
18717
18718 : see if writev exists
18719 set writev d_writev
18720 eval $inlibc
18721
18722 : preserve RCS keywords in files with variable substitution, grrr
18723 Date='$Date'
18724 Id='$Id'
18725 Log='$Log'
18726 RCSfile='$RCSfile'
18727 Revision='$Revision'
18728
18729 : check for alignment requirements
18730 echo " "
18731 case "$usecrosscompile$multiarch" in
18732 *$define*)
18733         $cat <<EOM
18734 You seem to be either cross-compiling or doing a multiarchitecture build,
18735 skipping the memory alignment check.
18736
18737 EOM
18738         case "$alignbytes" in
18739         '') alignbytes=8 ;;
18740         esac
18741         ;;
18742 *)
18743         case "$alignbytes" in
18744         '') echo "Checking alignment constraints..." >&4
18745                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18746                         $cat >try.c <<'EOCP'
18747 typedef long double NV;
18748 EOCP
18749                 else
18750                         $cat >try.c <<'EOCP'
18751 typedef double NV;
18752 EOCP
18753                 fi
18754                 $cat >>try.c <<'EOCP'
18755 #include <stdio.h>
18756 struct foobar {
18757         char foo;
18758         NV bar;
18759 } try_algn;
18760 int main()
18761 {
18762     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18763     return(0);
18764 }
18765 EOCP
18766                 set try
18767                 if eval $compile_ok; then
18768                         dflt=`$run ./try`
18769                 else
18770                         dflt='8'
18771                         echo "(I can't seem to compile the test program...)"
18772                 fi
18773                 ;;
18774         *) dflt="$alignbytes"
18775                 ;;
18776         esac
18777         rp="Doubles must be aligned on a how-many-byte boundary?"
18778         . ./myread
18779         alignbytes="$ans"
18780         $rm_try
18781         ;;
18782 esac
18783
18784
18785 : set the base revision
18786 baserev=5.0
18787
18788 : how do we concatenate cpp tokens here?
18789 echo " "
18790 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18791 $cat >cpp_stuff.c <<'EOCP'
18792 #define RCAT(a,b)a/**/b
18793 #define ACAT(a,b)a ## b
18794 RCAT(Rei,ser)
18795 ACAT(Cir,cus)
18796 EOCP
18797 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18798 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18799         echo "Oh!  Smells like ANSI's been here." >&4
18800         echo "We can catify or stringify, separately or together!"
18801         cpp_stuff=42
18802 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18803         echo "Ah, yes!  The good old days!" >&4
18804         echo "However, in the good old days we don't know how to stringify and"
18805         echo "catify at the same time."
18806         cpp_stuff=1
18807 else
18808         $cat >&4 <<EOM
18809 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18810 You're going to have to edit the values of CAT[2-5] in config.h...
18811 EOM
18812         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18813 fi
18814 $rm -f cpp_stuff.*
18815
18816 : see if this is a db.h system
18817 set db.h i_db
18818 eval $inhdr
18819
18820 case "$i_db" in
18821 $define)
18822         : Check db version.
18823         echo " "
18824         echo "Checking Berkeley DB version ..." >&4
18825         $cat >try.c <<EOCP
18826 #$d_const HASCONST
18827 #ifndef HASCONST
18828 #define const
18829 #endif
18830 #include <sys/types.h>
18831 #include <stdio.h>
18832 #$i_stdlib I_STDLIB
18833 #ifdef I_STDLIB
18834 #include <stdlib.h>
18835 #endif
18836 #include <db.h>
18837 int main(int argc, char *argv[])
18838 {
18839 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18840     int Major, Minor, Patch ;
18841     unsigned long Version ;
18842     (void)db_version(&Major, &Minor, &Patch) ;
18843     if (argc == 2) {
18844         printf("%d %d %d %d %d %d\n",
18845                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18846                Major, Minor, Patch);
18847         exit(0);
18848     }
18849     printf("You have Berkeley DB Version 2 or greater.\n");
18850
18851     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18852                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18853     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18854                 Major, Minor, Patch) ;
18855
18856     /* check that db.h & libdb are compatible */
18857     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18858         printf("db.h and libdb are incompatible.\n") ;
18859         exit(3);
18860     }
18861
18862     printf("db.h and libdb are compatible.\n") ;
18863
18864     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18865                 + DB_VERSION_PATCH ;
18866
18867     /* needs to be >= 2.3.4 */
18868     if (Version < 2003004) {
18869     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18870         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18871         exit(2);
18872     }
18873
18874     exit(0);
18875 #else
18876 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18877     if (argc == 2) {
18878         printf("1 0 0\n");
18879         exit(0);
18880     }
18881     printf("You have Berkeley DB Version 1.\n");
18882     exit(0);    /* DB version < 2: the coast is clear. */
18883 #else
18884     exit(1);    /* <db.h> not Berkeley DB? */
18885 #endif
18886 #endif
18887 }
18888 EOCP
18889         set try
18890         if eval $compile_ok && $run ./try; then
18891                 echo 'Looks OK.' >&4
18892                 set `$run ./try 1`
18893                 db_version_major=$1
18894                 db_version_minor=$2
18895                 db_version_patch=$3
18896         else
18897                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18898                 i_db=$undef
18899                 case " $libs " in
18900                 *"-ldb "*)
18901                         : Remove db from list of libraries to use
18902                         echo "Removing unusable -ldb from library list" >&4
18903                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18904                         shift
18905                         libs="$*"
18906                         echo "libs = $libs" >&4
18907                         ;;
18908                 esac
18909         fi
18910         $rm_try
18911         ;;
18912 esac
18913
18914 case "$i_db" in
18915 define)
18916         : Check the return type needed for hash
18917         echo " "
18918         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18919         $cat >try.c <<EOCP
18920 #$d_const HASCONST
18921 #ifndef HASCONST
18922 #define const
18923 #endif
18924 #include <sys/types.h>
18925 #include <db.h>
18926
18927 #ifndef DB_VERSION_MAJOR
18928 u_int32_t hash_cb (ptr, size)
18929 const void *ptr;
18930 size_t size;
18931 {
18932 }
18933 HASHINFO info;
18934 int main()
18935 {
18936         info.hash = hash_cb;
18937 }
18938 #endif
18939 EOCP
18940         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18941                 if $contains warning try.out >>/dev/null 2>&1 ; then
18942                         db_hashtype='int'
18943                 else
18944                         db_hashtype='u_int32_t'
18945                 fi
18946         else
18947                 : XXX Maybe we should just give up here.
18948                 db_hashtype=u_int32_t
18949                 $cat try.out >&4
18950                 echo "Help:  I can't seem to compile the db test program." >&4
18951                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18952         fi
18953         $rm_try
18954         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18955         ;;
18956 *)      db_hashtype=u_int32_t
18957         ;;
18958 esac
18959 case "$i_db" in
18960 define)
18961         : Check the return type needed for prefix
18962         echo " "
18963         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18964         cat >try.c <<EOCP
18965 #$d_const HASCONST
18966 #ifndef HASCONST
18967 #define const
18968 #endif
18969 #include <sys/types.h>
18970 #include <db.h>
18971
18972 #ifndef DB_VERSION_MAJOR
18973 size_t prefix_cb (key1, key2)
18974 const DBT *key1;
18975 const DBT *key2;
18976 {
18977 }
18978 BTREEINFO info;
18979 int main()
18980 {
18981         info.prefix = prefix_cb;
18982 }
18983 #endif
18984 EOCP
18985         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18986                 if $contains warning try.out >>/dev/null 2>&1 ; then
18987                         db_prefixtype='int'
18988                 else
18989                         db_prefixtype='size_t'
18990                 fi
18991         else
18992                 db_prefixtype='size_t'
18993                 : XXX Maybe we should just give up here.
18994                 $cat try.out >&4
18995                 echo "Help:  I can't seem to compile the db test program." >&4
18996                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18997         fi
18998         $rm_try
18999         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19000         ;;
19001 *)      db_prefixtype='size_t'
19002         ;;
19003 esac
19004
19005 : How can we generate normalized random numbers ?
19006 echo " "
19007 echo "Looking for a random number function..." >&4
19008 case "$randfunc" in
19009 '')
19010         if set drand48 val -f; eval $csym; $val; then
19011                 dflt="drand48"
19012                 echo "Good, found drand48()." >&4
19013         elif set random val -f; eval $csym; $val; then
19014                 dflt="random"
19015                 echo "OK, found random()." >&4
19016         else
19017                 dflt="rand"
19018                 echo "Yick, looks like I have to use rand()." >&4
19019         fi
19020         echo " "
19021         ;;
19022 *)
19023         dflt="$randfunc"
19024         ;;
19025 esac
19026 cont=true
19027
19028 case "$ccflags" in
19029 *-Dmy_rand=*|*-Dmy_srand=*)
19030         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19031         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19032         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19033         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19034         ;;
19035 esac
19036
19037 while $test "$cont"; do
19038         rp="Use which function to generate random numbers?"
19039         . ./myread
19040         if $test "$ans" = "$dflt"; then
19041                 : null
19042         else
19043                 randbits=''
19044         fi
19045         randfunc="$ans"
19046         if set $ans val -f; eval $csym; $val; then
19047                 cont=''
19048         else
19049                 dflt=y
19050                 rp="I cannot find function $ans. Use that name anyway?"
19051                 . ./myread
19052                 dflt=rand
19053                 case "$ans" in
19054                         [yY]*) cont='';;
19055                 esac
19056         fi
19057         case "$cont" in
19058         '')
19059                 case "$randfunc" in
19060                 drand48)
19061                         drand01="drand48()"
19062                         seedfunc="srand48"
19063                         randbits=48
19064                         randseedtype=long
19065                         ;;
19066                 rand|random)
19067                         case "$randbits" in
19068                         '')
19069 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19070                                 $cat >try.c <<EOCP
19071 #$i_unistd I_UNISTD
19072 #$i_stdlib I_STDLIB
19073 #include <stdio.h>
19074 #ifdef I_UNISTD
19075 #  include <unistd.h>
19076 #endif
19077 #ifdef I_STDLIB
19078 #  include <stdlib.h>
19079 #endif
19080 int main()
19081 {
19082         register int i;
19083         register unsigned long tmp;
19084         register unsigned long max = 0L;
19085
19086         for (i = 1000; i; i--) {
19087                 tmp = (unsigned long) $randfunc();
19088                 if (tmp > max) max = tmp;
19089         }
19090         for (i = 0; max; i++)
19091                 max /= 2;
19092         printf("%d\n",i);
19093 }
19094 EOCP
19095                                 set try
19096                                 if eval $compile_ok; then
19097                                         dflt=`try`
19098                                 else
19099                                         dflt='?'
19100                                         echo "(I can't seem to compile the test program...)"
19101                                 fi
19102                                 ;;
19103                         *)
19104                                 dflt="$randbits"
19105                                 ;;
19106                         esac
19107                         rp="How many bits does your $randfunc() function produce?"
19108                         . ./myread
19109                         randbits="$ans"
19110                         $rm_try
19111                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19112                         seedfunc="s$randfunc"
19113                         randseedtype=unsigned
19114                         ;;
19115                 *)
19116                         dflt="31"
19117                         rp="How many bits does your $randfunc() function produce?"
19118                         . ./myread
19119                         randbits="$ans"
19120                         seedfunc="s$randfunc"
19121                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19122                         if set $seedfunc val -f; eval $csym; $val; then
19123                                 echo "(Using $seedfunc() to seed random generator)"
19124                         else
19125                                 echo "(Warning: no $seedfunc() to seed random generator)"
19126                                 seedfunc=rand
19127                         fi
19128                         randseedtype=unsigned
19129                         ;;
19130                 esac
19131                 ;;
19132         esac
19133 done
19134
19135 : Determine if this is an EBCDIC system
19136 echo " "
19137 echo "Determining whether or not we are on an EBCDIC system..." >&4
19138 $cat >try.c <<'EOM'
19139 int main()
19140 {
19141   if ('M'==0xd4) return 0;
19142   return 1;
19143 }
19144 EOM
19145
19146 val=$undef
19147 set try
19148 if eval $compile_ok; then
19149         if $run ./try; then
19150                 echo "You seem to speak EBCDIC." >&4
19151                 val="$define"
19152         else
19153                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19154         fi
19155 else
19156         echo "I'm unable to compile the test program." >&4
19157         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19158 fi
19159 $rm_try
19160 set ebcdic
19161 eval $setvar
19162
19163 : Check how to flush
19164 echo " "
19165 $cat >&4 <<EOM
19166 Checking how to flush all pending stdio output...
19167 EOM
19168 # I only know how to find the first 32 possibly open files on SunOS.
19169 # See also hints/sunos_4_1.sh and util.c  --AD
19170 case "$osname" in
19171 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19172 esac
19173 $cat >>try.c <<EOCP
19174 #include <stdio.h>
19175 #$i_stdlib I_STDLIB
19176 #ifdef I_STDLIB
19177 #include <stdlib.h>
19178 #endif
19179 #$i_unistd I_UNISTD
19180 #ifdef I_UNISTD
19181 # include <unistd.h>
19182 #endif
19183 #$d_sysconf HAS_SYSCONF
19184 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19185 #ifdef HAS_STDIO_STREAM_ARRAY
19186 # define STDIO_STREAM_ARRAY $stdio_stream_array
19187 #endif
19188 int main() {
19189   FILE* p;
19190   unlink("try.out");
19191   p = fopen("try.out", "w");
19192 #ifdef TRY_FPUTC
19193   fputc('x', p);
19194 #else
19195 # ifdef TRY_FPRINTF
19196   fprintf(p, "x");
19197 # endif
19198 #endif
19199 #ifdef TRY_FFLUSH_NULL
19200   fflush(NULL);
19201 #endif
19202 #ifdef TRY_FFLUSH_ALL
19203   {
19204     long open_max = -1;
19205 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19206     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19207 # else
19208 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19209     open_max = sysconf(_SC_OPEN_MAX);
19210 #  else
19211 #   ifdef FOPEN_MAX
19212     open_max = FOPEN_MAX;
19213 #   else
19214 #    ifdef OPEN_MAX
19215     open_max = OPEN_MAX;
19216 #    else
19217 #     ifdef _NFILE
19218     open_max = _NFILE;
19219 #     endif
19220 #    endif
19221 #   endif
19222 #  endif
19223 # endif
19224 # ifdef HAS_STDIO_STREAM_ARRAY
19225     if (open_max > 0) {
19226       long i;
19227       for (i = 0; i < open_max; i++)
19228             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19229                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19230                 STDIO_STREAM_ARRAY[i]._flag)
19231                 fflush(&STDIO_STREAM_ARRAY[i]);
19232     }
19233   }
19234 # endif
19235 #endif
19236   _exit(42);
19237 }
19238 EOCP
19239 : first we have to find out how _not_ to flush
19240 $to try.c
19241 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19242     output=''
19243     set try -DTRY_FPUTC
19244     if eval $compile; then
19245             $run ./try 2>/dev/null
19246             code="$?"
19247             $from try.out
19248             if $test ! -s try.out -a "X$code" = X42; then
19249                 output=-DTRY_FPUTC
19250             fi
19251     fi
19252     case "$output" in
19253     '')
19254             set try -DTRY_FPRINTF
19255             if eval $compile; then
19256                     $run ./try 2>/dev/null
19257                     code="$?"
19258                     $from try.out
19259                     if $test ! -s try.out -a "X$code" = X42; then
19260                         output=-DTRY_FPRINTF
19261                     fi
19262             fi
19263         ;;
19264     esac
19265 fi
19266 : check for fflush NULL behaviour
19267 case "$fflushNULL" in
19268 '')     set try -DTRY_FFLUSH_NULL $output
19269         if eval $compile; then
19270                 $run ./try 2>/dev/null
19271                 code="$?"
19272                 $from try.out
19273                 if $test -s try.out -a "X$code" = X42; then
19274                         fflushNULL="`$cat try.out`"
19275                 else
19276                         if $test "X$code" != X42; then
19277                                 $cat >&4 <<EOM
19278 (If this test failed, don't worry, we'll try another method shortly.)
19279 EOM
19280                         fi
19281                 fi
19282         fi
19283         $rm -f core try.core core.try.*
19284         case "$fflushNULL" in
19285         x)      $cat >&4 <<EOM
19286 Your fflush(NULL) works okay for output streams.
19287 Let's see if it clobbers input pipes...
19288 EOM
19289 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19290 # bug that improperly flushes the input end of pipes.  So we avoid the
19291 # autoflush on fork/system/exec support for now. :-(
19292 $cat >tryp.c <<EOCP
19293 #include <stdio.h>
19294 int
19295 main(int argc, char **argv)
19296 {
19297     char buf[1024];
19298     int i;
19299     char *bp = buf;
19300     while (1) {
19301         while ((i = getc(stdin)) != -1
19302                && (*bp++ = i) != '\n'
19303                && bp < &buf[1024])
19304         /* DO NOTHING */ ;
19305         *bp = '\0';
19306         fprintf(stdout, "%s", buf);
19307         fflush(NULL);
19308         if (i == -1)
19309             return 0;
19310         bp = buf;
19311     }
19312 }
19313 EOCP
19314                 fflushNULL="$define"
19315                 set tryp
19316                 if eval $compile; then
19317                     $rm -f tryp.out
19318                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19319                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19320                        $cat >&4 <<EOM
19321 fflush(NULL) seems to behave okay with input streams.
19322 EOM
19323                         fflushNULL="$define"
19324                     else
19325                         $cat >&4 <<EOM
19326 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19327 EOM
19328                         fflushNULL="$undef"
19329                     fi
19330                 fi
19331                 $rm -f core tryp.c tryp.core core.tryp.*
19332                 ;;
19333         '')     $cat >&4 <<EOM
19334 Your fflush(NULL) isn't working (contrary to ANSI C).
19335 EOM
19336                 fflushNULL="$undef"
19337                 ;;
19338         *)      $cat >&4 <<EOM
19339 Cannot figure out whether your fflush(NULL) works or not.
19340 I'm assuming it doesn't (contrary to ANSI C).
19341 EOM
19342                 fflushNULL="$undef"
19343                 ;;
19344         esac
19345         ;;
19346 $define|true|[yY]*)
19347         fflushNULL="$define"
19348         ;;
19349 *)
19350         fflushNULL="$undef"
19351         ;;
19352 esac
19353 : check explicit looping only if NULL did not work, and if the pipe
19354 : bug does not show up on an explicit flush too
19355 case "$fflushNULL" in
19356 "$undef")
19357         $cat >tryp.c <<EOCP
19358 #include <stdio.h>
19359 int
19360 main(int argc, char **argv)
19361 {
19362     char buf[1024];
19363     int i;
19364     char *bp = buf;
19365     while (1) {
19366         while ((i = getc(stdin)) != -1
19367                && (*bp++ = i) != '\n'
19368                && bp < &buf[1024])
19369         /* DO NOTHING */ ;
19370         *bp = '\0';
19371         fprintf(stdout, "%s", buf);
19372         fflush(stdin);
19373         if (i == -1)
19374             return 0;
19375         bp = buf;
19376     }
19377 }
19378 EOCP
19379         set tryp
19380         if eval $compile; then
19381             $rm -f tryp.out
19382             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19383             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19384                $cat >&4 <<EOM
19385 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19386 EOM
19387                 : now check for fflushall behaviour
19388                 case "$fflushall" in
19389                 '')     set try -DTRY_FFLUSH_ALL $output
19390                         if eval $compile; then
19391                                 $cat >&4 <<EOM
19392 (Now testing the other method--but note that this also may fail.)
19393 EOM
19394                                 $run ./try 2>/dev/null
19395                                 code=$?
19396                                 $from try.out
19397                                 if $test -s try.out -a "X$code" = X42; then
19398                                         fflushall="`$cat try.out`"
19399                                 fi
19400                         fi
19401                         $rm_try
19402                         case "$fflushall" in
19403                         x)      $cat >&4 <<EOM
19404 Whew. Flushing explicitly all the stdio streams works.
19405 EOM
19406                                 fflushall="$define"
19407                                 ;;
19408                         '')     $cat >&4 <<EOM
19409 Sigh. Flushing explicitly all the stdio streams doesn't work.
19410 EOM
19411                                 fflushall="$undef"
19412                                 ;;
19413                         *)      $cat >&4 <<EOM
19414 Cannot figure out whether flushing stdio streams explicitly works or not.
19415 I'm assuming it doesn't.
19416 EOM
19417                                 fflushall="$undef"
19418                                 ;;
19419                         esac
19420                         ;;
19421                 "$define"|true|[yY]*)
19422                         fflushall="$define"
19423                         ;;
19424                 *)
19425                         fflushall="$undef"
19426                         ;;
19427                 esac
19428             else
19429                 $cat >&4 <<EOM
19430 All is futile.  Even fflush(stdin) clobbers input pipes!
19431 EOM
19432                 fflushall="$undef"
19433             fi
19434         else
19435             fflushall="$undef"
19436         fi
19437         $rm -f core tryp.c tryp.core core.tryp.*
19438         ;;
19439 *)      fflushall="$undef"
19440         ;;
19441 esac
19442
19443 case "$fflushNULL$fflushall" in
19444 undefundef)
19445         $cat <<EOM
19446 OK, I give up.  I cannot figure out how to flush pending stdio output.
19447 We won't be flushing handles at all before fork/exec/popen.
19448 EOM
19449         ;;
19450 esac
19451 $rm_try tryp
19452
19453 : Store the full pathname to the ar program for use in the C program
19454 : Respect a hint or command line value for full_ar.
19455 case "$full_ar" in
19456 '') full_ar=$ar ;;
19457 esac
19458
19459 : Store the full pathname to the sed program for use in the C program
19460 full_sed=$sed
19461
19462 : see what type gids are declared as in the kernel
19463 echo " "
19464 echo "Looking for the type for group ids returned by getgid()."
19465 set gid_t gidtype xxx stdio.h sys/types.h
19466 eval $typedef
19467 case "$gidtype" in
19468 xxx)
19469         xxx=`./findhdr sys/user.h`
19470         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19471         case $1 in
19472         unsigned) dflt="$1 $2" ;;
19473         *) dflt="$1" ;;
19474         esac
19475         ;;
19476 *) dflt="$gidtype";;
19477 esac
19478 case "$gidtype" in
19479 gid_t) echo "gid_t found." ;;
19480 *)      rp="What is the type for group ids returned by getgid()?"
19481         . ./myread
19482         gidtype="$ans"
19483         ;;
19484 esac
19485
19486 : Check the size of GID
19487 echo " "
19488 case "$gidtype" in
19489 *_t) zzz="$gidtype"     ;;
19490 *)   zzz="gid"          ;;
19491 esac
19492 echo "Checking the size of $zzz..." >&4
19493 cat > try.c <<EOCP
19494 #include <sys/types.h>
19495 #include <stdio.h>
19496 #$i_stdlib I_STDLIB
19497 #ifdef I_STDLIB
19498 #include <stdlib.h>
19499 #endif
19500 int main() {
19501     printf("%d\n", (int)sizeof($gidtype));
19502     exit(0);
19503 }
19504 EOCP
19505 set try
19506 if eval $compile_ok; then
19507         yyy=`$run ./try`
19508         case "$yyy" in
19509         '')     gidsize=4
19510                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19511                 ;;
19512         *)      gidsize=$yyy
19513                 echo "Your $zzz is $gidsize bytes long."
19514                 ;;
19515         esac
19516 else
19517         gidsize=4
19518         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19519 fi
19520
19521
19522 : Check if GID is signed
19523 echo " "
19524 case "$gidtype" in
19525 *_t) zzz="$gidtype"     ;;
19526 *)   zzz="gid"          ;;
19527 esac
19528 echo "Checking the sign of $zzz..." >&4
19529 cat > try.c <<EOCP
19530 #include <sys/types.h>
19531 #include <stdio.h>
19532 int main() {
19533         $gidtype foo = -1;
19534         if (foo < 0)
19535                 printf("-1\n");
19536         else
19537                 printf("1\n");
19538 }
19539 EOCP
19540 set try
19541 if eval $compile; then
19542         yyy=`$run ./try`
19543         case "$yyy" in
19544         '')     gidsign=1
19545                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19546                 ;;
19547         *)      gidsign=$yyy
19548                 case "$gidsign" in
19549                  1) echo "Your $zzz is unsigned." ;;
19550                 -1) echo "Your $zzz is signed."   ;;
19551                 esac
19552                 ;;
19553         esac
19554 else
19555         gidsign=1
19556         echo "(I can't compile the test program--guessing unsigned.)" >&4
19557 fi
19558
19559
19560 : Check 64bit sizes
19561 echo " "
19562
19563 if $test X"$quadtype" != X; then
19564
19565 echo "Checking how to print 64-bit integers..." >&4
19566
19567 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19568         $cat >try.c <<'EOCP'
19569 #include <sys/types.h>
19570 #include <stdio.h>
19571 int main() {
19572   int q = 12345678901;
19573   printf("%ld\n", q);
19574 }
19575 EOCP
19576         set try
19577         if eval $compile; then
19578                 yyy=`$run ./try`
19579                 case "$yyy" in
19580                 12345678901)
19581                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19582                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19583                         echo "We will use %d."
19584                         ;;
19585                 esac
19586         fi
19587 fi
19588
19589 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19590         $cat >try.c <<'EOCP'
19591 #include <sys/types.h>
19592 #include <stdio.h>
19593 int main() {
19594   long q = 12345678901;
19595   printf("%ld\n", q);
19596 }
19597 EOCP
19598         set try
19599         if eval $compile; then
19600                 yyy=`$run ./try`
19601                 case "$yyy" in
19602                 12345678901)
19603                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19604                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19605                         echo "We will use %ld."
19606                         ;;
19607                 esac
19608         fi
19609 fi
19610
19611 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19612         $cat >try.c <<'EOCP'
19613 #include <sys/types.h>
19614 #include <inttypes.h>
19615 #include <stdio.h>
19616 int main() {
19617   int64_t q = 12345678901;
19618   printf("%" PRId64 "\n", q);
19619 }
19620 EOCP
19621         set try
19622         if eval $compile; then
19623                 yyy=`$run ./try`
19624                 case "$yyy" in
19625                 12345678901)
19626                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19627                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19628                         echo "We will use the C9X style."
19629                         ;;
19630                 esac
19631         fi
19632 fi
19633
19634 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19635         $cat >try.c <<EOCP
19636 #include <sys/types.h>
19637 #include <stdio.h>
19638 int main() {
19639   $quadtype q = 12345678901;
19640   printf("%Ld\n", q);
19641 }
19642 EOCP
19643         set try
19644         if eval $compile; then
19645                 yyy=`$run ./try`
19646                 case "$yyy" in
19647                 12345678901)
19648                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19649                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19650                         echo "We will use %Ld."
19651                         ;;
19652                 esac
19653         fi
19654 fi
19655
19656 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19657         $cat >try.c <<'EOCP'
19658 #include <sys/types.h>
19659 #include <stdio.h>
19660 int main() {
19661   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19662   printf("%lld\n", q);
19663 }
19664 EOCP
19665         set try
19666         if eval $compile; then
19667                 yyy=`$run ./try`
19668                 case "$yyy" in
19669                 12345678901)
19670                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19671                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19672                         echo "We will use the %lld style."
19673                         ;;
19674                 esac
19675         fi
19676 fi
19677
19678 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19679         $cat >try.c <<EOCP
19680 #include <sys/types.h>
19681 #include <stdio.h>
19682 int main() {
19683   $quadtype q = 12345678901;
19684   printf("%qd\n", q);
19685 }
19686 EOCP
19687         set try
19688         if eval $compile; then
19689                 yyy=`$run ./try`
19690                 case "$yyy" in
19691                 12345678901)
19692                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19693                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19694                         echo "We will use %qd."
19695                         ;;
19696                 esac
19697         fi
19698 fi
19699
19700 if $test X"$sPRId64" = X; then
19701         echo "Cannot figure out how to print 64-bit integers." >&4
19702 fi
19703 $rm_try
19704
19705 fi
19706
19707 case "$sPRId64" in
19708 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19709         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19710         ;;
19711 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19712         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19713         ;;
19714 esac
19715
19716 : Check format strings for internal types
19717 echo " "
19718 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19719
19720 if $test X"$ivsize" = X8; then
19721         ivdformat="$sPRId64"
19722         uvuformat="$sPRIu64"
19723         uvoformat="$sPRIo64"
19724         uvxformat="$sPRIx64"
19725         uvXUformat="$sPRIXU64"
19726 else
19727         if $test X"$ivsize" = X"$longsize"; then
19728                 ivdformat='"ld"'
19729                 uvuformat='"lu"'
19730                 uvoformat='"lo"'
19731                 uvxformat='"lx"'
19732                 uvXUformat='"lX"'
19733         else
19734                 if $test X"$ivsize" = X"$intsize"; then
19735                         ivdformat='"d"'
19736                         uvuformat='"u"'
19737                         uvoformat='"o"'
19738                         uvxformat='"x"'
19739                         uvXUformat='"X"'
19740                 else
19741                         : far out
19742                         if $test X"$ivsize" = X"$shortsize"; then
19743                                 ivdformat='"hd"'
19744                                 uvuformat='"hu"'
19745                                 uvoformat='"ho"'
19746                                 uvxformat='"hx"'
19747                                 uvXUformat='"hX"'
19748                         fi
19749                 fi
19750         fi
19751 fi
19752
19753 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19754         nveformat="$sPRIeldbl"
19755         nvfformat="$sPRIfldbl"
19756         nvgformat="$sPRIgldbl"
19757         nvEUformat="$sPRIEUldbl"
19758         nvFUformat="$sPRIFUldbl"
19759         nvGUformat="$sPRIGUldbl"
19760 else
19761         nveformat='"e"'
19762         nvfformat='"f"'
19763         nvgformat='"g"'
19764         nvEUformat='"E"'
19765         nvFUformat='"F"'
19766         nvGUformat='"G"'
19767 fi
19768
19769 case "$ivdformat" in
19770 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19771     exit 1
19772     ;;
19773 esac
19774
19775 : Check format string for GID
19776
19777 echo " "
19778 $echo "Checking the format string to be used for gids..." >&4
19779
19780 case "$gidsign" in
19781 -1)     if $test X"$gidsize" = X"$ivsize"; then
19782                 gidformat="$ivdformat"
19783         else
19784                 if $test X"$gidsize" = X"$longsize"; then
19785                         gidformat='"ld"'
19786                 else
19787                         if $test X"$gidsize" = X"$intsize"; then
19788                                 gidformat='"d"'
19789                         else
19790                                 if $test X"$gidsize" = X"$shortsize"; then
19791                                         gidformat='"hd"'
19792                                 fi
19793                         fi
19794                 fi
19795         fi
19796         ;;
19797 *)      if $test X"$gidsize" = X"$uvsize"; then
19798                 gidformat="$uvuformat"
19799         else
19800                 if $test X"$gidsize" = X"$longsize"; then
19801                         gidformat='"lu"'
19802                 else
19803                         if $test X"$gidsize" = X"$intsize"; then
19804                                 gidformat='"u"'
19805                         else
19806                                 if $test X"$gidsize" = X"$shortsize"; then
19807                                         gidformat='"hu"'
19808                                 fi
19809                         fi
19810                 fi
19811         fi
19812         ;;
19813 esac
19814
19815 : see if getgroups exists
19816 set getgroups d_getgrps
19817 eval $inlibc
19818
19819 : see if setgroups exists
19820 set setgroups d_setgrps
19821 eval $inlibc
19822
19823 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19824 echo " "
19825 case "$d_getgrps$d_setgrps" in
19826 *define*)
19827         case "$groupstype" in
19828         '') dflt="$gidtype" ;;
19829         *)  dflt="$groupstype" ;;
19830         esac
19831         $cat <<EOM
19832 What type of pointer is the second argument to getgroups() and setgroups()?
19833 Usually this is the same as group ids, $gidtype, but not always.
19834
19835 EOM
19836         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19837         . ./myread
19838         groupstype="$ans"
19839         ;;
19840 *)  groupstype="$gidtype";;
19841 esac
19842
19843 : MAD = Misc Attribute Definition
19844
19845 if $test $patchlevel -lt 9; then
19846 : MAD is not available in 5.8.x or earlier.
19847     ans=n;
19848 else
19849     case "$mad" in
19850     $define|true|[yY]*) dflt='y' ;;
19851     *)                  dflt='n' ;;
19852     esac
19853     cat <<EOM
19854
19855 Would you like to build with Misc Attribute Decoration? This is development
19856 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19857 overhead on the interpreter.
19858
19859 If this doesn't make any sense to you, just accept the default '$dflt'.
19860 EOM
19861     rp='Build Perl with MAD?'
19862     . ./myread
19863 fi
19864 case "$ans" in
19865 y|Y)    val="$define"
19866         madlyh='madly.h madly.act madly.tab'
19867         madlysrc='madly.c'
19868         madlyobj="madly$_o" ;;
19869 *)      val="$undef"
19870         madlyh=''
19871         madlysrc=''
19872         madlyobj='' ;;
19873 esac
19874 set mad
19875 eval $setvar
19876
19877 : check whether make sets MAKE
19878 echo " "
19879 echo "Checking if your $make program sets \$(MAKE)..." >&4
19880 case "$make_set_make" in
19881 '')
19882         $sed 's/^X //' > testmake.mak << 'EOF'
19883 Xall:
19884 X       @echo 'maketemp="$(MAKE)"'
19885 EOF
19886         case "`$make -f testmake.mak 2>/dev/null`" in
19887         *maketemp=*) make_set_make='#' ;;
19888         *)      make_set_make="MAKE=$make" ;;
19889         esac
19890         $rm -f testmake.mak
19891         ;;
19892 esac
19893 case "$make_set_make" in
19894 '#') echo "Yup, it does.";;
19895 *) echo "Nope, it doesn't.";;
19896 esac
19897
19898 : see what type is used for mode_t
19899 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19900 set mode_t modetype int stdio.h sys/types.h
19901 eval $typedef_ask
19902
19903 : see if we need va_copy
19904 echo " "
19905 case "$i_stdarg" in
19906 "$define")
19907         $cat >try.c <<EOCP
19908 #include <stdarg.h>
19909 #include <stdio.h>
19910 #$i_stdlib I_STDLIB
19911 #ifdef I_STDLIB
19912 #include <stdlib.h>
19913 #endif
19914 #include <signal.h>
19915
19916 int
19917 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19918 {
19919   return vfprintf(f, fmt, *valp);
19920 }
19921
19922 int
19923 myvfprintf(FILE *f, const  char *fmt, va_list val)
19924 {
19925   return ivfprintf(f, fmt, &val);
19926 }
19927
19928 int
19929 myprintf(char *fmt, ...)
19930 {
19931   va_list val;
19932   va_start(val, fmt);
19933   return myvfprintf(stdout, fmt, val);
19934 }
19935
19936 int
19937 main(int ac, char **av)
19938 {
19939   signal(SIGSEGV, exit);
19940
19941   myprintf("%s%cs all right, then\n", "that", '\'');
19942   exit(0);
19943 }
19944 EOCP
19945         set try
19946         if eval $compile && $run ./try 2>&1 >/dev/null; then
19947                 case "`$run ./try`" in
19948                 "that's all right, then")
19949                         okay=yes
19950                         ;;
19951                 esac
19952         fi
19953         case "$okay" in
19954         yes)    echo "It seems that you don't need va_copy()." >&4
19955                 need_va_copy="$undef"
19956                 ;;
19957         *)      echo "It seems that va_copy() or similar will be needed." >&4
19958                 need_va_copy="$define"
19959                 ;;
19960         esac
19961         $rm_try
19962         ;;
19963 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19964         ;;
19965 esac
19966
19967 : see what type is used for size_t
19968 rp="What is the type used for the length parameter for string functions?"
19969 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19970 eval $typedef_ask
19971
19972 : check for type of arguments to gethostbyaddr. 
19973 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19974         case "$d_gethbyaddr" in
19975         $define)
19976                 $cat <<EOM
19977
19978 Checking to see what type of arguments are accepted by gethostbyaddr().
19979 EOM
19980                 hdrs="$define sys/types.h
19981                         $d_socket sys/socket.h 
19982                         $i_niin netinet/in.h 
19983                         $i_netdb netdb.h
19984                         $i_unistd unistd.h"
19985                 : The first arg can 'char *' or 'void *'
19986                 : The second arg is some of integral type
19987                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19988                         for yyy in size_t long int; do
19989                                 case "$netdb_host_type" in
19990                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
19991                                         if ./protochk "$try" $hdrs; then
19992                                                 echo "Your system accepts $xxx for the first arg."
19993                                                 echo "...and $yyy for the second arg."
19994                                                 netdb_host_type="$xxx"
19995                                                 netdb_hlen_type="$yyy"
19996                                         fi
19997                                         ;;
19998                                 esac
19999                         done
20000                 done
20001                 : In case none of those worked, prompt the user.
20002                 case "$netdb_host_type" in
20003                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20004                         dflt='char *'
20005                         . ./myread
20006                         netdb_host_type=$ans
20007                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20008                         dflt="$sizetype"
20009                         . ./myread
20010                         netdb_hlen_type=$ans
20011                         ;;
20012                 esac
20013                 ;;
20014         *)      : no gethostbyaddr, so pick harmless defaults
20015                 netdb_host_type='char *'
20016                 netdb_hlen_type="$sizetype"
20017                 ;;
20018         esac
20019         # Remove the "const" if needed. -- but then we'll have a 
20020         # prototype clash!
20021         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20022 fi
20023
20024 : check for type of argument to gethostbyname. 
20025 if test "X$netdb_name_type" = X ; then
20026         case "$d_gethbyname" in
20027         $define)
20028                 $cat <<EOM
20029
20030 Checking to see what type of argument is accepted by gethostbyname().
20031 EOM
20032                 hdrs="$define sys/types.h
20033                         $d_socket sys/socket.h 
20034                         $i_niin netinet/in.h 
20035                         $i_netdb netdb.h
20036                         $i_unistd unistd.h"
20037                 for xxx in "const char *" "char *"; do
20038                         case "$netdb_name_type" in
20039                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20040                                 if ./protochk "$try" $hdrs; then
20041                                         echo "Your system accepts $xxx."
20042                                         netdb_name_type="$xxx"
20043                                 fi
20044                                 ;;
20045                         esac
20046                 done
20047                 : In case none of those worked, prompt the user.
20048                 case "$netdb_name_type" in
20049                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20050                         dflt='char *'
20051                         . ./myread
20052                         netdb_name_type=$ans
20053                         ;;
20054                 esac
20055                 ;;
20056         *)      : no gethostbyname, so pick harmless default
20057                 netdb_name_type='char *'
20058                 ;;
20059         esac
20060 fi
20061
20062 : check for type of 1st argument to getnetbyaddr. 
20063 if test "X$netdb_net_type" = X ; then
20064         case "$d_getnbyaddr" in
20065         $define)
20066                 $cat <<EOM
20067
20068 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20069 EOM
20070                 hdrs="$define sys/types.h
20071                         $d_socket sys/socket.h 
20072                         $i_niin netinet/in.h 
20073                         $i_netdb netdb.h
20074                         $i_unistd unistd.h"
20075                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20076                         case "$netdb_net_type" in
20077                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20078                                 if ./protochk "$try" $hdrs; then
20079                                         echo "Your system accepts $xxx."
20080                                         netdb_net_type="$xxx"
20081                                 fi
20082                                 ;;
20083                         esac
20084                 done
20085                 : In case none of those worked, prompt the user.
20086                 case "$netdb_net_type" in
20087                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20088                         dflt='long'
20089                         . ./myread
20090                         netdb_net_type=$ans
20091                         ;;
20092                 esac
20093                 ;;
20094         *)      : no getnetbyaddr, so pick harmless default
20095                 netdb_net_type='long'
20096                 ;;
20097         esac
20098 fi
20099 : locate the preferred pager for this system
20100 fn=f/
20101 case "$pager" in
20102 '')
20103         dflt=''
20104         case "$pg" in
20105         /*) dflt=$pg;;
20106         [a-zA-Z]:/*) dflt=$pg;;
20107         esac
20108         case "$more" in
20109         /*) dflt=$more;;
20110         [a-zA-Z]:/*) dflt=$more;;
20111         esac
20112         case "$less" in
20113         /*) dflt=$less;;
20114         [a-zA-Z]:/*) dflt=$less;;
20115         esac
20116         case "$dflt" in
20117         '') dflt=/usr/ucb/more;;
20118         esac
20119         ;;
20120 *)      dflt="$pager"
20121         fn="f/($pager)"
20122         ;;
20123 esac
20124 echo " "
20125 rp='What pager is used on your system?'
20126 . ./getfile
20127 pager="$ans"
20128
20129 : see what type pids are declared as in the kernel
20130 rp="What is the type of process ids on this system?"
20131 set pid_t pidtype int stdio.h sys/types.h
20132 eval $typedef_ask
20133
20134 : see if ar generates random libraries by itself
20135 echo " "
20136 echo "Checking how to generate random libraries on your machine..." >&4
20137 echo 'int bar1() { return bar2(); }' > bar1.c
20138 echo 'int bar2() { return 2; }' > bar2.c
20139 $cat > foo.c <<EOP
20140 #$i_stdlib I_STDLIB
20141 #ifdef I_STDLIB
20142 #include <stdlib.h>
20143 #endif
20144 int main() { printf("%d\n", bar1()); exit(0); }
20145 EOP
20146 $cc $ccflags -c bar1.c >/dev/null 2>&1
20147 $cc $ccflags -c bar2.c >/dev/null 2>&1
20148 $cc $ccflags -c foo.c >/dev/null 2>&1
20149 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20150 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20151         $run ./foobar >/dev/null 2>&1; then
20152         echo "$ar appears to generate random libraries itself."
20153         orderlib=false
20154         if [ "X$ranlib" = "X" ]; then
20155             ranlib=":"
20156         fi
20157 elif $ar s bar$_a >/dev/null 2>&1 &&
20158         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20159         $run ./foobar >/dev/null 2>&1; then
20160                 echo "a table of contents needs to be added with '$ar s'."
20161                 orderlib=false
20162                 ranlib="$ar s"
20163 elif $ar ts bar$_a >/dev/null 2>&1 &&
20164         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20165         $run ./foobar >/dev/null 2>&1; then
20166                 echo "a table of contents needs to be added with '$ar ts'."
20167                 orderlib=false
20168                 ranlib="$ar ts"
20169 else
20170         case "$ranlib" in
20171         :) ranlib='';;
20172         '')
20173                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20174                 $test -f $ranlib || ranlib=''
20175                 ;;
20176         esac
20177         if $test -n "$ranlib"; then
20178                 echo "your system has '$ranlib'; we'll use that."
20179                 orderlib=false
20180         else
20181                 echo "your system doesn't seem to support random libraries"
20182                 echo "so we'll use lorder and tsort to order the libraries."
20183                 orderlib=true
20184                 ranlib=":"
20185         fi
20186 fi
20187 $rm -f foo* bar*
20188
20189 : see if this is a values.h system
20190 set values.h i_values
20191 eval $inhdr
20192
20193 : Check the max offset that gmtime and localtime accept
20194 echo "Checking max offsets that gmtime () accepts"
20195
20196 case $i_values in
20197     define) yyy="#include <values.h>" ;;
20198     *)      yyy="" ;;
20199     esac
20200
20201 case "$sGMTIME_min/$sGMTIME_max" in
20202     0/0|/)
20203         $cat >try.c <<EOCP
20204 #include <sys/types.h>
20205 #include <stdio.h>
20206 #include <time.h>
20207 $yyy
20208
20209 int i;
20210 struct tm *tmp;
20211 time_t pt;
20212
20213 void gm_check (time_t t, int min_year, int max_year)
20214 {
20215     tmp = gmtime (&t);
20216     if ( tmp == NULL ||
20217         /* Check tm_year overflow */
20218          tmp->tm_year < min_year || tmp->tm_year > max_year)
20219         tmp = NULL;
20220     else
20221         pt = t;
20222     } /* gm_check */
20223
20224 int check_max ()
20225 {
20226     tmp = NULL;
20227     pt  = 0;
20228 #ifdef MAXLONG
20229     gm_check (MAXLONG, 69, 0x7fffffff);
20230 #endif
20231     if (tmp == NULL || tmp->tm_year < 0) {
20232         for (i = 63; i >= 0; i--) {
20233             time_t x = pt | ((time_t)1 << i);
20234             if (x < 0 || x < pt) continue;
20235             gm_check (x, 69, 0x7fffffff);
20236             }
20237         }
20238     printf ("sGMTIME_max=%ld\n", pt);
20239     return (0);
20240     } /* check_max */
20241
20242 int check_min ()
20243 {
20244     tmp = NULL;
20245     pt  = 0;
20246 #ifdef MINLONG
20247     gm_check (MINLONG, -1900, 70);
20248 #endif
20249     if (tmp == NULL) {
20250         for (i = 36; i >= 0; i--) {
20251             time_t x = pt - ((time_t)1 << i);
20252             if (x > 0) continue;
20253             gm_check (x, -1900, 70);
20254             }
20255         }
20256     printf ("sGMTIME_min=%ld\n", pt);
20257     return (0);
20258     } /* check_min */
20259
20260 int main (int argc, char *argv[])
20261 {
20262     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20263     check_max ();
20264     check_min ();
20265     return (0);
20266     } /* main */
20267 EOCP
20268         set try
20269         if eval $compile; then
20270             eval `$run ./try`
20271         else
20272             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20273             fi
20274         $rm_try
20275         ;;
20276     esac
20277
20278 echo "Checking max offsets that localtime () accepts"
20279
20280 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20281     0/0|/)
20282         $cat >try.c <<EOCP
20283 #include <sys/types.h>
20284 #include <stdio.h>
20285 #include <time.h>
20286 $yyy
20287
20288 int i;
20289 struct tm *tmp;
20290 time_t pt;
20291
20292 void local_check (time_t t, int min_year, int max_year)
20293 {
20294     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20295         tmp = NULL;
20296     else
20297         tmp = localtime (&t);
20298     if ( tmp == NULL ||
20299         /* Check tm_year overflow */
20300          tmp->tm_year < min_year || tmp->tm_year > max_year)
20301         tmp = NULL;
20302     else
20303         pt = t;
20304     } /* local_check */
20305
20306 int check_max ()
20307 {
20308     tmp = NULL;
20309     pt  = 0;
20310 #ifdef MAXLONG
20311     local_check (MAXLONG, 69, 0x7fffffff);
20312 #endif
20313     if (tmp == NULL || tmp->tm_year < 0) {
20314         for (i = 63; i >= 0; i--) {
20315             time_t x = pt | ((time_t)1 << i);
20316             if (x < 0 || x < pt) continue;
20317             local_check (x, 69, 0x7fffffff);
20318             }
20319         }
20320     printf ("sLOCALTIME_max=%ld\n", pt);
20321     return (0);
20322    } /* check_max */
20323
20324 int check_min ()
20325 {
20326     tmp = NULL;
20327     pt  = 0;
20328 #ifdef MINLONG
20329     local_check (MINLONG, -1900, 70);
20330 #endif
20331     if (tmp == NULL) {
20332         for (i = 36; i >= 0; i--) {
20333             time_t x = pt - ((time_t)1 << i);
20334             if (x > 0) continue;
20335             local_check (x, -1900, 70);
20336             }
20337         }
20338     printf ("sLOCALTIME_min=%ld\n", pt);
20339     return (0);
20340     } /* check_min */
20341
20342 int main (int argc, char *argv[])
20343 {
20344     check_max ();
20345     check_min ();
20346     return (0);
20347     } /* main */
20348 EOCP
20349         set try
20350         if eval $compile; then
20351             eval `$run ./try`
20352         else
20353             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20354             fi
20355         $rm_try
20356         ;;
20357     esac
20358
20359 : check for type of arguments to select.
20360 case "$selecttype" in
20361 '') case "$d_select" in
20362         $define)
20363                 echo " "
20364                 $cat <<EOM
20365 Checking to see what type of arguments are accepted by select().
20366 EOM
20367                 hdrs="$define sys/types.h
20368                         $i_systime sys/time.h
20369                         $i_sysselct sys/select.h
20370                         $d_socket sys/socket.h"
20371                 : The first arg can be int, unsigned, or size_t
20372                 : The last arg may or may not be 'const'
20373                 val=''
20374                 : void pointer has been seen but using that
20375                 : breaks the selectminbits test
20376                 for xxx in 'fd_set *' 'int *'; do
20377                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20378                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20379                                         case "$val" in
20380                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20381                                                 if ./protochk "$try" $hdrs; then
20382                                                         echo "Your system accepts $xxx."
20383                                                         val="$xxx"
20384                                                 fi
20385                                                 ;;
20386                                         esac
20387                                 done
20388                         done
20389                 done
20390                 case "$val" in
20391                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20392                         case "$d_fd_set" in
20393                                 $define) dflt="fd_set *" ;;
20394                                 *)              dflt="int *" ;;
20395                         esac
20396                         . ./myread
20397                         val=$ans
20398                         ;;
20399                 esac
20400                 selecttype="$val"
20401                 ;;
20402         *)      : no select, so pick a harmless default
20403                 selecttype='int *'
20404                 ;;
20405         esac
20406         ;;
20407 esac
20408
20409 : check for the select 'width'
20410 case "$selectminbits" in
20411 '') safebits=`expr $ptrsize \* 8`
20412     case "$d_select" in
20413         $define)
20414                 $cat <<EOM
20415
20416 Checking to see on how many bits at a time your select() operates...
20417 EOM
20418                 $cat >try.c <<EOCP
20419 #include <sys/types.h>
20420 #$i_time I_TIME
20421 #$i_systime I_SYS_TIME
20422 #$i_systimek I_SYS_TIME_KERNEL
20423 #ifdef I_TIME
20424 #   include <time.h>
20425 #endif
20426 #ifdef I_SYS_TIME
20427 #   ifdef I_SYS_TIME_KERNEL
20428 #       define KERNEL
20429 #   endif
20430 #   include <sys/time.h>
20431 #   ifdef I_SYS_TIME_KERNEL
20432 #       undef KERNEL
20433 #   endif
20434 #endif
20435 #$i_sysselct I_SYS_SELECT
20436 #ifdef I_SYS_SELECT
20437 #include <sys/select.h>
20438 #endif
20439 #$d_socket HAS_SOCKET
20440 #ifdef HAS_SOCKET
20441 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20442 #endif
20443 #include <stdio.h>
20444 #$i_stdlib I_STDLIB
20445 #ifdef I_STDLIB
20446 #include <stdlib.h>
20447 #endif
20448 $selecttype b;
20449 #define S sizeof(*(b))
20450 #define MINBITS 64
20451 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20452 #define NBITS  (NBYTES * 8)
20453 int main() {
20454     char *s = (char *)malloc(NBYTES);
20455     struct timeval t;
20456     int i;
20457     FILE* fp;
20458     int fd;
20459
20460     if (!s)
20461         exit(1);
20462     fclose(stdin);
20463     fp = fopen("try.c", "r");
20464     if (fp == 0)
20465       exit(2);
20466     fd = fileno(fp);
20467     if (fd < 0)
20468       exit(3);
20469     b = ($selecttype)s;
20470     for (i = 0; i < NBITS; i++)
20471         FD_SET(i, b);
20472     t.tv_sec  = 0;
20473     t.tv_usec = 0;
20474     select(fd + 1, b, 0, 0, &t);
20475     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20476     free(s);
20477     printf("%d\n", i + 1);
20478     return 0;
20479 }
20480 EOCP
20481                 set try
20482                 if eval $compile_ok; then
20483                         selectminbits=`$run ./try`
20484                         case "$selectminbits" in
20485                         '')     cat >&4 <<EOM
20486 Cannot figure out on how many bits at a time your select() operates.
20487 I'll play safe and guess it is $safebits bits.
20488 EOM
20489                                 selectminbits=$safebits
20490                                 bits="$safebits bits"
20491                                 ;;
20492                         1)      bits="1 bit" ;;
20493                         *)      bits="$selectminbits bits" ;;
20494                         esac
20495                         echo "Your select() operates on $bits at a time." >&4
20496                 else
20497                         rp='What is the minimum number of bits your select() operates on?'
20498                         case "$byteorder" in
20499                         12345678)       dflt=64 ;;
20500                         1234)           dflt=32 ;;
20501                         *)              dflt=1  ;;
20502                         esac
20503                         . ./myread
20504                         val=$ans
20505                         selectminbits="$val"
20506                 fi
20507                 $rm_try
20508                 ;;
20509         *)      : no select, so pick a harmless default
20510                 selectminbits=$safebits
20511                 ;;
20512         esac
20513         ;;
20514 esac
20515
20516 : Trace out the files included by signal.h, then look for SIGxxx names.
20517 if [ "X$fieldn" = X ]; then
20518         : Just make some guesses.  We check them later.
20519         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20520 else
20521         xxx=`echo '#include <signal.h>' |
20522         $cppstdin $cppminus $cppflags 2>/dev/null |
20523         $grep '^[       ]*#.*include' |
20524         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20525                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20526 fi
20527 xxxfiles=''
20528 for xx in $xxx /dev/null ; do
20529         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20530 done
20531 case "$xxxfiles" in
20532 '')     xxxfiles=`./findhdr signal.h` ;;
20533 esac
20534 xxx=`awk '
20535 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20536         print substr($2, 4, 20)
20537 }
20538 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20539         print substr($3, 4, 20)
20540 }' $xxxfiles`
20541 : Append some common names just in case the awk scan failed.
20542 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20543 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20544 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20545 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20546 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20547
20548 : generate a few handy files for later
20549 $cat > signal.c <<EOCP
20550 #include <sys/types.h>
20551 #include <signal.h>
20552 #$i_stdlib I_STDLIB
20553 #ifdef I_STDLIB
20554 #include <stdlib.h>
20555 #endif
20556 #include <stdio.h>
20557 int main() {
20558
20559 /* Strange style to avoid deeply-nested #if/#else/#endif */
20560 #ifndef NSIG
20561 #  ifdef _NSIG
20562 #    define NSIG (_NSIG)
20563 #  endif
20564 #endif
20565
20566 #ifndef NSIG
20567 #  ifdef SIGMAX
20568 #    define NSIG (SIGMAX+1)
20569 #  endif
20570 #endif
20571
20572 #ifndef NSIG
20573 #  ifdef SIG_MAX
20574 #    define NSIG (SIG_MAX+1)
20575 #  endif
20576 #endif
20577
20578 #ifndef NSIG
20579 #  ifdef _SIG_MAX
20580 #    define NSIG (_SIG_MAX+1)
20581 #  endif
20582 #endif
20583
20584 #ifndef NSIG
20585 #  ifdef MAXSIG
20586 #    define NSIG (MAXSIG+1)
20587 #  endif
20588 #endif
20589
20590 #ifndef NSIG
20591 #  ifdef MAX_SIG
20592 #    define NSIG (MAX_SIG+1)
20593 #  endif
20594 #endif
20595
20596 #ifndef NSIG
20597 #  ifdef SIGARRAYSIZE
20598 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20599 #  endif
20600 #endif
20601
20602 #ifndef NSIG
20603 #  ifdef _sys_nsig
20604 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20605 #  endif
20606 #endif
20607
20608 /* Default to some arbitrary number that's big enough to get most
20609    of the common signals.
20610 */
20611 #ifndef NSIG
20612 #    define NSIG 50
20613 #endif
20614
20615 printf("NSIG %d\n", NSIG);
20616
20617 #ifndef JUST_NSIG
20618
20619 EOCP
20620
20621 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20622 {
20623         printf "#ifdef SIG"; printf $1; printf "\n"
20624         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20625         printf $1; printf ");\n"
20626         printf "#endif\n"
20627 }
20628 END {
20629         printf "#endif /* JUST_NSIG */\n";
20630         printf "exit(0);\n}\n";
20631 }
20632 ' >>signal.c
20633 $cat >signal.awk <<'EOP'
20634 BEGIN { ndups = 0 }
20635 $1 ~ /^NSIG$/ { nsig = $2 }
20636 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20637     if ($2 > maxsig) { maxsig = $2 }
20638     if (sig_name[$2]) {
20639         dup_name[ndups] = $1
20640         dup_num[ndups] = $2
20641         ndups++
20642     }
20643     else {
20644         sig_name[$2] = $1
20645         sig_num[$2] = $2
20646     }
20647 }
20648 END {
20649     if (nsig == 0) {
20650         nsig = maxsig + 1
20651     }
20652     printf("NSIG %d\n", nsig);
20653     for (n = 1; n < nsig; n++) {
20654         if (sig_name[n]) {
20655             printf("%s %d\n", sig_name[n], sig_num[n])
20656         }
20657         else {
20658             printf("NUM%d %d\n", n, n)
20659         }
20660     }
20661     for (n = 0; n < ndups; n++) {
20662         printf("%s %d\n", dup_name[n], dup_num[n])
20663     }
20664 }
20665 EOP
20666 $cat >signal_cmd <<EOS
20667 $startsh
20668 if $test -s signal.lst; then
20669     echo "Using your existing signal.lst file"
20670         exit 0
20671 fi
20672 xxx="$xxx"
20673 EOS
20674 $cat >>signal_cmd <<'EOS'
20675
20676 set signal
20677 if eval $compile_ok; then
20678         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20679                 $uniq | $awk -f signal.awk >signal.lst
20680 else
20681         echo "(I can't seem be able to compile the whole test program)" >&4
20682         echo "(I'll try it in little pieces.)" >&4
20683         set signal -DJUST_NSIG
20684         if eval $compile_ok; then
20685                 $run ./signal$_exe > signal.nsg
20686                 $cat signal.nsg
20687         else
20688                 echo "I can't seem to figure out how many signals you have." >&4
20689                 echo "Guessing 50." >&4
20690                 echo 'NSIG 50' > signal.nsg
20691         fi
20692         : Now look at all the signal names, one at a time.
20693         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20694                 $cat > signal.c <<EOCP
20695 #include <sys/types.h>
20696 #include <signal.h>
20697 #include <stdio.h>
20698 int main() {
20699 printf("$xx %d\n", SIG${xx});
20700 return 0;
20701 }
20702 EOCP
20703                 set signal
20704                 if eval $compile; then
20705                         echo "SIG${xx} found."
20706                         $run ./signal$_exe  >> signal.ls1
20707                 else
20708                         echo "SIG${xx} NOT found."
20709                 fi
20710         done
20711         if $test -s signal.ls1; then
20712                 $cat signal.nsg signal.ls1 |
20713                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20714         fi
20715
20716 fi
20717 if $test -s signal.lst; then
20718         :
20719 else
20720         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20721         echo 'kill -l' >signal
20722         set X `csh -f <signal`
20723         $rm -f signal
20724         shift
20725         case $# in
20726         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20727         esac
20728         echo $@ | $tr ' ' $trnl | \
20729             $awk '{ printf "%s %d\n", $1, ++s; }
20730                   END { printf "NSIG %d\n", ++s }' >signal.lst
20731 fi
20732 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20733 EOS
20734 chmod a+x signal_cmd
20735 $eunicefix signal_cmd
20736
20737 : generate list of signal names
20738 echo " "
20739 case "$sig_name_init" in
20740 '') doinit=yes ;;
20741 *)  case "$sig_num_init" in
20742     ''|*,*) doinit=yes ;;
20743     esac ;;
20744 esac
20745 case "$doinit" in
20746 yes)
20747         echo "Generating a list of signal names and numbers..." >&4
20748         . ./signal_cmd
20749         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20750         sig_name=`$awk 'BEGIN { printf "ZERO " }
20751                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20752         sig_num=`$awk  'BEGIN { printf "0 " }
20753                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20754         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20755                              !/^NSIG/   { printf "\"%s\", ", $1 }
20756                              END        { printf "0\n" }' signal.lst`
20757         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20758                              !/^NSIG/   { printf "%d, ", $2}
20759                              END        { printf "0\n"}' signal.lst`
20760         ;;
20761 esac
20762 echo "The following $sig_count signals are available:"
20763 echo " "
20764 echo $sig_name | $awk \
20765 'BEGIN { linelen = 0 }
20766 {
20767         for (i = 1; i <= NF; i++) {
20768                 name = "SIG" $i " "
20769                 linelen = linelen + length(name)
20770                 if (linelen > 70) {
20771                         printf "\n"
20772                         linelen = length(name)
20773                 }
20774                 printf "%s", name
20775         }
20776         printf "\n"
20777 }'
20778 sig_size=`echo $sig_name | awk '{print NF}'`
20779 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20780
20781 : Check size of size
20782 echo " "
20783 case "$sizetype" in
20784 *_t) zzz="$sizetype"    ;;
20785 *)   zzz="filesize"     ;;
20786 esac
20787 echo "Checking the size of $zzz..." >&4
20788 cat > try.c <<EOCP
20789 #include <sys/types.h>
20790 #include <stdio.h>
20791 #$i_stdlib I_STDLIB
20792 #ifdef I_STDLIB
20793 #include <stdlib.h>
20794 #endif
20795 int main() {
20796     printf("%d\n", (int)sizeof($sizetype));
20797     exit(0);
20798 }
20799 EOCP
20800 set try
20801 if eval $compile_ok; then
20802         yyy=`$run ./try`
20803         case "$yyy" in
20804         '')     sizesize=4
20805                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20806                 ;;
20807         *)      sizesize=$yyy
20808                 echo "Your $zzz size is $sizesize bytes."
20809                 ;;
20810         esac
20811 else
20812         sizesize=4
20813         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20814 fi
20815
20816
20817 : check for socklen_t
20818 echo " "
20819 echo "Checking to see if you have socklen_t..." >&4
20820 $cat >try.c <<EOCP
20821 #include <sys/types.h>
20822 #$d_socket HAS_SOCKET
20823 #ifdef HAS_SOCKET
20824 #include <sys/socket.h>
20825 #endif
20826 int main() { socklen_t x = 16; }
20827 EOCP
20828 set try
20829 if eval $compile; then
20830         val="$define"
20831         echo "You have socklen_t."
20832 else
20833         val="$undef"
20834         echo "You do not have socklen_t."
20835         case "$sizetype" in
20836         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20837         esac
20838 fi
20839 $rm_try
20840 set d_socklen_t
20841 eval $setvar
20842
20843 : see if this is a socks.h system
20844 set socks.h i_socks
20845 eval $inhdr
20846
20847 : check for type of the size argument to socket calls
20848 case "$d_socket" in
20849 "$define")
20850         $cat <<EOM
20851
20852 Checking to see what type is the last argument of accept().
20853 EOM
20854         yyy=''
20855         case "$d_socklen_t" in
20856         "$define") yyy="$yyy socklen_t"
20857         esac
20858         yyy="$yyy $sizetype int long unsigned"
20859         for xxx in $yyy; do
20860                 case "$socksizetype" in
20861                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
20862                         case "$usesocks" in
20863                         "$define")
20864                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20865                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20866                                         socksizetype="$xxx"
20867                                 fi
20868                                 ;;
20869                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20870                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20871                                         socksizetype="$xxx"
20872                                 fi
20873                                 ;;
20874                         esac
20875                         ;;
20876                 esac
20877         done
20878 : In case none of those worked, prompt the user.
20879         case "$socksizetype" in
20880         '')     rp='What is the type for socket address structure sizes?'
20881                 dflt='int'
20882                 . ./myread
20883                 socksizetype=$ans
20884                 ;;
20885         esac
20886         ;;
20887 *)      : no sockets, so pick relatively harmless default
20888         socksizetype='int'
20889         ;;
20890 esac
20891
20892 : see what type is used for signed size_t
20893 set ssize_t ssizetype int stdio.h sys/types.h
20894 eval $typedef
20895 dflt="$ssizetype"
20896 $cat > try.c <<EOM
20897 #include <stdio.h>
20898 #$i_stdlib I_STDLIB
20899 #ifdef I_STDLIB
20900 #include <stdlib.h>
20901 #endif
20902 #include <sys/types.h>
20903 #define Size_t $sizetype
20904 #define SSize_t $dflt
20905 int main()
20906 {
20907         if (sizeof(Size_t) == sizeof(SSize_t))
20908                 printf("$dflt\n");
20909         else if (sizeof(Size_t) == sizeof(int))
20910                 printf("int\n");
20911         else
20912                 printf("long\n");
20913         exit(0);
20914 }
20915 EOM
20916 echo " "
20917 set try
20918 if eval $compile_ok && $run ./try > /dev/null; then
20919         ssizetype=`$run ./try`
20920         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20921 else
20922         $cat >&4 <<EOM
20923 Help! I can't compile and run the ssize_t test program: please enlighten me!
20924 (This is probably a misconfiguration in your system or libraries, and
20925 you really ought to fix it.  Still, I'll try anyway.)
20926
20927 I need a type that is the same size as $sizetype, but is guaranteed to
20928 be signed.  Common values are ssize_t, int and long.
20929
20930 EOM
20931         rp="What signed type is the same size as $sizetype?"
20932         . ./myread
20933         ssizetype="$ans"
20934 fi
20935 $rm_try
20936
20937 : see what type of char stdio uses.
20938 echo " "
20939 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
20940 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20941         echo "Your stdio uses unsigned chars." >&4
20942         stdchar="unsigned char"
20943 else
20944         echo "Your stdio uses signed chars." >&4
20945         stdchar="char"
20946 fi
20947 $rm -f stdioh
20948
20949 : see what type uids are declared as in the kernel
20950 echo " "
20951 echo "Looking for the type for user ids returned by getuid()."
20952 set uid_t uidtype xxx stdio.h sys/types.h
20953 eval $typedef
20954 case "$uidtype" in
20955 xxx)
20956         xxx=`./findhdr sys/user.h`
20957         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20958         case $1 in
20959         unsigned) dflt="$1 $2" ;;
20960         *) dflt="$1" ;;
20961         esac
20962         ;;
20963 *) dflt="$uidtype";;
20964 esac
20965 case "$uidtype" in
20966 uid_t)  echo "uid_t found." ;;
20967 *)      rp="What is the type for user ids returned by getuid()?"
20968         . ./myread
20969         uidtype="$ans"
20970         ;;
20971 esac
20972
20973 : Check size of UID
20974 echo " "
20975 case "$uidtype" in
20976 *_t) zzz="$uidtype"     ;;
20977 *)   zzz="uid"          ;;
20978 esac
20979 echo "Checking the size of $zzz..." >&4
20980 cat > try.c <<EOCP
20981 #include <sys/types.h>
20982 #include <stdio.h>
20983 #$i_stdlib I_STDLIB
20984 #ifdef I_STDLIB
20985 #include <stdlib.h>
20986 #endif
20987 int main() {
20988     printf("%d\n", (int)sizeof($uidtype));
20989     exit(0);
20990 }
20991 EOCP
20992 set try
20993 if eval $compile_ok; then
20994         yyy=`$run ./try`
20995         case "$yyy" in
20996         '')     uidsize=4
20997                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20998                 ;;
20999         *)      uidsize=$yyy
21000                 echo "Your $zzz is $uidsize bytes long."
21001                 ;;
21002         esac
21003 else
21004         uidsize=4
21005         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21006 fi
21007
21008 : Check if UID is signed
21009 echo " "
21010 case "$uidtype" in
21011 *_t) zzz="$uidtype"     ;;
21012 *)   zzz="uid"          ;;
21013 esac
21014 echo "Checking the sign of $zzz..." >&4
21015 cat > try.c <<EOCP
21016 #include <sys/types.h>
21017 #include <stdio.h>
21018 int main() {
21019         $uidtype foo = -1;
21020         if (foo < 0)
21021                 printf("-1\n");
21022         else
21023                 printf("1\n");
21024 }
21025 EOCP
21026 set try
21027 if eval $compile; then
21028         yyy=`$run ./try`
21029         case "$yyy" in
21030         '')     uidsign=1
21031                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21032                 ;;
21033         *)      uidsign=$yyy
21034                 case "$uidsign" in
21035                  1) echo "Your $zzz is unsigned." ;;
21036                 -1) echo "Your $zzz is signed."   ;;
21037                 esac
21038                 ;;
21039         esac
21040 else
21041         uidsign=1
21042         echo "(I can't compile the test program--guessing unsigned.)" >&4
21043 fi
21044
21045
21046 : Check format string for UID
21047 echo " "
21048 $echo "Checking the format string to be used for uids..." >&4
21049
21050 case "$uidsign" in
21051 -1)     if $test X"$uidsize" = X"$ivsize"; then
21052                 uidformat="$ivdformat"
21053         else
21054                 if $test X"$uidsize" = X"$longsize"; then
21055                         uidformat='"ld"'
21056                 else
21057                         if $test X"$uidsize" = X"$intsize"; then
21058                                 uidformat='"d"'
21059                         else
21060                                 if $test X"$uidsize" = X"$shortsize"; then
21061                                         uidformat='"hd"'
21062                                 fi
21063                         fi
21064                 fi
21065         fi
21066         ;;
21067 *)      if $test X"$uidsize" = X"$uvsize"; then
21068                 uidformat="$uvuformat"
21069         else
21070                 if $test X"$uidsize" = X"$longsize"; then
21071                         uidformat='"lu"'
21072                 else
21073                         if $test X"$uidsize" = X"$intsize"; then
21074                                 uidformat='"u"'
21075                         else
21076                                 if $test X"$uidsize" = X"$shortsize"; then
21077                                         uidformat='"hu"'
21078                                 fi
21079                         fi
21080                 fi
21081         fi
21082         ;;
21083 esac
21084
21085 : Check if site customization support was requested
21086 case "$usesitecustomize" in
21087     $define|true|[Yy]*)
21088         usesitecustomize="$define"
21089         ;;
21090     *)
21091         usesitecustomize="$undef"
21092         ;;
21093     esac
21094
21095 : determine compiler compiler
21096 case "$yacc" in
21097 '')
21098         dflt=yacc;;
21099 *)
21100         dflt="$yacc";;
21101 esac
21102 echo " "
21103 comp='yacc'
21104 if $test -f "$byacc$_exe"; then
21105         dflt="$byacc"
21106         comp="byacc or $comp"
21107 fi
21108 if $test -f "$bison$_exe"; then
21109         comp="$comp or bison -y"
21110 fi
21111 rp="Which compiler compiler ($comp) shall I use?"
21112 . ./myread
21113 yacc="$ans"
21114 case "$yacc" in
21115 *bis*)
21116         case "$yacc" in
21117         *-y*) ;;
21118         *)
21119                 yacc="$yacc -y"
21120                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21121                 ;;
21122         esac
21123         ;;
21124 esac
21125
21126 : see if this is a assert.h system
21127 set assert.h i_assert
21128 eval $inhdr
21129
21130 : see if this is a fp.h system
21131 set fp.h i_fp
21132 eval $inhdr
21133
21134 : see if this is a fp_class.h system
21135 set fp_class.h i_fp_class
21136 eval $inhdr
21137
21138 : see if gdbm.h is available
21139 set gdbm.h t_gdbm
21140 eval $inhdr
21141 case "$t_gdbm" in
21142 $define)
21143         : see if gdbm_open exists
21144         set gdbm_open d_gdbm_open
21145         eval $inlibc
21146         case "$d_gdbm_open" in
21147         $undef)
21148                 t_gdbm="$undef"
21149                 echo "We won't be including <gdbm.h>"
21150                 ;;
21151         esac
21152         ;;
21153 esac
21154 val="$t_gdbm"
21155 set i_gdbm
21156 eval $setvar
21157
21158 : see if this is a ieeefp.h system
21159 case "$i_ieeefp" in
21160 '' ) set ieeefp.h i_ieeefp
21161      eval $inhdr
21162      ;;
21163 esac
21164
21165 : see if this is a libutil.h system
21166 set libutil.h i_libutil
21167 eval $inhdr
21168
21169 : see if mach cthreads are available
21170 if test "X$usethreads" = "X$define"; then
21171         set mach/cthreads.h i_machcthr
21172         eval $inhdr
21173 else
21174         i_machcthr="$undef"
21175 fi
21176
21177 : see if this is a mntent.h system
21178 set mntent.h i_mntent
21179 eval $inhdr
21180
21181 : see if net/errno.h is available
21182 val=''
21183 set net/errno.h val
21184 eval $inhdr
21185
21186 : Unfortunately, it causes problems on some systems.  Arrgh.
21187 case "$val" in
21188 $define)
21189         cat > try.c <<'EOM'
21190 #include <stdio.h>
21191 #include <errno.h>
21192 #include <net/errno.h>
21193 int func()
21194 {
21195         return ENOTSOCK;
21196 }
21197 EOM
21198         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21199                 echo "We'll be including <net/errno.h>." >&4
21200         else
21201                 echo "We won't be including <net/errno.h>." >&4
21202                 val="$undef"
21203         fi
21204         $rm_try
21205         ;;
21206 esac
21207 set i_neterrno
21208 eval $setvar
21209
21210 : see if netinet/tcp.h is available
21211 set netinet/tcp.h i_netinettcp
21212 eval $inhdr
21213
21214 : see if this is a poll.h system
21215 set poll.h i_poll
21216 eval $inhdr
21217
21218 : see if this is a prot.h system
21219 set prot.h i_prot
21220 eval $inhdr
21221
21222 : Preprocessor symbols
21223 echo " "
21224 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21225 $cat <<'EOSH' > Cppsym.know
21226 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21227 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21228 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21229 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21230 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21231 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21232 bull c cadmus clipper CMU COFF COMPILER_VERSION
21233 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21234 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21235 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21236 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21237 GLIBC GLIBC_MINOR
21238 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21239 H3050R H3050RX hbullx20 hcx host_mips
21240 hp200 hp300 hp700 HP700 hp800 hp9000
21241 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21242 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21243 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21244 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21245 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21246 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21247 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21248 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21249 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21250 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21251 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21252 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21253 MATH_HAS_NO_SIDE_EFFECTS
21254 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21255 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21256 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21257 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21258 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21259 NetBSD news1500 news1700 news1800 news1900 news3700
21260 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21261 ns32016 ns32332 ns32k nsc32000
21262 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21263 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21264 pc532 pdp11 PGC PIC plexus PORTAR posix
21265 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21266 POSIX_C_SOURCE POSIX_SOURCE POWER
21267 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21268 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21269 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21270 sony sony_news sonyrisc sparc sparclite spectrum
21271 stardent stdc STDC_EXT stratos sun sun3 sun386
21272 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21273 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21274 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21275 sysV68 sysV88 Tek4132 Tek4300 titan
21276 TM3200 TM5400 TM5600
21277 tower tower32 tower32_200 tower32_600 tower32_700
21278 tower32_800 tower32_850 tss
21279 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21280 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21281 unix UNIX95 UNIX99 unixpc unos
21282 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21283 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21284 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21285 USGr4 USGr4_2
21286 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21287 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21288 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21289 z8000
21290 EOSH
21291 # Maybe put other stuff here too.
21292 cat <<EOSH >>Cppsym.know
21293 $osname
21294 EOSH
21295 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21296 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21297 $cat Cppsym.know > Cppsym.c
21298 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21299 $rm -f Cppsym.a Cppsym.b Cppsym.c
21300 cat <<EOSH > Cppsym
21301 $startsh
21302 if $test \$# -gt 0; then
21303     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21304     if $test -s Cppsym.got; then
21305         $rm -f Cppsym.got
21306         exit 0
21307     fi
21308     $rm -f Cppsym.got
21309     exit 1
21310 else
21311     $tr " " "$trnl" | ./Cppsym.try
21312     exit 0
21313 fi
21314 EOSH
21315 chmod +x Cppsym
21316 $eunicefix Cppsym
21317 cat <<EOSH > Cppsym.try
21318 $startsh
21319 cat <<'EOCP' > try.c
21320 #include <stdio.h>
21321 #if cpp_stuff == 1
21322 #define STRINGIFY(a)    "a"
21323 #endif
21324 #if cpp_stuff == 42
21325 #define StGiFy(a)  #a
21326 #define STRINGIFY(a)    StGiFy(a)
21327 #endif
21328 #if $cpp_stuff != 1 && $cpp_stuff != 42
21329 #   include "Bletch: How does this C preprocessor stringify macros?"
21330 #endif
21331 int main() {
21332 EOCP
21333 $awk \\
21334 EOSH
21335 cat <<'EOSH' >> Cppsym.try
21336 'length($1) > 0 {
21337     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21338     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21339     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21340     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21341 }'       >> try.c
21342 echo 'return 0;}' >> try.c
21343 EOSH
21344 cat <<EOSH >> Cppsym.try
21345 ccflags="$ccflags"
21346 case "$osname-$gccversion" in
21347 irix-) ccflags="\$ccflags -woff 1178" ;;
21348 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21349 esac
21350 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21351 EOSH
21352 chmod +x Cppsym.try
21353 $eunicefix Cppsym.try
21354 ./Cppsym < Cppsym.know > Cppsym.true
21355 : Add in any linux cpp "predefined macros":
21356 case "$osname::$gccversion" in
21357   *linux*::*.*)
21358     tHdrH=_tmpHdr
21359     rm -f $tHdrH'.h' $tHdrH
21360     touch $tHdrH'.h'
21361     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21362        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21363        if [ -s $tHdrH'_cppsym.real' ]; then
21364           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21365        fi
21366     fi
21367     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21368   ;;
21369 esac
21370 : now check the C compiler for additional symbols
21371 postprocess_cc_v=''
21372 case "$osname" in
21373 aix) postprocess_cc_v="|$tr , ' '" ;;
21374 esac
21375 $cat >ccsym <<EOS
21376 $startsh
21377 $cat >tmp.c <<EOF
21378 extern int foo;
21379 EOF
21380 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21381 do
21382         case "\$i" in
21383         -D*) echo "\$i" | $sed 's/^-D//';;
21384         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21385         esac
21386 done
21387 $rm_try
21388 EOS
21389 postprocess_cc_v=''
21390 chmod +x ccsym
21391 $eunicefix ccsym
21392 ./ccsym > ccsym1.raw
21393 if $test -s ccsym1.raw; then
21394        $sort ccsym1.raw | $uniq >ccsym.raw
21395 else
21396        mv ccsym1.raw ccsym.raw
21397 fi
21398
21399 $awk '/\=/ { print $0; next }
21400         { print $0"=1" }' ccsym.raw >ccsym.list
21401 $comm -13 Cppsym.true ccsym.list >ccsym.own
21402 $comm -12 Cppsym.true ccsym.list >ccsym.com
21403 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21404 also=''
21405 if $test -z ccsym.raw; then
21406         echo "Your C compiler doesn't seem to define any symbols!" >&4
21407         echo " "
21408         echo "However, your C preprocessor defines the following symbols:"
21409         $cat Cppsym.true
21410         ccsymbols=''
21411         cppsymbols=`$cat Cppsym.true`
21412         cppsymbols=`echo $cppsymbols`
21413         cppccsymbols="$cppsymbols"
21414 else
21415         if $test -s ccsym.com; then
21416                 echo "Your C compiler and pre-processor define these symbols:"
21417                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21418                 also='also '
21419                 symbols='ones'
21420                 cppccsymbols=`$cat ccsym.com`
21421                 cppccsymbols=`echo $cppccsymbols`
21422                 $test "$silent" || sleep 1
21423         fi
21424         if $test -s ccsym.cpp; then
21425                 $test "$also" && echo " "
21426                 echo "Your C pre-processor ${also}defines the following symbols:"
21427                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21428                 also='further '
21429                 cppsymbols=`$cat ccsym.cpp`
21430                 cppsymbols=`echo $cppsymbols`
21431                 $test "$silent" || sleep 1
21432         fi
21433         if $test -s ccsym.own; then
21434                 $test "$also" && echo " "
21435                 echo "Your C compiler ${also}defines the following cpp symbols:"
21436                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21437                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21438                 ccsymbols=`$cat ccsym.own`
21439                 ccsymbols=`echo $ccsymbols`
21440                 $test "$silent" || sleep 1
21441         fi
21442 fi
21443
21444 : see if this is a termio system
21445 val="$undef"
21446 val2="$undef"
21447 val3="$undef"
21448 if $test `./findhdr termios.h`; then
21449         set tcsetattr i_termios
21450         eval $inlibc
21451         val3="$i_termios"
21452 fi
21453 echo " "
21454 case "$val3" in
21455 "$define") echo "You have POSIX termios.h... good!" >&4;;
21456 *) if ./Cppsym pyr; then
21457                 case "`/bin/universe`" in
21458                 ucb) if $test `./findhdr sgtty.h`; then
21459                                 val2="$define"
21460                                 echo "<sgtty.h> found." >&4
21461                         else
21462                                 echo "System is pyramid with BSD universe."
21463                                 ./warn "<sgtty.h> not found--you could have problems."
21464                         fi;;
21465                 *) if $test `./findhdr termio.h`; then
21466                                 val="$define"
21467                                 echo "<termio.h> found." >&4
21468                         else
21469                                 echo "System is pyramid with USG universe."
21470                                 ./warn "<termio.h> not found--you could have problems."
21471                         fi;;
21472                 esac
21473         elif ./usg; then
21474                 if $test `./findhdr termio.h`; then
21475                         echo "<termio.h> found." >&4
21476                         val="$define"
21477                 elif $test `./findhdr sgtty.h`; then
21478                         echo "<sgtty.h> found." >&4
21479                         val2="$define"
21480                 else
21481                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21482                 fi
21483         else
21484                 if $test `./findhdr sgtty.h`; then
21485                         echo "<sgtty.h> found." >&4
21486                         val2="$define"
21487                 elif $test `./findhdr termio.h`; then
21488                         echo "<termio.h> found." >&4
21489                         val="$define"
21490                 else
21491                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21492                 fi
21493         fi;;
21494 esac
21495 set i_termio; eval $setvar
21496 val=$val2; set i_sgtty; eval $setvar
21497 val=$val3; set i_termios; eval $setvar
21498
21499 : see if stddef is available
21500 set stddef.h i_stddef
21501 eval $inhdr
21502
21503 : see if sys/access.h is available
21504 set sys/access.h i_sysaccess
21505 eval $inhdr
21506
21507 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21508 set sys/filio.h i_sysfilio
21509 eval $inhdr
21510 echo " "
21511 if $test `./findhdr sys/ioctl.h`; then
21512         val="$define"
21513         echo '<sys/ioctl.h> found.' >&4
21514 else
21515         val="$undef"
21516         if $test $i_sysfilio = "$define"; then
21517             echo '<sys/ioctl.h> NOT found.' >&4
21518         else
21519                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21520                 $test $i_termio = "$define" && xxx="termio.h"
21521                 $test $i_termios = "$define" && xxx="termios.h"
21522 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21523         fi
21524 fi
21525 set i_sysioctl
21526 eval $setvar
21527
21528 : see if socket ioctl defs are in sys/sockio.h
21529 echo " "
21530 xxx=`./findhdr sys/sockio.h`
21531 if $test "$xxx"; then
21532         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21533                 val="$define"
21534                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21535         else
21536                 val="$undef"
21537                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21538         fi
21539 else
21540         val="$undef"
21541         $cat <<EOM
21542 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21543 EOM
21544 fi
21545 set i_syssockio
21546 eval $setvar
21547
21548 : see if this is a syslog.h system
21549 set syslog.h i_syslog
21550 eval $inhdr
21551
21552 : see if this is a sys/mode.h system
21553 set sys/mode.h i_sysmode
21554 eval $inhdr
21555
21556 : see if there is a sys/poll.h file
21557 set sys/poll.h i_syspoll
21558 eval $inhdr
21559
21560 : see if sys/resource.h has to be included
21561 set sys/resource.h i_sysresrc
21562 eval $inhdr
21563
21564 : see if sys/security.h is available
21565 set sys/security.h i_syssecrt
21566 eval $inhdr
21567
21568 : see if this is a sys/statvfs.h system
21569 set sys/statvfs.h i_sysstatvfs
21570 eval $inhdr
21571
21572 : see if this is a sys/un.h system
21573 set sys/un.h i_sysun
21574 eval $inhdr
21575
21576 : see if this is a sys/utsname.h system
21577 set sys/utsname.h i_sysutsname
21578 eval $inhdr
21579
21580 : see if this is a syswait system
21581 set sys/wait.h i_syswait
21582 eval $inhdr
21583
21584 : see if this is a ustat.h system
21585 set ustat.h i_ustat
21586 eval $inhdr
21587
21588 : see if this is an utime system
21589 set utime.h i_utime
21590 eval $inhdr
21591
21592 : see if this is a vfork system
21593 case "$d_vfork" in
21594 "$define")
21595         set vfork.h i_vfork
21596         eval $inhdr
21597         ;;
21598 *)
21599         i_vfork="$undef"
21600         ;;
21601 esac
21602
21603 : Check extensions
21604 echo " "
21605 echo "Looking for extensions..." >&4
21606 : If we are using the old config.sh, known_extensions may contain
21607 : old or inaccurate or duplicate values.
21608 known_extensions=''
21609 nonxs_extensions=''
21610 : We do not use find because it might not be available.
21611 : We do not just use MANIFEST because the user may have dropped
21612 : some additional extensions into the source tree and expect them
21613 : to be built.
21614
21615 : Function to recursively find available extensions, ignoring DynaLoader
21616 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21617 find_extensions='
21618     for xxx in *; do
21619         case "$xxx" in
21620             DynaLoader|dynaload) ;;
21621             *)
21622             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21623             leaf=`echo $xxx | $sed -e s/.*-//`;
21624             if $test -d File-Glob; then
21625                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21626                     known_extensions="$known_extensions $this_ext";
21627                 elif $test -d $xxx; then
21628                     nonxs_extensions="$nonxs_extensions $this_ext";
21629                 fi
21630             else
21631                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21632                     known_extensions="$known_extensions $1$this_ext";
21633                 elif $test -f $xxx/Makefile.PL; then
21634                     nonxs_extensions="$nonxs_extensions $1$this_ext";
21635                 else
21636                     if $test -d $xxx -a $# -lt 10; then
21637                         set $1$xxx/ $*;
21638                         cd "$xxx";
21639                         eval $find_extensions;
21640                         cd ..;
21641                         shift;
21642                     fi;
21643                 fi;
21644             fi
21645             ;;
21646         esac;
21647     done'
21648 tdir=`pwd`
21649 cd "$rsrc/ext"
21650 set X
21651 shift
21652 eval $find_extensions
21653 if $test -d File-Glob; then
21654     : All ext/ flattened
21655 else
21656     # Special case:  Add in modules that nest beyond the first level.
21657     # Currently threads/shared and Hash/Util/FieldHash, since they are
21658     # not picked up by the recursive find above (and adding in general
21659     # recursive finding breaks SDBM_File/sdbm).
21660     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21661     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21662 fi
21663 set X $known_extensions
21664 shift
21665 known_extensions="$*"
21666 set X $nonxs_extensions
21667 shift
21668 nonxs_extensions="$*"
21669 cd "$tdir"
21670
21671 : Now see which are supported on this system.
21672 avail_ext=''
21673 for xxx in $known_extensions ; do
21674         case "$xxx" in
21675         DB_File|db_file)
21676                 case "$i_db" in
21677                 $define) avail_ext="$avail_ext $xxx" ;;
21678                 esac
21679                 ;;
21680         GDBM_File|gdbm_fil)
21681                 case "$i_gdbm" in
21682                 $define) avail_ext="$avail_ext $xxx" ;;
21683                 esac
21684                 ;;
21685         I18N/Langinfo|i18n_lan)
21686                 case "$i_langinfo$d_nl_langinfo" in
21687                 $define$define) avail_ext="$avail_ext $xxx" ;;
21688                 esac
21689                 ;;
21690         IPC/SysV|ipc/sysv)
21691                 : XXX Do we need a useipcsysv variable here
21692                 case "${d_msg}${d_sem}${d_shm}" in
21693                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21694                 esac
21695                 ;;
21696         NDBM_File|ndbm_fil)
21697                 case "$i_ndbm" in
21698                 $define)
21699                     case "$osname-$use64bitint" in
21700                     hpux-define)
21701                         case "$libs" in
21702                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21703                         esac
21704                         ;;
21705                     *) avail_ext="$avail_ext $xxx" ;;
21706                     esac
21707                     ;;
21708                 esac
21709                 ;;
21710         ODBM_File|odbm_fil)
21711                 case "${i_dbm}${i_rpcsvcdbm}" in
21712                 *"${define}"*)
21713                     case "$d_cplusplus" in
21714                     define) ;; # delete as a function name will not work
21715                     *)  case "$osname-$use64bitint" in
21716                         hpux-define)
21717                             case "$libs" in
21718                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21719                             esac
21720                             ;;
21721                         *) avail_ext="$avail_ext $xxx" ;;
21722                         esac
21723                         ;;
21724                     esac
21725                     ;;
21726                 esac
21727                 ;;
21728         Opcode|opcode)
21729                 case "$useopcode" in
21730                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21731                 esac
21732                 ;;
21733         POSIX|posix)
21734                 case "$useposix" in
21735                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21736                 esac
21737                 ;;
21738         Socket|socket)
21739                 case "$d_socket" in
21740                 true|$define|y)
21741                     case "$osname" in
21742                     beos) ;; # not unless BONE
21743                     *) avail_ext="$avail_ext $xxx" ;;
21744                     esac
21745                     ;;
21746                 esac
21747                 ;;
21748         Sys/Syslog|sys/syslog)
21749                 : XXX syslog requires socket
21750                 case "$d_socket" in
21751                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21752                 esac
21753                 ;;
21754         Thread|thread)
21755                 case "$usethreads" in
21756                 true|$define|y)
21757                         case "$use5005threads" in
21758                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21759                         esac
21760                 esac
21761                 ;;
21762         threads|threads/shared)
21763                 # threads and threads::shared are special cases.
21764                 # To stop people from asking "Perl 5.8.0 was supposed
21765                 # to have this new fancy threads implementation but my
21766                 # perl doesn't have it" and from people trying to
21767                 # (re)install the threads module using CPAN.pm and
21768                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21769                 # the threads.pm and threads/shared.pm will always be
21770                 # there, croaking informatively ("you need to rebuild
21771                 # all of Perl with threads, sorry") when threads haven't
21772                 # been compiled in.
21773                 # --jhi
21774                 avail_ext="$avail_ext $xxx"
21775                 ;;
21776         VMS*)
21777                 ;;
21778         Win32*)
21779                 case "$osname" in
21780                 cygwin) avail_ext="$avail_ext $xxx" ;;
21781                 esac
21782                 ;;
21783         XS/APItest|xs/apitest)
21784                 # This is just for testing.  Skip it unless we have dynamic loading.
21785
21786                 case "$usedl" in
21787                 $define) avail_ext="$avail_ext $xxx" ;;
21788                 esac
21789                 ;;
21790         XS/Typemap|xs/typemap)
21791                 # This is just for testing.  Skip it unless we have dynamic loading.
21792                 case "$usedl" in
21793                 $define) avail_ext="$avail_ext $xxx" ;;
21794                 esac
21795                 ;;
21796         *)      avail_ext="$avail_ext $xxx"
21797                 ;;
21798         esac
21799 done
21800
21801 set X $avail_ext
21802 shift
21803 avail_ext="$*"
21804
21805 case "$onlyextensions" in
21806 '') ;;
21807 *)  keepextensions=''
21808     echo "You have requested that only certains extensions be included..." >&4
21809     for i in $onlyextensions; do
21810         case " $avail_ext " in
21811         *" $i "*)
21812             echo "Keeping extension $i."
21813             keepextensions="$keepextensions $i"
21814             ;;
21815         *) echo "Ignoring extension $i." ;;
21816         esac
21817     done
21818     avail_ext="$keepextensions"
21819     ;;
21820 esac
21821
21822 case "$noextensions" in
21823 '') ;;
21824 *)  keepextensions=''
21825     echo "You have requested that certain extensions be ignored..." >&4
21826     for i in $avail_ext; do
21827         case " $noextensions " in
21828         *" $i "*) echo "Ignoring extension $i." ;;
21829         *) echo "Keeping extension $i.";
21830            keepextensions="$keepextensions $i"
21831            ;;
21832         esac
21833     done
21834     avail_ext="$keepextensions"
21835     ;;
21836 esac
21837
21838 : Now see which nonxs extensions are supported on this system.
21839 : For now assume all are.
21840 nonxs_ext=''
21841 for xxx in $nonxs_extensions ; do
21842         case "$xxx" in
21843         *)      nonxs_ext="$nonxs_ext $xxx"
21844                 ;;
21845         esac
21846 done
21847
21848 set X $nonxs_ext
21849 shift
21850 nonxs_ext="$*"
21851
21852 case $usedl in
21853 $define)
21854         $cat <<EOM
21855 A number of extensions are supplied with $package.  You may choose to
21856 compile these extensions for dynamic loading (the default), compile
21857 them into the $package executable (static loading), or not include
21858 them at all.  Answer "none" to include no extensions.
21859 Note that DynaLoader is always built and need not be mentioned here.
21860
21861 EOM
21862         case "$dynamic_ext" in
21863         '')
21864                 : Exclude those listed in static_ext
21865                 dflt=''
21866                 for xxx in $avail_ext; do
21867                         case " $static_ext " in
21868                         *" $xxx "*) ;;
21869                         *) dflt="$dflt $xxx" ;;
21870                         esac
21871                 done
21872                 set X $dflt
21873                 shift
21874                 dflt="$*"
21875                 ;;
21876         *)      dflt="$dynamic_ext"
21877                 # Perhaps we are reusing an old out-of-date config.sh.
21878                 case "$hint" in
21879                 previous)
21880                         if test X"$dynamic_ext" != X"$avail_ext"; then
21881                                 $cat <<EOM
21882 NOTICE:  Your previous config.sh list may be incorrect.
21883 The extensions now available to you are
21884         ${avail_ext}
21885 but the default list from your previous config.sh is
21886         ${dynamic_ext}
21887
21888 EOM
21889                         fi
21890                         ;;
21891                 esac
21892                 ;;
21893         esac
21894         case "$dflt" in
21895         '')     dflt=none;;
21896         esac
21897         rp="What extensions do you wish to load dynamically?"
21898         . ./myread
21899         case "$ans" in
21900         none) dynamic_ext=' ' ;;
21901         *) dynamic_ext="$ans" ;;
21902         esac
21903
21904         case "$static_ext" in
21905         '')
21906                 : Exclude those already listed in dynamic linking
21907                 dflt=''
21908                 for xxx in $avail_ext; do
21909                         case " $dynamic_ext " in
21910                         *" $xxx "*) ;;
21911                         *) dflt="$dflt $xxx" ;;
21912                         esac
21913                 done
21914                 set X $dflt
21915                 shift
21916                 dflt="$*"
21917                 ;;
21918         *)  dflt="$static_ext"
21919                 ;;
21920         esac
21921
21922         case "$dflt" in
21923         '')     dflt=none;;
21924         esac
21925         rp="What extensions do you wish to load statically?"
21926         . ./myread
21927         case "$ans" in
21928         none) static_ext=' ' ;;
21929         *) static_ext="$ans" ;;
21930         esac
21931         ;;
21932 *)
21933         $cat <<EOM
21934 A number of extensions are supplied with $package.  Answer "none"
21935 to include no extensions.
21936 Note that DynaLoader is always built and need not be mentioned here.
21937
21938 EOM
21939         case "$static_ext" in
21940         '') dflt="$avail_ext" ;;
21941         *)      dflt="$static_ext"
21942                 # Perhaps we are reusing an old out-of-date config.sh.
21943                 case "$hint" in
21944                 previous)
21945                         if test X"$static_ext" != X"$avail_ext"; then
21946                                 $cat <<EOM
21947 NOTICE:  Your previous config.sh list may be incorrect.
21948 The extensions now available to you are
21949         ${avail_ext}
21950 but the default list from your previous config.sh is
21951         ${static_ext}
21952
21953 EOM
21954                         fi
21955                         ;;
21956                 esac
21957                 ;;
21958         esac
21959         : Exclude those that are not xs extensions
21960         case "$dflt" in
21961         '')     dflt=none;;
21962         esac
21963         rp="What extensions do you wish to include?"
21964         . ./myread
21965         case "$ans" in
21966         none) static_ext=' ' ;;
21967         *) static_ext="$ans" ;;
21968         esac
21969         ;;
21970 esac
21971 #
21972 # Encode is a special case.  If we are building Encode as a static
21973 # extension, we need to explicitly list its subextensions as well.
21974 # For other nested extensions, this is handled automatically by
21975 # the appropriate Makefile.PL.
21976 case " $static_ext " in
21977         *" Encode "*) # Add the subextensions of Encode
21978         cd "$rsrc/ext"
21979         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21980                 static_ext="$static_ext Encode/$xxx"
21981         done
21982         cd "$tdir"
21983         ;;
21984 esac
21985
21986 set X $dynamic_ext $static_ext $nonxs_ext
21987 shift
21988 extensions="$*"
21989
21990 # Sanity check:  We require an extension suitable for use with
21991 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21992 # should show up as failures in the test suite, but it's helpful to
21993 # catch them now.) The 'extensions' list is normally sorted
21994 # alphabetically, so we need to accept either
21995 #    DB_File ... Fcntl ... IO  ....
21996 # or something like
21997 #    Fcntl ... NDBM_File ... IO  ....
21998 case " $extensions"  in
21999 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22000 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22001 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22002 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22003    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22004    ;;
22005 esac
22006
22007 : Remove libraries needed only for extensions
22008 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22009 : The exception is SunOS 4.x, which needs them.
22010 case "${osname}X${osvers}" in
22011 sunos*X4*)
22012     perllibs="$libs"
22013     ;;
22014 *) case "$usedl" in
22015     $define|true|[yY]*)
22016             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22017             shift
22018             perllibs="$*"
22019             ;;
22020     *)  perllibs="$libs"
22021             ;;
22022     esac
22023     ;;
22024 esac
22025
22026 : Remove build directory name from cppstdin so it can be used from
22027 : either the present location or the final installed location.
22028 echo " "
22029 : Get out of the UU directory to get correct path name.
22030 cd ..
22031 case "$cppstdin" in
22032 `pwd`/cppstdin)
22033         echo "Stripping down cppstdin path name"
22034         cppstdin=cppstdin
22035         ;;
22036 esac
22037 cd UU
22038
22039 : end of configuration questions
22040 echo " "
22041 echo "End of configuration questions."
22042 echo " "
22043
22044 : back to where it started
22045 if test -d ../UU; then
22046         cd ..
22047 fi
22048
22049 : configuration may be unconditionally patched via a 'config.arch' file
22050 if $test -f config.arch; then
22051         echo "I see a config.arch file, loading it." >&4
22052         . ./config.arch
22053 fi
22054
22055 : configuration may be patched via a 'config.over' file
22056 if $test -f config.over; then
22057         echo " "
22058         dflt=y
22059         rp='I see a config.over file.  Do you wish to load it?'
22060         . UU/myread
22061         case "$ans" in
22062         n*) echo "OK, I'll ignore it.";;
22063         *)      . ./config.over
22064                 echo "Configuration override changes have been loaded."
22065                 ;;
22066         esac
22067 fi
22068
22069 : in case they want portability, strip down executable paths
22070 case "$d_portable" in
22071 "$define")
22072         echo " "
22073         echo "Stripping down executable paths..." >&4
22074         for file in $loclist $trylist; do
22075                 eval temp=\$$file
22076                 eval $file=`basename $temp`
22077         done
22078         ;;
22079 esac
22080
22081 : create config.sh file
22082 echo " "
22083 echo "Creating config.sh..." >&4
22084 $spitshell <<EOT >config.sh
22085 $startsh
22086 #
22087 # This file was produced by running the Configure script. It holds all the
22088 # definitions figured out by Configure. Should you modify one of these values,
22089 # do not forget to propagate your changes by running "Configure -der". You may
22090 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22091 #
22092
22093 # Package name      : $package
22094 # Source directory  : $src
22095 # Configuration time: $cf_time
22096 # Configured by     : $cf_by
22097 # Target system     : $myuname
22098
22099 EOT
22100 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22101 $spitshell <<EOT >>config.sh
22102
22103 Author='$Author'
22104 Date='$Date'
22105 Header='$Header'
22106 Id='$Id'
22107 Locker='$Locker'
22108 Log='$Log'
22109 RCSfile='$RCSfile'
22110 Revision='$Revision'
22111 Source='$Source'
22112 State='$State'
22113 _a='$_a'
22114 _exe='$_exe'
22115 _o='$_o'
22116 afs='$afs'
22117 afsroot='$afsroot'
22118 alignbytes='$alignbytes'
22119 ansi2knr='$ansi2knr'
22120 aphostname='$aphostname'
22121 api_revision='$api_revision'
22122 api_subversion='$api_subversion'
22123 api_version='$api_version'
22124 api_versionstring='$api_versionstring'
22125 ar='$ar'
22126 archlib='$archlib'
22127 archlibexp='$archlibexp'
22128 archname64='$archname64'
22129 archname='$archname'
22130 archobjs='$archobjs'
22131 asctime_r_proto='$asctime_r_proto'
22132 awk='$awk'
22133 baserev='$baserev'
22134 bash='$bash'
22135 bin='$bin'
22136 binexp='$binexp'
22137 bison='$bison'
22138 byacc='$byacc'
22139 byteorder='$byteorder'
22140 c='$c'
22141 castflags='$castflags'
22142 cat='$cat'
22143 cc='$cc'
22144 cccdlflags='$cccdlflags'
22145 ccdlflags='$ccdlflags'
22146 ccflags='$ccflags'
22147 ccflags_uselargefiles='$ccflags_uselargefiles'
22148 ccname='$ccname'
22149 ccsymbols='$ccsymbols'
22150 ccversion='$ccversion'
22151 cf_by='$cf_by'
22152 cf_email='$cf_email'
22153 cf_time='$cf_time'
22154 chgrp='$chgrp'
22155 chmod='$chmod'
22156 chown='$chown'
22157 clocktype='$clocktype'
22158 comm='$comm'
22159 compress='$compress'
22160 contains='$contains'
22161 cp='$cp'
22162 cpio='$cpio'
22163 cpp='$cpp'
22164 cpp_stuff='$cpp_stuff'
22165 cppccsymbols='$cppccsymbols'
22166 cppflags='$cppflags'
22167 cpplast='$cpplast'
22168 cppminus='$cppminus'
22169 cpprun='$cpprun'
22170 cppstdin='$cppstdin'
22171 cppsymbols='$cppsymbols'
22172 crypt_r_proto='$crypt_r_proto'
22173 cryptlib='$cryptlib'
22174 csh='$csh'
22175 ctermid_r_proto='$ctermid_r_proto'
22176 ctime_r_proto='$ctime_r_proto'
22177 d_Gconvert='$d_Gconvert'
22178 d_PRIEUldbl='$d_PRIEUldbl'
22179 d_PRIFUldbl='$d_PRIFUldbl'
22180 d_PRIGUldbl='$d_PRIGUldbl'
22181 d_PRIXU64='$d_PRIXU64'
22182 d_PRId64='$d_PRId64'
22183 d_PRIeldbl='$d_PRIeldbl'
22184 d_PRIfldbl='$d_PRIfldbl'
22185 d_PRIgldbl='$d_PRIgldbl'
22186 d_PRIi64='$d_PRIi64'
22187 d_PRIo64='$d_PRIo64'
22188 d_PRIu64='$d_PRIu64'
22189 d_PRIx64='$d_PRIx64'
22190 d_SCNfldbl='$d_SCNfldbl'
22191 d__fwalk='$d__fwalk'
22192 d_access='$d_access'
22193 d_accessx='$d_accessx'
22194 d_aintl='$d_aintl'
22195 d_alarm='$d_alarm'
22196 d_archlib='$d_archlib'
22197 d_asctime64='$d_asctime64'
22198 d_asctime_r='$d_asctime_r'
22199 d_atolf='$d_atolf'
22200 d_atoll='$d_atoll'
22201 d_attribute_deprecated='$d_attribute_deprecated'
22202 d_attribute_format='$d_attribute_format'
22203 d_attribute_malloc='$d_attribute_malloc'
22204 d_attribute_nonnull='$d_attribute_nonnull'
22205 d_attribute_noreturn='$d_attribute_noreturn'
22206 d_attribute_pure='$d_attribute_pure'
22207 d_attribute_unused='$d_attribute_unused'
22208 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22209 d_bcmp='$d_bcmp'
22210 d_bcopy='$d_bcopy'
22211 d_bsd='$d_bsd'
22212 d_bsdgetpgrp='$d_bsdgetpgrp'
22213 d_bsdsetpgrp='$d_bsdsetpgrp'
22214 d_builtin_choose_expr='$d_builtin_choose_expr'
22215 d_builtin_expect='$d_builtin_expect'
22216 d_bzero='$d_bzero'
22217 d_c99_variadic_macros='$d_c99_variadic_macros'
22218 d_casti32='$d_casti32'
22219 d_castneg='$d_castneg'
22220 d_charvspr='$d_charvspr'
22221 d_chown='$d_chown'
22222 d_chroot='$d_chroot'
22223 d_chsize='$d_chsize'
22224 d_class='$d_class'
22225 d_clearenv='$d_clearenv'
22226 d_closedir='$d_closedir'
22227 d_cmsghdr_s='$d_cmsghdr_s'
22228 d_const='$d_const'
22229 d_copysignl='$d_copysignl'
22230 d_cplusplus='$d_cplusplus'
22231 d_crypt='$d_crypt'
22232 d_crypt_r='$d_crypt_r'
22233 d_csh='$d_csh'
22234 d_ctermid='$d_ctermid'
22235 d_ctermid_r='$d_ctermid_r'
22236 d_ctime64='$d_ctime64'
22237 d_ctime_r='$d_ctime_r'
22238 d_cuserid='$d_cuserid'
22239 d_dbl_dig='$d_dbl_dig'
22240 d_dbminitproto='$d_dbminitproto'
22241 d_difftime64='$d_difftime64'
22242 d_difftime='$d_difftime'
22243 d_dir_dd_fd='$d_dir_dd_fd'
22244 d_dirfd='$d_dirfd'
22245 d_dirnamlen='$d_dirnamlen'
22246 d_dlerror='$d_dlerror'
22247 d_dlopen='$d_dlopen'
22248 d_dlsymun='$d_dlsymun'
22249 d_dosuid='$d_dosuid'
22250 d_drand48_r='$d_drand48_r'
22251 d_drand48proto='$d_drand48proto'
22252 d_dup2='$d_dup2'
22253 d_eaccess='$d_eaccess'
22254 d_endgrent='$d_endgrent'
22255 d_endgrent_r='$d_endgrent_r'
22256 d_endhent='$d_endhent'
22257 d_endhostent_r='$d_endhostent_r'
22258 d_endnent='$d_endnent'
22259 d_endnetent_r='$d_endnetent_r'
22260 d_endpent='$d_endpent'
22261 d_endprotoent_r='$d_endprotoent_r'
22262 d_endpwent='$d_endpwent'
22263 d_endpwent_r='$d_endpwent_r'
22264 d_endsent='$d_endsent'
22265 d_endservent_r='$d_endservent_r'
22266 d_eofnblk='$d_eofnblk'
22267 d_eunice='$d_eunice'
22268 d_faststdio='$d_faststdio'
22269 d_fchdir='$d_fchdir'
22270 d_fchmod='$d_fchmod'
22271 d_fchown='$d_fchown'
22272 d_fcntl='$d_fcntl'
22273 d_fcntl_can_lock='$d_fcntl_can_lock'
22274 d_fd_macros='$d_fd_macros'
22275 d_fd_set='$d_fd_set'
22276 d_fds_bits='$d_fds_bits'
22277 d_fgetpos='$d_fgetpos'
22278 d_finite='$d_finite'
22279 d_finitel='$d_finitel'
22280 d_flexfnam='$d_flexfnam'
22281 d_flock='$d_flock'
22282 d_flockproto='$d_flockproto'
22283 d_fork='$d_fork'
22284 d_fp_class='$d_fp_class'
22285 d_fpathconf='$d_fpathconf'
22286 d_fpclass='$d_fpclass'
22287 d_fpclassify='$d_fpclassify'
22288 d_fpclassl='$d_fpclassl'
22289 d_fpos64_t='$d_fpos64_t'
22290 d_frexpl='$d_frexpl'
22291 d_fs_data_s='$d_fs_data_s'
22292 d_fseeko='$d_fseeko'
22293 d_fsetpos='$d_fsetpos'
22294 d_fstatfs='$d_fstatfs'
22295 d_fstatvfs='$d_fstatvfs'
22296 d_fsync='$d_fsync'
22297 d_ftello='$d_ftello'
22298 d_ftime='$d_ftime'
22299 d_futimes='$d_futimes'
22300 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22301 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22302 d_getcwd='$d_getcwd'
22303 d_getespwnam='$d_getespwnam'
22304 d_getfsstat='$d_getfsstat'
22305 d_getgrent='$d_getgrent'
22306 d_getgrent_r='$d_getgrent_r'
22307 d_getgrgid_r='$d_getgrgid_r'
22308 d_getgrnam_r='$d_getgrnam_r'
22309 d_getgrps='$d_getgrps'
22310 d_gethbyaddr='$d_gethbyaddr'
22311 d_gethbyname='$d_gethbyname'
22312 d_gethent='$d_gethent'
22313 d_gethname='$d_gethname'
22314 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22315 d_gethostbyname_r='$d_gethostbyname_r'
22316 d_gethostent_r='$d_gethostent_r'
22317 d_gethostprotos='$d_gethostprotos'
22318 d_getitimer='$d_getitimer'
22319 d_getlogin='$d_getlogin'
22320 d_getlogin_r='$d_getlogin_r'
22321 d_getmnt='$d_getmnt'
22322 d_getmntent='$d_getmntent'
22323 d_getnbyaddr='$d_getnbyaddr'
22324 d_getnbyname='$d_getnbyname'
22325 d_getnent='$d_getnent'
22326 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22327 d_getnetbyname_r='$d_getnetbyname_r'
22328 d_getnetent_r='$d_getnetent_r'
22329 d_getnetprotos='$d_getnetprotos'
22330 d_getpagsz='$d_getpagsz'
22331 d_getpbyname='$d_getpbyname'
22332 d_getpbynumber='$d_getpbynumber'
22333 d_getpent='$d_getpent'
22334 d_getpgid='$d_getpgid'
22335 d_getpgrp2='$d_getpgrp2'
22336 d_getpgrp='$d_getpgrp'
22337 d_getppid='$d_getppid'
22338 d_getprior='$d_getprior'
22339 d_getprotobyname_r='$d_getprotobyname_r'
22340 d_getprotobynumber_r='$d_getprotobynumber_r'
22341 d_getprotoent_r='$d_getprotoent_r'
22342 d_getprotoprotos='$d_getprotoprotos'
22343 d_getprpwnam='$d_getprpwnam'
22344 d_getpwent='$d_getpwent'
22345 d_getpwent_r='$d_getpwent_r'
22346 d_getpwnam_r='$d_getpwnam_r'
22347 d_getpwuid_r='$d_getpwuid_r'
22348 d_getsbyname='$d_getsbyname'
22349 d_getsbyport='$d_getsbyport'
22350 d_getsent='$d_getsent'
22351 d_getservbyname_r='$d_getservbyname_r'
22352 d_getservbyport_r='$d_getservbyport_r'
22353 d_getservent_r='$d_getservent_r'
22354 d_getservprotos='$d_getservprotos'
22355 d_getspnam='$d_getspnam'
22356 d_getspnam_r='$d_getspnam_r'
22357 d_gettimeod='$d_gettimeod'
22358 d_gmtime64='$d_gmtime64'
22359 d_gmtime_r='$d_gmtime_r'
22360 d_gnulibc='$d_gnulibc'
22361 d_grpasswd='$d_grpasswd'
22362 d_hasmntopt='$d_hasmntopt'
22363 d_htonl='$d_htonl'
22364 d_ilogbl='$d_ilogbl'
22365 d_inc_version_list='$d_inc_version_list'
22366 d_index='$d_index'
22367 d_inetaton='$d_inetaton'
22368 d_int64_t='$d_int64_t'
22369 d_isascii='$d_isascii'
22370 d_isfinite='$d_isfinite'
22371 d_isinf='$d_isinf'
22372 d_isnan='$d_isnan'
22373 d_isnanl='$d_isnanl'
22374 d_killpg='$d_killpg'
22375 d_lchown='$d_lchown'
22376 d_ldbl_dig='$d_ldbl_dig'
22377 d_libm_lib_version='$d_libm_lib_version'
22378 d_link='$d_link'
22379 d_localtime64='$d_localtime64'
22380 d_localtime_r='$d_localtime_r'
22381 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22382 d_locconv='$d_locconv'
22383 d_lockf='$d_lockf'
22384 d_longdbl='$d_longdbl'
22385 d_longlong='$d_longlong'
22386 d_lseekproto='$d_lseekproto'
22387 d_lstat='$d_lstat'
22388 d_madvise='$d_madvise'
22389 d_malloc_good_size='$d_malloc_good_size'
22390 d_malloc_size='$d_malloc_size'
22391 d_mblen='$d_mblen'
22392 d_mbstowcs='$d_mbstowcs'
22393 d_mbtowc='$d_mbtowc'
22394 d_memchr='$d_memchr'
22395 d_memcmp='$d_memcmp'
22396 d_memcpy='$d_memcpy'
22397 d_memmove='$d_memmove'
22398 d_memset='$d_memset'
22399 d_mkdir='$d_mkdir'
22400 d_mkdtemp='$d_mkdtemp'
22401 d_mkfifo='$d_mkfifo'
22402 d_mkstemp='$d_mkstemp'
22403 d_mkstemps='$d_mkstemps'
22404 d_mktime64='$d_mktime64'
22405 d_mktime='$d_mktime'
22406 d_mmap='$d_mmap'
22407 d_modfl='$d_modfl'
22408 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22409 d_modflproto='$d_modflproto'
22410 d_mprotect='$d_mprotect'
22411 d_msg='$d_msg'
22412 d_msg_ctrunc='$d_msg_ctrunc'
22413 d_msg_dontroute='$d_msg_dontroute'
22414 d_msg_oob='$d_msg_oob'
22415 d_msg_peek='$d_msg_peek'
22416 d_msg_proxy='$d_msg_proxy'
22417 d_msgctl='$d_msgctl'
22418 d_msgget='$d_msgget'
22419 d_msghdr_s='$d_msghdr_s'
22420 d_msgrcv='$d_msgrcv'
22421 d_msgsnd='$d_msgsnd'
22422 d_msync='$d_msync'
22423 d_munmap='$d_munmap'
22424 d_mymalloc='$d_mymalloc'
22425 d_ndbm='$d_ndbm'
22426 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22427 d_nice='$d_nice'
22428 d_nl_langinfo='$d_nl_langinfo'
22429 d_nv_preserves_uv='$d_nv_preserves_uv'
22430 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22431 d_off64_t='$d_off64_t'
22432 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22433 d_oldpthreads='$d_oldpthreads'
22434 d_oldsock='$d_oldsock'
22435 d_open3='$d_open3'
22436 d_pathconf='$d_pathconf'
22437 d_pause='$d_pause'
22438 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22439 d_phostname='$d_phostname'
22440 d_pipe='$d_pipe'
22441 d_poll='$d_poll'
22442 d_portable='$d_portable'
22443 d_printf_format_null='$d_printf_format_null'
22444 d_procselfexe='$d_procselfexe'
22445 d_pseudofork='$d_pseudofork'
22446 d_pthread_atfork='$d_pthread_atfork'
22447 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22448 d_pthread_yield='$d_pthread_yield'
22449 d_pwage='$d_pwage'
22450 d_pwchange='$d_pwchange'
22451 d_pwclass='$d_pwclass'
22452 d_pwcomment='$d_pwcomment'
22453 d_pwexpire='$d_pwexpire'
22454 d_pwgecos='$d_pwgecos'
22455 d_pwpasswd='$d_pwpasswd'
22456 d_pwquota='$d_pwquota'
22457 d_qgcvt='$d_qgcvt'
22458 d_quad='$d_quad'
22459 d_random_r='$d_random_r'
22460 d_readdir64_r='$d_readdir64_r'
22461 d_readdir='$d_readdir'
22462 d_readdir_r='$d_readdir_r'
22463 d_readlink='$d_readlink'
22464 d_readv='$d_readv'
22465 d_recvmsg='$d_recvmsg'
22466 d_rename='$d_rename'
22467 d_rewinddir='$d_rewinddir'
22468 d_rmdir='$d_rmdir'
22469 d_safebcpy='$d_safebcpy'
22470 d_safemcpy='$d_safemcpy'
22471 d_sanemcmp='$d_sanemcmp'
22472 d_sbrkproto='$d_sbrkproto'
22473 d_scalbnl='$d_scalbnl'
22474 d_sched_yield='$d_sched_yield'
22475 d_scm_rights='$d_scm_rights'
22476 d_seekdir='$d_seekdir'
22477 d_select='$d_select'
22478 d_sem='$d_sem'
22479 d_semctl='$d_semctl'
22480 d_semctl_semid_ds='$d_semctl_semid_ds'
22481 d_semctl_semun='$d_semctl_semun'
22482 d_semget='$d_semget'
22483 d_semop='$d_semop'
22484 d_sendmsg='$d_sendmsg'
22485 d_setegid='$d_setegid'
22486 d_seteuid='$d_seteuid'
22487 d_setgrent='$d_setgrent'
22488 d_setgrent_r='$d_setgrent_r'
22489 d_setgrps='$d_setgrps'
22490 d_sethent='$d_sethent'
22491 d_sethostent_r='$d_sethostent_r'
22492 d_setitimer='$d_setitimer'
22493 d_setlinebuf='$d_setlinebuf'
22494 d_setlocale='$d_setlocale'
22495 d_setlocale_r='$d_setlocale_r'
22496 d_setnent='$d_setnent'
22497 d_setnetent_r='$d_setnetent_r'
22498 d_setpent='$d_setpent'
22499 d_setpgid='$d_setpgid'
22500 d_setpgrp2='$d_setpgrp2'
22501 d_setpgrp='$d_setpgrp'
22502 d_setprior='$d_setprior'
22503 d_setproctitle='$d_setproctitle'
22504 d_setprotoent_r='$d_setprotoent_r'
22505 d_setpwent='$d_setpwent'
22506 d_setpwent_r='$d_setpwent_r'
22507 d_setregid='$d_setregid'
22508 d_setresgid='$d_setresgid'
22509 d_setresuid='$d_setresuid'
22510 d_setreuid='$d_setreuid'
22511 d_setrgid='$d_setrgid'
22512 d_setruid='$d_setruid'
22513 d_setsent='$d_setsent'
22514 d_setservent_r='$d_setservent_r'
22515 d_setsid='$d_setsid'
22516 d_setvbuf='$d_setvbuf'
22517 d_sfio='$d_sfio'
22518 d_shm='$d_shm'
22519 d_shmat='$d_shmat'
22520 d_shmatprototype='$d_shmatprototype'
22521 d_shmctl='$d_shmctl'
22522 d_shmdt='$d_shmdt'
22523 d_shmget='$d_shmget'
22524 d_sigaction='$d_sigaction'
22525 d_signbit='$d_signbit'
22526 d_sigprocmask='$d_sigprocmask'
22527 d_sigsetjmp='$d_sigsetjmp'
22528 d_sitearch='$d_sitearch'
22529 d_snprintf='$d_snprintf'
22530 d_sockatmark='$d_sockatmark'
22531 d_sockatmarkproto='$d_sockatmarkproto'
22532 d_socket='$d_socket'
22533 d_socklen_t='$d_socklen_t'
22534 d_sockpair='$d_sockpair'
22535 d_socks5_init='$d_socks5_init'
22536 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22537 d_sqrtl='$d_sqrtl'
22538 d_srand48_r='$d_srand48_r'
22539 d_srandom_r='$d_srandom_r'
22540 d_sresgproto='$d_sresgproto'
22541 d_sresuproto='$d_sresuproto'
22542 d_statblks='$d_statblks'
22543 d_statfs_f_flags='$d_statfs_f_flags'
22544 d_statfs_s='$d_statfs_s'
22545 d_statvfs='$d_statvfs'
22546 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22547 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22548 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22549 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22550 d_stdio_stream_array='$d_stdio_stream_array'
22551 d_stdiobase='$d_stdiobase'
22552 d_stdstdio='$d_stdstdio'
22553 d_strchr='$d_strchr'
22554 d_strcoll='$d_strcoll'
22555 d_strctcpy='$d_strctcpy'
22556 d_strerrm='$d_strerrm'
22557 d_strerror='$d_strerror'
22558 d_strerror_r='$d_strerror_r'
22559 d_strftime='$d_strftime'
22560 d_strlcat='$d_strlcat'
22561 d_strlcpy='$d_strlcpy'
22562 d_strtod='$d_strtod'
22563 d_strtol='$d_strtol'
22564 d_strtold='$d_strtold'
22565 d_strtoll='$d_strtoll'
22566 d_strtoq='$d_strtoq'
22567 d_strtoul='$d_strtoul'
22568 d_strtoull='$d_strtoull'
22569 d_strtouq='$d_strtouq'
22570 d_strxfrm='$d_strxfrm'
22571 d_suidsafe='$d_suidsafe'
22572 d_symlink='$d_symlink'
22573 d_syscall='$d_syscall'
22574 d_syscallproto='$d_syscallproto'
22575 d_sysconf='$d_sysconf'
22576 d_sysernlst='$d_sysernlst'
22577 d_syserrlst='$d_syserrlst'
22578 d_system='$d_system'
22579 d_tcgetpgrp='$d_tcgetpgrp'
22580 d_tcsetpgrp='$d_tcsetpgrp'
22581 d_telldir='$d_telldir'
22582 d_telldirproto='$d_telldirproto'
22583 d_time='$d_time'
22584 d_timegm='$d_timegm'
22585 d_times='$d_times'
22586 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22587 d_tm_tm_zone='$d_tm_tm_zone'
22588 d_tmpnam_r='$d_tmpnam_r'
22589 d_truncate='$d_truncate'
22590 d_ttyname_r='$d_ttyname_r'
22591 d_tzname='$d_tzname'
22592 d_u32align='$d_u32align'
22593 d_ualarm='$d_ualarm'
22594 d_umask='$d_umask'
22595 d_uname='$d_uname'
22596 d_union_semun='$d_union_semun'
22597 d_unordered='$d_unordered'
22598 d_unsetenv='$d_unsetenv'
22599 d_usleep='$d_usleep'
22600 d_usleepproto='$d_usleepproto'
22601 d_ustat='$d_ustat'
22602 d_vendorarch='$d_vendorarch'
22603 d_vendorbin='$d_vendorbin'
22604 d_vendorlib='$d_vendorlib'
22605 d_vendorscript='$d_vendorscript'
22606 d_vfork='$d_vfork'
22607 d_void_closedir='$d_void_closedir'
22608 d_voidsig='$d_voidsig'
22609 d_voidtty='$d_voidtty'
22610 d_volatile='$d_volatile'
22611 d_vprintf='$d_vprintf'
22612 d_vsnprintf='$d_vsnprintf'
22613 d_wait4='$d_wait4'
22614 d_waitpid='$d_waitpid'
22615 d_wcstombs='$d_wcstombs'
22616 d_wctomb='$d_wctomb'
22617 d_writev='$d_writev'
22618 d_xenix='$d_xenix'
22619 date='$date'
22620 db_hashtype='$db_hashtype'
22621 db_prefixtype='$db_prefixtype'
22622 db_version_major='$db_version_major'
22623 db_version_minor='$db_version_minor'
22624 db_version_patch='$db_version_patch'
22625 defvoidused='$defvoidused'
22626 direntrytype='$direntrytype'
22627 dlext='$dlext'
22628 dlsrc='$dlsrc'
22629 doublesize='$doublesize'
22630 drand01='$drand01'
22631 drand48_r_proto='$drand48_r_proto'
22632 dtrace='$dtrace'
22633 dynamic_ext='$dynamic_ext'
22634 eagain='$eagain'
22635 ebcdic='$ebcdic'
22636 echo='$echo'
22637 egrep='$egrep'
22638 emacs='$emacs'
22639 endgrent_r_proto='$endgrent_r_proto'
22640 endhostent_r_proto='$endhostent_r_proto'
22641 endnetent_r_proto='$endnetent_r_proto'
22642 endprotoent_r_proto='$endprotoent_r_proto'
22643 endpwent_r_proto='$endpwent_r_proto'
22644 endservent_r_proto='$endservent_r_proto'
22645 eunicefix='$eunicefix'
22646 exe_ext='$exe_ext'
22647 expr='$expr'
22648 extensions='$extensions'
22649 extern_C='$extern_C'
22650 extras='$extras'
22651 fflushNULL='$fflushNULL'
22652 fflushall='$fflushall'
22653 find='$find'
22654 firstmakefile='$firstmakefile'
22655 flex='$flex'
22656 fpossize='$fpossize'
22657 fpostype='$fpostype'
22658 freetype='$freetype'
22659 from='$from'
22660 full_ar='$full_ar'
22661 full_csh='$full_csh'
22662 full_sed='$full_sed'
22663 gccansipedantic='$gccansipedantic'
22664 gccosandvers='$gccosandvers'
22665 gccversion='$gccversion'
22666 getgrent_r_proto='$getgrent_r_proto'
22667 getgrgid_r_proto='$getgrgid_r_proto'
22668 getgrnam_r_proto='$getgrnam_r_proto'
22669 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22670 gethostbyname_r_proto='$gethostbyname_r_proto'
22671 gethostent_r_proto='$gethostent_r_proto'
22672 getlogin_r_proto='$getlogin_r_proto'
22673 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22674 getnetbyname_r_proto='$getnetbyname_r_proto'
22675 getnetent_r_proto='$getnetent_r_proto'
22676 getprotobyname_r_proto='$getprotobyname_r_proto'
22677 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22678 getprotoent_r_proto='$getprotoent_r_proto'
22679 getpwent_r_proto='$getpwent_r_proto'
22680 getpwnam_r_proto='$getpwnam_r_proto'
22681 getpwuid_r_proto='$getpwuid_r_proto'
22682 getservbyname_r_proto='$getservbyname_r_proto'
22683 getservbyport_r_proto='$getservbyport_r_proto'
22684 getservent_r_proto='$getservent_r_proto'
22685 getspnam_r_proto='$getspnam_r_proto'
22686 gidformat='$gidformat'
22687 gidsign='$gidsign'
22688 gidsize='$gidsize'
22689 gidtype='$gidtype'
22690 glibpth='$glibpth'
22691 gmake='$gmake'
22692 gmtime_r_proto='$gmtime_r_proto'
22693 gnulibc_version='$gnulibc_version'
22694 grep='$grep'
22695 groupcat='$groupcat'
22696 groupstype='$groupstype'
22697 gzip='$gzip'
22698 h_fcntl='$h_fcntl'
22699 h_sysfile='$h_sysfile'
22700 hint='$hint'
22701 hostcat='$hostcat'
22702 html1dir='$html1dir'
22703 html1direxp='$html1direxp'
22704 html3dir='$html3dir'
22705 html3direxp='$html3direxp'
22706 i16size='$i16size'
22707 i16type='$i16type'
22708 i32size='$i32size'
22709 i32type='$i32type'
22710 i64size='$i64size'
22711 i64type='$i64type'
22712 i8size='$i8size'
22713 i8type='$i8type'
22714 i_arpainet='$i_arpainet'
22715 i_assert='$i_assert'
22716 i_bsdioctl='$i_bsdioctl'
22717 i_crypt='$i_crypt'
22718 i_db='$i_db'
22719 i_dbm='$i_dbm'
22720 i_dirent='$i_dirent'
22721 i_dld='$i_dld'
22722 i_dlfcn='$i_dlfcn'
22723 i_fcntl='$i_fcntl'
22724 i_float='$i_float'
22725 i_fp='$i_fp'
22726 i_fp_class='$i_fp_class'
22727 i_gdbm='$i_gdbm'
22728 i_gdbm_ndbm='$i_gdbm_ndbm'
22729 i_gdbmndbm='$i_gdbmndbm'
22730 i_grp='$i_grp'
22731 i_ieeefp='$i_ieeefp'
22732 i_inttypes='$i_inttypes'
22733 i_langinfo='$i_langinfo'
22734 i_libutil='$i_libutil'
22735 i_limits='$i_limits'
22736 i_locale='$i_locale'
22737 i_machcthr='$i_machcthr'
22738 i_malloc='$i_malloc'
22739 i_mallocmalloc='$i_mallocmalloc'
22740 i_math='$i_math'
22741 i_memory='$i_memory'
22742 i_mntent='$i_mntent'
22743 i_ndbm='$i_ndbm'
22744 i_netdb='$i_netdb'
22745 i_neterrno='$i_neterrno'
22746 i_netinettcp='$i_netinettcp'
22747 i_niin='$i_niin'
22748 i_poll='$i_poll'
22749 i_prot='$i_prot'
22750 i_pthread='$i_pthread'
22751 i_pwd='$i_pwd'
22752 i_rpcsvcdbm='$i_rpcsvcdbm'
22753 i_sfio='$i_sfio'
22754 i_sgtty='$i_sgtty'
22755 i_shadow='$i_shadow'
22756 i_socks='$i_socks'
22757 i_stdarg='$i_stdarg'
22758 i_stddef='$i_stddef'
22759 i_stdlib='$i_stdlib'
22760 i_string='$i_string'
22761 i_sunmath='$i_sunmath'
22762 i_sysaccess='$i_sysaccess'
22763 i_sysdir='$i_sysdir'
22764 i_sysfile='$i_sysfile'
22765 i_sysfilio='$i_sysfilio'
22766 i_sysin='$i_sysin'
22767 i_sysioctl='$i_sysioctl'
22768 i_syslog='$i_syslog'
22769 i_sysmman='$i_sysmman'
22770 i_sysmode='$i_sysmode'
22771 i_sysmount='$i_sysmount'
22772 i_sysndir='$i_sysndir'
22773 i_sysparam='$i_sysparam'
22774 i_syspoll='$i_syspoll'
22775 i_sysresrc='$i_sysresrc'
22776 i_syssecrt='$i_syssecrt'
22777 i_sysselct='$i_sysselct'
22778 i_syssockio='$i_syssockio'
22779 i_sysstat='$i_sysstat'
22780 i_sysstatfs='$i_sysstatfs'
22781 i_sysstatvfs='$i_sysstatvfs'
22782 i_systime='$i_systime'
22783 i_systimek='$i_systimek'
22784 i_systimes='$i_systimes'
22785 i_systypes='$i_systypes'
22786 i_sysuio='$i_sysuio'
22787 i_sysun='$i_sysun'
22788 i_sysutsname='$i_sysutsname'
22789 i_sysvfs='$i_sysvfs'
22790 i_syswait='$i_syswait'
22791 i_termio='$i_termio'
22792 i_termios='$i_termios'
22793 i_time='$i_time'
22794 i_unistd='$i_unistd'
22795 i_ustat='$i_ustat'
22796 i_utime='$i_utime'
22797 i_values='$i_values'
22798 i_varargs='$i_varargs'
22799 i_varhdr='$i_varhdr'
22800 i_vfork='$i_vfork'
22801 ignore_versioned_solibs='$ignore_versioned_solibs'
22802 inc_version_list='$inc_version_list'
22803 inc_version_list_init='$inc_version_list_init'
22804 incpath='$incpath'
22805 inews='$inews'
22806 initialinstalllocation='$initialinstalllocation'
22807 installarchlib='$installarchlib'
22808 installbin='$installbin'
22809 installhtml1dir='$installhtml1dir'
22810 installhtml3dir='$installhtml3dir'
22811 installman1dir='$installman1dir'
22812 installman3dir='$installman3dir'
22813 installprefix='$installprefix'
22814 installprefixexp='$installprefixexp'
22815 installprivlib='$installprivlib'
22816 installscript='$installscript'
22817 installsitearch='$installsitearch'
22818 installsitebin='$installsitebin'
22819 installsitehtml1dir='$installsitehtml1dir'
22820 installsitehtml3dir='$installsitehtml3dir'
22821 installsitelib='$installsitelib'
22822 installsiteman1dir='$installsiteman1dir'
22823 installsiteman3dir='$installsiteman3dir'
22824 installsitescript='$installsitescript'
22825 installstyle='$installstyle'
22826 installusrbinperl='$installusrbinperl'
22827 installvendorarch='$installvendorarch'
22828 installvendorbin='$installvendorbin'
22829 installvendorhtml1dir='$installvendorhtml1dir'
22830 installvendorhtml3dir='$installvendorhtml3dir'
22831 installvendorlib='$installvendorlib'
22832 installvendorman1dir='$installvendorman1dir'
22833 installvendorman3dir='$installvendorman3dir'
22834 installvendorscript='$installvendorscript'
22835 intsize='$intsize'
22836 issymlink='$issymlink'
22837 ivdformat='$ivdformat'
22838 ivsize='$ivsize'
22839 ivtype='$ivtype'
22840 known_extensions='$known_extensions'
22841 ksh='$ksh'
22842 ld='$ld'
22843 lddlflags='$lddlflags'
22844 ldflags='$ldflags'
22845 ldflags_uselargefiles='$ldflags_uselargefiles'
22846 ldlibpthname='$ldlibpthname'
22847 less='$less'
22848 lib_ext='$lib_ext'
22849 libc='$libc'
22850 libperl='$libperl'
22851 libpth='$libpth'
22852 libs='$libs'
22853 libsdirs='$libsdirs'
22854 libsfiles='$libsfiles'
22855 libsfound='$libsfound'
22856 libspath='$libspath'
22857 libswanted='$libswanted'
22858 libswanted_uselargefiles='$libswanted_uselargefiles'
22859 line='$line'
22860 lint='$lint'
22861 lkflags='$lkflags'
22862 ln='$ln'
22863 lns='$lns'
22864 localtime_r_proto='$localtime_r_proto'
22865 locincpth='$locincpth'
22866 loclibpth='$loclibpth'
22867 longdblsize='$longdblsize'
22868 longlongsize='$longlongsize'
22869 longsize='$longsize'
22870 lp='$lp'
22871 lpr='$lpr'
22872 ls='$ls'
22873 lseeksize='$lseeksize'
22874 lseektype='$lseektype'
22875 mad='$mad'
22876 madlyh='$madlyh'
22877 madlyobj='$madlyobj'
22878 madlysrc='$madlysrc'
22879 mail='$mail'
22880 mailx='$mailx'
22881 make='$make'
22882 make_set_make='$make_set_make'
22883 mallocobj='$mallocobj'
22884 mallocsrc='$mallocsrc'
22885 malloctype='$malloctype'
22886 man1dir='$man1dir'
22887 man1direxp='$man1direxp'
22888 man1ext='$man1ext'
22889 man3dir='$man3dir'
22890 man3direxp='$man3direxp'
22891 man3ext='$man3ext'
22892 mips_type='$mips_type'
22893 mistrustnm='$mistrustnm'
22894 mkdir='$mkdir'
22895 mmaptype='$mmaptype'
22896 modetype='$modetype'
22897 more='$more'
22898 multiarch='$multiarch'
22899 mv='$mv'
22900 myarchname='$myarchname'
22901 mydomain='$mydomain'
22902 myhostname='$myhostname'
22903 myuname='$myuname'
22904 n='$n'
22905 need_va_copy='$need_va_copy'
22906 netdb_hlen_type='$netdb_hlen_type'
22907 netdb_host_type='$netdb_host_type'
22908 netdb_name_type='$netdb_name_type'
22909 netdb_net_type='$netdb_net_type'
22910 nm='$nm'
22911 nm_opt='$nm_opt'
22912 nm_so_opt='$nm_so_opt'
22913 nonxs_ext='$nonxs_ext'
22914 nroff='$nroff'
22915 nvEUformat='$nvEUformat'
22916 nvFUformat='$nvFUformat'
22917 nvGUformat='$nvGUformat'
22918 nv_overflows_integers_at='$nv_overflows_integers_at'
22919 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22920 nveformat='$nveformat'
22921 nvfformat='$nvfformat'
22922 nvgformat='$nvgformat'
22923 nvsize='$nvsize'
22924 nvtype='$nvtype'
22925 o_nonblock='$o_nonblock'
22926 obj_ext='$obj_ext'
22927 old_pthread_create_joinable='$old_pthread_create_joinable'
22928 optimize='$optimize'
22929 orderlib='$orderlib'
22930 osname='$osname'
22931 osvers='$osvers'
22932 otherlibdirs='$otherlibdirs'
22933 package='$package'
22934 pager='$pager'
22935 passcat='$passcat'
22936 patchlevel='$patchlevel'
22937 path_sep='$path_sep'
22938 perl5='$perl5'
22939 perl='$perl'
22940 perl_patchlevel='$perl_patchlevel'
22941 perladmin='$perladmin'
22942 perllibs='$perllibs'
22943 perlpath='$perlpath'
22944 pg='$pg'
22945 phostname='$phostname'
22946 pidtype='$pidtype'
22947 plibpth='$plibpth'
22948 pmake='$pmake'
22949 pr='$pr'
22950 prefix='$prefix'
22951 prefixexp='$prefixexp'
22952 privlib='$privlib'
22953 privlibexp='$privlibexp'
22954 procselfexe='$procselfexe'
22955 prototype='$prototype'
22956 ptrsize='$ptrsize'
22957 quadkind='$quadkind'
22958 quadtype='$quadtype'
22959 randbits='$randbits'
22960 randfunc='$randfunc'
22961 random_r_proto='$random_r_proto'
22962 randseedtype='$randseedtype'
22963 ranlib='$ranlib'
22964 rd_nodata='$rd_nodata'
22965 readdir64_r_proto='$readdir64_r_proto'
22966 readdir_r_proto='$readdir_r_proto'
22967 revision='$revision'
22968 rm='$rm'
22969 rm_try='$rm_try'
22970 rmail='$rmail'
22971 run='$run'
22972 runnm='$runnm'
22973 sGMTIME_max='$sGMTIME_max'
22974 sGMTIME_min='$sGMTIME_min'
22975 sLOCALTIME_max='$sLOCALTIME_max'
22976 sLOCALTIME_min='$sLOCALTIME_min'
22977 sPRIEUldbl='$sPRIEUldbl'
22978 sPRIFUldbl='$sPRIFUldbl'
22979 sPRIGUldbl='$sPRIGUldbl'
22980 sPRIXU64='$sPRIXU64'
22981 sPRId64='$sPRId64'
22982 sPRIeldbl='$sPRIeldbl'
22983 sPRIfldbl='$sPRIfldbl'
22984 sPRIgldbl='$sPRIgldbl'
22985 sPRIi64='$sPRIi64'
22986 sPRIo64='$sPRIo64'
22987 sPRIu64='$sPRIu64'
22988 sPRIx64='$sPRIx64'
22989 sSCNfldbl='$sSCNfldbl'
22990 sched_yield='$sched_yield'
22991 scriptdir='$scriptdir'
22992 scriptdirexp='$scriptdirexp'
22993 sed='$sed'
22994 seedfunc='$seedfunc'
22995 selectminbits='$selectminbits'
22996 selecttype='$selecttype'
22997 sendmail='$sendmail'
22998 setgrent_r_proto='$setgrent_r_proto'
22999 sethostent_r_proto='$sethostent_r_proto'
23000 setlocale_r_proto='$setlocale_r_proto'
23001 setnetent_r_proto='$setnetent_r_proto'
23002 setprotoent_r_proto='$setprotoent_r_proto'
23003 setpwent_r_proto='$setpwent_r_proto'
23004 setservent_r_proto='$setservent_r_proto'
23005 sh='$sh'
23006 shar='$shar'
23007 sharpbang='$sharpbang'
23008 shmattype='$shmattype'
23009 shortsize='$shortsize'
23010 shrpenv='$shrpenv'
23011 shsharp='$shsharp'
23012 sig_count='$sig_count'
23013 sig_name='$sig_name'
23014 sig_name_init='$sig_name_init'
23015 sig_num='$sig_num'
23016 sig_num_init='$sig_num_init'
23017 sig_size='$sig_size'
23018 signal_t='$signal_t'
23019 sitearch='$sitearch'
23020 sitearchexp='$sitearchexp'
23021 sitebin='$sitebin'
23022 sitebinexp='$sitebinexp'
23023 sitehtml1dir='$sitehtml1dir'
23024 sitehtml1direxp='$sitehtml1direxp'
23025 sitehtml3dir='$sitehtml3dir'
23026 sitehtml3direxp='$sitehtml3direxp'
23027 sitelib='$sitelib'
23028 sitelib_stem='$sitelib_stem'
23029 sitelibexp='$sitelibexp'
23030 siteman1dir='$siteman1dir'
23031 siteman1direxp='$siteman1direxp'
23032 siteman3dir='$siteman3dir'
23033 siteman3direxp='$siteman3direxp'
23034 siteprefix='$siteprefix'
23035 siteprefixexp='$siteprefixexp'
23036 sitescript='$sitescript'
23037 sitescriptexp='$sitescriptexp'
23038 sizesize='$sizesize'
23039 sizetype='$sizetype'
23040 sleep='$sleep'
23041 smail='$smail'
23042 so='$so'
23043 sockethdr='$sockethdr'
23044 socketlib='$socketlib'
23045 socksizetype='$socksizetype'
23046 sort='$sort'
23047 spackage='$spackage'
23048 spitshell='$spitshell'
23049 srand48_r_proto='$srand48_r_proto'
23050 srandom_r_proto='$srandom_r_proto'
23051 src='$src'
23052 ssizetype='$ssizetype'
23053 startperl='$startperl'
23054 startsh='$startsh'
23055 static_ext='$static_ext'
23056 stdchar='$stdchar'
23057 stdio_base='$stdio_base'
23058 stdio_bufsiz='$stdio_bufsiz'
23059 stdio_cnt='$stdio_cnt'
23060 stdio_filbuf='$stdio_filbuf'
23061 stdio_ptr='$stdio_ptr'
23062 stdio_stream_array='$stdio_stream_array'
23063 strerror_r_proto='$strerror_r_proto'
23064 strings='$strings'
23065 submit='$submit'
23066 subversion='$subversion'
23067 sysman='$sysman'
23068 tail='$tail'
23069 tar='$tar'
23070 targetarch='$targetarch'
23071 tbl='$tbl'
23072 tee='$tee'
23073 test='$test'
23074 timeincl='$timeincl'
23075 timetype='$timetype'
23076 tmpnam_r_proto='$tmpnam_r_proto'
23077 to='$to'
23078 touch='$touch'
23079 tr='$tr'
23080 trnl='$trnl'
23081 troff='$troff'
23082 ttyname_r_proto='$ttyname_r_proto'
23083 u16size='$u16size'
23084 u16type='$u16type'
23085 u32size='$u32size'
23086 u32type='$u32type'
23087 u64size='$u64size'
23088 u64type='$u64type'
23089 u8size='$u8size'
23090 u8type='$u8type'
23091 uidformat='$uidformat'
23092 uidsign='$uidsign'
23093 uidsize='$uidsize'
23094 uidtype='$uidtype'
23095 uname='$uname'
23096 uniq='$uniq'
23097 uquadtype='$uquadtype'
23098 use5005threads='$use5005threads'
23099 use64bitall='$use64bitall'
23100 use64bitint='$use64bitint'
23101 usecrosscompile='$usecrosscompile'
23102 usedevel='$usedevel'
23103 usedl='$usedl'
23104 usedtrace='$usedtrace'
23105 usefaststdio='$usefaststdio'
23106 useithreads='$useithreads'
23107 uselargefiles='$uselargefiles'
23108 uselongdouble='$uselongdouble'
23109 usemallocwrap='$usemallocwrap'
23110 usemorebits='$usemorebits'
23111 usemultiplicity='$usemultiplicity'
23112 usemymalloc='$usemymalloc'
23113 usenm='$usenm'
23114 useopcode='$useopcode'
23115 useperlio='$useperlio'
23116 useposix='$useposix'
23117 usereentrant='$usereentrant'
23118 userelocatableinc='$userelocatableinc'
23119 usesfio='$usesfio'
23120 useshrplib='$useshrplib'
23121 usesitecustomize='$usesitecustomize'
23122 usesocks='$usesocks'
23123 usethreads='$usethreads'
23124 usevendorprefix='$usevendorprefix'
23125 usevfork='$usevfork'
23126 usrinc='$usrinc'
23127 uuname='$uuname'
23128 uvXUformat='$uvXUformat'
23129 uvoformat='$uvoformat'
23130 uvsize='$uvsize'
23131 uvtype='$uvtype'
23132 uvuformat='$uvuformat'
23133 uvxformat='$uvxformat'
23134 vendorarch='$vendorarch'
23135 vendorarchexp='$vendorarchexp'
23136 vendorbin='$vendorbin'
23137 vendorbinexp='$vendorbinexp'
23138 vendorhtml1dir='$vendorhtml1dir'
23139 vendorhtml1direxp='$vendorhtml1direxp'
23140 vendorhtml3dir='$vendorhtml3dir'
23141 vendorhtml3direxp='$vendorhtml3direxp'
23142 vendorlib='$vendorlib'
23143 vendorlib_stem='$vendorlib_stem'
23144 vendorlibexp='$vendorlibexp'
23145 vendorman1dir='$vendorman1dir'
23146 vendorman1direxp='$vendorman1direxp'
23147 vendorman3dir='$vendorman3dir'
23148 vendorman3direxp='$vendorman3direxp'
23149 vendorprefix='$vendorprefix'
23150 vendorprefixexp='$vendorprefixexp'
23151 vendorscript='$vendorscript'
23152 vendorscriptexp='$vendorscriptexp'
23153 version='$version'
23154 version_patchlevel_string='$version_patchlevel_string'
23155 versiononly='$versiononly'
23156 vi='$vi'
23157 voidflags='$voidflags'
23158 xlibpth='$xlibpth'
23159 yacc='$yacc'
23160 yaccflags='$yaccflags'
23161 zcat='$zcat'
23162 zip='$zip'
23163 EOT
23164
23165 : Add in command line options if available
23166 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23167
23168 : add special variables
23169 $test -f $src/patchlevel.h && \
23170 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23171 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23172 echo "PERL_CONFIG_SH=true" >>config.sh
23173
23174 : propagate old symbols
23175 if $test -f UU/config.sh; then
23176         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23177         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23178                 config.sh config.sh UU/oldconfig.sh |\
23179                 $sort | $uniq -u >UU/oldsyms
23180         set X `cat UU/oldsyms`
23181         shift
23182         case $# in
23183         0) ;;
23184         *)
23185                 cat <<EOM
23186 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23187 EOM
23188                 echo ": Variables propagated from previous config.sh file." >>config.sh
23189                 for sym in `cat UU/oldsyms`; do
23190                         echo "    Propagating $hint variable "'$'"$sym..."
23191                         eval 'tmp="$'"${sym}"'"'
23192                         echo "$tmp" | \
23193                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23194                 done
23195                 ;;
23196         esac
23197 fi
23198
23199 : Finish up by extracting the .SH files
23200 case "$alldone" in
23201 exit)
23202         $rm -rf UU
23203         echo "Extraction done."
23204         exit 0
23205         ;;
23206 cont)
23207         ;;
23208 '')
23209         dflt=''
23210         nostick=true
23211         $cat <<EOM
23212
23213 If you'd like to make any changes to the config.sh file before I begin
23214 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23215
23216 EOM
23217         rp="Press return or use a shell escape to edit config.sh:"
23218         . UU/myread
23219         nostick=''
23220         case "$ans" in
23221         '') ;;
23222         *) : in case they cannot read
23223                 sh 1>&4 -c "$ans";;
23224         esac
23225         ;;
23226 esac
23227
23228 : if this fails, just run all the .SH files by hand
23229 . ./config.sh
23230
23231 echo " "
23232 exec 1>&4
23233 pwd=`pwd`
23234 . ./UU/extract
23235 cd "$pwd"
23236
23237 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23238         dflt=y
23239         case "$silent" in
23240         true) ;;
23241         *)
23242                 $cat <<EOM
23243
23244 Now you need to generate make dependencies by running "$make depend".
23245 You might prefer to run it in background: "$make depend > makedepend.out &"
23246 It can take a while, so you might not want to run it right now.
23247
23248 EOM
23249                 ;;
23250         esac
23251         rp="Run $make depend now?"
23252         . UU/myread
23253         case "$ans" in
23254         y*)
23255                 $make depend && echo "Now you must run '$make'."
23256                 ;;
23257         *)
23258                 echo "You must run '$make depend' then '$make'."
23259                 ;;
23260         esac
23261 elif test -f [Mm]akefile; then
23262         echo " "
23263         echo "Now you must run a $make."
23264 else
23265         echo "Configure done."
23266 fi
23267
23268 if $test -f Policy.sh; then
23269     $cat <<EOM
23270
23271 If you compile $package on a different machine or from a different object
23272 directory, copy the Policy.sh file from this object directory to the
23273 new one before you run Configure -- this will help you with most of
23274 the policy defaults.
23275
23276 EOM
23277 fi
23278 if $test -f config.msg; then
23279     echo "Hmm.  I also noted the following information while running:"
23280     echo " "
23281     $cat config.msg >&4
23282     $rm -f config.msg
23283 fi
23284 $rm -f kit*isdone ark*isdone
23285 $rm -rf UU
23286
23287 : End of Configure
23288